diff options
author | Steve Block <steveblock@google.com> | 2010-08-24 07:50:47 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-24 07:50:47 -0700 |
commit | c570a147a94b126d4172c30914f53dea17b4c8f5 (patch) | |
tree | 99c11741887d21f65d67c5bbdab58b7ba2a5d4d5 /WebCore | |
parent | c952714bc6809a5ad081baaf9fcc04107b92ea3f (diff) | |
parent | 6c65f16005b91786c2b7c0791b9ea1dd684d57f4 (diff) | |
download | external_webkit-c570a147a94b126d4172c30914f53dea17b4c8f5.zip external_webkit-c570a147a94b126d4172c30914f53dea17b4c8f5.tar.gz external_webkit-c570a147a94b126d4172c30914f53dea17b4c8f5.tar.bz2 |
Merge changes I2e7e2317,Ie6ccde3a,I3e89f231,Id06ff339,I268dfe7d,Icaf70d9f,Ie234f1a0,Iff5c7aaa,I69b75bf0,Ifbf384f4
* changes:
Merge WebKit at r65615 : Update WebKit revision number
Merge WebKit at r65615 : Ignore http/tests/appcache/origin-quota.html
Merge WebKit at r65615 : Android-specific results for Geolocation tests.
Merge WebKit at r65615 : Fix GraphicsContext and ImageBuffer.
Merge WebKit at r65615 : processingUserGesture() is now static.
Merge WebKit at r65615 : UTF8String() becomes utf8().
Merge WebKit at r65615 : Fix include paths for string headers.
Merge WebKit at r65615 : Fix Makefiles.
Merge WebKit at r65615 : Fix conflicts.
Merge WebKit at r65615 : Initial merge by git.
Diffstat (limited to 'WebCore')
736 files changed, 18590 insertions, 9423 deletions
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index bd93563..94ed500 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -261,7 +261,6 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/html/%.cpp : $(intermediates)/htm GEN := \ $(intermediates)/html/canvas/JSArrayBuffer.h \ $(intermediates)/html/canvas/JSCanvasGradient.h \ - $(intermediates)/html/canvas/JSCanvasNumberArray.h \ $(intermediates)/html/canvas/JSCanvasPattern.h \ $(intermediates)/html/canvas/JSCanvasRenderingContext.h \ $(intermediates)/html/canvas/JSCanvasRenderingContext2D.h \ diff --git a/WebCore/Android.derived.mk b/WebCore/Android.derived.mk index 2111e6e..821d3a2 100644 --- a/WebCore/Android.derived.mk +++ b/WebCore/Android.derived.mk @@ -67,14 +67,13 @@ $(GEN): $(LOCAL_PATH)/html/DocTypeStrings.gperf $(intermediates)/html/HTMLDocument.o : $(GEN) -# HTML entity names +# HTML entity table -GEN := $(intermediates)/html/HTMLEntityNames.cpp -$(GEN): SCRIPT := $(LOCAL_PATH)/make-hash-tools.pl -$(GEN): PRIVATE_CUSTOM_TOOL = perl $(SCRIPT) . $< -$(GEN): $(LOCAL_PATH)/html/HTMLEntityNames.gperf +GEN := $(intermediates)/html/HTMLEntityTable.cpp +$(GEN): SCRIPT := $(LOCAL_PATH)/../WebKitTools/Scripts/create-html-entity-table +$(GEN): PRIVATE_CUSTOM_TOOL = $(SCRIPT) -o $@ $< +$(GEN): $(LOCAL_PATH)/html/HTMLEntityNames.json $(transform-generated-source) - @mv ./HTMLEntityNames.cpp $@ LOCAL_GENERATED_SOURCES += $(GEN) diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index 532d343..d1d737b 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -245,7 +245,6 @@ $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates) GEN := \ $(intermediates)/bindings/V8ArrayBuffer.h \ $(intermediates)/bindings/V8CanvasGradient.h \ - $(intermediates)/bindings/V8CanvasNumberArray.h \ $(intermediates)/bindings/V8CanvasPattern.h \ $(intermediates)/bindings/V8CanvasPixelArray.h \ $(intermediates)/bindings/V8CanvasRenderingContext.h \ diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk index 20e9161..74e7350 100644 --- a/WebCore/Android.jscbindings.mk +++ b/WebCore/Android.jscbindings.mk @@ -70,7 +70,6 @@ LOCAL_SRC_FILES += \ bindings/js/JSCSSStyleDeclarationCustom.cpp \ bindings/js/JSCSSValueCustom.cpp \ bindings/js/JSCallbackData.cpp \ - bindings/js/JSCanvasNumberArrayCustom.cpp \ bindings/js/JSCanvasRenderingContext2DCustom.cpp \ bindings/js/JSCanvasRenderingContextCustom.cpp \ bindings/js/JSClipboardCustom.cpp \ diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 56f3055..ca8c31f 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -265,6 +265,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/AsyncImageResizer.cpp \ html/Blob.cpp \ html/BlobBuilder.cpp \ + html/BlobURL.cpp \ html/CollectionCache.cpp \ html/CSSPreloadScanner.cpp \ html/DOMFormData.cpp \ @@ -277,6 +278,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/FileThread.cpp \ html/FormDataList.cpp \ html/HTMLEntityParser.cpp \ + html/HTMLEntitySearch.cpp \ html/HTMLTokenizer.cpp \ html/HTMLPreloadScanner.cpp \ html/HTMLScriptRunner.cpp \ @@ -298,18 +300,17 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/HTMLParserScheduler.cpp \ html/HTMLTableRowsCollection.cpp \ html/HTMLViewSourceDocument.cpp \ + html/HTMLViewSourceParser.cpp \ html/ImageData.cpp \ html/ImageResizerThread.cpp \ html/LabelsNodeList.cpp \ html/LegacyHTMLTreeBuilder.cpp \ html/StepRange.cpp \ - html/LegacyHTMLDocumentParser.cpp \ - html/LegacyPreloadScanner.cpp \ + html/ThreadableBlobRegistry.cpp \ html/TimeRanges.cpp \ html/ValidityState.cpp \ \ html/canvas/CanvasGradient.cpp \ - html/canvas/CanvasNumberArray.cpp \ html/canvas/WebGLObject.cpp \ html/canvas/CanvasPattern.cpp \ html/canvas/CanvasPixelArray.cpp \ @@ -391,6 +392,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ page/FrameView.cpp \ page/Geolocation.cpp \ page/GeolocationPositionCache.cpp \ + page/GroupSettings.cpp \ page/History.cpp \ page/Location.cpp \ page/MemoryInfo.cpp \ @@ -436,6 +438,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/DragData.cpp \ platform/DragImage.cpp \ platform/FileChooser.cpp \ + platform/FileSystem.cpp \ platform/GeolocationService.cpp \ platform/KURL.cpp \ platform/KURLGoogle.cpp \ @@ -575,6 +578,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/mock/SpeechInputClientMock.cpp \ \ platform/network/AuthenticationChallengeBase.cpp \ + platform/network/BlobData.cpp \ + platform/network/BlobRegistryImpl.cpp \ platform/network/Credential.cpp \ platform/network/CredentialStorage.cpp \ platform/network/FormData.cpp \ @@ -755,6 +760,7 @@ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ rendering/SVGCharacterData.cpp \ rendering/SVGCharacterLayoutInfo.cpp \ + rendering/SVGImageBufferTools.cpp \ rendering/SVGInlineFlowBox.cpp \ rendering/SVGInlineTextBox.cpp \ rendering/SVGMarkerLayoutInfo.cpp \ @@ -940,6 +946,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ svg/SVGNumberList.cpp \ svg/SVGPaint.cpp \ svg/SVGParserUtilities.cpp \ + svg/SVGPathBlender.cpp \ svg/SVGPathBuilder.cpp \ svg/SVGPathByteStreamBuilder.cpp \ svg/SVGPathByteStreamSource.cpp \ @@ -962,6 +969,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ svg/SVGPathSegMoveto.cpp \ svg/SVGPathStringBuilder.cpp \ svg/SVGPathStringSource.cpp \ + svg/SVGPathTraversalStateBuilder.cpp \ svg/SVGPatternElement.cpp \ svg/SVGPointList.cpp \ svg/SVGPolyElement.cpp \ diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt index 0d4625c..2940015 100644 --- a/WebCore/CMakeLists.txt +++ b/WebCore/CMakeLists.txt @@ -334,6 +334,17 @@ SET(WebCore_IDL_FILES storage/Database.idl storage/DatabaseCallback.idl storage/DatabaseSync.idl + storage/DirectoryEntry.idl + storage/DirectoryReader.idl + storage/DOMFileSystem.idl + storage/EntriesCallback.idl + storage/Entry.idl + storage/EntryArray.idl + storage/EntryCallback.idl + storage/ErrorCallback.idl + storage/FileEntry.idl + storage/FileSystemCallback.idl + storage/Flags.idl storage/IDBAny.idl storage/IDBCursor.idl storage/IDBDatabaseError.idl @@ -349,6 +360,8 @@ SET(WebCore_IDL_FILES storage/IDBRequest.idl storage/IDBSuccessEvent.idl storage/IDBTransaction.idl + storage/Metadata.idl + storage/MetadataCallback.idl storage/SQLError.idl storage/SQLException.idl storage/SQLResultSet.idl @@ -528,9 +541,8 @@ IF (ENABLE_SVG) ENDIF() SET(WebCore_SOURCES - ${DERIVED_SOURCES_DIR}/CSSGrammar.cpp ${DERIVED_SOURCES_DIR}/HTMLElementFactory.cpp - ${DERIVED_SOURCES_DIR}/HTMLEntityNames.cpp + ${DERIVED_SOURCES_DIR}/HTMLEntityTable.cpp ${DERIVED_SOURCES_DIR}/HTMLNames.cpp ${DERIVED_SOURCES_DIR}/JSHTMLElementWrapperFactory.cpp ${DERIVED_SOURCES_DIR}/MathMLElementFactory.cpp @@ -538,7 +550,6 @@ SET(WebCore_SOURCES ${DERIVED_SOURCES_DIR}/UserAgentStyleSheetsData.cpp ${DERIVED_SOURCES_DIR}/XMLNames.cpp ${DERIVED_SOURCES_DIR}/XMLNSNames.cpp - ${DERIVED_SOURCES_DIR}/XPathGrammar.cpp ${DERIVED_SOURCES_DIR}/InspectorBackendDispatcher.cpp accessibility/AXObjectCache.cpp @@ -931,6 +942,7 @@ SET(WebCore_SOURCES html/AsyncImageResizer.cpp html/Blob.cpp html/BlobBuilder.cpp + html/BlobURL.cpp html/CollectionCache.cpp html/CSSPreloadScanner.cpp html/DOMDataGridDataSource.cpp @@ -971,6 +983,7 @@ SET(WebCore_SOURCES html/HTMLDocument.cpp html/HTMLElement.cpp html/HTMLElementStack.cpp + html/HTMLEntitySearch.cpp html/HTMLEmbedElement.cpp html/HTMLFieldSetElement.cpp html/HTMLFormattingElementList.cpp @@ -1031,14 +1044,14 @@ SET(WebCore_SOURCES html/HTMLTableSectionElement.cpp html/HTMLTextAreaElement.cpp html/HTMLTitleElement.cpp - html/LegacyHTMLDocumentParser.cpp html/HTMLUListElement.cpp html/HTMLViewSourceDocument.cpp + html/HTMLViewSourceParser.cpp html/ImageData.cpp html/ImageResizerThread.cpp html/LabelsNodeList.cpp - html/LegacyPreloadScanner.cpp html/StepRange.cpp + html/ThreadableBlobRegistry.cpp html/ValidityState.cpp html/canvas/CanvasGradient.cpp html/canvas/CanvasPattern.cpp @@ -1162,6 +1175,7 @@ SET(WebCore_SOURCES page/Geolocation.cpp page/GeolocationController.cpp page/GeolocationPositionCache.cpp + page/GroupSettings.cpp page/History.cpp page/Location.cpp page/MemoryInfo.cpp @@ -1202,6 +1216,7 @@ SET(WebCore_SOURCES platform/DragData.cpp platform/DragImage.cpp platform/FileChooser.cpp + platform/FileSystem.cpp platform/GeolocationService.cpp platform/KURL.cpp platform/KillRingNone.cpp @@ -1289,6 +1304,8 @@ SET(WebCore_SOURCES platform/mock/GeolocationServiceMock.cpp platform/network/AuthenticationChallengeBase.cpp + platform/network/BlobData.cpp + platform/network/BlobRegistryImpl.cpp platform/network/Credential.cpp platform/network/FormData.cpp platform/network/FormDataBuilder.cpp @@ -1301,13 +1318,6 @@ SET(WebCore_SOURCES platform/network/ResourceRequestBase.cpp platform/network/ResourceResponseBase.cpp - platform/sql/SQLValue.cpp - platform/sql/SQLiteAuthorizer.cpp - platform/sql/SQLiteDatabase.cpp - platform/sql/SQLiteFileSystem.cpp - platform/sql/SQLiteStatement.cpp - platform/sql/SQLiteTransaction.cpp - platform/text/Base64.cpp platform/text/BidiContext.cpp platform/text/LineEnding.cpp @@ -1443,6 +1453,12 @@ SET(WebCore_SOURCES storage/DatabaseTask.cpp storage/DatabaseThread.cpp storage/DatabaseTracker.cpp + storage/DirectoryEntry.cpp + storage/DirectoryReader.cpp + storage/DOMFileSystem.cpp + storage/Entry.cpp + storage/EntryArray.cpp + storage/FileEntry.cpp storage/IDBAny.cpp storage/IDBDatabase.cpp storage/IDBDatabaseBackendImpl.cpp @@ -1534,6 +1550,18 @@ SET(WebCore_SOURCES xml/XSLTUnicodeSort.cpp ) + +IF (ENABLE_DATABASE) + LIST(APPEND WebCore_SOURCES + platform/sql/SQLValue.cpp + platform/sql/SQLiteAuthorizer.cpp + platform/sql/SQLiteDatabase.cpp + platform/sql/SQLiteFileSystem.cpp + platform/sql/SQLiteStatement.cpp + platform/sql/SQLiteTransaction.cpp + ) +ENDIF () + IF (ENABLE_SVG) LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/JSSVGElementWrapperFactory.cpp @@ -1579,6 +1607,7 @@ IF (ENABLE_SVG) rendering/RenderSVGViewportContainer.cpp rendering/SVGCharacterData.cpp rendering/SVGCharacterLayoutInfo.cpp + rendering/SVGImageBufferTools.cpp rendering/SVGInlineFlowBox.cpp rendering/SVGInlineTextBox.cpp rendering/SVGMarkerLayoutInfo.cpp @@ -1676,6 +1705,7 @@ IF (ENABLE_SVG) svg/SVGNumberList.cpp svg/SVGPaint.cpp svg/SVGParserUtilities.cpp + svg/SVGPathBlender.cpp svg/SVGPathBuilder.cpp svg/SVGPathByteStreamBuilder.cpp svg/SVGPathByteStreamSource.cpp @@ -1698,6 +1728,7 @@ IF (ENABLE_SVG) svg/SVGPathSegMoveto.cpp svg/SVGPathStringBuilder.cpp svg/SVGPathStringSource.cpp + svg/SVGPathTraversalStateBuilder.cpp svg/SVGPatternElement.cpp svg/SVGPointList.cpp svg/SVGPolyElement.cpp @@ -1759,6 +1790,22 @@ IF (ENABLE_SVG) ) ENDIF() +IF (ENABLE_VIDEO) + LIST(APPEND WebCore_SOURCES + ${DERIVED_SOURCES_DIR}/JSTimeRanges.cpp + bindings/js/JSAudioConstructor.cpp + html/HTMLAudioElement.cpp + html/HTMLMediaElement.cpp + html/HTMLSourceElement.cpp + html/HTMLVideoElement.cpp + html/TimeRanges.cpp + platform/graphics/MediaPlayer.cpp + rendering/MediaControlElements.cpp + rendering/RenderMedia.cpp + rendering/RenderVideo.cpp + ) +ENDIF() + IF (ENABLE_WML) LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/WMLElementFactory.cpp @@ -1819,27 +1866,38 @@ GENERATE_INSPECTOR_FROM_IDL(inspector/Inspector.idl) LIST(APPEND WebCore_SOURCES ${JS_IDL_FILES} ${Inspector_IDL_FILES}) -GENERATE_GPERF(${WEBCORE_DIR}/html/HTMLEntityNames.gperf) -GENERATE_GPERF(${WEBCORE_DIR}/platform/ColorData.gperf) -GENERATE_GPERF(${WEBCORE_DIR}/html/DocTypeStrings.gperf) + +GENERATE_JSON(${WEBCORE_DIR}/html/HTMLEntityNames.json ${DERIVED_SOURCES_DIR}/HTMLEntityTable.cpp ${WEBCORE_DIR}/../WebKitTools/Scripts/create-html-entity-table) + + +GENERATE_GPERF(${WEBCORE_DIR}/platform/ColorData.gperf ${DERIVED_SOURCES_DIR}/ColorData.cpp findColor "") +ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/platform/graphics/Color.cpp ColorData.cpp) + + +GENERATE_GPERF(${WEBCORE_DIR}/html/DocTypeStrings.gperf ${DERIVED_SOURCES_DIR}/DocTypeStrings.cpp findDoctypeEntry "-F,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards") +ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/html/HTMLDocument.cpp DocTypeStrings.cpp) + GENERATE_TOKENIZER() GENERATE_USER_AGENT_STYLES() -GENERATE_GRAMMAR(cssyy ${WEBCORE_DIR}/css/CSSGrammar.y) -GENERATE_GRAMMAR(xpathyy ${WEBCORE_DIR}/xml/XPathGrammar.y) + +GENERATE_GRAMMAR(cssyy ${WEBCORE_DIR}/css/CSSGrammar.y ${DERIVED_SOURCES_DIR}/CSSGrammar.h ${DERIVED_SOURCES_DIR}/CSSGrammar.cpp) +LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/CSSGrammar.cpp) + + +GENERATE_GRAMMAR(xpathyy ${WEBCORE_DIR}/xml/XPathGrammar.y ${DERIVED_SOURCES_DIR}/XPathGrammar.h ${DERIVED_SOURCES_DIR}/XPathGrammar.cpp) +LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/XPathGrammar.cpp) + GENERATE_CSS_PROPERTY_NAMES() GENERATE_CSS_VALUE_KEYWORDS() + ADD_SOURCE_DERIVED_DEPENDENCIES(${DERIVED_SOURCES_DIR}/CSSGrammar.cpp CSSValueKeywords.h) 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.cpp) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSParser.cpp tokenizer.cpp) -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}/html/HTMLTreeBuilder.cpp MathMLNames.cpp) ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSStyleSelector.cpp UserAgentStyleSheetsData.cpp UserAgentStyleSheets.h) @@ -1896,8 +1954,10 @@ ADD_DEFINITIONS(-DBUILDING_WebCore) INCLUDE_DIRECTORIES(${WebCore_INCLUDE_DIRECTORIES}) ADD_LIBRARY(${WebCore_LIBRARY_NAME} ${WebCore_LIBRARY_TYPE} ${WebCore_SOURCES}) TARGET_LINK_LIBRARIES(${WebCore_LIBRARY_NAME} ${WebCore_LIBRARIES}) -ADD_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} LINK_FLAGS ${WebCore_LINK_FLAGS}) +IF (WebCore_LINK_FLAGS) + ADD_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} LINK_FLAGS "${WebCore_LINK_FLAGS}") +ENDIF () IF (SHARED_CORE) SET_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) diff --git a/WebCore/CMakeListsEfl.txt b/WebCore/CMakeListsEfl.txt index 0837b02..5c8cdf2 100644 --- a/WebCore/CMakeListsEfl.txt +++ b/WebCore/CMakeListsEfl.txt @@ -70,6 +70,7 @@ IF (WTF_PLATFORM_CAIRO) platform/graphics/cairo/FontCustomPlatformData.cpp platform/graphics/cairo/FontPlatformDataCairo.cpp platform/graphics/cairo/GOwnPtrCairo.cpp + platform/graphics/cairo/GRefPtrCairo.cpp platform/graphics/cairo/GlyphPageTreeNodeCairo.cpp platform/graphics/cairo/GradientCairo.cpp platform/graphics/cairo/GraphicsContextCairo.cpp diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 85e6aa8..a107c10 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,5622 @@ +2010-08-18 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Darin Adler. + + CanvasStyle method naming cleanup + https://bugs.webkit.org/show_bug.cgi?id=44184 + + Renamed the various create() overloads to reflect what they're + constructing the CanvasStyle from. + + The unused CanvasStyle::create(grayLevel) and accompanying constructor + were removed. + + Also renamed the isEquivalentColor overloads to isEquivalent{RGBA,CMYKA} + + * bindings/js/JSCanvasRenderingContext2DCustom.cpp: + (WebCore::toHTMLCanvasStyle): + * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: + (WebCore::toCanvasStyle): + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::State::State): + (WebCore::CanvasRenderingContext2D::setStrokeColor): + (WebCore::CanvasRenderingContext2D::setFillColor): + * html/canvas/CanvasStyle.cpp: + (WebCore::CanvasStyle::createFromString): + (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): + (WebCore::CanvasStyle::createFromGradient): + (WebCore::CanvasStyle::createFromPattern): + (WebCore::CanvasStyle::isEquivalentRGBA): + (WebCore::CanvasStyle::isEquivalentCMYKA): + * html/canvas/CanvasStyle.h: + (WebCore::CanvasStyle::createFromRGBA): + (WebCore::CanvasStyle::createFromGrayLevelWithAlpha): + (WebCore::CanvasStyle::createFromRGBAChannels): + (WebCore::CanvasStyle::createFromCMYKAChannels): + +2010-08-18 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement Maemo5 local rendering NPAPI extension. See + https://wiki.mozilla.org/Plugins:NokiaMaemoImageSurface for details. + + With the local rendering extension, Flash will paint into a 16-bit surface. + For wmode=transparent, Flash expects the surface to contain the contents + beneath it. As it is tricky to implement the content propagation across all + graphics systems, transparent Flash is not supported. We just fill the surface + with white and wmode=transparent behaves the same as wmode=opaque with a white + background. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCore.pro: + * plugins/PluginView.cpp: + (WebCore::PluginView::setValue): + (WebCore::PluginView::PluginView): + * plugins/PluginView.h: + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::paintUsingImageSurfaceExtension): + (WebCore::PluginView::paint): + (WebCore::PluginView::platformGetValueStatic): + +2010-08-18 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65603. + http://trac.webkit.org/changeset/65603 + https://bugs.webkit.org/show_bug.cgi?id=44179 + + 4 tests crash on Qt bot (Requested by Ossy on #webkit). + + * WebCore.pro: + * page/Geolocation.cpp: + (WebCore::Geolocation::handlePendingPermissionNotifiers): + +2010-08-18 Ryuan Choi <ryuan.choi@samsung.com> + + Unreviewed. Attempted build fix for EFL + + [EFL]REGRESSION(65530) need to fix build break + https://bugs.webkit.org/show_bug.cgi?id=44154 + + * CMakeListsEfl.txt: + +2010-08-18 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed qt build fix. + + * WebCore.pri: + +2010-08-17 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: replace hand written InspectorBackendStub.js with generated one. + New command-line flag was added to combine-javascript-resources. + It specifies the location of generated scripts. + https://bugs.webkit.org/show_bug.cgi?id=43791 + + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * combine-javascript-resources: + * inspector/CodeGeneratorInspector.pm: + * inspector/front-end/InspectorBackendStub.js: Removed. + * inspector/front-end/WebKit.qrc: + +2010-08-18 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: extension panels do not occupy entire panel client area. + https://bugs.webkit.org/show_bug.cgi?id=44167 + + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer.prototype._onCreatePanel): + (WebInspector.ExtensionServer.prototype._createClientIframe): + +2010-08-18 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + Use SVGPathParser logic to traverse states of a Path + https://bugs.webkit.org/show_bug.cgi?id=44009 + + Move the getPathSegAtLength logic from SVGPathSegList into a new SVGPathConsumer + class: SVGPathTraversalStateBuilder. + This allows us to get a SVGPathSeg at a given length for SVGPathByteStreams and SVGPathSegLists. + It is also possible to use unaltered SVG path data, instead of just normalized path data. + This is the final preparation to provide normalized and unaltered SVGPathSegLists + on SVGPathElement. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * svg/SVGAllInOne.cpp: + * svg/SVGPathBuilder.h: + (WebCore::SVGPathBuilder::nextPathSegment): + (WebCore::SVGPathBuilder::quitEarlier): + * svg/SVGPathByteStreamBuilder.h: + (WebCore::SVGPathByteStreamBuilder::nextPathSegment): + (WebCore::SVGPathByteStreamBuilder::quitEarlier): + * svg/SVGPathConsumer.h: + * svg/SVGPathElement.cpp: + (WebCore::SVGPathElement::getPathSegAtLength): + * svg/SVGPathElement.h: + * svg/SVGPathElement.idl: + * svg/SVGPathParser.cpp: + (WebCore::SVGPathParser::parsePathDataFromSource): + * svg/SVGPathParserFactory.cpp: + (WebCore::globalSVGPathTraversalStateBuilder): + (WebCore::SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathSegList): + * svg/SVGPathParserFactory.h: + * svg/SVGPathSegList.cpp: + * svg/SVGPathSegList.h: + * svg/SVGPathSegListBuilder.h: + (WebCore::SVGPathSegListBuilder::nextPathSegment): + (WebCore::SVGPathSegListBuilder::quitEarlier): + * svg/SVGPathStringBuilder.h: + (WebCore::SVGPathStringBuilder::nextPathSegment): + (WebCore::SVGPathStringBuilder::quitEarlier): + * svg/SVGPathTraversalStateBuilder.cpp: Added. New Consumer for SVGPathParser. + (WebCore::SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder): + (WebCore::SVGPathTraversalStateBuilder::moveTo): + (WebCore::SVGPathTraversalStateBuilder::lineTo): + (WebCore::SVGPathTraversalStateBuilder::curveToCubic): + (WebCore::SVGPathTraversalStateBuilder::closePath): + (WebCore::SVGPathTraversalStateBuilder::setDesiredLength): + (WebCore::SVGPathTraversalStateBuilder::quitEarlier): + (WebCore::SVGPathTraversalStateBuilder::nextPathSegment): + (WebCore::SVGPathTraversalStateBuilder::pathSegmentIndex): + * svg/SVGPathTraversalStateBuilder.h: Added. + (WebCore::SVGPathTraversalStateBuilder::setCurrentTraversalState): + (WebCore::SVGPathTraversalStateBuilder::cleanup): + (WebCore::SVGPathTraversalStateBuilder::lineToHorizontal): + (WebCore::SVGPathTraversalStateBuilder::lineToVertical): + (WebCore::SVGPathTraversalStateBuilder::curveToCubicSmooth): + (WebCore::SVGPathTraversalStateBuilder::curveToQuadratic): + (WebCore::SVGPathTraversalStateBuilder::curveToQuadraticSmooth): + (WebCore::SVGPathTraversalStateBuilder::arcTo): + +2010-08-18 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Steve Block. + + [Qt] Request for permission before starting Geolocation service + https://bugs.webkit.org/show_bug.cgi?id=42027 + + Handles starting location acquisition when request is granted for ports using + "!CLIENT_BASED_GEOLOCATION and PREEMPT_GEOLOCATION_PERMISSION" policy + Only Qt port as of today uses the above combination. Enable + PREEMPT_GEOLOCATION_PERMISSION for qt port. + + Below tests cover these changes on platform using PREEMPT_GEOLOCATION_PERMISSION + - fast/dom/Geolocation/delayed-permission-allowed.html + - fast/dom/Geolocation/delayed-permission-denied.html + - fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html + - fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html + + * WebCore.pro: + * page/Geolocation.cpp: + (WebCore::Geolocation::handlePendingPermissionNotifiers): + +2010-08-18 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65595. + http://trac.webkit.org/changeset/65595 + https://bugs.webkit.org/show_bug.cgi?id=44161 + + qt build failed (Requested by loislo on #webkit). + + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/copyInspectorFiles.cmd: + * WebCore.xcodeproj/project.pbxproj: + * combine-javascript-resources: + * inspector/CodeGeneratorInspector.pm: + * inspector/front-end/InspectorBackendStub.js: Added. + (WebInspector.InspectorBackendStub): + (WebInspector.InspectorBackendStub.prototype._registerDelegate): + (WebInspector.InspectorBackendStub.prototype.sendMessageToBackend): + * inspector/front-end/InspectorBackendStub.qrc: Removed. + * inspector/front-end/WebKit.qrc: + +2010-08-18 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: make objectId of string type instead of object. + https://bugs.webkit.org/show_bug.cgi?id=44160 + + * WebCore.xcodeproj/project.pbxproj: + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor.): + * inspector/front-end/InjectedScriptAccess.js: + (get InjectedScriptAccess.getForObjectId): + * inspector/front-end/RemoteObject.js: + (WebInspector.RemoteObject.prototype.getProperties): + (WebInspector.RemoteObject.prototype.setPropertyValue): + (WebInspector.RemoteObject.prototype.pushNodeToFrontend): + +2010-08-17 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: replace hand written InspectorBackendStub.js by generated one. + New command-line flag was added to combine-javascript-resources. + It specifies the location of generated scripts. + https://bugs.webkit.org/show_bug.cgi?id=43791 + + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * combine-javascript-resources: + * inspector/CodeGeneratorInspector.pm: + * inspector/front-end/InspectorBackendStub.js: Removed. + * inspector/front-end/WebKit.qrc: + +2010-08-18 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Dimitri Glazkov. + + Printer font is different from screen font + https://bugs.webkit.org/show_bug.cgi?id=43340 + + Not testable because PNG output in layoutTestController.setPrinting + for chromium isn't implemented yet. + + * platform/graphics/FontDescription.h: Use screen font even for printing on Mac Chromium + (WebCore::FontDescription::setUsePrinterFont): + +2010-08-18 Renata Hodovan <reni@inf.u-szeged.hu> + + Reviewed by Dirk Schulze. + + Fix displaying problem of feTurbulence. + https://bugs.webkit.org/show_bug.cgi?id=44111 + + Change the order of calculating turbulenceFunctionResult + and clamping it. Furthermore remove the unnecessary rounding of m_seed. + Add a new test for checking the change of seed's value. + + Test: svg/W3C-SVG-1.1/filters-turb-02-f.svg + + * svg/graphics/filters/SVGFETurbulence.cpp: + (WebCore::FETurbulence::initPaint): + (WebCore::FETurbulence::calculateTurbulenceValueForPoint): + (WebCore::FETurbulence::apply): + +2010-08-17 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig. + + Bug 44146 - Remove toDouble/toUInt32 methods from UString. + + These methods all implement JavaScript language specific behaviour, and as such + are not suited to being on a generic string object. They are also inefficient + and incorrectly used, refactor & cleanup. Uses of these methods really divide + out into two cases. + + ToNumber: + Uses of toDouble from JSString and from parseFloat are implementing ecma's + ToNumber conversion from strings (see ecma-262 9.3.1), so UString::toDouble + should largely just be moved out to a global jsToNumber function. ToNumber is + capable of recognizing either decimal or hexadecimal numbers, but parseFloat + should only recognize decimal values. This is currently handled by testing for + hexadecimal before calling toDouble, which should unnecessary - instead we can + just split out the two parts to the grammar into separate functions. Also, + strtod recognizes a set of literals (nan, inf, and infinity - all with any + capitalization) - which are not defined by any of the specs we are implementing. + To handle this we need to perform additional work in toDouble to convert the + unsupported cases of infinities back to NaNs. Instead we should simply remove + support for this literals from strtod. This should provide a more desirable + behaviour for all clients of strtod. + + Indexed properties: + Uses of the toStrictUInt32 methods are were all converting property names to + indices, and all uses of toUInt32 were incorrect; in all cases we should have + been calling toUInt32. This error results in some incorrect behaviour in the + DOM (accessing property "0 " of a NodeList should fail; it currently does not). + Move this method onto Identifier (our canonical property name), and make it + always perform a strict conversion. Add a layout test to check NodeList does + convert indexed property names correctly. + + Test: fast/dom/NodeList/nodelist-item-with-index.html + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::getOwnPropertySlot): + (WebCore::JSDOMWindow::getOwnPropertyDescriptor): + * bindings/js/JSHTMLAllCollectionCustom.cpp: + (WebCore::callHTMLAllCollection): + (WebCore::JSHTMLAllCollection::item): + * bindings/js/JSHTMLCollectionCustom.cpp: + (WebCore::callHTMLCollection): + (WebCore::JSHTMLCollection::item): + * bindings/js/JSNodeListCustom.cpp: + (WebCore::callNodeList): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/runtime_array.cpp: + (JSC::RuntimeArray::getOwnPropertySlot): + (JSC::RuntimeArray::getOwnPropertyDescriptor): + (JSC::RuntimeArray::put): + +2010-08-18 Adam Barth <abarth@webkit.org> + + Reviewed by Adele Peterson. + + Null dereference in DOMSelection::deleteFromDocument + https://bugs.webkit.org/show_bug.cgi?id=44153 + + deleteFromDocument checks selection->isNone() before calling + selection->selection().toNormalizedRange(), but toNormalizedRange() + notes that it needs to updateLayout(), which can make the selection + isNone() again. In that case, we crash on a NULL pointer in + deleteFromDocument. I don't know how to trigger that situation in a + test, but cross_fuzz was able to hit it, so we should fix it. + + * page/DOMSelection.cpp: + (WebCore::DOMSelection::deleteFromDocument): + +2010-08-17 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Antonio Gomes. + + [Qt] On Maemo5, there is no libgdk-x11-2.0.so symlink. Look for + libgdk-x11-2.0.so.0 instead on X11 and Maemo5. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::getPluginDisplay): + +2010-08-17 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Antonio Gomes. + + [Qt] Remove unused ContextShadowParameter class in GraphicsContextQt + https://bugs.webkit.org/show_bug.cgi?id=44142 + + The class is not needed anymore after r65425. + We know have dedicated ContextShadow in its own file. + + * platform/graphics/qt/GraphicsContextQt.cpp: + +2010-08-17 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Darin Adler. + + Add NetworkingContext to avoid layer violations + https://bugs.webkit.org/show_bug.cgi?id=42292 + + Preparation: Just add the files to the build system. + + * GNUmakefile.am: Added new files. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + + * loader/FrameNetworkingContext.h: Added. + * platform/network/NetworkingContext.h: Added. + Placeholders with tentative code that might be changed when landing + the rest of it. + +2010-08-17 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Darin Fisher. + + Back button after Google search result click broken + https://bugs.webkit.org/show_bug.cgi?id=44086 + + Test: fast/history/redirect-via-iframe.html + + isLoadingInAPISense doesn't quite map to onload (it also returns true + if frames are loading, even after the parent frame has fired its onload + handler). Instead, add a flag for the onload event being fired, and + use that. + + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::DocumentLoader): + * loader/DocumentLoader.h: + (WebCore::DocumentLoader::handledOnloadEvents): + (WebCore::DocumentLoader::wasOnloadHandled): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::handledOnloadEvents): + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::mustLockBackForwardList): + +2010-08-17 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Geolocation clearWatch() needs to protect against invalid IDs + https://bugs.webkit.org/show_bug.cgi?id=44096 + + If the ID passed to clearWatch() is invalid, we early-out. + + Test: fast/dom/Geolocation/clear-watch-invalid-id-crash.html + + * page/Geolocation.cpp: + (WebCore::Geolocation::Watchers::set): + (WebCore::Geolocation::Watchers::remove): + (WebCore::Geolocation::watchPosition): + (WebCore::Geolocation::clearWatch): + +2010-08-17 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Allow non-Skia ports to compile with ENABLE(ACCELERATED_2D_CANVAS). + https://bugs.webkit.org/show_bug.cgi?id=44130 + + No tests; if it compiles, it's good. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D): + Fix a warning (treated as error). + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::setGraphicsContext3D): + (WebCore::GraphicsContext::syncSoftwareCanvas): + * platform/graphics/GraphicsContext.h: + Make setGraphicsContext3D() and syncSoftwareCanvas() stubbed out, + but still present in non-Skia ports. This allows Chrome Mac to + compile with ENABLE(ACCELERATED_2D_CANVAS) (although it isn't hooked + up yet, it should at least compile). + +2010-08-17 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Navigating back/forward during a modal dialog causes a crash when the modal dialog is dismissed. + <rdar://problem/8313579> and https://bugs.webkit.org/show_bug.cgi?id=44131 + + No new tests. (Especially since DRT doesn't spin inner run loops at all, it would be a significant + effort to give it the ability to perform the back/forward navigation in the background to reproduce + this bug) + + Manual tests in place of layout tests: + * manual-tests/back-forward-during-alert-1.html: Added. + * manual-tests/back-forward-during-alert-2.html: Added. + + * page/Page.cpp: + (WebCore::Page::goToItem): + +2010-08-17 Ojan Vafai <ojan@chromium.org> + + Reviewed by Tony Chang. + + selectionStart clobbered if textarea isn't focused + https://bugs.webkit.org/show_bug.cgi?id=43814 + + If a text control is blurred, setting selectionStart/end should use + the cached selection value, which is currently stored on the form + control element. + + Test: fast/forms/text-control-select-blurred.html + + * rendering/RenderTextControl.cpp: + (WebCore::RenderTextControl::setSelectionStart): + (WebCore::RenderTextControl::setSelectionEnd): + +2010-08-17 Dmitry Titov <dimich@chromium.org> + + Reviewed by David Levin. + + MessagePort.close() crashes if the owning context was destroyed. + https://bugs.webkit.org/show_bug.cgi?id=43140 + + Test: fast/events/message-port-context-destroyed.html + + * dom/MessagePort.cpp: + (WebCore::MessagePort::postMessage): + (WebCore::MessagePort::start): + (WebCore::MessagePort::close): + (WebCore::MessagePort::contextDestroyed): + Use isEntangled() method to gate various operations on MessagePort. This method also takes into account m_closed bit. + + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::stopActiveDOMObjects): + (WebCore::ScriptExecutionContext::closeMessagePorts): + * dom/ScriptExecutionContext.h: + Add closeMessagePorts() method that closes message ports at the same moments when other ActiveDOMObjects are stopped. + +2010-08-17 Fady Samuel <fsamuel@chromium.org> + + Reviewed by David Hyatt. + + Updated table cell hit testing and painting to use binary search instead of linear scan. + + Improved Table Hit Testing and Painting Performance + https://bugs.webkit.org/show_bug.cgi?id=43933 + + Tests: fast/table/simple_paint.html + tables/hittesting/filltable-emptycells.html + tables/hittesting/filltable-levels.html + tables/hittesting/filltable-outline.html + tables/hittesting/filltable-rtl.html + tables/hittesting/filltable-stress.html + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::paintObject): Dirty rect determined using binary search. + (WebCore::RenderTableSection::nodeAtPoint): Cell hit determined using binary search + +2010-08-17 Abhishek Arya <inferno@chromium.org> + + Reviewed by Dave Hyatt. + + Only destroy empty anonymous block when it is columns or column span block + in RenderBlock::removeChild. + https://bugs.webkit.org/show_bug.cgi?id=44035 + + Test: fast/block/basic/empty-anonymous-block-remove-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::removeChild): + +2010-08-17 Darin Fisher <darin@chromium.org> + + Reviewed by Darin Adler. + + [Chromium] REGRESSION: Incorrect repaint on scrolling with position:fixed elements + https://bugs.webkit.org/show_bug.cgi?id=42949 + + This is a partial revert of http://trac.webkit.org/changeset/63907 + + * page/FrameView.cpp: + (WebCore::FrameView::scrollPositionChangedViaPlatformWidget): + (WebCore::FrameView::scrollPositionChanged): + * platform/ScrollView.cpp: + (WebCore::ScrollView::valueChanged): + +2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65528. + http://trac.webkit.org/changeset/65528 + https://bugs.webkit.org/show_bug.cgi?id=44123 + + "Broke a bunch of canvas tests on Chrome win/linux." + (Requested by senorblanco on #webkit). + + * platform/graphics/skia/BitmapImageSingleFrameSkia.h: + (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::drawsUsingCopy): + (WebCore::ImageBuffer::copyImage): + (WebCore::ImageBuffer::draw): + (WebCore::ImageBuffer::drawPattern): + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::BitmapImageSingleFrameSkia::create): + * platform/graphics/skia/NativeImageSkia.cpp: + * platform/graphics/skia/NativeImageSkia.h: + +2010-08-17 Martin Robinson <mrobinson@igalia.com> + + Reviewed by David Hyatt. + + [Cairo] Remove unnecessary full-surface copies from ImageCairo and GraphicsContextCairo + https://bugs.webkit.org/show_bug.cgi?id=44076 + + No new tests as functionality has not changed. + + * GNUmakefile.am: Added GRefPtrCairo to the sources list. + * platform/graphics/cairo/GRefPtrCairo.cpp: Added. + (WTF::refGPtr): Added specializations for cairo_t and cairo_surface_t. + (WTF::derefGPtr): + * platform/graphics/cairo/GRefPtrCairo.h: Added. + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::createPlatformShadow): Access the image surface directly + from the ImageBuffer instead of wrapping it in an Image. + * platform/graphics/cairo/ImageCairo.cpp: + (WebCore::Image::drawPattern): Create the temporary surface using cairo primitives + instead of through the platform-independent WebCore code. + +2010-08-17 Martin Robinson <mrobinson@igalia.com> + + [GTK] Clean up WebCore/platform/graphics/gtk/ImageGtk.cpp + https://bugs.webkit.org/show_bug.cgi?id=44069 + + No new tests as functionality has not changed. + + * GNUmakefile.am: Add WEBKITGTK_API_VERSION_STRING definition, which + allows WebCore to use this as well. + * platform/graphics/gtk/ImageGtk.cpp: + (getWebKitDataDirectory): Added this helper. + (WebCore::Image::loadPlatformResource): Use GOwnPtr for gchar pointers and + use the new getWebKitDataDirectory helper. + * platform/gtk/GOwnPtrGtk.cpp: Move the GtkIconInfo template specialization to this file. + (WTF::GtkIconInfo): Added this forward declaration. + * platform/gtk/GOwnPtrGtk.h: Declaration for new template specialization. + +2010-08-17 Stephen White <senorblanco@chromium.org> + + Reviewed by Darin Fisher. + + [CHROMIUM] Eliminate a memcpy() from the canvas.drawImage(canvas, ...) path. + This is the Skia followup to Dave Hyatt's patch in r65449. + https://bugs.webkit.org/show_bug.cgi?id=44115 + + Covered by canvas layout tests. + + * platform/graphics/skia/BitmapImageSingleFrameSkia.h: + Add a "copyPixels" argument to the create() static to indicate if + the caller wants the pixels to be copied or ref'ed. + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::drawsUsingCopy): + We don't use the always-copy path anymore, so return false. + (WebCore::ImageBuffer::copyImage): + Shouldn't get here anymore, so ASSERT_NOT_REACHED. + (WebCore::ImageBuffer::draw): + (WebCore::ImageBuffer::drawPattern): + Create a temporary BitampImageSingleFrameSkia wrapped around the + canvas's bitmap, and draw with it immediately. If drawing to our own + canvas, copy the pixels, otherwise just shallow copy. + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::BitmapImageSingleFrameSkia::BitmapImageSingleFrameSkia): + Make the constructor take an SkBitmap to be wrapped. + (WebCore::BitmapImageSingleFrameSkia::create): + Implement the "copyPixels" flag: if true, do a deep copy, otherwise + do a shallow copy. + * platform/graphics/skia/NativeImageSkia.cpp: + (WebCore::NativeImageSkia::NativeImageSkia): + * platform/graphics/skia/NativeImageSkia.h: + Implement a new constructor that shallow-copies the given SkBitmap. + +2010-08-17 Jian Li <jianli@chromium.org> + + Reviewed by Darin Fisher. + + Move BlobRegistry interface and implementation to platform/network + https://bugs.webkit.org/show_bug.cgi?id=44116 + + Also move BlobData and BlobStorageData since they're part of BlobRegistry + implementation. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/network/BlobData.cpp: Renamed from WebCore/platform/BlobData.cpp. + * platform/network/BlobData.h: Renamed from WebCore/platform/BlobData.h. + * platform/network/BlobRegistry.h: Renamed from WebCore/platform/BlobRegistry.h. + * platform/network/BlobRegistryImpl.cpp: Renamed from WebCore/html/BlobRegistryImpl.cpp. + * platform/network/BlobRegistryImpl.h: Renamed from WebCore/html/BlobRegistryImpl.h. + * platform/network/BlobStorageData.h: Renamed from WebCore/html/BlobStorageData.h. + +2010-08-17 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Path: Fast approximation of stroke bounding rects + https://bugs.webkit.org/show_bug.cgi?id=44014 + + In canvas's stroke(), use QPainterPath::controlPointRect() to calculate + a slightly larger bounding rect in a fraction of the time. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::stroke): + +2010-08-17 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Kenneth Rohde Christiansen. + Set PluginQuirkRequiresDefaultScreenDepth for all Flash versions and not + just Flash 10. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::determineQuirks): + +2010-08-17 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Change FileStream implementation to prepare for blob resource handling. + https://bugs.webkit.org/show_bug.cgi?id=43985 + + Change FileStream to support synchronous usage only. All the asychronous + logics are moved to FileStreamProxy. Update the existing FileReader code + to adapt to this change. + + * html/FileReader.cpp: Account for FileStreamProxy changes. + (WebCore::FileReader::didStart): + (WebCore::FileReader::didGetSize): + (WebCore::FileReader::didOpen): + (WebCore::FileReader::didRead): + * html/FileReader.h: + * html/FileStream.cpp: Remove m_client and make all calls synchronous only. + (WebCore::FileStream::FileStream): + (WebCore::FileStream::start): + (WebCore::FileStream::stop): + (WebCore::FileStream::getSize): + (WebCore::FileStream::openForRead): + (WebCore::FileStream::openForWrite): + (WebCore::FileStream::close): + (WebCore::FileStream::read): + (WebCore::FileStream::write): + (WebCore::FileStream::truncate): + * html/FileStream.h: Add getSize() and make all calls synchronous by adding return values. + (WebCore::FileStream::create): + * html/FileStreamClient.h: Account for FileStreamProxy changes. + (WebCore::FileStreamClient::didRead): + (WebCore::FileStreamClient::didTruncate): + (WebCore::FileStreamClient::didOpen): + * html/FileStreamProxy.cpp: All the logics to handle asynchronous calls are wrapped here. + (WebCore::FileStreamProxy::FileStreamProxy): + (WebCore::FileStreamProxy::create): + (WebCore::FileStreamProxy::fileThread): + (WebCore::didStart): + (WebCore::FileStreamProxy::startOnFileThread): + (WebCore::FileStreamProxy::stop): + (WebCore::derefProxyOnContext): + (WebCore::FileStreamProxy::stopOnFileThread): + (WebCore::didGetSize): + (WebCore::FileStreamProxy::getSize): + (WebCore::FileStreamProxy::getSizeOnFileThread): + (WebCore::didOpen): + (WebCore::FileStreamProxy::openForRead): + (WebCore::FileStreamProxy::openForReadOnFileThread): + (WebCore::FileStreamProxy::openForWrite): + (WebCore::FileStreamProxy::openForWriteOnFileThread): + (WebCore::FileStreamProxy::close): + (WebCore::FileStreamProxy::closeOnFileThread): + (WebCore::didRead): + (WebCore::FileStreamProxy::read): + (WebCore::FileStreamProxy::readOnFileThread): + (WebCore::didWrite): + (WebCore::FileStreamProxy::write): + (WebCore::FileStreamProxy::writeOnFileThread): + (WebCore::didTruncate): + (WebCore::FileStreamProxy::truncate): + (WebCore::FileStreamProxy::truncateOnFileThread): + * html/FileStreamProxy.h: + * html/FileThreadTask.h: Change all methods to return void since return value is not needed now. + +2010-08-17 Dimitri Glazkov <dglazkov@chromium.org> + + Returned WebCore.xcodeproj to default settings after http://trac.webkit.org/changeset/65468/trunk/WebCore/WebCore.xcodeproj/project.pbxproj. + + * WebCore.xcodeproj/project.pbxproj: Removed developmentRegion = English line. + +2010-08-17 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Eric Seidel. + + Eliminate extra traversal of the tree when determining ability to lazy-attach a Node. + https://bugs.webkit.org/show_bug.cgi?id=43749 + + Land the actual change that I intended to land in http://trac.webkit.org/changeset/65508. + + Neither SVG nor inputs/counters shadow DOM are traveling down this path (they home-bake their attachment), + so the check for shadow tree existence isn't needed. + Gives a small, but consistent win in Dromaeo's DOM Modification test. + + * dom/Node.h: + (WebCore::Node::canLazyAttach): Changed to always return true. + +2010-08-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Eric Carlson. + + Restore intrinsic size of video elements after loading poster + + The element might already have the instrinsic size of the video, in + which case we don't want to override it witht that of the image. + + * rendering/RenderVideo.cpp: call updateIntrinsicSize() to restore size + +2010-08-17 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + Reviewed by Steve Block. + + Geolocation preemptive permissions policy is buggy + https://bugs.webkit.org/show_bug.cgi?id=42811 + + While waiting for permission, m_startRequestPermissionNotifier was + used to consider only one pending request. This patch implements a set + m_pendingForPermissionNotifiers to maintain set of pending requests. + When user grants/denies permission all listeners will be notified. + Also fixed issue with hasZeroTimeout() where startTimerIfNeeded() has + to start irrespective of permission state + + Tests: fast/dom/Geolocation/delayed-permission-allowed-for-multiple-requests.html + fast/dom/Geolocation/delayed-permission-denied-for-multiple-requests.html + + * WebCore.pro: + * page/Geolocation.cpp: + (WebCore::Geolocation::startRequest): + (WebCore::Geolocation::setIsAllowed): + (WebCore::Geolocation::startUpdating): + (WebCore::Geolocation::handlePendingPermissionNotifiers): + * page/Geolocation.h: + +2010-08-11 Jeremy Orlow <jorlow@chromium.org> + + Beginnings of IndexedDB persistance + IDBDatabase.description fleshed out + https://bugs.webkit.org/show_bug.cgi?id=43744 + + The beginnings of a SQLite backend for IndexedDB. Right now, only persists + meta-data for the database. The rest is coming in future patches. Adds + a manual test to verify persistance. + + Test: storage/indexeddb/database-description.html + + a manual test + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * manual-tests/indexed-database.html: Added. + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::databaseIdentifier): + * platform/FileSystem.cpp: Added. + (WebCore::): + (WebCore::shouldEscapeUChar): + (WebCore::encodeForFileName): + * platform/FileSystem.h: + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::IDBDatabase): + * storage/IDBDatabase.h: + (WebCore::IDBDatabase::description): + * storage/IDBDatabaseBackendImpl.cpp: + (WebCore::extractMetaData): + (WebCore::setMetaData): + (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl): + (WebCore::IDBDatabaseBackendImpl::setDescription): + * storage/IDBDatabaseBackendImpl.h: + (WebCore::IDBDatabaseBackendImpl::create): + * storage/IDBFactory.h: + * storage/IDBFactory.idl: + * storage/IDBFactoryBackendImpl.cpp: + (WebCore::IDBFactoryBackendImpl::IDBFactoryBackendImpl): + (WebCore::IDBFactoryBackendImpl::~IDBFactoryBackendImpl): + (WebCore::openSQLiteDatabase): + (WebCore::createTables): + (WebCore::IDBFactoryBackendImpl::open): + * storage/IDBFactoryBackendImpl.h: + (WebCore::IDBFactoryBackendImpl::create): + +2010-08-17 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Eric Seidel. + + Eliminate extra traversal of the tree when determining ability to lazy-attach a Node. + https://bugs.webkit.org/show_bug.cgi?id=43749 + + Neither SVG nor inputs/counters shadow DOM are traveling down this path (they home-bake their attachment), + so the check for shadow tree existence isn't needed. + + Gives a small, but consisten win in Dromaeo's DOM Modification test. + + * dom/Node.cpp: Removed canLazyAttach declaration. + * dom/Node.h: + (WebCore::Node::canLazyAttach): Changed to always return true. + +2010-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: [CRASH] Console formatting crashes after cross-domain navigation. + https://bugs.webkit.org/show_bug.cgi?id=44103 + + * bindings/js/JSInjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::injectedScriptFor): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::injectedScriptFor): + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::addToFrontend): + +2010-08-17 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: upstream Chromium debugger step tests + https://bugs.webkit.org/show_bug.cgi?id=44106 + + Tests: inspector/debugger-step-in.html + inspector/debugger-step-out.html + inspector/debugger-step-over.html + + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::returnEvent): check that debugger is still attached after continue to ensure + that current call frame is not 0. + +2010-08-17 Ademar de Souza Reis Jr <ademar.reis@openbossa.org> + + Reviewed by David Levin. + + Trivial fix removing the self-inclusion of a couple of header files. + + Self inclusion in Document.h and RenderTheme.h + https://bugs.webkit.org/show_bug.cgi?id=44065 + + * dom/Document.h: + * rendering/RenderTheme.h: + +2010-08-17 No'am Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Move the accelerated compositing build flag to the right place + https://bugs.webkit.org/show_bug.cgi?id=43882 + + No new tests: build fix. + + * WebCore.pro: + +2010-08-17 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65500. + http://trac.webkit.org/changeset/65500 + https://bugs.webkit.org/show_bug.cgi?id=44108 + + Qt bots failed to compile. (Requested by loislo on #webkit). + + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/copyInspectorFiles.cmd: + * WebCore.xcodeproj/project.pbxproj: + * combine-javascript-resources: + * inspector/CodeGeneratorInspector.pm: + * inspector/front-end/InspectorBackendStub.js: Added. + (WebInspector.InspectorBackendStub): + (WebInspector.InspectorBackendStub.prototype._registerDelegate): + (WebInspector.InspectorBackendStub.prototype.sendMessageToBackend): + * inspector/front-end/InspectorBackendStub.qrc: Removed. + * inspector/front-end/WebKit.qrc: + +2010-08-17 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: replace hand written InspectorBackendStub.js by generated one. + New command-line flag was added to combine-javascript-resources. + It specifies the location of generated scripts. + https://bugs.webkit.org/show_bug.cgi?id=43791 + + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * combine-javascript-resources: + * inspector/CodeGeneratorInspector.pm: + * inspector/front-end/InspectorBackendStub.js: Removed. + * inspector/front-end/WebKit.qrc: + +2010-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: get rid of node and scoped object-specific ids. + https://bugs.webkit.org/show_bug.cgi?id=44097 + + * inspector/front-end/ConsoleView.js: + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._createTooltipForNode): + * inspector/front-end/EventListenersSidebarPane.js: + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor.): + (injectedScriptConstructor): + * inspector/front-end/InjectedScriptAccess.js: + (InjectedScriptAccess): + (InjectedScriptAccess.getForNode): + (InjectedScriptAccess._installHandler.InjectedScriptAccess.prototype.methodName): + (InjectedScriptAccess._installHandler): + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update): + * inspector/front-end/RemoteObject.js: + (WebInspector.RemoteObjectId): + (WebInspector.RemoteObject.resolveNode): + * inspector/front-end/ScriptsPanel.js: + +2010-08-17 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Fix wrapping of core Events in the bindings + https://bugs.webkit.org/show_bug.cgi?id=44095 + + Return the proper GObject type instead of hardcoding + WebKitDOMEvent for all Event types. + + * bindings/gobject/GObjectEventListener.cpp: + (WebCore::GObjectEventListener::handleEvent): + * bindings/gobject/WebKitDOMBinding.cpp: + (WebKit::kit): + +2010-08-17 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + Revert supposed build-fix which was in fact reverting a previous + build fix which was correct (oh dear). + + * GNUmakefile.am: + +2010-08-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Antonio Gomes. + + [Qt] Add media element support for preload=none + + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + * platform/graphics/qt/MediaPlayerPrivateQt.h: + +2010-08-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Antonio Gomes. + + [Qt] Pre-roll media when loading media elements + + This ensures we get correct size-hints from QtMultimedia, as well as + the media states Buffering and Buffered instead of Loading and Loaded, + which we use to transition into MediaPlayer::HaveEnoughData. + + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + * platform/graphics/qt/MediaPlayerPrivateQt.h: + +2010-08-16 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix missing default controls for stand-alone media elements + + https://bugs.webkit.org/show_bug.cgi?id=35427 + + * css/mediaControlsQt.css: + +2010-08-17 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Reduce the size of the shadow buffer to the clip region + https://bugs.webkit.org/show_bug.cgi?id=44091 + + Instead of allocating the buffer image (for the blur support) as big + as the rectangle which casts the shadow, we limit the size to the + current clip region. + + * platform/graphics/qt/ContextShadow.cpp: + (WebCore::ContextShadow::drawShadowRect): + +2010-08-17 Philippe Normand <pnormand@igalia.com> + + Reviewed by Martin Robinson. + + [GStreamer] media/invalid-media-url-crash.html fails + https://bugs.webkit.org/show_bug.cgi?id=42960 + + Implemented two ResourceHandleClient callbacks that need to notify + downstream GStreamer elements of errors while accessing the + resource. + + * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: + (StreamingClient::wasBlocked): + (StreamingClient::cannotShowURL): + +2010-08-16 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Remove unnecessary includes from UString.h, add new includes as necessary. + + * dom/ScriptExecutionContext.h: + * loader/appcache/ApplicationCache.cpp: + +2010-08-16 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Darin Adler. + + CSS: Add fast-path for rgba() color parsing + https://bugs.webkit.org/show_bug.cgi?id=42965 + + Test: fast/canvas/rgba-parsing.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseColor): Extended with support for rgba(). + (WebCore::parseAlphaValue): Added, parses an alpha value using + WTF::strtod() (if necessary) and clamps between 0 and 1. + (WebCore::isTenthAlpha): + +2010-08-16 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Add idl and mock classes for FileSystem API's {File,Directory}Entry and related interfaces + https://bugs.webkit.org/show_bug.cgi?id=43993 + + Adding DirectoryEntry, DirectoryReader, EntriesCallback and FileEntry as defined in HTML5 FileSystem API. + http://dev.w3.org/2009/dap/file-system/file-dir-sys.html + + Also adding Makefile entries for idl and mock classes added in changeset 64414 (except for Android platforms). + + Tests will be added when we add underlying implementation. + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * storage/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::root): + * storage/DOMFileSystem.h: + * storage/DOMFileSystem.idl: + * storage/DirectoryEntry.cpp: Added. + * storage/DirectoryEntry.h: Added. + * storage/DirectoryEntry.idl: Added. + * storage/DirectoryReader.cpp: Added. + * storage/DirectoryReader.h: Added. + * storage/DirectoryReader.idl: Added. + * storage/EntriesCallback.h: Added. + * storage/EntriesCallback.idl: Added. + * storage/EntryArray.cpp: Added. + * storage/EntryArray.h: Added. + * storage/EntryArray.idl: Added. + * storage/Entry.cpp: + (WebCore::Entry::Entry): + (WebCore::Entry::getMetadata): + (WebCore::Entry::moveTo): + (WebCore::Entry::copyTo): + (WebCore::Entry::remove): + (WebCore::Entry::getParent): + * storage/Entry.h: + (WebCore::Entry::isFile): + (WebCore::Entry::isDirectory): + * storage/Entry.idl: + * storage/FileEntry.cpp: Added. + * storage/FileEntry.h: Added. + * storage/FileEntry.idl: Added. + +2010-08-16 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Path::closeSubpath() should only close the last subpath if it has >1 point + https://bugs.webkit.org/show_bug.cgi?id=44061 + + Spec link: + http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-closepath + + Test: fast/canvas/canvas-closePath-single-point.html + + * platform/graphics/Path.h: Add a Qt-only member to track the last subpath. + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::closeSubpath): Only close the last subpath if it + has more than 1 point. Otherwise behave as moveTo(first point in last subpath) + (WebCore::Path::Path): + (WebCore::Path::operator=): + (WebCore::Path::moveTo): + (WebCore::Path::transform): + +2010-08-16 Nate Chapin <japhet@chromium.org> + + Unreviewed, Chromium mac build fix (with help from jamesr). + + * platform/chromium/ScrollbarThemeChromiumMac.mm: + (WebCore::ScrollbarThemeChromiumMac::paint): + +2010-08-16 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Bug 44080 - String find/reverseFind methods need tidying up + These methods have a couple of problems with their interface, and implementation. + + These methods take and int index, and return an int - however this is problematic + since on 64-bit string indices may have a full 32-bit range. This spills out into + surrounding code, which unsafely casts string indices from unsigned to int. Code + checking the result of these methods check for a mix of "== -1", "< 0", and + "== notFound". Clean this up by changing these methods to take an unsigned + starting index, and return a size_t. with a failed match indicated by notFound. + reverseFind also has a special meaning for the starting index argument, in that a + negative index is interpreted as an offset back from the end of the string. Remove + this functionality, in the (1!) case where it is used we should just calculate the + offset by subtracting from the string's length. + + The implementation has a few problems too. The code is not in webkit style, in + using assorted abbreviations in variable names, and implementations of similar + find methods with differing argument types were unnecessarily inconsistent. When + find is passed const char* data the string would be handled as latin1 (zero + extended to UTF-16) for all characters but the first; this is sign extended. + Case-insensitive find is broken for unicode strings; the hashing optimization is + not unicode safe, and could result in false negatives. + + Unify UString find methods to match String. + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::RareData::parseNth): + * css/CSSStyleDeclaration.cpp: + (WebCore::CSSStyleDeclaration::setProperty): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): + * dom/Document.cpp: + (WebCore::Document::getImageMap): + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::inputText): + * editing/InsertTextCommand.cpp: + (WebCore::InsertTextCommand::input): + * editing/TextIterator.cpp: + (WebCore::TextIterator::handleTextBox): + * editing/TypingCommand.cpp: + (WebCore::TypingCommand::insertText): + * editing/markup.cpp: + (WebCore::fillContainerFromString): + (WebCore::createFragmentFromText): + * html/File.cpp: + (WebCore::File::Init): + * html/HTMLAnchorElement.cpp: + (WebCore::HTMLAnchorElement::setHost): + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::parseMappedAttribute): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLTextFormControlElement::isPlaceholderEmpty): + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::parseMappedAttribute): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::performSearch): + * loader/CrossOriginPreflightResultCache.cpp: + (WebCore::parseAccessControlAllowList): + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::substituteMIMETypeFromPluginDatabase): + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::parseHeader): + (WebCore::parseHeaders): + * loader/icon/IconFetcher.cpp: + (WebCore::parseIconLink): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::parseModalDialogFeatures): + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::createFromDatabaseIdentifier): + * page/UserContentURLPattern.cpp: + (WebCore::UserContentURLPattern::parse): + * page/XSSAuditor.cpp: + (WebCore::XSSAuditor::findInRequest): + * platform/ContentType.cpp: + (WebCore::ContentType::parameter): + (WebCore::ContentType::type): + * platform/KURL.cpp: + (WebCore::KURL::lastPathComponent): + (WebCore::KURL::setProtocol): + (WebCore::decodeURLEscapeSequences): + (WebCore::substituteBackslashes): + (WebCore::mimeTypeFromDataURL): + * platform/Length.cpp: + (WebCore::newCoordsArray): + (WebCore::newLengthArray): + * platform/LinkHash.cpp: + (WebCore::findSlashDotDotSlash): + (WebCore::findSlashSlash): + (WebCore::findSlashDotSlash): + (WebCore::cleanPath): + * platform/MIMETypeRegistry.cpp: + (WebCore::MIMETypeRegistry::getMIMETypeForPath): + * platform/SchemeRegistry.cpp: + (WebCore::SchemeRegistry::shouldTreatURLAsLocal): + * platform/graphics/MediaPlayer.cpp: + (WebCore::MediaPlayer::load): + * platform/mac/DragImageMac.mm: + (WebCore::createDragImageIconForCachedImage): + * platform/network/CredentialStorage.cpp: + (WebCore::protectionSpaceMapKeyFromURL): + (WebCore::findDefaultProtectionSpaceForURL): + * platform/network/HTTPParsers.cpp: + (WebCore::skipWhiteSpace): + (WebCore::skipToken): + (WebCore::parseHTTPRefresh): + (WebCore::filenameFromHTTPContentDisposition): + (WebCore::findCharsetInMediaType): + (WebCore::parseXSSProtectionHeader): + (WebCore::extractReasonPhraseFromHTTPStatusLine): + * platform/network/ResourceResponseBase.cpp: + (WebCore::ResourceResponseBase::isAttachment): + (WebCore::parseCacheHeader): + * rendering/RenderEmbeddedObject.cpp: + (WebCore::RenderEmbeddedObject::updateWidget): + * storage/Entry.cpp: + (WebCore::Entry::Entry): + * svg/SVGFont.cpp: + (WebCore::isCompatibleGlyph): + * svg/SVGURIReference.cpp: + (WebCore::SVGURIReference::getTarget): + * svg/animation/SVGSMILElement.cpp: + (WebCore::SVGSMILElement::parseClockValue): + (WebCore::SVGSMILElement::parseCondition): + * xml/XPathFunctions.cpp: + (WebCore::XPath::FunSubstringBefore::evaluate): + (WebCore::XPath::FunSubstringAfter::evaluate): + (WebCore::XPath::FunTranslate::evaluate): + (WebCore::XPath::FunLang::evaluate): + * xml/XPathParser.cpp: + (WebCore::XPath::Parser::expandQName): + +2010-08-16 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Tony Chang. + + REGRESSION(r65208): editing/pasteboard/smart-paste-003.html and smart-paste-004.html crash on Windows Chromium + https://bugs.webkit.org/show_bug.cgi?id=44070 + + The crash was caused by start or end node being removed in pushDownInlineStyleAroundNode. + It made start and end orphaned, and caused s.node() to be detached from the document. + Fixed the crash by using nodes passed to pushDownInlineStyleAroundNode for start and end if the original + start and end are orphaned because pushDownInlineStyleAroundNode won't prune targetNode. + + Test: editing/pasteboard/smart-paste-003-trailing-whitespace.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::removeInlineStyle): + +2010-08-16 James Robinson <jamesr@chromium.org> + + Compile fix. Remove ANGLEWebKitBridge classes from Chromium build. They are unused. + + * WebCore.gypi: + +2010-08-16 Vincent Scheib <scheib@chromium.org> + + Reviewed by Dimitri Glazkov. + + Canvas2D does not support images larger than system's GPU max texture size + https://bugs.webkit.org/show_bug.cgi?id=43864 + + A new class "TilingData" has been created that provides logic for + splitting a large image into a series of smaller tiles. + + GLES2Texture and CLES2Canvas are modified to use the TilingData to + split images on texture upload and render one logical image as many smaller + images. + + TilingData is tested via unit tests in WebKit/chromium/tests/TilingDataTest.cpp + + * WebCore.gypi: + * platform/graphics/chromium/GLES2Canvas.cpp: + (WebCore::GLES2Canvas::drawTexturedRect): + (WebCore::GLES2Canvas::drawTexturedRectTile): + * platform/graphics/chromium/GLES2Canvas.h: + * platform/graphics/chromium/GLES2Texture.cpp: + (WebCore::GLES2Texture::GLES2Texture): + (WebCore::GLES2Texture::~GLES2Texture): + (WebCore::GLES2Texture::create): + (WebCore::copySubRect): + (WebCore::GLES2Texture::load): + (WebCore::GLES2Texture::bindTile): + * platform/graphics/chromium/GLES2Texture.h: + (WebCore::GLES2Texture::tiles): + * platform/graphics/chromium/TilingData.cpp: Added. + (WebCore::computeNumTiles): + (WebCore::TilingData::TilingData): + (WebCore::TilingData::tileXIndexFromSrcCoord): + (WebCore::TilingData::tileYIndexFromSrcCoord): + (WebCore::TilingData::tileBounds): + (WebCore::TilingData::tileBoundsWithBorder): + (WebCore::TilingData::tileBoundsNormalized): + (WebCore::TilingData::tilePositionX): + (WebCore::TilingData::tilePositionY): + (WebCore::TilingData::tileSizeX): + (WebCore::TilingData::tileSizeY): + (WebCore::TilingData::overlappedTileIndices): + (WebCore::TilingData::intersectDrawQuad): + * platform/graphics/chromium/TilingData.h: Added. + (WebCore::TilingData::maxTextureSize): + (WebCore::TilingData::totalSizeX): + (WebCore::TilingData::totalSizeY): + (WebCore::TilingData::numTiles): + (WebCore::TilingData::numTilesX): + (WebCore::TilingData::numTilesY): + (WebCore::TilingData::tileIndex): + (WebCore::TilingData::tileXIndex): + (WebCore::TilingData::tileYIndex): + (WebCore::TilingData::TilingData): + (WebCore::TilingData::assertTile): + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::BitmapImage::draw): + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::uploadSoftwareToHardware): + +2010-08-16 David Hyatt <hyatt@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=43507, stop ImageBuffer from copying its data when rendering after canvas changes happen. + + This patch renames ImageBuffer::image() to ImageBuffer::copyImage(). The new method always returns a new copy that is a current + snapshot of the ImageBuffer. + + To draw an ImageBuffer, you now use new GraphicsContext calls: drawImageBuffer. Platforms can then optimize these calls to draw + efficiently without having to copy the bits of the ImageBuffer into an Image. + + * WebCore.xcodeproj/project.pbxproj: + * css/CSSCanvasValue.cpp: + (WebCore::CSSCanvasValue::image): + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::willDraw): + (WebCore::HTMLCanvasElement::reset): + (WebCore::HTMLCanvasElement::paint): + (WebCore::HTMLCanvasElement::setSurfaceSize): + (WebCore::HTMLCanvasElement::copiedImage): + (WebCore::HTMLCanvasElement::clearCopiedImage): + * html/HTMLCanvasElement.h: + * html/canvas/CanvasPattern.cpp: + (WebCore::CanvasPattern::CanvasPattern): + * html/canvas/CanvasPattern.h: + (WebCore::CanvasPattern::create): + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::drawImage): + (WebCore::CanvasRenderingContext2D::createPattern): + (WebCore::CanvasRenderingContext2D::drawTextInternal): + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::paintRenderingResultsToCanvas): + (WebCore::WebGLRenderingContext::reshape): + (WebCore::WebGLRenderingContext::texImage2D): + (WebCore::WebGLRenderingContext::texSubImage2D): + * html/canvas/WebGLRenderingContext.h: + (WebCore::WebGLRenderingContext::paintsIntoCanvasBuffer): + * platform/graphics/GeneratedImage.cpp: + (WebCore::GeneratedImage::drawPattern): + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::drawImageBuffer): + (WebCore::GraphicsContext::clipToImageBuffer): + * platform/graphics/GraphicsContext.h: + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::paintsIntoCanvasBuffer): + * platform/graphics/Image.h: + * platform/graphics/ImageBuffer.h: + (WebCore::ImageBuffer::width): + (WebCore::ImageBuffer::height): + * platform/graphics/Pattern.cpp: + (WebCore::Pattern::Pattern): + * platform/graphics/Pattern.h: + (WebCore::Pattern::create): + * platform/graphics/cairo/GraphicsContextCairo.cpp: + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::ImageBuffer::drawsUsingCopy): + (WebCore::ImageBuffer::copyImage): + (WebCore::ImageBuffer::clip): + (WebCore::ImageBuffer::draw): + (WebCore::ImageBuffer::drawPattern): + * platform/graphics/cg/GraphicsContextCG.cpp: + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::ImageBuffer::ImageBuffer): + (WebCore::ImageBuffer::drawsUsingCopy): + (WebCore::ImageBuffer::copyImage): + (WebCore::ImageBuffer::draw): + (WebCore::ImageBuffer::drawPattern): + (WebCore::ImageBuffer::clip): + * platform/graphics/cg/ImageBufferData.h: + * platform/graphics/filters/FEColorMatrix.cpp: + (WebCore::FEColorMatrix::apply): + * platform/graphics/filters/FEComposite.cpp: + (WebCore::FEComposite::apply): + * platform/graphics/filters/SourceAlpha.cpp: + (WebCore::SourceAlpha::apply): + * platform/graphics/filters/SourceGraphic.cpp: + (WebCore::SourceGraphic::apply): + * platform/graphics/mac/GraphicsContext3DMac.mm: + * platform/graphics/qt/GraphicsContext3DQt.cpp: + * platform/graphics/qt/GraphicsContextQt.cpp: + * platform/graphics/qt/ImageBufferData.h: + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBufferData::ImageBufferData): + (WebCore::ImageBuffer::drawsUsingCopy): + (WebCore::ImageBuffer::copyImage): + (WebCore::ImageBuffer::draw): + (WebCore::ImageBuffer::drawPattern): + (WebCore::ImageBuffer::clip): + * platform/graphics/skia/GraphicsContextSkia.cpp: + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::drawsUsingCopy): + (WebCore::ImageBuffer::copyImage): + (WebCore::ImageBuffer::clip): + (WebCore::): + * platform/graphics/wx/GraphicsContextWx.cpp: + * platform/graphics/wx/ImageBufferWx.cpp: + (WebCore::ImageBuffer::drawsUsingCopy): + (WebCore::ImageBuffer::copyImage): + (WebCore::ImageBuffer::clip): + (WebCore::ImageBuffer::draw): + (WebCore::ImageBuffer::drawPattern): + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::ScrollbarThemeMac::paint): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::applyClippingToContext): + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::postApplyResource): + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::clipToTextMask): + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::applyResource): + * rendering/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::buildPattern): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintProgressBar): + * svg/SVGFEImageElement.cpp: + (WebCore::SVGFEImageElement::build): + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::nativeImageForCurrentFrame): + * svg/graphics/SVGImage.h: + * svg/graphics/filters/SVGFEMerge.cpp: + (WebCore::FEMerge::apply): + * svg/graphics/filters/SVGFEOffset.cpp: + (WebCore::FEOffset::apply): + * svg/graphics/filters/SVGFETile.cpp: + (WebCore::FETile::apply): + +2010-08-16 Paul Sawaya <psawaya@apple.com> + + Reviewed by Chris Marrin. + + Added shader validation via ANGLE + https://bugs.webkit.org/show_bug.cgi?id=42405 + + Added validation to WebGL via ANGLE + + * Configurations/WebCore.xcconfig: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/ANGLEWebKitBridge.cpp: Added. + (WebCore::ANGLEWebKitBridge::ANGLEWebKitBridge): + (WebCore::ANGLEWebKitBridge::~ANGLEWebKitBridge): + (WebCore::ANGLEWebKitBridge::validateShaderSource): + * platform/graphics/ANGLEWebKitBridge.h: Added. + (WebCore::): + (WebCore::ANGLEWebKitBridge::setResources): + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + * platform/graphics/mac/GraphicsContext3DMac.mm: + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::compileShader): + (WebCore::GraphicsContext3D::shaderSource): + (WebCore::GraphicsContext3D::getShaderiv): + (WebCore::GraphicsContext3D::getShaderInfoLog): + (WebCore::GraphicsContext3D::getShaderSource): + +2010-08-16 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, do not build WebCore as a convenience library as this leads to + errors in the Win build w/export symbols and causes problems with DOM bindings + debugging in gdb. + + * wscript: Removed. + +2010-08-16 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Adam Roben. + + Current implementation of WebCore post-build step on windows platform is error prone. + It would be better to extract the script into external file. + https://bugs.webkit.org/show_bug.cgi?id=44058 + + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/copyForwardingHeaders.cmd: Added. + * WebCore.vcproj/copyInspectorFiles.cmd: Added. + +2010-08-16 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Fix typo in previous build fix. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-08-16 Alex Milowski <alex@milowski.com> + + Reviewed by David Levin. + + Added the configuration of the MathML related files. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: fix Leopard Release inspector tests. + + * inspector/front-end/inspector.js: + +2010-08-16 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Implements IDBKeyPath extractor. + https://bugs.webkit.org/show_bug.cgi?id=43276 + + Unit-test IDBKeyPathExtractorTest.cpp. + LayoutTests will arrive as IndexedDB infrastructure is fleshed out. + + * bindings/v8/IDBBindingUtilities.cpp: + (WebCore::getValueFrom): + (WebCore::createIDBKeyFromSerializedValueAndKeyPath): + * bindings/v8/IDBBindingUtilities.h: + +2010-08-13 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Kenneth Rohde Christiansen and Martin Robinson. + + [GTK] GTK+ drawing idle starved + https://bugs.webkit.org/show_bug.cgi?id=43994 + + Tune down the priority of the shared timers to guarantee GTK+ has + an opportunity to redraw. + + * platform/gtk/SharedTimerGtk.cpp: + (WebCore::setSharedTimerFireTime): + +2010-08-16 Leandro Pereira <leandro@profusion.mobi> + + [EFL] Build fix after r65366. + + EFL port does not support automated tests yet. + + * CMakeLists.txt: Use if (VAR) instead of if (${VAR}) to check if + they're empty. + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Make InjectedScript proto-based. + https://bugs.webkit.org/show_bug.cgi?id=44028 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + +2010-08-16 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Adam Roben. + + Fix warning in WebCore/plugins/win/PluginPackageWin.cpp + https://bugs.webkit.org/show_bug.cgi?id=43920 + + * plugins/win/PluginPackageWin.cpp: + (WebCore::PluginPackage::fetchInfo): + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Touch inspector file to force frontend deployment. + + * inspector/InspectorController.cpp: + +2010-08-16 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix for non-Win ports on Windows. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-08-16 Adam Langley <agl@chromium.org> + + Reviewed by Tony Chang. + + [chromium] Improve spacing support for complex text on Linux + + https://bugs.webkit.org/show_bug.cgi?id=39014 + + Previously, our complex text support ignored word-spacing, + justification and letter-spacing. This fixes the first two issues and + allows us to render Scribd's HTML5 documents much better. + + Test: fast/text/atsui-spacing-features.html + + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::TextRunWalker::TextRunWalker): + (WebCore::TextRunWalker::setWordSpacingAdjustment): + (WebCore::TextRunWalker::setLetterSpacingAdjustment): + (WebCore::TextRunWalker::setPadding): + (WebCore::TextRunWalker::setGlyphXPositions): + (WebCore::TextRunWalker::isCodepointSpace): + (WebCore::Font::drawComplexText): + (WebCore::Font::floatWidthForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + +2010-08-16 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Fix warnings: unknown conversion type character 'l' in format + https://bugs.webkit.org/show_bug.cgi?id=43359 + + * loader/icon/IconDatabase.cpp: + (WebCore::IconDatabase::performURLImport): Replace %zu with %lu, because Windows doesn't understand z modifier. + (WebCore::IconDatabase::pruneUnretainedIcons): Use %I64i intsead of %lli on Windows. + * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp: + (WebCore::MediaPlayerPrivate::totalTimeChanged): Use %I64d intsead of %lld on Windows. + * platform/sql/SQLiteDatabase.cpp: + (WebCore::SQLiteDatabase::setMaximumSize): Use %I64i intsead of %lli on Windows. + * storage/DatabaseTracker.cpp: + (WebCore::DatabaseTracker::setQuota): Use %I64u intsead of %llu on Windows. + +2010-08-16 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Fix warnings: unknown conversion type character 'l' in format + https://bugs.webkit.org/show_bug.cgi?id=43359 + + * loader/FTPDirectoryParser.cpp: Use %I64u format specifier instead of %llu on Windows. + (WebCore::parseOneFTPLine): + +2010-08-16 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Shadow blur for rectangle fill + https://bugs.webkit.org/show_bug.cgi?id=44025 + + The blur implementation follows the approximation of Gaussian blur + with three successive box blurs, working on the alpha channel only. + (see http://www.w3.org/TR/SVG/filters.html#feGaussianBlur). + + * WebCore.pro: Refer to ContexShadow.* files. + * platform/graphics/qt/ContextShadow.cpp: Added. + (WebCore::ContextShadow::ContextShadow): + (WebCore::ContextShadow::clear): + (WebCore::blurHorizontal): Box blurs in horizontal direction, working + on QImage (in-place). + (WebCore::shadowBlur): Main blur function which just calls the + above blurHorizontal function twice, once with transposed image + (equivalent as it would have done vertical box blurs). + (WebCore::ContextShadow::drawShadowRect): + * platform/graphics/qt/ContextShadow.h: Added. + (WebCore::ContextShadow::): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::hasShadow): + (WebCore::GraphicsContext::restorePlatformState): + (WebCore::GraphicsContext::fillRect): Use ContextShadow for the shadow. + (WebCore::GraphicsContext::setPlatformShadow): + +2010-08-16 Andras Becsi <abecsi@webkit.org> + + Rubber-stamped by Gustavo Noronha Silva. + + [GTK] Build fix for MathML code generation. + + No new tests needed. + + * GNUmakefile.am: + +2010-08-16 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65414. + http://trac.webkit.org/changeset/65414 + https://bugs.webkit.org/show_bug.cgi?id=44055 + + GTL & QT tests failing. (Requested by pfeldman on #webkit). + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + +2010-08-16 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Antonio Gomes. + + [Qt] Save and restore shadow state in GraphicsContextQt + https://bugs.webkit.org/show_bug.cgi?id=44031 + + This is needed after r65362. + Use a new class ContextShadowParameter to track and keep the shadow + state. We use this rather than using GraphicsContextState to allow + possible optimizations (right now only to determine the shadow type, + but in future it might cover things like cached scratch image, + persistent shader, etc). + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::ContextShadowParameter::): + (WebCore::ContextShadowParameter::ContextShadowParameter): + (WebCore::ContextShadowParameter::clear): + (WebCore::GraphicsContextPlatformPrivate::hasShadow): + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::savePlatformState): + (WebCore::GraphicsContext::restorePlatformState): + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::clearPlatformShadow): + +2010-07-28 Marcus Bulach <bulach@chromium.org> + + Reviewed by Adam Barth. + + Implement IDBKeyPath parser. + https://bugs.webkit.org/show_bug.cgi?id=42976 + + IDBKeyPath is an internal class, exposed only for unit tests for now. + It'll allow indexed database implementation to traverse a given key path and obtain the corresponding properties + from a SerializedScriptValue. + + * WebCore.gypi: + * storage/IDBKeyPath.cpp: Added. + (WebCore::IDBKeyPath::create): + (WebCore::IDBKeyPath::IDBKeyPath): + (WebCore::IDBKeyPath::~IDBKeyPath): + (WebCore::IDBKeyPath::hasNext): + (WebCore::IDBKeyPath::next): + (WebCore::IDBKeyPath::identifier): + (WebCore::IDBKeyPath::hasIndex): + (WebCore::IDBKeyPath::indexValue): + (WebCore::IDBKeyPath::parserError): + (WebCore::IDBKeyPath::parse): + (WebCore::IDBKeyPath::Lexer::lex): + (WebCore::isSafeIdentifierStartCharacter): + (WebCore::isSafeIdentifierCharacter): + (WebCore::IDBKeyPath::Lexer::lexIdentifier): + (WebCore::IDBKeyPath::Lexer::lexNumber): + * storage/IDBKeyPath.h: Added. + (WebCore::IDBKeyPath::Token::Token): + (WebCore::IDBKeyPath::): + (WebCore::IDBKeyPath::Lexer::Lexer): + (WebCore::IDBKeyPath::Lexer::next): + (WebCore::IDBKeyPath::Lexer::currentToken): + +2010-08-13 Steve Block <steveblock@google.com> + + Reviewed by Alexey Proskuryakov. + + Geolocation requests in progress when the frame is disconnected should invoke the error callback + https://bugs.webkit.org/show_bug.cgi?id=43974 + + If requests are ongoing when the Frame is disconnected, we abort them with a fatal error. + To do this, when Geolocation::disconnectFrame() is called we call cancelAllRequests() to + set a fatal error on all ongoing requests. Once the requests have made their error + callbacks, they are deleted. Note that we check at callback time that the script + execution context for the callback is still valid, so it's safe to attempt these + callbacks even after the Geolocation object's Frame has gone. + + This requires a change to allow multiple calls to GeoNotifier::setFatalError(). + For repeated calls, we do not replace the existing error. This ensures that when + permission has been denied and the frame is then disconnected, the error callback + reports the permission error, as required by the spec. + + Tests: fast/dom/Geolocation/disconnected-frame.html + fast/dom/Geolocation/disconnected-frame-permission-denied.html + + * page/Geolocation.cpp: + (WebCore::Geolocation::GeoNotifier::setFatalError): + (WebCore::Geolocation::disconnectFrame): + (WebCore::Geolocation::startRequest): + (WebCore::Geolocation::cancelAllRequests): + * page/Geolocation.h: + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: upstream frontend-side WebSocket transport. + https://bugs.webkit.org/show_bug.cgi?id=43970 + + Chromium already has an alternate WebSocket-based communication channel with + the backend. Upstreaming it in this change. We will agree on the URI + of the remote service as the protocol matures. + + * inspector/front-end/inspector.js: + (.WebInspector.socket.onmessage): + (.WebInspector.socket.onerror): + (.WebInspector.socket.onopen): + (WebInspector.loaded): + (WebInspector.doLoadedDone): + (WebInspector_syncDispatch): + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Make InjectedScript proto-based. + https://bugs.webkit.org/show_bug.cgi?id=44028 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + * inspector/front-end/inspector.js: + (WebInspector.loaded): + +2010-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: [REGRESSION] console's clear command does not work. + https://bugs.webkit.org/show_bug.cgi?id=44027 + + Test: inspector/console-command-clear.html + + * inspector/Inspector.idl: + * inspector/InspectorBackend.cpp: + * inspector/InspectorBackend.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::clearConsoleMessages): + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.requestClearMessages): + * inspector/front-end/inspector.js: + (WebInspector.consoleMessagesCleared): + +2010-08-16 Jeremy Orlow <jorlow@chromium.org> + + Ugh, the #if ENABLE() was supposed to be added to Settings not GroupSettings. + + * page/GroupSettings.cpp: + (WebCore::GroupSettings::GroupSettings): + (WebCore::GroupSettings::setLocalStorageQuotaBytes): + * page/GroupSettings.h: + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + +2010-08-16 Jeremy Orlow <jorlow@chromium.org> + + Last build fix? + + * page/PageGroup.cpp: + (WebCore::PageGroup::PageGroup): + +2010-08-16 Jeremy Orlow <jorlow@chromium.org> + + Ugh...another build fix. + + * page/GroupSettings.cpp: + (WebCore::GroupSettings::GroupSettings): + * page/GroupSettings.h: + +2010-08-16 Jeremy Orlow <jorlow@chromium.org> + + Build fix. + + * GNUmakefile.am: + +2010-08-16 Jeremy Orlow <jorlow@chromium.org> + + Build fix. + + * page/PageGroup.cpp: + (WebCore::PageGroup::localStorage): + +2010-08-13 Jeremy Orlow <jorlow@chromium.org> + + Some settings are linked to the PageGroup not the Page. Create a new class for those. + https://bugs.webkit.org/show_bug.cgi?id=43794 + + Since persistient storage is shared between pages, there's no way to modify + some settings related to it on a per page basis. As such, it's not technically + correct for these settings to be on the Page's settings. Create a new class + called GroupSettings, move group-wide local storage setting there (the other we + can't), and add a new setting for IndexedDB's path (which is prompting this change). + + No behavior has changed, so no tests. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * page/GroupSettings.cpp: Added. + (WebCore::GroupSettings::GroupSettings): + (WebCore::GroupSettings::setLocalStorageQuotaBytes): + (WebCore::GroupSettings::setLocalStorageDatabasePath): + (WebCore::GroupSettings::setIndexedDBDatabasePath): + * page/GroupSettings.h: Added. + (WebCore::GroupSettings::create): + (WebCore::GroupSettings::localStorageQuotaBytes): + (WebCore::GroupSettings::localStorageDatabasePath): + (WebCore::GroupSettings::indexedDBDatabasePath): + * page/PageGroup.cpp: + (WebCore::PageGroup::PageGroup): + (WebCore::PageGroup::localStorage): + * page/PageGroup.h: + (WebCore::PageGroup::groupSettings): + * page/Settings.cpp: + (WebCore::Settings::Settings): + (WebCore::Settings::setSessionStorageQuota): + * page/Settings.h: + +2010-08-16 Adam Barth <abarth@webkit.org> + + Reviewed by Alexey Proskuryakov. + + HTML5 fragment parsing doesn't load iframes + https://bugs.webkit.org/show_bug.cgi?id=44038 + + Previously, this code assumed that every source iframe was actually + attached to a render tree. It tried to "keep the iframe alive" as it + moved documents. However, if the iframe wasn't attached to begin with, + it was never "alive," so trying to keep a dead iframe alive lead to a + ... zombie iframe. + + Test: fast/frames/adopt-from-created-document.html + + * dom/Document.cpp: + (WebCore::Document::adoptNode): + +2010-08-13 MORITA Hajime <morrita@google.com> + + Reviewed by Tony Chang. + + https://bugs.webkit.org/show_bug.cgi?id=43778 + Dropping should fire textInput event + + This change: + - added TextEvent::m_isDrop to distinguish drop-initiated events. + - added to dispatch TextEvent from DragController before making a side effect + and cancel the side effect if the event prevents default + + Tests: editing/pasteboard/drop-text-events-sideeffect.html + editing/pasteboard/drop-text-events.html + + * dom/TextEvent.cpp: + (WebCore::TextEvent::createForDrop): Added. + (WebCore::TextEvent::TextEvent): + * dom/TextEvent.h: + (WebCore::TextEvent::isDrop): Added. + * editing/Editor.cpp: + (WebCore::Editor::handleTextEvent): + (WebCore::Editor::findEventTargetFrom): Extracted from findEventTargetFromSelection(). + (WebCore::Editor::findEventTargetFromSelection): + * editing/Editor.h: + * page/DragController.cpp: + (WebCore::DragController::dispatchTextInputEventFor): Added. + (WebCore::DragController::concludeEditDrag): Added an event dispatch path. + * page/DragController.h: + +2010-08-15 Ariya Hidayat <ariya@sencha.com> + + Unreviewed, rolling out r65393. + http://trac.webkit.org/changeset/65393 + https://bugs.webkit.org/show_bug.cgi?id=44031 + + Breaks some canvas tests. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::): + (WebCore::GraphicsContextPlatformPrivate::hasShadow): + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::savePlatformState): + (WebCore::GraphicsContext::restorePlatformState): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::clearPlatformShadow): + +2010-08-15 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Antonio Gomes. + + [Qt] Save and restore shadow state in GraphicsContextQt + https://bugs.webkit.org/show_bug.cgi?id=44031 + + This is needed after r65362. + Use a new class ContextShadowParameter to track and keep the shadow + state. We use this rather than using GraphicsContextState to allow + possible optimizations (right now only to determine the shadow type, + but in future it might cover things like cached scratch image, + persistent shader, etc). + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::ContextShadowParameter::): + (WebCore::ContextShadowParameter::ContextShadowParameter): + (WebCore::ContextShadowParameter::clear): + (WebCore::GraphicsContextPlatformPrivate::hasShadow): + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::savePlatformState): + (WebCore::GraphicsContext::restorePlatformState): + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::clearPlatformShadow): + +2010-08-15 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Antonio Gomes. + + [Qt] Border should not cast shadows + https://bugs.webkit.org/show_bug.cgi?id=44015 + + Shadows should be not casted except for brush fill (which is not what + drawLine and drawRect are supposed to do). + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): Remove shadow painting, + (WebCore::GraphicsContext::drawLine): ditto. + +2010-08-15 Ryuan Choi <ryuan.choi@samsung.com> + + Reviewed by Antonio Gomes. + + [EFL] Build error on r65378 + https://bugs.webkit.org/show_bug.cgi?id=44019 + + Change build script for HTMLEntityNames.json instead of HTMLEntityNames.gperf + + * CMakeLists.txt: + +2010-08-15 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, add missing header. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-08-15 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, don't build PluginDataNone.cpp even on GTK as PluginDataWx.cpp compiles. + + * wscript: + +2010-08-15 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + document.write() doesn't flush plain text + https://bugs.webkit.org/show_bug.cgi?id=8961 + + Originally I thought we should buffer the character tokens until we've + reached the end of the input stream, but that's not how the spec + handles things (it emits the character tokens one-by-one). + + Tests: fast/tokenizer/flush-characters-in-document-write-evil.html + fast/tokenizer/flush-characters-in-document-write.html + + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::emitEndOfFile): + (WebCore::HTMLTokenizer::nextToken): + (WebCore::HTMLTokenizer::haveBufferedCharacterToken): + - Renamed this function now that it's simplier. + * html/HTMLTokenizer.h: + +2010-08-15 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Don't try to replace a non-existent document after executing JavaScript URLs + https://bugs.webkit.org/show_bug.cgi?id=44024 + + Synchronous JavaScript execution is evil. Previously, the frame was + deleted after executing the JavaScript URL, so we'd get confused when + we tried to replace its document. + + Test: fast/frames/javascript-url-for-deleted-frame.html + + * bindings/ScriptControllerBase.cpp: + (WebCore::ScriptController::executeIfJavaScriptURL): + +2010-08-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65374. + http://trac.webkit.org/changeset/65374 + https://bugs.webkit.org/show_bug.cgi?id=44018 + + broke a myriad of svg tests (Requested by kling on #webkit). + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::strokeBoundingRect): + +2010-08-14 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + XSLTProcessor.transformToFragment should not pass contextElement to html/xml document parsers + https://bugs.webkit.org/show_bug.cgi?id=44017 + + This fixes two tests which otherwise would fail when the + HTML5 TreeBuilder is enabled for fragment parsing. + + This revealed a bug in HTMLTreeBuilder() which I fixed as well. + + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): + * xml/XSLTProcessor.cpp: + (WebCore::createFragmentFromSource): + +2010-08-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Path: Fast approximation of stroke bounding rects + https://bugs.webkit.org/show_bug.cgi?id=44014 + + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::strokeBoundingRect): Use QPainterPath::controlPointRect() + to calculate a slightly larger bounding rect in a fraction of the time. + +2010-08-14 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Move innerHTML off of Range::createContextualFragment + https://bugs.webkit.org/show_bug.cgi?id=44011 + + This makes all the editing tests stop failing under the + HTML5 TreeBuilder. + + In a previous patch Adam disabled some of the (wrong) code + in createContextualFragment when in html5 treebuilder mode. + The problem is that the editing code depends on + createContextualFragment (as well as the Range DOM API), + so we have to leave this code in until we can figure + out if it's right or wrong behavior for the Range API. + + This patch moves innerHTML/outerHTML off of using + createContextualFragment and instead calls + DocumentFragment::parseHTML directly (which is much simpler). + + I expect Adam and I will end up turning on the HTML5 TreeBuilder + in the next couple days, and most of the if branches I added + here will go away for good. + + I renamed Element::createContextualFragment to + deprecatedCreateContextualFragment, to indicate that it's a + dead API. The editing code should move off of it and consider + using DocumentFragment::parseHTML instead. + + * dom/Element.cpp: + (WebCore::Element::deprecatedCreateContextualFragment): + * dom/Element.h: + * dom/Range.cpp: + (WebCore::Range::createContextualFragment): + * editing/markup.cpp: + (WebCore::createFragmentFromMarkup): + * html/HTMLElement.cpp: + (WebCore::useLegacyTreeBuilder): + (WebCore::HTMLElement::deprecatedCreateContextualFragment): + (WebCore::HTMLElement::setInnerHTML): + (WebCore::HTMLElement::setOuterHTML): + * html/HTMLElement.h: + +2010-08-14 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Antonio Gomes. + + [Qt] Fix compilation with QT_NO_LINEEDIT + https://bugs.webkit.org/show_bug.cgi?id=38324 + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + (JSC::Bindings::convertQVariantToValue): + +2010-08-14 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Dirk Schulze. + + IE SVG empty path test fails + https://bugs.webkit.org/show_bug.cgi?id=44008 + + Change createLine to allow creating zero-length lines. This makes it possible + to have markers and line-caps applied to zero-length lines. + + Test: svg/custom/marker-empty-path.svg + + * platform/graphics/Path.cpp: + (WebCore::Path::createLine): + +2010-08-14 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Kenneth Rohde Christiansen. + + [CMake] Move SQL files into a IF (ENABLE_DATABASE) section + https://bugs.webkit.org/show_bug.cgi?id=43979 + + * CMakeLists.txt: + +2010-08-14 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Kenneth Rohde Christiansen. + + Canvas is not reset when setting canvas.width + https://bugs.webkit.org/show_bug.cgi?id=43341 + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::reset): Moved the call to + hasCreatedImageBuffer up *before* the call to setSurface since setSurface + sets hasCreatedImageBuffer to false every time. + +2010-08-14 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Kenneth Rohde Christiansen. + + [CMake] Set target properties only if available + https://bugs.webkit.org/show_bug.cgi?id=43978 + + * CMakeLists.txt: + +2010-08-14 Dirk Schulze <krit@webkit.org> + + Unreviewed sort of Xcode project file. + + * WebCore.xcodeproj/project.pbxproj: + +2010-08-14 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Simon Hausmann and Kenneth Rohde Christiansen. + + [Qt] Refactor shadow state handling in GraphicsContextQt + https://bugs.webkit.org/show_bug.cgi?id=44006 + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::): Added shadow states as + member variables. + (WebCore::GraphicsContextPlatformPrivate::hasShadow): Convenient + function to check whether there is shadow or not. + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::drawRect): Use shadow states instead of + calling getShadow. + (WebCore::GraphicsContext::drawLine): ditto. + (WebCore::GraphicsContext::strokeArc): ditto. + (WebCore::GraphicsContext::drawConvexPolygon): ditto. + (WebCore::GraphicsContext::fillPath): ditto. + (WebCore::GraphicsContext::strokePath): ditto. + (WebCore::GraphicsContext::fillRect): Removes the use of helper function + drawBorderlessRectShadow as the code already becomes a lot simpler. + (WebCore::GraphicsContext::fillRoundedRect): Removes the use of helper + function drawFilledShadowPath as the code already becomes a lot simpler. + (WebCore::GraphicsContext::setPlatformShadow): Store shadow states + and find out the shadow type (complexity) for future use. + (WebCore::GraphicsContext::clearPlatformShadow): Reset shadow states. + +2010-08-13 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename some concepts in HTML entity search to be more self-documenting + https://bugs.webkit.org/show_bug.cgi?id=44004 + + Start and end are now first and last, which lets us use some better + names for the statics in HTMLEntityTable. + + * html/HTMLEntityParser.cpp: + (WebCore::consumeHTMLEntity): + * html/HTMLEntitySearch.cpp: + (WebCore::HTMLEntitySearch::HTMLEntitySearch): + (WebCore::HTMLEntitySearch::findFirst): + (WebCore::HTMLEntitySearch::findLast): + (WebCore::HTMLEntitySearch::advance): + * html/HTMLEntitySearch.h: + (WebCore::HTMLEntitySearch::isEntityPrefix): + (WebCore::HTMLEntitySearch::mostRecentMatch): + (WebCore::HTMLEntitySearch::fail): + * html/HTMLEntityTable.h: + +2010-08-13 Adam Barth <abarth@webkit.org> + + Fix ASSERT in XML entity parsing. You can't advance the entity search + if you've already discovered that your string is not an entity. + + * html/HTMLEntityParser.cpp: + (WebCore::decodeNamedEntity): + +2010-08-13 Eric Seidel <eric@webkit.org> + + Unreviewed. Attempt at fixing Chromium build. + + Add support for MathML entities + https://bugs.webkit.org/show_bug.cgi?id=43949 + + * WebCore.gyp/WebCore.gyp: + - I have no clue if this is right or not. + +2010-08-13 Eric Seidel <eric@webkit.org> + + Unreviewed. Attempted build fix for Windows. + + Add support for MathML entities + https://bugs.webkit.org/show_bug.cgi?id=43949 + + * DerivedSources.cpp: + - Add HTMLEntityTable.cpp + +2010-08-09 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Add support for MathML entities + https://bugs.webkit.org/show_bug.cgi?id=43949 + + Implementing the HTML5 entity parsing algorithm require refactoring how + we search for entity names. Instead of using a perfect hash, we now + use a sorted list. As we advance through the input, we walk down a + binary search of the table looking for an entity. + + Using this data structure lets us keep track of whether the current + string is a prefix of an existing entity, which we need for the + algorithm. In a future patch, I plan to add some indices to the + table, which should let us narrow down the range of interesting entries + more quickly. + + The one nasty piece of the algorithm is if we walk too far down the + input and we need to back up to a previous match. In this patch, we + accomplish this by rewinding the input and consuming a known number of + characters to resync the source. + + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLEntityParser.cpp: + (WebCore::consumeHTMLEntity): + * html/HTMLEntitySearch.cpp: Added. + (WebCore::): + (WebCore::HTMLEntitySearch::HTMLEntitySearch): + (WebCore::HTMLEntitySearch::compare): + (WebCore::HTMLEntitySearch::findStart): + (WebCore::HTMLEntitySearch::findEnd): + (WebCore::HTMLEntitySearch::advance): + * html/HTMLEntitySearch.h: Added. + (WebCore::HTMLEntitySearch::isEntityPrefix): + (WebCore::HTMLEntitySearch::currentValue): + (WebCore::HTMLEntitySearch::lastMatch): + (WebCore::HTMLEntitySearch::): + (WebCore::HTMLEntitySearch::fail): + * html/HTMLEntityTable.h: Added. + (WebCore::HTMLEntityTableEntry::lastCharacter): + +2010-08-13 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Eric Seidel. + + Refactor HTMLScriptRunner to allow deferred scripts to share code + https://bugs.webkit.org/show_bug.cgi?id=43736 + + No new tests because no functional change + + * html/HTMLScriptRunner.cpp: + (WebCore::HTMLScriptRunner::sourceFromPendingScript): Make const to enforce the idea that it doesn't change m_parsingBlockingScript. + (WebCore::HTMLScriptRunner::executeParsingBlockingScript): Rename to make it clear this deals with the parsing blocking script and refactor to use executePendingScriptAndDispatchEvent. + (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Factored out of executePendingScript, this can be used for executing any external script. + (WebCore::HTMLScriptRunner::executeScript): This can be used for executing any inline or external script. ASSERTs moved to the two calling points. + (WebCore::HTMLScriptRunner::executeParsingBlockingScripts): Moved method. + (WebCore::HTMLScriptRunner::requestParsingBlockingScript): Factored out requestPendingScript. + (WebCore::HTMLScriptRunner::requestPendingScript): Factored out from reqeustParsingBlockingScript. + (WebCore::HTMLScriptRunner::runScript): + * html/HTMLScriptRunner.h: + +2010-08-13 Gavin Barraclough <barraclough@apple.com> + + Windows build fix. + + * WebCore.xcodeproj/project.pbxproj: + * platform/win/SharedBufferWin.cpp: + +2010-08-13 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + Switch String::/UString::ascii() to return a CString. + + * WebCore.xcodeproj/project.pbxproj: + * bridge/c/c_class.cpp: + (JSC::Bindings::CClass::methodsNamed): + (JSC::Bindings::CClass::fieldNamed): + * bridge/jni/jsc/JNIBridgeJSC.cpp: + (JavaField::valueFromInstance): + (JavaField::setValueToInstance): + * bridge/jni/jsc/JavaInstanceJSC.cpp: + (JavaInstance::invokeMethod): + * bridge/objc/objc_class.mm: + (JSC::Bindings::ObjcClass::methodsNamed): + (JSC::Bindings::ObjcClass::fieldNamed): + * bridge/objc/objc_instance.mm: + (ObjcInstance::setValueOfUndefinedField): + (ObjcInstance::getValueOfUndefinedField): + * loader/icon/IconRecord.cpp: + * platform/sql/SQLiteDatabase.cpp: + * platform/sql/SQLiteStatement.cpp: + * storage/SQLStatement.cpp: + +2010-08-13 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Dimitri Glazkov. + + Session history should skip over JS redirects + https://bugs.webkit.org/show_bug.cgi?id=42861 + + Lock the back/forward list for location changes and form submits that + happen before the onload event fires that are not the result of user + gestures. + + Made form submission (at the ScheduledFormSubmission level) more similar + to ScheduledURLNavigation by having it call clientRedirected too, fixing + a long-standing FIXME. + + Test: fast/history/gesture-before-onload-location-href.html, + fast/history/gesture-before-onload-form-submit.html and updated + expectations for http/tests/history tests that used to fail. + + * loader/FormSubmission.cpp: + (WebCore::FormSubmission::requestURL): + (WebCore::FormSubmission::populateFrameLoadRequest): + * loader/FormSubmission.h: + * loader/RedirectScheduler.cpp: + (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): + (WebCore::ScheduledFormSubmission::fire): + (WebCore::ScheduledFormSubmission::didStartTimer): + (WebCore::ScheduledFormSubmission::didStopTimer): + (WebCore::RedirectScheduler::scheduleRedirect): + (WebCore::RedirectScheduler::mustLockBackForwardList): + (WebCore::RedirectScheduler::scheduleLocationChange): + (WebCore::RedirectScheduler::scheduleFormSubmission): + * loader/RedirectScheduler.h: + +2010-08-13 Leandro Pereira <leandro@profusion.mobi> + + [EFL] Unreviewed build fix. + These changes were supposed to be landed on r65319, but due to some + svn-apply/commit-queue bug it wasn't fully applied. A bug was filed + by Patrick Gansterer (author of the changes in this commit): + https://bugs.webkit.org/show_bug.cgi?id=43981 + + * CMakeLists.txt: Update calls to GENERATE_GPERF and + GENERATE_GRAMMAR macros. + +2010-08-13 Chris Fleizach <cfleizach@apple.com> + + AX: isNativeCheckbox does not work as advertised + https://bugs.webkit.org/show_bug.cgi?id=43872 + + Re-adding this patch after it was erroneously rolled out. + + Test: platform/mac/accessibility/native-vs-nonnative-checkboxes.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::isInputImage): + (WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio): + * dom/InputElement.h: + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::isCheckbox): + +2010-08-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65331. + http://trac.webkit.org/changeset/65331 + https://bugs.webkit.org/show_bug.cgi?id=43980 + + This patch breaks some shadow tests on Qt Linux release + (Requested by ariya on #webkit). + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::drawFilledShadowPath): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::drawBorderlessRectShadow): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::clearPlatformShadow): + +2010-08-13 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by David Levin. + + Update run-bindings-tests expectations + https://bugs.webkit.org/show_bug.cgi?id=43944 + + The results have become out of sync after changeset 64552 and 65269. + + Test: WebKitTools/Scripts/run-bindings-tests + + * 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/WebKitDOMTestCallback.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_void_method_with_args): + (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_idb_key): + (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_obj): + (webkit_dom_test_obj_with_script_state_obj_exception): + (webkit_dom_test_obj_get_read_only_string_attr): + (webkit_dom_test_obj_get_read_only_test_obj_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_xml_obj_attr): + (webkit_dom_test_obj_set_xml_obj_attr): + (webkit_dom_test_obj_get_reflected_string_attr): + (webkit_dom_test_obj_set_reflected_string_attr): + (webkit_dom_test_obj_get_reflected_url_attr): + (webkit_dom_test_obj_set_reflected_url_attr): + (webkit_dom_test_obj_get_reflected_non_empty_url_attr): + (webkit_dom_test_obj_set_reflected_non_empty_url_attr): + (webkit_dom_test_obj_get_reflected_custom_url_attr): + (webkit_dom_test_obj_set_reflected_custom_url_attr): + (webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr): + (webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr): + (webkit_dom_test_obj_get_string_attr_with_getter_exception): + (webkit_dom_test_obj_set_string_attr_with_getter_exception): + (webkit_dom_test_obj_get_string_attr_with_setter_exception): + (webkit_dom_test_obj_set_string_attr_with_setter_exception): + (webkit_dom_test_obj_get_script_string_attr): + (webkit_dom_test_obj_get_hash): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): + +2010-08-13 Ariya Hidayat <ariya@sencha.com> + + Reviewed by Simon Hausmann. + + [Qt] Canvas and CSS: blur option in shadow not working + https://bugs.webkit.org/show_bug.cgi?id=34479 + + Patch 1: Refactor shadow states handling. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContextPlatformPrivate::): Added shadow states as + member variables. + (WebCore::GraphicsContextPlatformPrivate::hasShadow): Convenient + function to check whether there is shadow or not. + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::drawRect): Use shadow states instead of + calling getShadow. + (WebCore::GraphicsContext::drawLine): ditto. + (WebCore::GraphicsContext::strokeArc): ditto. + (WebCore::GraphicsContext::drawConvexPolygon): ditto. + (WebCore::GraphicsContext::fillPath): ditto. + (WebCore::GraphicsContext::strokePath): ditto. + (WebCore::GraphicsContext::fillRect): Removes the use of helper function + drawBorderlessRectShadow as the code already becomes a lot simpler. + (WebCore::GraphicsContext::fillRoundedRect): Removes the use of helper + function drawFilledShadowPath as the code already becomes a lot simpler. + (WebCore::GraphicsContext::setPlatformShadow): Store shadow states + and find out the shadow type (complexity) for future use. + (WebCore::GraphicsContext::clearPlatformShadow): Reset shadow states. + +2010-08-11 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + Regression in linking of programs + https://bugs.webkit.org/show_bug.cgi?id=43820 + + Shaders and programs shouldn't be deleted until their attachments are removed, therefore, we need to track the attach/detach/useProgram. + + * html/canvas/WebGLObject.cpp: Track the object attachment count and whether it should really be deleted. + (WebCore::WebGLObject::WebGLObject): + (WebCore::WebGLObject::setObject): + (WebCore::WebGLObject::deleteObject): + * html/canvas/WebGLObject.h: Track the object attachment count and whether it should really be deleted. + (WebCore::WebGLObject::onAttached): + (WebCore::WebGLObject::onDetached): + (WebCore::WebGLObject::getAttachmentCount): + * html/canvas/WebGLProgram.cpp: Track the attached shaders. + (WebCore::WebGLProgram::WebGLProgram): + (WebCore::WebGLProgram::deleteObjectImpl): + (WebCore::WebGLProgram::getAttachedShader): + (WebCore::WebGLProgram::attachShader): + (WebCore::WebGLProgram::detachShader): + * html/canvas/WebGLProgram.h: Track the attached shaders. + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::attachShader): Track the attachment of a shader to a program. + (WebCore::WebGLRenderingContext::deleteProgram): Detach shaders. + (WebCore::WebGLRenderingContext::detachShader): Track the attachment of a shader to a program. + (WebCore::WebGLRenderingContext::validateWebGLObject): Also check if object == 0. + (WebCore::WebGLRenderingContext::linkProgram): Using the cached attached shaders instead of query from driver. + (WebCore::WebGLRenderingContext::useProgram): Track the attachment of a program to the current rendering pipeline. + +2010-08-13 Steve Block <steveblock@google.com> + + Reviewed by Alexey Proskuryakov. + + Geolocation activity started after frame has been disconnected can cause crash + https://bugs.webkit.org/show_bug.cgi?id=39879 + + New requests started after the Frame has been disconnected are ignored. We do + not invoke the error callback as this would allow buggy or malicious pages to + hose the CPU. Such a page could hold a reference to a Geolocation object from + a since closed Page and register new requests from the error callback to + create an infinite loop. + + Tests: fast/dom/Geolocation/disconnected-frame-already.html + + * page/Geolocation.cpp: + +2010-08-13 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Support for multiple speech enabled elements in same page. + https://bugs.webkit.org/show_bug.cgi?id=43922 + + * page/SpeechInput.cpp: Generates request ids as necessary when each speech enabled input element gets + created/destroyed and multiplexes the listener callbacks to the appropriate input element based on the request id. + (WebCore::SpeechInput::SpeechInput): + (WebCore::SpeechInput::~SpeechInput): + (WebCore::SpeechInput::registerListener): + (WebCore::SpeechInput::unregisterListener): + (WebCore::SpeechInput::didCompleteRecording): + (WebCore::SpeechInput::didCompleteRecognition): + (WebCore::SpeechInput::setRecognitionResult): + (WebCore::SpeechInput::startRecognition): + (WebCore::SpeechInput::stopRecording): + (WebCore::SpeechInput::cancelRecognition): + * page/SpeechInput.h: + * page/SpeechInputClient.h: Now requires a one time set for the WebCore::SpeechInputListener and + takes in a 'requestId' for all calls. + * page/SpeechInputListener.h: Now returns the above mentioned requestId in all the listener callbacks for + identifying which input element the event goes to. + * platform/mock/SpeechInputClientMock.cpp: + (WebCore::SpeechInputClientMock::SpeechInputClientMock): + (WebCore::SpeechInputClientMock::setListener): + (WebCore::SpeechInputClientMock::startRecognition): + (WebCore::SpeechInputClientMock::stopRecording): + (WebCore::SpeechInputClientMock::cancelRecognition): + (WebCore::SpeechInputClientMock::timerFired): + * platform/mock/SpeechInputClientMock.h: + * rendering/TextControlInnerElements.cpp: + (WebCore::InputFieldSpeechButtonElement::InputFieldSpeechButtonElement): + (WebCore::InputFieldSpeechButtonElement::~InputFieldSpeechButtonElement): + (WebCore::InputFieldSpeechButtonElement::defaultEventHandler): + (WebCore::InputFieldSpeechButtonElement::speechInput): + (WebCore::InputFieldSpeechButtonElement::didCompleteRecording): + (WebCore::InputFieldSpeechButtonElement::didCompleteRecognition): + (WebCore::InputFieldSpeechButtonElement::setRecognitionResult): + * rendering/TextControlInnerElements.h: + +2010-08-13 Eric Carlson <eric.carlson@apple.com> + + Reviewed by David Kilzer. + + HTMLMediaElement::prepareForLoad should cancel current plug-in proxy media player + https://bugs.webkit.org/show_bug.cgi?id=43923 + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::prepareForLoad): Tell mediaPlayer to cancel the current load + if it already exists. + +2010-08-12 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + [CHROMIUM] Use the BGRA format for canvas 2D accel upload and readbacks. + https://bugs.webkit.org/show_bug.cgi?id=43804 + + Use the BGRA format from GraphicsContext3D, if supported. Also keep a + texture around for uploads, rather than re-creating it each time. + + Covered by many layout tests (once we're running them). + + * platform/graphics/chromium/GLES2Texture.cpp: + (WebCore::convertFormat): + Move convertFormat() ahead of texture creation, so we can check for + BGRA support. + (WebCore::GLES2Texture::create): + Use convertFormat() to determine the correct format and types to use; + use the returned format also for internalFormat, since GLES2 insists + they match. + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::setGraphicsContext3D): + Clear the upload texture when a new context is set. + (WebCore::PlatformContextSkia::uploadSoftwareToHardware): + Use m_uploadTexture instead of creating a new one each time. + (WebCore::PlatformContextSkia::readbackHardwareToSoftware): + When the context supports it, use the BGRA format for readbacks + instead of swizzling. + * platform/graphics/skia/PlatformContextSkia.h: + Add m_uploadTexture for consecutive uploads. + +2010-08-13 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Clean up mobile feature useage + https://bugs.webkit.org/show_bug.cgi?id=43968 + + * WebCore.pro: Replaced use of Nokia specific platform scopes with concrete + feature names. + +2010-08-13 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: rename InspectorValue::push and set to + push{Value|Object|Array} and set{...}. + https://bugs.webkit.org/show_bug.cgi?id=43966 + + * bindings/js/ScriptProfile.cpp: + (WebCore::buildInspectorObjectFor): + * bindings/js/ScriptValue.cpp: + (WebCore::jsToInspectorValue): + * bindings/v8/ScriptCallStack.cpp: + (WebCore::ScriptCallStack::stackTrace): + * bindings/v8/ScriptProfile.cpp: + (WebCore::buildInspectorObjectFor): + * bindings/v8/ScriptValue.cpp: + (WebCore::v8ToInspectorValue): + * inspector/CodeGeneratorInspector.pm: + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::addToFrontend): + * inspector/Inspector.idl: + * inspector/InspectorApplicationCacheAgent.cpp: + (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache): + (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::buildArrayForCookies): + (WebCore::InspectorController::getDOMStorageEntries): + (WebCore::InspectorController::getProfileHeaders): + (WebCore::InspectorController::getProfile): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::getEventListenersForNode): + (WebCore::InspectorDOMAgent::buildObjectForNode): + (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): + (WebCore::InspectorDOMAgent::getStyles): + (WebCore::InspectorDOMAgent::getAllStyles): + (WebCore::InspectorDOMAgent::getRuleRanges): + (WebCore::InspectorDOMAgent::buildObjectForAttributeStyles): + (WebCore::InspectorDOMAgent::buildArrayForCSSRules): + (WebCore::InspectorDOMAgent::buildArrayForPseudoElements): + (WebCore::InspectorDOMAgent::buildObjectForStyle): + (WebCore::InspectorDOMAgent::populateObjectWithStyleProperties): + (WebCore::InspectorDOMAgent::buildArrayForDisabledStyleProperties): + (WebCore::InspectorDOMAgent::buildObjectForStyleSheet): + (WebCore::InspectorDOMAgent::buildObjectForRule): + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::saveBreakpoints): + * inspector/InspectorResource.cpp: + (WebCore::InspectorResource::updateScriptObject): + * inspector/InspectorStorageAgent.cpp: + (WebCore::): + (WebCore::InspectorStorageAgent::executeSQL): + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::pushGCEventRecords): + (WebCore::InspectorTimelineAgent::didInstallTimer): + (WebCore::InspectorTimelineAgent::didRemoveTimer): + (WebCore::InspectorTimelineAgent::didScheduleResourceRequest): + (WebCore::InspectorTimelineAgent::willSendResourceRequest): + (WebCore::InspectorTimelineAgent::didFinishLoadingResource): + (WebCore::InspectorTimelineAgent::didMarkTimeline): + (WebCore::InspectorTimelineAgent::addRecordToTimeline): + (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): + * inspector/InspectorValues.cpp: + (WebCore::): + (WebCore::InspectorValue::asValue): + (WebCore::InspectorValue::asObject): + (WebCore::InspectorValue::asArray): + (WebCore::InspectorObject::asObject): + (WebCore::InspectorArray::asArray): + * inspector/InspectorValues.h: + (WebCore::InspectorObject::setBool): + (WebCore::InspectorObject::setNumber): + (WebCore::InspectorObject::setString): + (WebCore::InspectorObject::setValue): + (WebCore::InspectorObject::setObject): + (WebCore::InspectorObject::setArray): + (WebCore::InspectorArray::pushValue): + (WebCore::InspectorArray::pushObject): + (WebCore::InspectorArray::pushArray): + * inspector/ScriptBreakpoint.cpp: + (WebCore::ScriptBreakpoint::inspectorObjectFromSourceBreakpoints): + * inspector/TimelineRecordFactory.cpp: + (WebCore::TimelineRecordFactory::createGenericRecord): + +2010-08-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65204. + http://trac.webkit.org/changeset/65204 + https://bugs.webkit.org/show_bug.cgi?id=43965 + + Caused a lot of test crashes in Chromium (Requested by yutak + on #webkit). + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::isInputImage): + (WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio): + * dom/InputElement.h: + * html/HTMLInputElement.h: + +2010-08-13 Anton Muhin <antonm@chromium.org> + + Reviewed by Nate Chapin. + + Reapplying http://trac.webkit.org/changeset/65284 after fixed include. + + [v8] Create callbacks for named access of elements from document object on fly. + https://bugs.webkit.org/show_bug.cgi?id=43725 + + That should speed up access to methods on document as there is no need to + consult with interceptor before invoking the method. + + This reapplies http://trac.webkit.org/changeset/60670 reverted with + http://trac.webkit.org/changeset/63845. The main difference is in treatment + of removed named elements: we don't remove an accessor any more, but leave it. + Therefore any accessor should be able to treat the case when there is no + expando property. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::namedItemAdded): + (WebCore::ScriptController::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::checkDocumentWrapper): + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + (WebCore::getter): + (WebCore::V8DOMWindowShell::namedItemAdded): + (WebCore::V8DOMWindowShell::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.h: + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::WrapInShadowObject): + (WebCore::V8HTMLDocument::GetNamedProperty): + (WebCore::V8HTMLDocument::allAccessorSetter): + (WebCore::toV8): + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::removeItemFromMap): + +2010-08-13 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: remove openInInspectorWindow and evaluateAndStringify from InjectedScript. + https://bugs.webkit.org/show_bug.cgi?id=43854 + + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::openInInspectedWindow): + * inspector/InspectorController.h: + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage.callback): + (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/InjectedScriptAccess.js: + * inspector/front-end/InspectorBackendStub.js: + (WebInspector.InspectorBackendStub): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourceSidebarTreeElement.prototype.ondblclick): + +2010-08-13 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + flaky websocket/tests/frame-length-overflow.html + https://bugs.webkit.org/show_bug.cgi?id=43902 + + Add m_shouldDiscardReceivedData flag to indicate it will no longer + receive data from network. + + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::WebSocketChannel): + (WebCore::WebSocketChannel::didReceiveData): + (WebCore::WebSocketChannel::didFail): + (WebCore::WebSocketChannel::processBuffer): + - when frame length overflows, we couldn't process data any more. + clear buffer and mark m_shouldDiscardReceivedData true to make sure + it doesn't process the same buffer again. + * websockets/WebSocketChannel.h: + +2010-08-13 Dirk Schulze <krit@webkit.org> + + Reviewed by Nikolas Zimmermann. + + Use SVGPathByteStream to animate SVGPath + https://bugs.webkit.org/show_bug.cgi?id=43929 + + Use SVGPathByteStream to perform animations of Paths. SVGPathBlender blends + the starting point to the end point according to the current progress value. + Cleanup SVGPathSegList, by removing the unnecessary legacy blending code. + + No new tests because no functional changes. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * svg/SVGAllInOne.cpp: + * svg/SVGAnimateElement.cpp: + (WebCore::SVGAnimateElement::SVGAnimateElement): + (WebCore::SVGAnimateElement::calculateAnimatedValue): + (WebCore::SVGAnimateElement::calculateFromAndToValues): + (WebCore::SVGAnimateElement::resetToBaseValue): + (WebCore::SVGAnimateElement::applyResultsToTarget): + * svg/SVGAnimateElement.h: + * svg/SVGPathBlender.cpp: Added. + (WebCore::SVGPathBlender::SVGPathBlender): + (WebCore::SVGPathBlender::~SVGPathBlender): + (WebCore::SVGPathBlender::blendAnimatedFloat): + (WebCore::SVGPathBlender::blendAnimatedFloatPoint): + (WebCore::SVGPathBlender::blendMoveToSegment): + (WebCore::SVGPathBlender::blendLineToSegment): + (WebCore::SVGPathBlender::blendLineToHorizontalSegment): + (WebCore::SVGPathBlender::blendLineToVerticalSegment): + (WebCore::SVGPathBlender::blendCurveToCubicSegment): + (WebCore::SVGPathBlender::blendCurveToCubicSmoothSegment): + (WebCore::SVGPathBlender::blendCurveToQuadraticSegment): + (WebCore::SVGPathBlender::blendCurveToQuadraticSmoothSegment): + (WebCore::SVGPathBlender::blendArcToSegment): + (WebCore::SVGPathBlender::blendAnimatedPath): + (WebCore::SVGPathBlender::cleanup): + * svg/SVGPathBlender.h: Added. + * svg/SVGPathParserFactory.cpp: + (WebCore::globalSVGPathBlender): + (WebCore::SVGPathParserFactory::buildAnimatedSVGPathByteStream): + * svg/SVGPathParserFactory.h: + * svg/SVGPathSegList.cpp: + (WebCore::SVGPathSegList::getPathSegAtLength): + * svg/SVGPathSegList.h: + (WebCore::SVGPathSegList::create): + * svg/SVGPointList.cpp: + (WebCore::adjustAnimatedValue): + +2010-08-12 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Window size changes + resources on absolute sized content leads to pixelation + https://bugs.webkit.org/show_bug.cgi?id=43921 + + Avoid pixelation when using resources on absolute sized objects. Be sure to invalidate the used resources if window size changes. + Otherwhise masks etc. will be scaled up and pixelate. As nice side-effect, this fixes run-webkit-tests --singly svg/W3C-SVG-1.1, which + used to produce wrong results for the gradient tests, as the window size change from 800x600 for 480x360 (svg/W3C-SVG-1.1 specific DRT quirk) + didn't invalidate the resources. + + Renamed invalidateClient -> removeClientFromCache and invalidateClients -> removeAllClientsFromCache. + Add a boolean "markForInvalidation" parameter, that controls wheter the clients should be marked for repaint/boundaries invalidation/layout + or wheter we only want to notify the parents that the resource changed, to avoid doing unncessary work in SVGRenderSupport::layoutChildren. + + Test: svg/custom/absolute-sized-content-with-resources.xhtml + + * rendering/RenderSVGGradientStop.cpp: + (WebCore::RenderSVGGradientStop::styleDidChange): Don't do anything for StyleDifferenceEqual. + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::imageChanged): + * rendering/RenderSVGResource.cpp: + (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): + * rendering/RenderSVGResource.h: + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::removeAllClientsFromCache): + (WebCore::RenderSVGResourceClipper::removeClientFromCache): + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceContainer.cpp: + (WebCore::RenderSVGResourceContainer::layout): + (WebCore::RenderSVGResourceContainer::idChanged): + (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation): + (WebCore::RenderSVGResourceContainer::markClientForInvalidation): + * rendering/RenderSVGResourceContainer.h: + (WebCore::RenderSVGResourceContainer::): + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::removeAllClientsFromCache): + (WebCore::RenderSVGResourceFilter::removeClientFromCache): + (WebCore::RenderSVGResourceFilter::postApplyResource): + * rendering/RenderSVGResourceFilter.h: + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::RenderSVGResourceGradient::removeAllClientsFromCache): + (WebCore::RenderSVGResourceGradient::removeClientFromCache): + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourceGradient.h: + * rendering/RenderSVGResourceMarker.cpp: + (WebCore::RenderSVGResourceMarker::layout): + (WebCore::RenderSVGResourceMarker::removeAllClientsFromCache): + (WebCore::RenderSVGResourceMarker::removeClientFromCache): + * rendering/RenderSVGResourceMarker.h: + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::removeAllClientsFromCache): + (WebCore::RenderSVGResourceMasker::removeClientFromCache): + * rendering/RenderSVGResourceMasker.h: + * rendering/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::removeAllClientsFromCache): + (WebCore::RenderSVGResourcePattern::removeClientFromCache): + (WebCore::RenderSVGResourcePattern::applyResource): + * rendering/RenderSVGResourcePattern.h: + * rendering/RenderSVGResourceSolidColor.h: + (WebCore::RenderSVGResourceSolidColor::removeAllClientsFromCache): + (WebCore::RenderSVGResourceSolidColor::removeClientFromCache): + * rendering/SVGRenderSupport.cpp: + (WebCore::invalidateResourcesOfChildren): Add new helper funtion recursively invalidating resources of a sub render tree. + (WebCore::SVGRenderSupport::layoutChildren): Keep track of all objects that didn't need layout, as we still have to invalidate their resources, if window size changes. + * rendering/SVGResources.cpp: + (WebCore::SVGResources::removeClientFromCache): + (WebCore::SVGResources::resourceDestroyed): + * rendering/SVGResources.h: + * rendering/SVGResourcesCache.cpp: + (WebCore::SVGResourcesCache::clientLayoutChanged): + +2010-08-13 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Chromium DevTools: [CRASH] Autocomplete on arrays causes crashes. + https://bugs.webkit.org/show_bug.cgi?id=43955 + + * bindings/v8/ScriptValue.cpp: + (WebCore::v8ToInspectorValue): + +2010-08-13 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Unify UString::UTF8String() & String::utf8() methods, + remove UString::cost() & make atArrayIndex a free function. + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::getOwnPropertySlot): + (WebCore::JSDOMWindow::getOwnPropertyDescriptor): + * bridge/NP_jsobject.cpp: + (_NPN_Enumerate): + * bridge/c/c_utility.cpp: + (JSC::Bindings::convertValueToNPVariant): + * bridge/jni/JNIBridge.cpp: + (JavaParameter::JavaParameter): + (JavaMethod::JavaMethod): + (JavaMethod::signature): + (JavaMethod::methodID): + * bridge/jni/JNIBridge.h: + (JSC::Bindings::JavaString::utf8): + (JSC::Bindings::JavaParameter::type): + (JSC::Bindings::JavaMethod::returnType): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::call): + (JavaJSObject::eval): + (JavaJSObject::getMember): + (JavaJSObject::setMember): + (JavaJSObject::removeMember): + (JavaJSObject::convertJObjectToValue): + * bridge/jni/jsc/JNIBridgeJSC.cpp: + (JavaField::JavaField): + (JavaField::valueFromInstance): + (JavaField::setValueToInstance): + * bridge/jni/jsc/JNIBridgeJSC.h: + (JSC::Bindings::JavaField::type): + * bridge/jni/jsc/JavaInstanceJSC.cpp: + (JavaInstance::invokeMethod): + * bridge/jni/jsc/JavaStringJSC.h: + (JSC::Bindings::JavaStringImpl::utf8): + * bridge/runtime_array.cpp: + (JSC::RuntimeArray::getOwnPropertySlot): + (JSC::RuntimeArray::getOwnPropertyDescriptor): + (JSC::RuntimeArray::put): + +2010-08-12 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: allow interrupting long running JS to execute inspector command + https://bugs.webkit.org/show_bug.cgi?id=43900 + + * bindings/v8/ScriptDebugServer.cpp: + (WebCore::): + (WebCore::ScriptDebugServer::pause): + (WebCore::ScriptDebugServer::interruptAndRun): + (WebCore::ScriptDebugServer::runPendingTasks): + (WebCore::ScriptDebugServer::handleV8DebugEvent): + * bindings/v8/ScriptDebugServer.h: + (WebCore::ScriptDebugServer::Task::~Task): + +2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65295. + http://trac.webkit.org/changeset/65295 + https://bugs.webkit.org/show_bug.cgi?id=43950 + + It broke 4 sputnik tests (Requested by Ossy on #webkit). + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::getOwnPropertySlot): + (WebCore::JSDOMWindow::getOwnPropertyDescriptor): + * bridge/NP_jsobject.cpp: + (_NPN_Enumerate): + * bridge/c/c_utility.cpp: + (JSC::Bindings::convertValueToNPVariant): + * bridge/jni/JNIBridge.cpp: + (JavaParameter::JavaParameter): + (JavaMethod::JavaMethod): + (JavaMethod::signature): + (JavaMethod::methodID): + * bridge/jni/JNIBridge.h: + (JSC::Bindings::JavaString::UTF8String): + (JSC::Bindings::JavaParameter::type): + (JSC::Bindings::JavaMethod::returnType): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::call): + (JavaJSObject::eval): + (JavaJSObject::getMember): + (JavaJSObject::setMember): + (JavaJSObject::removeMember): + (JavaJSObject::convertJObjectToValue): + * bridge/jni/jsc/JNIBridgeJSC.cpp: + (JavaField::JavaField): + (JavaField::valueFromInstance): + (JavaField::setValueToInstance): + * bridge/jni/jsc/JNIBridgeJSC.h: + (JSC::Bindings::JavaField::type): + * bridge/jni/jsc/JavaInstanceJSC.cpp: + (JavaInstance::invokeMethod): + * bridge/jni/jsc/JavaStringJSC.h: + (JSC::Bindings::JavaStringImpl::UTF8String): + * bridge/runtime_array.cpp: + (JSC::RuntimeArray::getOwnPropertySlot): + (JSC::RuntimeArray::getOwnPropertyDescriptor): + (JSC::RuntimeArray::put): + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Fixed typo in inspector js. + Follow up to r65300. + + * inspector/front-end/inspector.js: + (WebInspector.log.isLogAvailable): + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: Make getPrototypes return objects, not names. + https://bugs.webkit.org/show_bug.cgi?id=43934 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + * inspector/front-end/inspector.js: + (WebInspector.log): + +2010-08-12 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r65284 and r65288. Broke chromium compile. + https://bugs.webkit.org/show_bug.cgi?id=43725 + http://trac.webkit.org/changeset/65284 + http://trac.webkit.org/changeset/65288 + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::namedItemAdded): + (WebCore::ScriptController::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + * bindings/v8/V8DOMWindowShell.h: + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::namedPropertyDeleter): + (WebCore::V8HTMLDocument::namedPropertyGetter): + (WebCore::V8HTMLDocument::indexedPropertyGetter): + (WebCore::V8HTMLDocument::allAccessorSetter): + (WebCore::toV8): + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::removeItemFromMap): + +2010-08-12 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Unify UString::UTF8String() & String::utf8() methods, + remove UString::cost() & make atArrayIndex a free function. + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::getOwnPropertySlot): + (WebCore::JSDOMWindow::getOwnPropertyDescriptor): + * bridge/NP_jsobject.cpp: + (_NPN_Enumerate): + * bridge/c/c_utility.cpp: + (JSC::Bindings::convertValueToNPVariant): + * bridge/jni/JNIBridge.cpp: + (JavaParameter::JavaParameter): + (JavaMethod::JavaMethod): + (JavaMethod::signature): + (JavaMethod::methodID): + * bridge/jni/JNIBridge.h: + (JSC::Bindings::JavaString::utf8): + (JSC::Bindings::JavaParameter::type): + (JSC::Bindings::JavaMethod::returnType): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::call): + (JavaJSObject::eval): + (JavaJSObject::getMember): + (JavaJSObject::setMember): + (JavaJSObject::removeMember): + (JavaJSObject::convertJObjectToValue): + * bridge/jni/jsc/JNIBridgeJSC.cpp: + (JavaField::JavaField): + (JavaField::valueFromInstance): + (JavaField::setValueToInstance): + * bridge/jni/jsc/JNIBridgeJSC.h: + (JSC::Bindings::JavaField::type): + * bridge/jni/jsc/JavaInstanceJSC.cpp: + (JavaInstance::invokeMethod): + * bridge/jni/jsc/JavaStringJSC.h: + (JSC::Bindings::JavaStringImpl::utf8): + * bridge/runtime_array.cpp: + (JSC::RuntimeArray::getOwnPropertySlot): + (JSC::RuntimeArray::getOwnPropertyDescriptor): + (JSC::RuntimeArray::put): + +2010-08-12 Gavin Barraclough <barraclough@apple.com> + + Speculative build fix for chromium bindings (someone added the old include style!). + + * bindings/v8/V8DOMWindowShell.h: + +2010-08-12 MORITA Hajime <morrita@google.com> + + Reviewed by Tony Chang. + + [Refactoring] TextEvent class has to many flags + https://bugs.webkit.org/show_bug.cgi?id=43893 + + Turned TextEvent::m_isLineBreak, TextEvent::m_isBacktab, TextEvent::m_isPaste + into single TextEvent::m_inputType enumeration. + + No functional change. No new tests. + + * dom/TextEvent.cpp: + (WebCore::TextEvent::selectInputType): + (WebCore::TextEvent::create): + (WebCore::TextEvent::createForPlainTextPaste): + (WebCore::TextEvent::createForFragmentPaste): + (WebCore::TextEvent::TextEvent): + * dom/TextEvent.h: + (WebCore::TextEvent::): + (WebCore::TextEvent::isLineBreak): + (WebCore::TextEvent::isBackTab): + (WebCore::TextEvent::isPaste): + * page/EventHandler.cpp: + (WebCore::EventHandler::handleTextInputEvent): + +2010-08-12 Kenneth Russell <kbr@google.com> + + Reviewed by David Levin. + + Delete obsolete CanvasNumberArray + https://bugs.webkit.org/show_bug.cgi?id=38619 + + Deleted unreferenced code. Built WebKit and Chromium to test. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.jscbindings.mk: + * Android.mk: + * bindings/js/JSCanvasNumberArrayCustom.cpp: Removed. + * html/canvas/CanvasNumberArray.cpp: Removed. + * html/canvas/CanvasNumberArray.h: Removed. + * html/canvas/CanvasNumberArray.idl: Removed. + +2010-08-12 Anton Muhin <antonm@chromium.org> + + Reviewed by Nate Chapin. + + [v8] Create callbacks for named access of elements from document object on fly. + https://bugs.webkit.org/show_bug.cgi?id=43725 + + That should speed up access to methods on document as there is no need to + consult with interceptor before invoking the method. + + This reapplies http://trac.webkit.org/changeset/60670 reverted with + http://trac.webkit.org/changeset/63845. The main difference is in treatment + of removed named elements: we don't remove an accessor any more, but leave it. + Therefore any accessor should be able to treat the case when there is no + expando property. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::namedItemAdded): + (WebCore::ScriptController::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::checkDocumentWrapper): + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + (WebCore::getter): + (WebCore::V8DOMWindowShell::namedItemAdded): + (WebCore::V8DOMWindowShell::namedItemRemoved): + * bindings/v8/V8DOMWindowShell.h: + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::WrapInShadowObject): + (WebCore::V8HTMLDocument::GetNamedProperty): + (WebCore::V8HTMLDocument::allAccessorSetter): + (WebCore::toV8): + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::removeItemFromMap): + +2010-08-12 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Adam Barth. + + Ensure that parser doesn't attach children that have been removed by JavaScript event handlers. + https://bugs.webkit.org/show_bug.cgi?id=43813 + + This patch re-fixes bug 40742 in a way that keeps allowing HTMLLinkElement + to lazy-attach. + + * html/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::attach): Added parent check. + * html/HTMLLinkElement.cpp: Basically undoes changes introduced by r61424. + * html/HTMLLinkElement.h: Ditto. + +2010-08-12 Justin Schuh <jschuh@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Clear PluginData's page pointer on page refresh + https://bugs.webkit.org/show_bug.cgi?id=43888 + + Test: plugins/access-after-page-destroyed.html + + * page/Page.cpp: + (WebCore::Page::refreshPlugins): + +2010-08-12 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + getParameter(STENCIL_VALUE_MASK) (and others) returns the wrong value + https://bugs.webkit.org/show_bug.cgi?id=31842 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getUnsignedLongParameter): Casting from int to unsigned long correctly. + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Joseph Pecoraro. + + Web Inspector: mimic FireBug's array detection. + https://bugs.webkit.org/show_bug.cgi?id=30974 + + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-08-12 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + regression in generateMipmap + https://bugs.webkit.org/show_bug.cgi?id=43873 + + * html/canvas/WebGLTexture.cpp: + (WebCore::WebGLTexture::generateMipmapLevelInfo): should set m_needToUseBlackTexture to false if generateMipmapLevelInfo runs through successfully. + +2010-08-12 Ariya Hidayat <ariya@sencha.com> + + Reviewed by David Hyatt. + + [Qt] Split TransparencyLayer into its own header file. + https://bugs.webkit.org/show_bug.cgi?id=43935 + + * WebCore.pro: Include TransparencyLayer.h. + * platform/graphics/qt/GraphicsContextQt.cpp: + * platform/graphics/qt/TransparencyLayer.h: Added. + (WebCore::TransparencyLayer::TransparencyLayer): + (WebCore::TransparencyLayer::operator=): + +2010-08-12 François Sausset <sausset@gmail.com> + + Reviewed by Beth Dakin. + + Horizontal padding should be 0 on mrow elements. + https://bugs.webkit.org/show_bug.cgi?id=43908 + + Updated tests in /mathml + + * css/mathml.css: + (mrow, mfenced): + (mfenced): + +2010-08-12 Aaron Boodman <aa@chromium.org> + + Reviewed by David Hyatt. + + Make the cascade level of "user" styles configurable + https://bugs.webkit.org/show_bug.cgi?id=43457 + + * WebCore.exp.in: + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::CSSStyleSelector): + * dom/Document.cpp: + (WebCore::Document::pageGroupUserSheets): + * page/PageGroup.cpp: + (WebCore::PageGroup::addUserStyleSheetToWorld): + * page/PageGroup.h: + * page/UserStyleSheet.h: + (WebCore::UserStyleSheet::): + (WebCore::UserStyleSheet::UserStyleSheet): + (WebCore::UserStyleSheet::level): + +2010-08-12 Jian Li <jianli@chromium.org> + + Fix qt build break. + + * html/ThreadableBlobRegistry.cpp: + (WebCore::postTaskToMainThread): + +2010-08-12 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Add ThreadableBlobRegistry to support calling BlobRegistry methods in + main thread. + https://bugs.webkit.org/show_bug.cgi?id=43874 + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::addBlob): + (WebCore::ScriptExecutionContext::removeBlob): + (WebCore::ScriptExecutionContext::createPublicBlobURL): + (WebCore::ScriptExecutionContext::revokePublicBlobURL): + * dom/ScriptExecutionContext.h: + * html/Blob.cpp: + (WebCore::Blob::Blob): + (WebCore::Blob::~Blob): + (WebCore::Blob::contextDestroyed): + * html/Blob.h: + * html/BlobRegistryImpl.cpp: + (WebCore::BlobRegistryImpl::registerBlobURL): + (WebCore::BlobRegistryImpl::unregisterBlobURL): + (WebCore::BlobRegistryImpl::getBlobDataFromURL): + * html/ThreadableBlobRegistry.cpp: Added. + * html/ThreadableBlobRegistry.h: Added. + +2010-08-12 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Darin Adler. + + generate-bindings.pl should generate warning free code + https://bugs.webkit.org/show_bug.cgi?id=43353 + + * bindings/scripts/CodeGeneratorJS.pm: Suggested parentheses added around && within || + +2010-08-11 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Kent Tamura. + + merge MarkupAccumulator and MarkupAccumulatorWrapper + https://bugs.webkit.org/show_bug.cgi?id=43834 + + Removed MarkupAccumulator and added serializeNodesWithNamespaces to use MarkupAccumulatorWrapper + in both versions of createMarkup. Accumulation of nodes done manually in serializeNodes is + now done by MarkupAccumulatorWrapper as done in the original MarkupAccumulator. + + No new tests added since this is a cleanup. + + * editing/markup.cpp: + (WebCore::MarkupAccumulatorWrapper::MarkupAccumulatorWrapper): Takes vector of nodes and set it to m_nodes. + (WebCore::MarkupAccumulatorWrapper::insertOpenTag): Adds node to m_nodes. + (WebCore::MarkupAccumulatorWrapper::wrapWithNode): Adds node to m_nodes. + (WebCore::serializeNodes): Adding node to nodes is moved into MarkupAccumulatorWrapper. + (WebCore::createMarkup): Instantiates MarkupAccumulatorWrapper. + (WebCore::serializeNodesWithNamespaces): Renamed from MarkupAccumulator::appendMarkup. + +2010-08-12 Dirk Schulze <krit@webkit.org> + + Unreviewed sort of Xcode project file. + + * WebCore.xcodeproj/project.pbxproj: + +2010-08-12 Ben Murdoch <benm@google.com> + + Reviewed by Pavel Feldman. + + InspectorController.h missing InspectorObject forward declaration + https://bugs.webkit.org/show_bug.cgi?id=43913 + + Build fix so no new tests. + + * inspector/InspectorController.h: Adds the necessary forward declaration. + +2010-08-12 Hui Huang <hui.2.huang@nokia.com> + + Reviewed by Eric Seidel. + + m_windowRect is not updated because parent of PluginView is not + set when updatePluginWidget is called. plugin gets wrong window + size on setwindow. + https://bugs.webkit.org/show_bug.cgi?id=43635 + + * plugins/symbian/PluginViewSymbian.cpp: + (WebCore::PluginView::setParent): + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed, re-apply r65241 and 65243. + + Web Inspector: brush up object proxies, introduce remote object model. + https://bugs.webkit.org/show_bug.cgi?id=43847 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/AuditRules.js: + (WebInspector.AuditRules.CssInHeadRule.prototype.doRun): + (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun): + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.doEvalInWindow): + (WebInspector.ConsoleView.prototype._enterKeyPressed.printResult): + (WebInspector.ConsoleView.prototype._enterKeyPressed): + (WebInspector.ConsoleView.prototype._format): + (WebInspector.ConsoleView.prototype._formatarray): + (WebInspector.ConsoleView.prototype._formatAsArrayEntry): + (WebInspector.ConsoleMessage.prototype._format): + (WebInspector.ConsoleCommandResult): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMNode): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.performSearch): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._createTooltipForNode): + * inspector/front-end/EventListenersSidebarPane.js: + (): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + * inspector/front-end/ObjectPropertiesSection.js: + (WebInspector.ObjectPropertiesSection.prototype.update): + (WebInspector.ObjectPropertiesSection.prototype.updateProperties): + (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): + (WebInspector.ObjectPropertyTreeElement.prototype.update): + (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression): + * inspector/front-end/ObjectProxy.js: Removed. + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + * inspector/front-end/RemoteObject.js: Added. + (WebInspector.RemoteObjectId): + (WebInspector.RemoteObject): + (WebInspector.RemoteObject.fromPrimitiveValue): + (WebInspector.RemoteObject.fromNode): + (WebInspector.RemoteObject.fromPayload): + (WebInspector.RemoteObject.type): + (WebInspector.RemoteObject.prototype.get objectId): + (WebInspector.RemoteObject.prototype.get type): + (WebInspector.RemoteObject.prototype.get description): + (WebInspector.RemoteObject.prototype.get hasChildren): + (WebInspector.RemoteObject.prototype.isError): + (WebInspector.RemoteObject.prototype.getPropertyValueDescriptions): + (WebInspector.RemoteObject.prototype.getOwnProperties): + (WebInspector.RemoteObject.prototype.getProperties.remoteObjectBinder): + (WebInspector.RemoteObjectProperty): + * inspector/front-end/ScopeChainSidebarPane.js: + (WebInspector.ScopeChainSidebarPane.prototype.update): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame.updatingCallbackWrapper): + (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame): + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._showPopup.evaluateCallback): + (WebInspector.SourceFrame.prototype._showPopup): + (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame): + * inspector/front-end/WatchExpressionsSidebarPane.js: + (WebInspector.WatchExpressionsSection.prototype.update): + (WebInspector.WatchExpressionTreeElement.prototype.update): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.log.logMessage): + (WebInspector.log): + * inspector/front-end/utilities.js: + (): + +2010-08-11 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Add support for BGRA pixel format to GraphicsContext3D. + https://bugs.webkit.org/show_bug.cgi?id=43858 + + Although this has been standard in desktop GL since 1.2, it's an + extension in GL ES 2.0, so a query function is provided to check + for support. Since they differ on semantics (GL ES 2.0 requires + TexImage2D()'s format and internalFormat to match, while desktop GL + will not accept BGRA as an internalFormat), the stub implementation + returns false until these quirks have been implemented and tested on + each port. + + * platform/graphics/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::supportsBGRA): + Add implementation for non-chromium platforms which returns false. + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + Add query function (supportsBGRA()) and the BGRA_EXT token. + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Rolling out r65241 and 65243 for breaking inspector tests. + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Adding the file missing in r65241. + + * inspector/front-end/RemoteObject.js: Added. + (WebInspector.RemoteObjectId): + (WebInspector.RemoteObject): + (WebInspector.RemoteObject.fromPrimitiveValue): + (WebInspector.RemoteObject.fromNode): + (WebInspector.RemoteObject.fromPayload): + (WebInspector.RemoteObject.type): + (WebInspector.RemoteObject.prototype.get objectId): + (WebInspector.RemoteObject.prototype.get type): + (WebInspector.RemoteObject.prototype.get description): + (WebInspector.RemoteObject.prototype.get hasChildren): + (WebInspector.RemoteObject.prototype.isError): + (WebInspector.RemoteObject.prototype.getPropertyValueDescriptions): + (WebInspector.RemoteObject.prototype.getOwnProperties): + (WebInspector.RemoteObject.prototype.getProperties.remoteObjectBinder): + (WebInspector.RemoteObjectProperty): + +2010-08-12 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: brush up object proxies, introduce remote object model. + https://bugs.webkit.org/show_bug.cgi?id=43847 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/AuditRules.js: + (WebInspector.AuditRules.CssInHeadRule.prototype.doRun): + (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun): + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.doEvalInWindow): + (WebInspector.ConsoleView.prototype._enterKeyPressed.printResult): + (WebInspector.ConsoleView.prototype._enterKeyPressed): + (WebInspector.ConsoleView.prototype._format): + (WebInspector.ConsoleView.prototype._formatnode): + (WebInspector.ConsoleView.prototype._formatarray): + (WebInspector.ConsoleView.prototype._formatAsArrayEntry): + (WebInspector.ConsoleMessage.prototype._format): + (WebInspector.ConsoleCommandResult): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMNode): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._createTooltipForNode): + * inspector/front-end/EventListenersSidebarPane.js: + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + (injectedScriptConstructor.): + * inspector/front-end/ObjectPropertiesSection.js: + (WebInspector.ObjectPropertiesSection.prototype.update): + (WebInspector.ObjectPropertiesSection.prototype.updateProperties): + (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): + (WebInspector.ObjectPropertyTreeElement.prototype.update): + (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression): + * inspector/front-end/ObjectProxy.js: Removed. + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + * inspector/front-end/RemoteObject.js: Added. + (WebInspector.RemoteObjectId): + (WebInspector.RemoteObject): + (WebInspector.RemoteObject.fromPrimitiveValue): + (WebInspector.RemoteObject.fromErrorMessage): + (WebInspector.RemoteObject.fromNode): + (WebInspector.RemoteObject.fromPayload): + (WebInspector.RemoteObject.type): + (WebInspector.RemoteObject.prototype.get objectId): + (WebInspector.RemoteObject.prototype.get type): + (WebInspector.RemoteObject.prototype.get description): + (WebInspector.RemoteObject.prototype.get hasChildren): + (WebInspector.RemoteObject.prototype.isError): + (WebInspector.RemoteObject.prototype.getPropertyValueDescriptions): + (WebInspector.RemoteObject.prototype.getOwnProperties): + (WebInspector.RemoteObject.prototype.getProperties.remoteObjectBinder): + (WebInspector.RemoteObjectProperty): + * inspector/front-end/ScopeChainSidebarPane.js: + (WebInspector.ScopeChainSidebarPane.prototype.update): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame.updatingCallbackWrapper): + (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame): + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._showPopup.evaluateCallback): + (WebInspector.SourceFrame.prototype._showPopup): + (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame): + * inspector/front-end/WatchExpressionsSidebarPane.js: + (WebInspector.WatchExpressionsSection.prototype.update): + (WebInspector.WatchExpressionTreeElement.prototype.update): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.log.logMessage): + (WebInspector.log): + * inspector/front-end/utilities.js: + +2010-08-12 Ben Murdoch <benm@google.com> + + Reviewed by Steve Block. + + V8 code generator does not add V8BindingMacros.h include in all places it is needed + https://bugs.webkit.org/show_bug.cgi?id=43907 + + Adds the V8BindingMacros.h header before using the STRING_TO_V8PARAMETER_EXCEPTION_BLOCK + macro. + + Build fix so no new tests. + + * bindings/scripts/CodeGeneratorV8.pm: include the header at the right time. + +2010-08-12 Jeremy Orlow <jorlow@chromium.org> + + Revert for now + https://bugs.webkit.org/show_bug.cgi?id=43794 + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * page/GroupSettings.cpp: Removed. + * page/GroupSettings.h: Removed. + * page/PageGroup.cpp: + (WebCore::PageGroup::PageGroup): + (WebCore::PageGroup::localStorage): + * page/PageGroup.h: + * page/Settings.cpp: + (WebCore::Settings::Settings): + (WebCore::Settings::setLocalStorageQuota): + (WebCore::Settings::setLocalStorageDatabasePath): + * page/Settings.h: + (WebCore::Settings::localStorageQuota): + (WebCore::Settings::localStorageDatabasePath): + +2010-08-12 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Follow up to Jeremys fix, just remove the context parameter, it's not needed anymore. + + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::createMaskAndSwapContextForTextGradient): + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::applyResource): + * rendering/SVGImageBufferTools.cpp: + (WebCore::SVGImageBufferTools::createImageBuffer): + * rendering/SVGImageBufferTools.h: + +2010-08-12 Jeremy Orlow <jorlow@chromium.org> + + Build fix. + + * rendering/SVGImageBufferTools.cpp: + (WebCore::SVGImageBufferTools::createImageBuffer): + +2010-08-12 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + SVG masking performance very slow + https://bugs.webkit.org/show_bug.cgi?id=43622 + + Create ImageBuffers only as large as the final rendered size on screen. Only gradient on text on CG handled this correctly so far. + Refactored the code into a new SVGImageBufferTools class, and use the code from RenderSVGResourceMasker -> makes the IE9 demo SVG dice usable. + Clippers, Patterns and Filters remain to be converted. + + Test: svg/zoom/page/zoom-mask-with-percentages.svg + + * Android.mk: Add SVGImageBufferTools.* to build. + * CMakeLists.txt: Ditto. + * GNUmakefile.am: Ditto. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * rendering/RenderSVGAllInOne.cpp: Ditto. + * rendering/RenderSVGResourceGradient.cpp: Refactored CG gradient specific "create image buffer in absolute coordinates" code into SVGImageBufferTools class. + (WebCore::createMaskAndSwapContextForTextGradient): + (WebCore::clipToTextMask): + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/RenderSVGResourceMasker.cpp: Use new SVGImageBufferTools class, to avoid pixelation when zooming and to create image buffers as big as the final rendered size on screen, not more. + (WebCore::RenderSVGResourceMasker::invalidateClients): + (WebCore::RenderSVGResourceMasker::applyResource): + (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): + (WebCore::RenderSVGResourceMasker::calculateMaskContentRepaintRect): + (WebCore::RenderSVGResourceMasker::resourceBoundingBox): + * rendering/RenderSVGResourceMasker.h: + * rendering/SVGImageBufferTools.cpp: Added. + (WebCore::SVGImageBufferTools::absoluteTransformFromContext): + (WebCore::SVGImageBufferTools::createImageBuffer): + (WebCore::SVGImageBufferTools::clipToImageBuffer): + * rendering/SVGImageBufferTools.h: Added. + (WebCore::SVGImageBufferTools::SVGImageBufferTools): + (WebCore::SVGImageBufferTools::~SVGImageBufferTools): + +2010-08-10 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Adam Barth. + + Some settings are linked to the PageGroup not the Page. Create a new class for those. + https://bugs.webkit.org/show_bug.cgi?id=43794 + + Since persistient storage is shared between pages, there's no way to modify + some settings related to it on a per page basis. As such, it's not technically + correct for these settings to be on the Page's settings. Create a new class + called GroupSettings, move the 2 group-wide local storage settings there, and + add a new setting for IndexedDB's path (which is prompting this change). + + No behavior has changed, so no tests. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * page/PageGroup.cpp: + (WebCore::PageGroup::PageGroup): + (WebCore::PageGroup::localStorage): + * page/PageGroup.h: + (WebCore::PageGroup::groupSettings): + * page/Settings.cpp: + (WebCore::Settings::Settings): + (WebCore::Settings::setSessionStorageQuota): + * page/Settings.h: + +2010-08-12 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Decode images directly to QPixmap + https://bugs.webkit.org/show_bug.cgi?id=40797 + + Use the new API of Qt 4.7 to decode data from the image + reader directly to QPixmap. + + This allow us to use JDCT_IFAST when decoding jpeg images + to pixmap, and to decode animated GIF images, while still + using in-place conversion of color space. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::setData): + (WebCore::ImageDecoderQt::internalHandleCurrentImage): + +2010-07-14 Marcus Bulach <bulach@chromium.org> + + Reviewed by darin@apple.com. + + Removes DontCheckEnums from some IDLs and fixes the corresponding enums. + https://bugs.webkit.org/show_bug.cgi?id=42278 + + This is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=42250: it fixes some IDL/.h and enables generating compile-time checks for enums. + + Tests: idls should generate valid code. + + * dom/Node.h: + (WebCore::Node::): + * dom/Node.idl: + * dom/OverflowEvent.h: + (WebCore::OverflowEvent::): + * dom/OverflowEvent.idl: + * html/FileReader.cpp: + (WebCore::FileReader::readyState): + * html/FileReader.h: + (WebCore::FileReader::): + * html/FileReader.idl: + +2010-08-12 Alejandro G. Castro <alex@igalia.com> + + Reviewed by David Levin. + + The #if clause enabling a feature should avoid the all includes of + the feature + https://bugs.webkit.org/show_bug.cgi?id=43866 + + Modified the position of the guard to avoid including all the + headers if the feature controlling the guard is not enabled. + + * dom/make_names.pl: + +2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65221. + http://trac.webkit.org/changeset/65221 + https://bugs.webkit.org/show_bug.cgi?id=43896 + + Broke snow leopard build. (Requested by dave_levin on + #webkit). + + * platform/graphics/GraphicsContext3D.cpp: + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + +2010-08-11 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Add support for BGRA pixel format to GraphicsContext3D. + https://bugs.webkit.org/show_bug.cgi?id=43858 + + Although this has been standard in desktop GL since 1.2, it's an + extension in GL ES 2.0, so a query function is provided to check + for support. Since they differ on semantics (GL ES 2.0 requires + TexImage2D()'s format and internalFormat to match, while desktop GL + will not accept BGRA as an internalFormat), the stub implementation + returns false until these quirks have been implemented and tested on + each port. + + * platform/graphics/GraphicsContext3D.cpp: + (WebCore::GraphicsContext3D::supportsBGRA): + Add implementation for non-chromium platforms which returns false. + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + Add query function (supportsBGRA()) and the BGRA_EXT token. + +2010-08-11 Satish Sampath <satish@chromium.org> + + Reviewed by Kent Tamura. + + Handle clicks and recognition events for the speech input button + https://bugs.webkit.org/show_bug.cgi?id=43857 + + * rendering/RenderInputSpeech.cpp: + (WebCore::RenderInputSpeech::paintInputFieldSpeechButton): Selects the image based on current state. + * rendering/TextControlInnerElements.cpp: + (WebCore::InputFieldSpeechButtonElement::InputFieldSpeechButtonElement): + (WebCore::InputFieldSpeechButtonElement::defaultEventHandler): + (WebCore::InputFieldSpeechButtonElement::set_state): Switch to a new state and update the UI. + (WebCore::InputFieldSpeechButtonElement::didCompleteRecording): + (WebCore::InputFieldSpeechButtonElement::didCompleteRecognition): + * rendering/TextControlInnerElements.h: + (WebCore::InputFieldSpeechButtonElement::): + (WebCore::InputFieldSpeechButtonElement::state): + +2010-08-11 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + REGRESSION(65135): format specifier warnings + https://bugs.webkit.org/show_bug.cgi?id=43876 + + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::appendToBuffer): cast size_t to unsigned long for %lu. + (WebCore::WebSocketChannel::processBuffer): cast size_t to unsigned long for %lu. + +2010-08-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, don't generate WebDOMEventTarget.h/.cpp as we use the ones in bindings/cpp. + + * DerivedSources.make: + +2010-08-11 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Adam Barth. + + Make PendingScript copyable so that it can be stored in containers + https://bugs.webkit.org/show_bug.cgi?id=43875 + + This will be useful for storing PendingScripts in a Vector or Deque for + async and defer scripts. + + No new tests because no functional changes. + + * dom/PendingScript.h: + (WebCore::PendingScript::PendingScript): + (WebCore::PendingScript::operator=): + +2010-08-11 Victoria Kirst <vrk@google.com> + + Reviewed by David Levin. + + Fixing a regression in the UI for Mac default audio/video controls. + https://bugs.webkit.org/show_bug.cgi?id=43750 + + * rendering/RenderThemeChromiumMac.h: + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderContainer): + (WebCore::RenderThemeChromiumMac::paintMediaSliderThumb): + (WebCore::RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton): + +2010-08-11 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + HTML TreeBuilder hits ASSERT in fragment case with insertAdjacentHTML and colgroup + https://bugs.webkit.org/show_bug.cgi?id=43758 + + This patch conditionalizes some LegacyHTMLTreeBuilder-specific code in + HTMLElement::createContextualFragment that interferes with the new + HTMLTreeBuilder. Doing that exposes the above ASSERT, which I've fixed + in this patch too. Fixing that ASSERT involved a small refactoring in + ExternalCharacterTokenBuffer. + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::createContextualFragment): + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::skipLeadingWhitespace): + (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeLeadingWhitespace): + (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeLeadingNonWhitespace): + (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::skipLeading): + (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeLeading): + (WebCore::HTMLTreeBuilder::processCharacterBuffer): + +2010-08-11 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Conditionalize wrong fragment parsing code to pass more HTML5lib tests + https://bugs.webkit.org/show_bug.cgi?id=43877 + + This code exists to support the LegacyHTMLTreeBuilder. Unfortunately, + it causes problems for the new HTMLTreeBuilder (which is more + self-contained). + + * dom/Element.cpp: + (WebCore::Element::createContextualFragment): + +2010-08-11 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Tony Chang. + + Can't unbold text in div in font-weight span + https://bugs.webkit.org/show_bug.cgi?id=26871 + + The bug was caused by removeInlineStyle not being able to include styled inline nodes around the start. + Solved this problem by pushing down all inline styles instead of just text-decorations. + This approach allows removeInlineStyle to remove styled ancestors properly and generates compact markups. + + Test: editing/style/push-down-inline-styles.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::removeCSSStyle): No longer removes attributes or node when mode == RemoveNone. + (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle): Calls shouldRemoveInlineStyleFromElement + to determine the highest ancestor whose style needs to be pushed down. + (WebCore::ApplyStyleCommand::extractInlineStyleToPushDown): Renamed from extractTextDecorationStyle. + Extracts all inline CSS properties specified instead of just text decorations. + (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown): Renamed from applyTextDecorationStyle. + Applies inline styles using addInlineStyleIfNeeded or adds inline CSS values. + (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode): Renamed from pushDownTextDecorationStyleAroundNode. + (WebCore::ApplyStyleCommand::removeInlineStyle): Calls pushDownTextDecorationStyleAroundNode. + * editing/ApplyStyleCommand.h: + * editing/DeleteSelectionCommand.cpp: + (WebCore::DeleteSelectionCommand::mergeParagraphs): Prevents moveParagraph from preserving + the style of an empty paragraph when merged with the previous paragraph because we don't use that style anyways. + +2010-08-11 Julien Chaffraix <jchaffraix@codeaurora.org> + + Reviewed by Ariya Hidayat. + + Remove dead code in CSSStyleSelector. + https://bugs.webkit.org/show_bug.cgi?id=43805 + + * css/CSSStyleSelector.cpp: Remove some debugging code that + was compiled out. + +2010-08-11 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Beth Dakin. + + AX: isNativeCheckbox does not work as advertised + https://bugs.webkit.org/show_bug.cgi?id=43872 + + Test: platform/mac/accessibility/native-vs-nonnative-checkboxes.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::isInputImage): + Only say it's an input image if its role has not been overriden + (WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio): + * dom/InputElement.h: + Add methods to query if it's a checkbox or radio button type element. + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::isCheckbox): + +2010-08-11 Kenneth Russell <kbr@google.com> + + Reviewed by David Levin. + + Remove obsolete WebGLArray type names + https://bugs.webkit.org/show_bug.cgi?id=43885 + + Deleted aliases to obsolete WebGLArray type names. Updated + affected layout tests, synchronizing them with the versions in the + Khronos repository where appropriate. Ran all layout tests. + + * bindings/js/JSDOMWindowCustom.cpp: + * page/DOMWindow.idl: + +2010-08-11 Steve Block <steveblock@google.com> + + Reviewed by David Levin. + + [chromium] Geolocation breaks the compile if ENABLE_GEOLOCATION is set to 0 + https://bugs.webkit.org/show_bug.cgi?id=43753 + + This change guards the entire contents of the V8 custom bindings files + with ENABLE(GEOLOCATION) to match JSC. + + No new tests, build fix only. + + * bindings/v8/custom/V8CustomPositionCallback.cpp: + * bindings/v8/custom/V8CustomPositionErrorCallback.cpp: + * bindings/v8/custom/V8GeolocationCustom.cpp: + +2010-08-11 Kwang Yul Seo <skyul@company100.net> + + Reviewed by David Levin. + + Include <wtf/UnusedParam.h> in GraphicsContextSkia.cpp + https://bugs.webkit.org/show_bug.cgi?id=43843 + + wtf/UnusedParam.h must be included because UNUSED_PARAM macro is used. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + +2010-08-11 Nico Weber <thakis@chromium.org> + + Reviewed by David Levin. + + [chromium/mac]: Fix colors in compositing mode + https://bugs.webkit.org/show_bug.cgi?id=43823 + + The textures are drawn by opengl, which doesn't do any color space + correction -- it assumes everything is in the device color space + already. Hence, when drawing into the memory that will be uploaded + as opengl texture, use the device color space. + + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::updateTextureContents): + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::updateTextureContents): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::setRootLayerCanvasSize): + +2010-08-11 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + Remove obsolete texImage2D and texSubImage2D entry points + https://bugs.webkit.org/show_bug.cgi?id=40320 + + No new tests; covered by existing WebGL tests. + + * html/canvas/WebGLRenderingContext.cpp: + * html/canvas/WebGLRenderingContext.h: + * html/canvas/WebGLRenderingContext.idl: + +2010-08-11 Gavin Barraclough <barraclough@apple.com> + + Windows build fix. + + * platform/win/BString.cpp: + (WebCore::BString::BString): + +2010-08-11 Gavin Barraclough <barraclough@apple.com> + + Qt build fix II. + + * WebCore.xcodeproj/project.pbxproj: + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-08-11 Gavin Barraclough <barraclough@apple.com> + + Qt build fix. + + * WebCore.xcodeproj/project.pbxproj: + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-08-11 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Need EmptyDeviceOrientationClient and EmptyDeviceMotionClient for use with SVGImage + https://bugs.webkit.org/show_bug.cgi?id=43848 + + Tested by existing DeviceOrientation tests. + + * loader/EmptyClients.h: + (WebCore::EmptyDeviceMotionClient::setController): + (WebCore::EmptyDeviceMotionClient::startUpdating): + (WebCore::EmptyDeviceMotionClient::stopUpdating): + (WebCore::EmptyDeviceMotionClient::currentDeviceMotion): + (WebCore::EmptyDeviceOrientationClient::setController): + (WebCore::EmptyDeviceOrientationClient::startUpdating): + (WebCore::EmptyDeviceOrientationClient::stopUpdating): + (WebCore::EmptyDeviceOrientationClient::lastOrientation): + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::dataChanged): + +2010-08-11 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=42042 + An empty value for xml:lang isn't considered + + Revert last line change of my patch ; it happens to + behave correctly and same as before, but makes the + use case of empty values unneededly slower. + + No new tests. (No change in behavior) + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): + +2010-08-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx, WebDOM] Build fix. Fix callback params and WebCore::String -> WTF::String fixes. + + * bindings/cpp/WebDOMCustomVoidCallback.cpp: Added. + (WebDOMCustomVoidCallback::WebDOMCustomVoidCallback): + (WebDOMCustomVoidCallback::~WebDOMCustomVoidCallback): + (WebDOMCustomVoidCallback::handleEvent): + (toWebCore): + * bindings/cpp/WebDOMCustomVoidCallback.h: Added. + (WebDOMCustomVoidCallback::create): + * bindings/cpp/WebDOMHTMLDocumentCustom.cpp: + (documentWrite): + * bindings/cpp/WebDOMString.cpp: + (WebDOMString::equals): + * bindings/scripts/CodeGeneratorCPP.pm: + * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: + (WebDOMTestCallback::callbackWithClass1Param): + (WebDOMTestCallback::callbackWithClass2Param): + (WebDOMTestCallback::callbackWithNonBoolReturnType): + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + * bindings/scripts/test/V8/V8TestInterface.h: + * bindings/scripts/test/V8/V8TestObj.h: + * wscript: + +2010-08-11 Gavin Barraclough <barraclough@apple.com> + + Rubber stamps by Darin Adler & Sam Weinig. + + Bug 43867 - Some UString cleanup + + Change JSC::UString data(), size(), and from(), to characters(), length(), and number() to match WTF::String. + Move string concatenation methods to a new header to simplify down UString.h. Remove is8Bit(). + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + (WebCore::hasCSSPropertyNamePrefix): + (WebCore::cssPropertyName): + * bindings/js/JSLocationCustom.cpp: + (WebCore::JSLocation::setPort): + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::dispatchDidParseSource): + * bindings/js/ScriptString.h: + (WebCore::ScriptString::size): + * bindings/js/ScriptValue.cpp: + (WebCore::jsToInspectorValue): + * bindings/objc/WebScriptObject.mm: + (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]): + * bridge/jni/jni_jsobject.mm: + (JavaJSObject::convertValueToJObject): + * bridge/jni/jsc/JNIUtilityPrivate.cpp: + (JSC::Bindings::convertArrayInstanceToJavaArray): + (JSC::Bindings::convertValueToJValue): + * bridge/objc/objc_runtime.mm: + (JSC::Bindings::callObjCFallbackObject): + +2010-08-10 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=43806, add ability to paginate screen content. + + Add a new boolean to Document to indicate that content should be paginated. This is checked when doing page breaks + and in a couple of other cases. + + * dom/Document.cpp: + (WebCore::Document::Document): + * dom/Document.h: + (WebCore::Document::paginatedForScreen): + (WebCore::Document::setPaginatedForScreen): + (WebCore::Document::paginated): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintChildren): + (WebCore::RenderBlock::calcColumnWidth): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::calcHeight): + * rendering/RenderView.cpp: + (WebCore::RenderView::paint): + +2010-08-11 Adam Barth <abarth@webkit.org> + + Windows build fix. Turns out we need to unconditionally include + HTMLEntityNames.cpp now that LegacyHTMLDocumentParser doesn't exist. + + * html/HTMLEntityParser.cpp: + +2010-08-11 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Darin Adler. + + Inserting a <source> element should immediately set networkState to NETWORK_NO_SOURCE. + https://bugs.webkit.org/show_bug.cgi?id=42897 + + A <source> element inserted as a child of a media element with a networkState of NETWORK_EMPTY + should cause the networkState to immediately change to NETWORK_NO_SOURCE. + + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::HTMLMediaElement): Remove unused variable m_processingLoad. + (WebCore::HTMLMediaElement::prepareForLoad): Set m_networkState to NETWORK_NO_SOURCE. + (WebCore::HTMLMediaElement::loadInternal): Remove unused variable m_processingLoad. + (WebCore::HTMLMediaElement::selectMediaResource): No need to change m_networkState, it was done in prepareForLoad. + * html/HTMLMediaElement.h: + + * html/HTMLSourceElement.cpp: + (WebCore::HTMLSourceElement::insertedIntoTree): Renamed from insertedIntoDocument because we want + to do this setup whether or not the parent media element is in the document. + * html/HTMLSourceElement.h: + +2010-08-11 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Delete LegacyHTMLDocumentParser and LegacyPreloadScanner + https://bugs.webkit.org/show_bug.cgi?id=43836 + + These classes are bit-rotting disturbingly quickly. We removed the + last dependencies on these classes and so we can remove them. + + We might need to preserve some of their particular quirks to handle + some legacy applications, but our current thinking is to do that with + individual settings that affect the new parser. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/Document.cpp: + * dom/DocumentFragment.cpp: + (WebCore::DocumentFragment::parseHTML): + * dom/DocumentParser.h: + * dom/XMLDocumentParserLibxml2.cpp: + * dom/XMLDocumentParserQt.cpp: + * html/HTMLConstructionSite.cpp: + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::createParser): + * html/HTMLEntityParser.cpp: + (WebCore::decodeNamedEntity): + * html/HTMLEntityParser.h: + * html/HTMLFormControlElement.cpp: + * html/HTMLTreeBuilder.cpp: + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createParser): + * html/LegacyHTMLDocumentParser.cpp: Removed. + * html/LegacyHTMLDocumentParser.h: Removed. + * html/LegacyHTMLTreeBuilder.cpp: + * html/LegacyPreloadScanner.cpp: Removed. + * html/LegacyPreloadScanner.h: Removed. + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryDocumentParser::FTPDirectoryDocumentParser): + (WebCore::FTPDirectoryDocumentParser::appendEntry): + (WebCore::FTPDirectoryDocumentParser::createTDForFilename): + (WebCore::processFilesizeString): + (WebCore::wasLastDayOfMonth): + (WebCore::processFileDateString): + (WebCore::FTPDirectoryDocumentParser::parseAndAppendOneLine): + (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): + (WebCore::FTPDirectoryDocumentParser::createBasicDocument): + (WebCore::FTPDirectoryDocumentParser::append): + (WebCore::FTPDirectoryDocumentParser::finish): + * page/XSSAuditor.cpp: + (WebCore::XSSAuditor::decodeHTMLEntities): + * page/XSSAuditor.h: + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::prepend): + +2010-08-11 Chris Jerdonek <cjerdonek@webkit.org> + + Reviewed by Adam Barth. + + Refactored FrameLoader::createWindow() out of the FrameLoader class + since FrameLoader should not be responsible for creating windows. + + https://bugs.webkit.org/show_bug.cgi?id=39156 + + No new functionality, so no new tests. + + * bindings/generic/BindingDOMWindow.h: + (WebCore::::createWindow): + - Updated the call to FrameLoader's createWindow(). + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::createWindow): + - Updated the call to FrameLoader's createWindow(). + * loader/FrameLoader.cpp: + (WebCore::createWindowFromFrameLoader): + - Made FrameLoader::createWindow() non-member, non-friend and changed it + to accept Frame* parameters instead of FrameLoader*. + * loader/FrameLoader.h: + - Updated the header file to reflect the above change to FrameLoader.cpp. + +2010-08-11 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: small refactoring for CodeGeneratorInspector. + all "notify" methods are generating in InspectorFrontend + the other methods are generating in InspectorBackend. + https://bugs.webkit.org/show_bug.cgi?id=43849 + + * inspector/CodeGeneratorInspector.pm: + +2010-08-11 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Misc improvements to the scrolling code + https://bugs.webkit.org/show_bug.cgi?id=41926 + + Refactor code that uses deprecated ways of dealing with the + adjustments to use the GtkVersioning infrastructure. + + * GNUmakefile.am: + * platform/gtk/GtkVersioning.cpp: Added. + * platform/gtk/GtkVersioning.h: + * platform/gtk/ScrollViewGtk.cpp: + * platform/gtk/ScrollbarGtk.cpp: + (ScrollbarGtk::detachAdjustment): + (ScrollbarGtk::updateThumbPosition): + (ScrollbarGtk::updateThumbProportion): + +2010-08-11 Nate Chapin <japhet@chromium.org> + + Chromium mac build fix (variables weren't being initialized). + + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::FEGaussianBlur::apply): Initalize dxLeft, dxRight, dyLeft, dyRight. + +2010-08-11 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: apply correct fix to storage panel status bar buttons. + + https://bugs.webkit.org/show_bug.cgi?id=43846 + + * inspector/front-end/DatabaseTableView.js: + (WebInspector.DatabaseTableView.prototype.get statusBarItems): + * inspector/front-end/StoragePanel.js: + (WebInspector.StoragePanel.prototype._genericViewSetup): + +2010-08-11 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Adam Barth. + + Override operator= for C++ DOM binding classes with private structs + and update C++ DOM bindings test results. + https://bugs.webkit.org/show_bug.cgi?id=43735 + + * bindings/cpp/WebDOMEventTarget.cpp: + (WebDOMEventTarget::operator=): + * bindings/cpp/WebDOMEventTarget.h: + * bindings/scripts/CodeGeneratorCPP.pm: + * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: + (WebDOMTestCallback::operator=): + * bindings/scripts/test/CPP/WebDOMTestCallback.h: + * bindings/scripts/test/CPP/WebDOMTestInterface.cpp: + (WebDOMTestInterface::operator=): + * bindings/scripts/test/CPP/WebDOMTestInterface.h: + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::operator=): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + +2010-08-11 Julie Parent <jparent@chromium.org> + + Reviewed by Justin Garcia. + + Crash in replaceSelectionCommand with RTL text. + https://bugs.webkit.org/show_bug.cgi?id=41485 + + For text with mixed directionality, sort the text boxes before + computing gaps, since that code assumes the boxes are in order. + + Test: editing/execCommand/insert-image-on-top-of-directional-text.html + + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::deleteInsignificantText): Sort boxes + like we do in TextIterator before computing gaps. + * editing/TextIterator.cpp: + (WebCore::TextIterator::handleTextNode): Use new compareByStart + rather than compareBoxStart. No functional change. + * rendering/InlineTextBox.h: + (WebCore::InlineTextBox::compareByStart): Moved compareBoxStart + from TextIterator here so it can be used in multiple places. + +2010-08-11 Fumitoshi Ukai <ukai@chromium.org> + + Unreviewed build fix of Leopard Intel Debug (Build) + + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::processBuffer): use %lu, instead of %ul + +2010-08-11 Alejandro G. Castro <alex@igalia.com> + + Reviewed by Dirk Schulze. + + Fixes to the gaussian blur algorithm + https://bugs.webkit.org/show_bug.cgi?id=41605 + + Added the recomendations of SVG regarding the kernel size + calculation for the approximation of the gaussian + blur. http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement. + Modified also some variable names to clarify algorithm, reviewed + the situation where both standard deviations are 0. + + * platform/graphics/filters/FEGaussianBlur.cpp: + (WebCore::FEGaussianBlur::FEGaussianBlur): + (WebCore::FEGaussianBlur::stdDeviationX): + (WebCore::FEGaussianBlur::setStdDeviationX): + (WebCore::FEGaussianBlur::stdDeviationY): + (WebCore::FEGaussianBlur::setStdDeviationY): + (WebCore::boxBlur): + (WebCore::FEGaussianBlur::kernelPosition): Added the SVG kernel + position recomendation. + (WebCore::FEGaussianBlur::apply): + (WebCore::FEGaussianBlur::externalRepresentation): + * platform/graphics/filters/FEGaussianBlur.h: + +2010-08-11 Kristian Monsen <kristianm@google.com> + + Reviewed by Steve Block. + + Compile fix for Android, added include for <wtf/text/Cstring.h, this + did not get included in Android. + https://bugs.webkit.org/show_bug.cgi?id=41517 + + Build fix only, no new tests. + + * page/PrintContext.cpp: + +2010-08-11 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Fix length calculation to be more robust. + https://bugs.webkit.org/show_bug.cgi?id=43777 + + Test: websocket/tests/frame-length-overflow.html + + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::appendToBuffer): len is size_t. + - add sanity check for integer wraps. + (WebCore::WebSocketChannel::skipBuffer): len is size_t. + (WebCore::WebSocketChannel::processBuffer): length is size_t. + - add sanity check for integer wraps. + * websockets/WebSocketChannel.h: change m_bufferSize and len to size_t. + +2010-08-10 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Barth. + + Fix three ASSERTs hit with the HTML5 TreeBuilder in fragment mode + https://bugs.webkit.org/show_bug.cgi?id=43762 + + In fixing the insertAdjacentHTML I had to make small changes to + the error logic, which ended up bringing us closer to HTML5. + + Test: fast/dom/HTMLElement/insertAdjacentHTML-errors.html + + * html/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::attach): + - This ASSERT was just wrong, the child should not be attached + in the case the parent is not attached. + * html/HTMLElement.cpp: + (WebCore::contextElementForInsertion): + - This is part of HTML5, needed to know what to call the + HTML or XML parsers with. The previous code always passed + "this" which is wrong in the case of beforeBegin or afterEnd insertion. + (WebCore::HTMLElement::insertAdjacentHTML): + - Use the right contextElement now that we know how to compute it. + * html/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::processEndTagForInCell): + - This ASSERT is direct from the spec, but it's wrong, so I've filed a spec bug. + +2010-08-11 Adam Barth <abarth@webkit.org> + + Attempt to fix Windows build. + + * platform/win/COMPtr.h: + (WTF::): + +2010-08-11 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Port view-source to new parser + https://bugs.webkit.org/show_bug.cgi?id=43746 + + This patch switches the view-source mode for frames over to using the + new HTML parsing infrastructure. This patch is an architectural change + to how we parser view source documents. + + Previously, the LegacyHTMLDocumentParser would output a "guide string" + that consided of the inter-attribute whitespace and various "control" + characters. The HTMLViewSourceDocument would then interpret this guide + string to approximately reconstruct the source of the original document + and colorize various syntatic constructs. + + Unfortunately, that approach is inherently low-fidelity. It's not + really feasible to reconstruct the input document from the token + stream. The old view source mode also had a number of hacks in the old + parser (e.g., to turn of decoding of HTML entities). + + Instead of trying to reconstruct the original document from the token + stream, we use the segmentation information given by the tokens to + colorize the input document itself. Each token now caries information + about where in the input stream it came from and where various + subcomponents (e.g., attribute names and values) are located. This + approach is higher fidelity because we use this segmentation + information to colorize the original input instead of attempting to + reconstruct the original input. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLDocumentParser.cpp: + * html/HTMLToken.h: + (WebCore::HTMLToken::clear): + (WebCore::HTMLToken::startIndex): + (WebCore::HTMLToken::length): + (WebCore::HTMLToken::end): + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::createParser): + (WebCore::HTMLViewSourceDocument::addSource): + (WebCore::HTMLViewSourceDocument::processDoctypeToken): + (WebCore::HTMLViewSourceDocument::processTagToken): + (WebCore::HTMLViewSourceDocument::processCommentToken): + (WebCore::HTMLViewSourceDocument::processCharacterToken): + (WebCore::HTMLViewSourceDocument::addRange): + * html/HTMLViewSourceDocument.h: + * html/HTMLViewSourceParser.cpp: Added. + (WebCore::HTMLViewSourceParser::~HTMLViewSourceParser): + (WebCore::HTMLViewSourceParser::insert): + (WebCore::HTMLViewSourceParser::pumpTokenizer): + (WebCore::HTMLViewSourceParser::append): + (WebCore::HTMLViewSourceParser::sourceForToken): + (WebCore::HTMLViewSourceParser::updateTokenizerState): + (WebCore::HTMLViewSourceParser::finish): + (WebCore::HTMLViewSourceParser::finishWasCalled): + * html/HTMLViewSourceParser.h: Added. + (WebCore::HTMLViewSourceParser::HTMLViewSourceParser): + (WebCore::HTMLViewSourceParser::document): + * html/LegacyHTMLDocumentParser.cpp: + (WebCore::LegacyHTMLDocumentParser::processToken): + (WebCore::LegacyHTMLDocumentParser::processDoctypeToken): + +2010-08-11 Yoshiki Hayashi <yhayashi@google.com> + + Reviewed by Shinichiro Hamaji. + + Make form controls, textarea, legend and datagrid treat width: + auto as specified in stretching vertical flexbox. Otherwise it's + treated as intrinsic as before. + https://bugs.webkit.org/show_bug.cgi?id=17918 + + Test: fast/flexbox/vertical-box-form-controls.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::adjustRenderStyle): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::sizesToIntrinsicWidth): + +2010-08-10 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Add leakRef and clear to all RefPtr variants + https://bugs.webkit.org/show_bug.cgi?id=42389 + + * platform/win/COMPtr.h: Changed all uses of "template <...>" to instead do + "template<...>". Defined many of the inlined functions outside the class + definition, to avoid style checker warnings about multiple statements on + a single line and for slightly better clarity of the class definition itself. + Renamed releaseRef to leakRef. Added a releaseRef that calls leakRef so we + don't have to rename all callers at once. Added a clear function. Changed + the hash table code so it doesn't need to call releaseRef, and so it uses + the hash table deleted value hooks already present within the class. + +2010-08-10 Ariya Hidayat <ariya@sencha.com> + + [Qt] Fix build warning: remove reference to html/BlobRegistryImp.h + + * WebCore.pro: + +2010-08-10 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=43803 + <rdar://problem/6988023> Only the last Korean character can be shown if font style is enabled while typing (43803) + + Test: platform/mac/editing/input/bold-node.html + + * editing/Editor.cpp: (WebCore::Editor::setComposition): It is not clear to me what the + "baseNode == extentNode" check is about in this function , but let's try to make it more + likely that it passes. + +2010-08-10 Hayato Ito <hayato@chromium.org> + + Reviewed by Kent Tamura. + + Make CSSSelector::specificity() non-recursive. + https://bugs.webkit.org/show_bug.cgi?id=43784 + + This change is one of the required changes to fix the following master bug: + https://bugs.webkit.org/show_bug.cgi?id=42806 + + No functional change, thus no tests. + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::specificity): + (WebCore::CSSSelector::specificityForOneSelector): + (WebCore::CSSSelector::specificityForPage): + * css/CSSSelector.h: + +2010-08-10 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Darin Adler. + + 2d.path.clip.empty.html test is failing + https://bugs.webkit.org/show_bug.cgi?id=43161 + + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::clip): + Catching the empty path case from being sent directly to + CGContextClip - which would ignore it. Instead, using + CGContextClip with a CGRectZero to achieve the desired + behavior of reducing the clipping region to nothing. + +2010-08-10 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Reviewed by Antonio Gomes. + + [EFL] Add video files to enable video in WebKit EFL + https://bugs.webkit.org/show_bug.cgi?id=43790 + + Add files regarding html5 video to CMakeList.txt for WebKit Efl. + But, this patch is not run html5 video on WebKit EFL yet. + + * CMakeLists.txt: Add files related to html5video. + * platform/efl/LocalizedStringsEfl.cpp: Add functions for html5 video. + (WebCore::localizedMediaControlElementString): + (WebCore::localizedMediaControlElementHelpText): + (WebCore::localizedMediaTimeDescription): + * platform/graphics/MediaPlayer.cpp: + (WebCore::installedMediaEngines): Disable MediaPlayerPrivate::r + egisterMediaEngine for WebKit EFL. + +2010-08-10 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Nikolas Zimmermann. + + Add a toRenderSVGImage function + https://bugs.webkit.org/show_bug.cgi?id=43789 + + Add a function for casting to RenderSVGImage and use it. + + * rendering/RenderSVGImage.h: + (WebCore::toRenderSVGImage): + * rendering/RenderTreeAsText.cpp: + (WebCore::write): + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeSVGImage): + * rendering/SVGRenderTreeAsText.h: + * svg/SVGImageElement.cpp: + (WebCore::SVGImageElement::attach): + +2010-08-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Clients of HTMLTokenizer should be able to see where characters went in the token + https://bugs.webkit.org/show_bug.cgi?id=43766 + + When viewing the source of a document, we want to colorize different + parts of the input depending on how they were tokenized. In this + patch, we expose the internal segmentation of a token by recording the + start and end offsets for each attribute name and each attribute value. + + * html/HTMLToken.h: + (WebCore::HTMLToken::addNewAttribute): + (WebCore::HTMLToken::beginAttributeName): + (WebCore::HTMLToken::endAttributeName): + (WebCore::HTMLToken::beginAttributeValue): + (WebCore::HTMLToken::endAttributeValue): + (WebCore::HTMLToken::appendToAttributeName): + (WebCore::HTMLToken::appendToAttributeValue): + (WebCore::AtomicHTMLToken::AtomicHTMLToken): + * html/HTMLTokenizer.cpp: + (WebCore::HTMLTokenizer::nextToken): + +2010-08-10 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Do not post a sync task to the DB thread if it's terminating. + https://bugs.webkit.org/show_bug.cgi?id=43676 + + * bindings/generic/ActiveDOMCallback.cpp: The context can + sometimes be NULL. Check if it's NULL instead of asserting that + it's not. + (WebCore::ActiveDOMCallback::ActiveDOMCallback): + * dom/ActiveDOMObject.cpp: + (WebCore::ActiveDOMObject::ActiveDOMObject): + + * storage/Database.cpp: Do not post a sync task to the DB thread + if the DB thread is terminating. Also, when a task is destroyed, + ASSERT that it was completed, or that it had no synchronizer. + (WebCore::Database::openAndVerifyVersion): + (WebCore::Database::markAsDeletedAndClose): + (WebCore::Database::tableNames): + * storage/DatabaseTask.cpp: + (WebCore::DatabaseTaskSynchronizer::DatabaseTaskSynchronizer): + (WebCore::DatabaseTask::~DatabaseTask): + (WebCore::DatabaseTask::performTask): + * storage/DatabaseTask.h: + (WebCore::DatabaseTaskSynchronizer::hasCheckedForTermination): + (WebCore::DatabaseTaskSynchronizer::setHasCheckedForTermination): + (WebCore::DatabaseTask::hasSynchronizer): + (WebCore::DatabaseTask::hasCheckedForTermination): + * storage/DatabaseThread.cpp: + (WebCore::DatabaseThread::terminationRequested): + (WebCore::DatabaseThread::scheduleTask): + (WebCore::DatabaseThread::scheduleImmediateTask): + * storage/DatabaseThread.h: + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Qt build fix. + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-08-10 Jian Li <jianli@chromium.org> + + Fix more build break. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::ZigZag::Reader::readBlob): + (WebCore::ZigZag::Reader::readFile): + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::revokeBlobURL): + * dom/ScriptExecutionContext.h: + * html/Blob.cpp: + (WebCore::Blob::slice): + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Bug 43817 - Remove UString::Rep + UString::Rep has for a long time been replaced by UStringImpl (Rep + remaining as a typedef). UStringImpl has since been removed too + (unified with StringImpl). Remove Rep, rename rep() to impl() and + m_rep to m_impl. Also add impl() method to Identifier, and rename + its UString member from _ustring to m_string. + + * bindings/js/JSDOMBinding.cpp: + (WebCore::findAtomicString): + * bindings/js/JSDOMBinding.h: + (WebCore::ustringToString): + (WebCore::identifierToString): + (WebCore::ustringToAtomicString): + (WebCore::identifierToAtomicString): + * bindings/js/SerializedScriptValue.h: + (WebCore::SerializedScriptValueData::SerializedScriptValueData): + * bridge/IdentifierRep.cpp: + (WebCore::IdentifierRep::get): + * bridge/c/c_class.cpp: + (JSC::Bindings::CClass::methodsNamed): + (JSC::Bindings::CClass::fieldNamed): + * bridge/jni/jsc/JavaClassJSC.cpp: + (JavaClass::JavaClass): + (JavaClass::methodsNamed): + (JavaClass::fieldNamed): + * bridge/jni/jsc/JavaStringJSC.h: + (JSC::Bindings::JavaStringImpl::~JavaStringImpl): + (JSC::Bindings::JavaStringImpl::init): + (JSC::Bindings::JavaStringImpl::UTF8String): + (JSC::Bindings::JavaStringImpl::uchars): + (JSC::Bindings::JavaStringImpl::length): + (JSC::Bindings::JavaStringImpl::uString): + * bridge/jsc/BridgeJSC.h: + +2010-08-10 Jian Li <jianli@chromium.org> + + Fix qt build break. + + * html/BlobRegistryImpl.cpp: + * html/BlobRegistryImpl.h: + * html/BlobURL.cpp: + * html/BlobURL.h: + * platform/BlobRegistry.h: + +2010-08-10 Jian Li <jianli@chromium.org> + + Reviewed by David Levin. + + Add the support to register the blob data. + https://bugs.webkit.org/show_bug.cgi?id=43600 + + This is the first step towards adding Blob URL support. The blob has + an internal URL (used by FileReader) and public URLs (used by Blob.url). + The URL and its associated data are managed by BlobRegistry interface. + + This patch does not remove the usage of BlobItem. It will be removed + when all the blob data support is hooked up and the new tests will be + added then. + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/SerializedScriptValue.cpp: + (WebCore::SerializedBlob::create): + (WebCore::SerializedBlob::url): + (WebCore::SerializedBlob::type): + (WebCore::SerializedBlob::size): + (WebCore::SerializedBlob::SerializedBlob): + (WebCore::SerializedFile::create): + (WebCore::SerializedFile::path): + (WebCore::SerializedFile::url): + (WebCore::SerializedFile::type): + (WebCore::SerializedFile::SerializedFile): + (WebCore::SerializedFileList::item): + (WebCore::SerializedFileList::SerializedFileList): + (WebCore::SerializedScriptValueData::SerializedScriptValueData): + (WebCore::SharedSerializedData::asBlob): + (WebCore::SharedSerializedData::asFile): + (WebCore::SerializingTreeWalker::convertIfTerminal): + (WebCore::DeserializingTreeWalker::convertIfTerminal): + (WebCore::TeardownTreeWalker::convertIfTerminal): + * bindings/js/SerializedScriptValue.h: + (WebCore::SerializedScriptValueData::): + (WebCore::SerializedScriptValueData::asString): + (WebCore::SerializedScriptValueData::asBlob): + (WebCore::SerializedScriptValueData::asFile): + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::ZigZag::Writer::writeBlob): + (WebCore::ZigZag::Writer::writeFile): + (WebCore::ZigZag::Writer::writeFileList): + (WebCore::ZigZag::Writer::doWriteUintHelper): + (WebCore::ZigZag::Writer::doWriteUint32): + (WebCore::ZigZag::Writer::doWriteUint64): + (WebCore::ZigZag::Serializer::writeBlob): + (WebCore::ZigZag::Serializer::writeFile): + (WebCore::ZigZag::Reader::readBlob): + (WebCore::ZigZag::Reader::readFile): + (WebCore::ZigZag::Reader::readFileList): + (WebCore::ZigZag::Reader::doReadUintHelper): + (WebCore::ZigZag::Reader::doReadUint32): + (WebCore::ZigZag::Reader::doReadUint64): + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::trackBlobURL): + (WebCore::ScriptExecutionContext::revokeBlobURL): + * dom/ScriptExecutionContext.h: + * html/Blob.cpp: + (WebCore::Blob::Blob): + (WebCore::Blob::~Blob): + (WebCore::Blob::createPublicURL): + * html/Blob.h: + (WebCore::Blob::create): + (WebCore::Blob::url): + * html/BlobRegistryImpl.cpp: Added. + * html/BlobRegistryImpl.h: Added. + * html/BlobStorageData.h: Added. + * html/BlobURL.cpp: Added. + * html/BlobURL.h: Added. + * html/File.cpp: + (WebCore::File::File): + * html/File.h: + (WebCore::File::create): + * platform/BlobData.cpp: Added. + * platform/BlobData.h: Added. + * platform/BlobRegistry.h: Added. + +2010-08-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + SegmentedString should keep track of how many characters it consumes + https://bugs.webkit.org/show_bug.cgi?id=43765 + + The easiest way to keep track of how many characters we've consumed + would be to increment a counter every time we advance, but that's too + slow. Instead, we keep track lazily and update our summary durning the + slow case of advance (which is sufficiently rare). + + There's some subtly to how this works w.r.t. "unconsuming" characters + by pushing them back on the front of the segmented string. This isn't + really a "right answer" here because the notion of unconsuming input + isn't present in the API. This patch makes some assumptions about how + clients of this class use its API. In a future patch, we might want to + rename some of the method names to make this more explicit. + + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::operator=): + (WebCore::SegmentedString::append): + (WebCore::SegmentedString::prepend): + (WebCore::SegmentedString::advanceSubstring): + * platform/text/SegmentedString.h: + (WebCore::SegmentedSubstring::numberOfCharactersConsumed): + (WebCore::SegmentedString::SegmentedString): + (WebCore::SegmentedString::numberOfCharactersConsumed): + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + Bug 43816 - Remove UStringImpl + The class was actually removed a long time ago, replaced by StringImpl. + UStringImpl is just a typedef onto StringImpl. Remove this. + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMBinding.cpp: + (WebCore::findAtomicString): + +2010-08-09 Stephen White <senorblanco@chromium.org> + + Reviewed by David Levin. + + Prefer the medium-quality (bilinear) image resampling for 2D canvas on + Chromium. + https://bugs.webkit.org/show_bug.cgi?id=43646 + + This is what the accelerated path is going to do, + so do it in the software path as well. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::createImageBuffer): + * platform/graphics/GraphicsContext.h: + +2010-08-10 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Dave Hyatt. + + Removing an element from an anonymous block causes crash + https://bugs.webkit.org/show_bug.cgi?id=42309 + + There was a case where a continuation was added as a child, but if you asked + that child who is your parent, it would return the wrong answer. + + The specific scenario was when a sibling of an element who was the start of a + continuation was present. Retrieving the parent object had then follow the sibling + chain and then follow the originating continuation chain. + + Test: accessibility/removed-anonymous-block-child-causes-crash.html + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::nextSibling): + Fix erroneous comment + (WebCore::nextContinuation): + (WebCore::AccessibilityRenderObject::renderParentObject): + Handle unhandled continuation case. + (WebCore::AccessibilityRenderObject::addChildren): + ASSERT that the parentObject() is the same when adding a new child. + +2010-08-10 Abhishek Arya <inferno@chromium.org> + + Reviewed by David Hyatt. + + Take checks for ruby base existence out of the ASSERTs. + https://bugs.webkit.org/show_bug.cgi?id=43795 + + Test: fast/ruby/ruby-remove-no-base.html + + * rendering/RenderRubyRun.cpp: + (WebCore::RenderRubyRun::addChild): + (WebCore::RenderRubyRun::removeChild): + +2010-08-06 Zhenyao Mo <zmo@google.com> + + Reviewed by Dimitri Glazkov. + + texture functions should gen INVALID_OPERATION if no texture is bound + https://bugs.webkit.org/show_bug.cgi?id=42907 + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::copyTexImage2D): Check if a texture is bound to target. + (WebCore::WebGLRenderingContext::copyTexSubImage2D): Ditto. + (WebCore::WebGLRenderingContext::generateMipmap): Ditto. + (WebCore::WebGLRenderingContext::getTexParameter): Ditto. + (WebCore::WebGLRenderingContext::texImage2DBase): Ditto. + (WebCore::WebGLRenderingContext::texParameter): Ditto. + (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto. + (WebCore::WebGLRenderingContext::validateTextureBinding): Check if target is valid and if a texture is bound to it. + * html/canvas/WebGLRenderingContext.h: Declare validateTextureBinding(). + +2010-08-10 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Sam Weinig. + + [WINCE] Implement Path::currentPoint() + https://bugs.webkit.org/show_bug.cgi?id=42927 + + * platform/graphics/wince/PathWince.cpp: + (WebCore::Path::currentPoint): + +2010-08-10 Ariya Hidayat <ariya@sencha.com> + + [Qt] Warning fix, remove reference to platform/text/StringImpl.h + + * WebCore.pro: + +2010-08-10 Alice Liu <alice.liu@apple.com> + + Chromium build fix attempt. not reviewed + + * platform/text/TextBoundaries.cpp: use correct stringimplh include + +2010-08-10 Jian Li <jianli@chromium.org> + + Chromium build fix. + + * platform/graphics/chromium/FontPlatformDataChromiumWin.h: + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + +2010-08-10 Johnny Ding <jnd@chromium.org> + + Reviewed by Adam Barth. + + Change the ScriptController::processingUserGesture to static method + and use dynamic(JSC binding)/entered(V8 binding) frame to check the user gesture. + https://bugs.webkit.org/show_bug.cgi?id=42827. + + Test: fast/events/popup-blocked-from-iframe-script.html + + * WebCore.order: + * bindings/js/JSDOMBinding.cpp: + (WebCore::processingUserGesture): + * bindings/js/JSDOMBinding.h: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::setLocation): + (WebCore::createWindow): + (WebCore::domWindowAllowPopUp): + (WebCore::JSDOMWindow::open): + (WebCore::JSDOMWindow::showModalDialog): + * bindings/js/JSDocumentCustom.cpp: + (WebCore::JSDocument::setLocation): + * bindings/js/JSLocationCustom.cpp: + (WebCore::navigateIfAllowed): + (WebCore::JSLocation::reload): + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): + * bindings/js/ScriptController.h: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): + (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): + (WebCore::ScriptController::anyPageIsProcessingUserGesture): + * bindings/v8/ScriptController.h: + * bindings/v8/specialization/V8BindingState.cpp: + (WebCore::::processingUserGesture): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::isProcessingUserGesture): + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Chromium build fix + + * platform/graphics/chromium/FontPlatformDataLinux.h: + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + Bug 43786 - Move AtomicStringHash from WebCore to WTF + Also remove deprecated string headers from WebCore/platform/text. + + * ForwardingHeaders/wtf/text/AtomicStringHash.h: Added. + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + * bindings/cpp/WebDOMHTMLCollectionCustom.cpp: + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + * bindings/js/JSClipboardCustom.cpp: + * bindings/js/JSDOMApplicationCacheCustom.cpp: + * bindings/js/JSDOMMimeTypeArrayCustom.cpp: + * bindings/js/JSDOMPluginArrayCustom.cpp: + * bindings/js/JSDOMPluginCustom.cpp: + * bindings/js/JSDOMStringMapCustom.cpp: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSDataGridColumnListCustom.cpp: + * bindings/js/JSHTMLAllCollectionCustom.cpp: + * bindings/js/JSHTMLCollectionCustom.cpp: + * bindings/js/JSMessagePortCustom.cpp: + * bindings/js/JSNodeListCustom.cpp: + * bindings/scripts/CodeGeneratorCPP.pm: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + * bindings/scripts/test/V8/V8TestInterface.h: + * bindings/scripts/test/V8/V8TestObj.h: + * bindings/v8/ScriptDebugServer.h: + * bindings/v8/V8Binding.cpp: + * bindings/v8/V8Binding.h: + * bridge/jni/v8/JavaClassV8.h: + * css/CSSFontFaceSource.h: + * css/CSSFontSelector.cpp: + * css/CSSFontSelector.h: + * css/CSSNamespace.h: + * css/CSSParser.cpp: + * css/CSSParser.h: + * css/CSSParserValues.h: + * css/CSSStyleSelector.h: + * css/CSSVariablesDeclaration.h: + * css/MediaFeatureNames.h: + * css/MediaQueryExp.h: + * css/WebKitCSSKeyframesRule.h: + * dom/CustomEvent.h: + * dom/Document.cpp: + * dom/Event.cpp: + * dom/Event.h: + * dom/EventNames.h: + * dom/EventTarget.h: + * dom/InputElement.h: + * dom/MessagePort.cpp: + * dom/MessagePort.h: + * dom/NameNodeList.h: + * dom/NodeRareData.h: + * dom/QualifiedName.h: + * dom/ScriptElement.cpp: + * dom/SpaceSplitString.h: + * dom/TagNodeList.h: + * dom/XMLDocumentParser.h: + * editing/EditorCommand.cpp: + * history/mac/HistoryItemMac.mm: + * html/BlobBuilder.cpp: + * html/DataGridColumn.h: + * html/DataGridColumnList.cpp: + * html/HTMLDocument.h: + * html/HTMLInputElement.cpp: + * html/HTMLTokenizer.cpp: + * html/HTMLTokenizer.h: + * html/LegacyPreloadScanner.cpp: + * html/LegacyPreloadScanner.h: + * inspector/InspectorCSSStore.h: + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + * inspector/InspectorDOMAgent.h: + * inspector/InspectorDebuggerAgent.h: + * inspector/InspectorValues.h: + * loader/Cache.h: + * loader/CrossOriginAccessControl.cpp: + * loader/CrossOriginPreflightResultCache.h: + * loader/DocLoader.h: + * loader/ImageLoader.h: + * loader/appcache/ApplicationCache.h: + * loader/appcache/ApplicationCacheStorage.h: + * loader/appcache/DOMApplicationCache.h: + * loader/icon/IconDatabase.h: + * loader/icon/IconRecord.h: + * loader/loader.h: + * notifications/Notification.h: + * page/FrameTree.h: + * page/Page.cpp: + * page/PageGroup.h: + * page/SecurityOrigin.h: + * page/Settings.h: + * page/WindowFeatures.cpp: + * page/animation/AnimationBase.h: + * page/animation/AnimationControllerPrivate.h: + * page/animation/CompositeAnimation.h: + * platform/Cookie.h: + * platform/KURL.cpp: + * platform/KURLGoogle.cpp: + * platform/KURLHash.h: + * platform/Length.cpp: + * platform/LinkHash.cpp: + * platform/LinkHash.h: + * platform/MIMETypeRegistry.cpp: + * platform/MIMETypeRegistry.h: + * platform/SchemeRegistry.h: + * platform/ThreadGlobalData.cpp: + * platform/ThreadGlobalData.h: + * platform/cf/BinaryPropertyList.cpp: + * platform/chromium/SearchPopupMenuChromium.cpp: + * platform/efl/ClipboardEfl.cpp: + * platform/efl/CookieJarEfl.cpp: + * platform/efl/PlatformKeyboardEventEfl.cpp: + * platform/graphics/FontCache.cpp: + * platform/graphics/FontFamily.h: + * platform/graphics/MediaPlayer.h: + * platform/graphics/cg/ImageSourceCGWin.cpp: + * platform/graphics/chromium/FontCacheChromiumWin.cpp: + * platform/graphics/chromium/FontCacheLinux.cpp: + * platform/graphics/chromium/FontUtilsChromiumWin.cpp: + * platform/graphics/chromium/LayerChromium.h: + * platform/graphics/filters/Filter.h: + * platform/graphics/mac/FontPlatformData.h: + * platform/graphics/mac/GraphicsLayerCA.h: + * platform/graphics/qt/FontCacheQt.cpp: + * platform/graphics/win/FontCacheWin.cpp: + * platform/graphics/win/FontPlatformDataCGWin.cpp: + * platform/graphics/win/FontPlatformDataCairoWin.cpp: + * platform/graphics/win/FontPlatformDataWin.cpp: + * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: + * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp: + * platform/graphics/win/WKCACFLayer.h: + * platform/graphics/wince/FontPlatformData.cpp: + * platform/graphics/wx/FontPlatformData.h: + * platform/gtk/ClipboardGtk.cpp: + * platform/gtk/DataObjectGtk.h: + * platform/haiku/ClipboardHaiku.cpp: + * platform/haiku/CookieJarHaiku.cpp: + * platform/haiku/SearchPopupMenuHaiku.cpp: + * platform/mac/SearchPopupMenuMac.mm: + * platform/mac/ThreadCheck.mm: + * platform/network/CredentialStorage.cpp: + * platform/network/HTTPHeaderMap.h: + * platform/network/cf/DNSCFNet.cpp: + * platform/network/curl/CookieJarCurl.cpp: + * platform/qt/ClipboardQt.cpp: + * platform/text/AtomicString.h: Removed. + * platform/text/AtomicStringHash.h: Removed. + * platform/text/AtomicStringImpl.h: Removed. + * platform/text/AtomicStringKeyedMRUCache.h: + * platform/text/StringBuilder.cpp: + * platform/text/StringHash.h: Removed. + * platform/text/StringImpl.h: Removed. + * platform/text/TextCodecLatin1.cpp: + * platform/text/TextCodecUTF16.cpp: + * platform/text/TextCodecUserDefined.cpp: + * platform/text/cf/HyphenationCF.cpp: + * platform/text/cf/StringImplCF.cpp: + * platform/text/mac/HyphenationMac.mm: + * platform/text/mac/StringImplMac.mm: + * platform/text/transcoder/FontTranscoder.h: + * platform/text/wince/TextCodecWinCE.cpp: + * platform/win/BString.cpp: + * platform/win/ClipboardWin.cpp: + * platform/win/SearchPopupMenuWin.cpp: + * platform/wince/SearchPopupMenuWince.cpp: + * platform/wx/ClipboardWx.cpp: + * plugins/DOMMimeTypeArray.cpp: + * plugins/DOMPlugin.cpp: + * plugins/DOMPluginArray.cpp: + * plugins/PluginDatabase.h: + * plugins/PluginPackage.h: + * plugins/PluginStream.h: + * rendering/RenderApplet.h: + * rendering/RenderText.cpp: + * rendering/style/BindingURI.h: + * rendering/style/ContentData.cpp: + * rendering/style/CounterContent.h: + * rendering/style/CounterDirectives.h: + * rendering/style/KeyframeList.h: + * rendering/style/StyleRareInheritedData.h: + * storage/AbstractDatabase.cpp: + * storage/DatabaseAuthorizer.h: + * storage/DatabaseTracker.h: + * storage/IDBDatabaseBackendImpl.h: + * storage/IDBFactoryBackendImpl.h: + * storage/IDBObjectStoreBackendImpl.h: + * storage/OriginQuotaManager.h: + * storage/OriginUsageRecord.h: + * storage/SQLTransactionCoordinator.h: + * storage/StorageAreaSync.h: + * storage/StorageMap.h: + * storage/StorageNamespaceImpl.cpp: + * storage/chromium/QuotaTracker.h: + * svg/SVGAltGlyphElement.h: + * svg/SVGDocumentExtensions.cpp: + * svg/SVGDocumentExtensions.h: + * svg/SVGFitToViewBox.cpp: + * svg/SVGLangSpace.h: + * svg/animation/SMILTimeContainer.h: + * svg/graphics/filters/SVGFilterBuilder.h: + * websockets/WebSocket.h: + * websockets/WebSocketChannel.cpp: + * websockets/WebSocketHandshake.cpp: + * websockets/WebSocketHandshakeResponse.cpp: + * wml/WMLPageState.h: + * workers/AbstractWorker.h: + * workers/DefaultSharedWorkerRepository.h: + * workers/Worker.h: + * workers/WorkerContext.h: + * xml/XMLHttpRequest.h: + * xml/XMLHttpRequestUpload.cpp: + * xml/XMLHttpRequestUpload.h: + * xml/XPathExpressionNode.h: + * xml/XPathNamespace.h: + * xml/XPathParser.cpp: + * xml/XSLTProcessor.h: + +2010-08-10 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Adding changes that escaped from r65072. + + Web Inspector: move database processing to native layer. + https://bugs.webkit.org/show_bug.cgi?id=43788 + + * inspector/front-end/InspectorBackendStub.js: + (WebInspector.InspectorBackendStub): + * inspector/front-end/StoragePanel.js: + (WebInspector.StoragePanel.prototype._genericViewSetup): + +2010-08-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + [GTK] Inputs of type 'search' have weird looking checkboxes instead of search/clear icons + https://bugs.webkit.org/show_bug.cgi?id=43760 + + Draw appropriate GTK+ stock images for search/clear icons in search entries. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::paintSearchFieldResultsButton): + (WebCore::RenderThemeGtk::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeGtk::paintSearchFieldCancelButton): + +2010-08-10 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed. Qt build fix, follow up for r65072. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::releaseFrontendLifetimeAgents): + 2010-08-10 Pavel Feldman <pfeldman@chromium.org> Reviewed by Yury Semikhatsky. diff --git a/WebCore/Configurations/WebCore.xcconfig b/WebCore/Configurations/WebCore.xcconfig index 73e3519..83e535c 100644 --- a/WebCore/Configurations/WebCore.xcconfig +++ b/WebCore/Configurations/WebCore.xcconfig @@ -43,14 +43,14 @@ FRAMEWORK_SEARCH_PATHS_iphoneos_Production = $(PRODUCTION_FRAMEWORKS_DIR); FRAMEWORK_SEARCH_PATHS_iphonesimulator = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); FRAMEWORK_SEARCH_PATHS_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS); -HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 $(SQLITE3_HEADER_SEARCH_PATHS) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" $(HEADER_SEARCH_PATHS); +HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 $(SQLITE3_HEADER_SEARCH_PATHS) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" "${BUILT_PRODUCTS_DIR}/usr/local/include" $(HEADER_SEARCH_PATHS); INFOPLIST_FILE = Info.plist; INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME)); INSTALL_PATH_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; INSTALLHDRS_COPY_PHASE = YES; INSTALLHDRS_SCRIPT_PHASE = YES; PRODUCT_NAME = WebCore; -OTHER_LDFLAGS_BASE = -l$(SQLITE3_LIBRARY) -lobjc; +OTHER_LDFLAGS_BASE = -l$(SQLITE3_LIBRARY) -lobjc -lANGLE; OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework QuartzCore; OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos); diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index fd7fcf8..351db54 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -26,6 +26,7 @@ // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. #include "HTMLElementFactory.cpp" +#include "HTMLEntityTable.cpp" #include "JSAbstractWorker.cpp" #include "JSAttr.cpp" #include "JSBarInfo.cpp" @@ -72,11 +73,14 @@ #include "JSDataGridColumnList.cpp" #include "JSDedicatedWorkerContext.cpp" #include "JSDeviceOrientationEvent.cpp" +#include "JSDirectoryEntry.cpp" +#include "JSDirectoryReader.cpp" #include "JSDocument.cpp" #include "JSDocumentFragment.cpp" #include "JSDocumentType.cpp" #include "JSDOMApplicationCache.cpp" #include "JSDOMCoreException.cpp" +#include "JSDOMFileSystem.cpp" #include "JSDOMFormData.cpp" #include "JSDOMImplementation.cpp" #include "JSDOMMimeType.cpp" @@ -91,14 +95,22 @@ #include "JSElement.cpp" #include "JSEntity.cpp" #include "JSEntityReference.cpp" +#include "JSEntriesCallback.cpp" +#include "JSEntry.cpp" +#include "JSEntryArray.cpp" +#include "JSEntryCallback.cpp" +#include "JSErrorCallback.cpp" #include "JSErrorEvent.cpp" #include "JSEvent.cpp" #include "JSEventException.cpp" #include "JSEventSource.cpp" #include "JSFile.cpp" +#include "JSFileEntry.cpp" #include "JSFileError.cpp" #include "JSFileList.cpp" #include "JSFileReader.cpp" +#include "JSFileSystemCallback.cpp" +#include "JSFlags.cpp" #include "JSGeolocation.cpp" #include "JSGeoposition.cpp" #include "JSHistory.cpp" @@ -202,6 +214,8 @@ #include "JSMessageChannel.cpp" #include "JSMessageEvent.cpp" #include "JSMessagePort.cpp" +#include "JSMetadata.cpp" +#include "JSMetadataCallback.cpp" #include "JSMouseEvent.cpp" #include "JSMutationEvent.cpp" #include "JSNamedNodeMap.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index f25e91e..886c1f3 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -129,6 +129,8 @@ DOM_CLASSES = \ DatabaseSync \ DeviceMotionEvent \ DeviceOrientationEvent \ + DirectoryEntry \ + DirectoryReader \ Document \ DocumentFragment \ DocumentType \ @@ -136,7 +138,9 @@ DOM_CLASSES = \ ElementTimeControl \ Entity \ EntityReference \ + EntriesCallback \ Entry \ + EntryArray \ EntryCallback \ ErrorCallback \ ErrorEvent \ @@ -146,6 +150,7 @@ DOM_CLASSES = \ EventSource \ EventTarget \ File \ + FileEntry \ FileError \ FileList \ FileReader \ @@ -490,7 +495,7 @@ JS_DOM_HEADERS=$(filter-out JSEventListener.h JSEventTarget.h,$(DOM_CLASSES:%=JS WEB_DOM_HEADERS := ifeq ($(findstring BUILDING_WX,$(FEATURE_DEFINES)), BUILDING_WX) -WEB_DOM_HEADERS := $(filter-out WebDOMXSLTProcessor.h,$(DOM_CLASSES:%=WebDOM%.h)) +WEB_DOM_HEADERS := $(filter-out WebDOMXSLTProcessor.h WebDOMEventTarget.h,$(DOM_CLASSES:%=WebDOM%.h)) endif # BUILDING_WX all : \ @@ -505,7 +510,7 @@ all : \ ColorData.cpp \ DocTypeStrings.cpp \ HTMLElementFactory.cpp \ - HTMLEntityNames.cpp \ + HTMLEntityTable.cpp \ HTMLNames.cpp \ WMLElementFactory.cpp \ WMLNames.cpp \ @@ -600,8 +605,8 @@ DocTypeStrings.cpp : html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl # HTML entity names -HTMLEntityNames.cpp : html/HTMLEntityNames.gperf $(WebCore)/make-hash-tools.pl - perl $(WebCore)/make-hash-tools.pl . $(WebCore)/html/HTMLEntityNames.gperf +HTMLEntityTable.cpp : html/HTMLEntityNames.json $(WebCore)/../WebKitTools/Scripts/create-html-entity-table + python $(WebCore)/../WebKitTools/Scripts/create-html-entity-table -o HTMLEntityTable.cpp $(WebCore)/html/HTMLEntityNames.json # -------- diff --git a/WebCore/ForwardingHeaders/wtf/text/AtomicStringHash.h b/WebCore/ForwardingHeaders/wtf/text/AtomicStringHash.h new file mode 100644 index 0000000..3ca1b77 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/text/AtomicStringHash.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_AtomicStringHash_h +#define WebCore_FWD_AtomicStringHash_h +#include <JavaScriptCore/AtomicStringHash.h> +#endif diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 388b687..c191573 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -69,6 +69,7 @@ webcore_cppflags += \ -DDATA_DIR=\"${datadir}\" webcoregtk_cppflags += \ + -DWEBKITGTK_API_VERSION_STRING=\"@WEBKITGTK_API_VERSION@\" \ -DWTF_USE_SOUP=1 \ -DWTF_USE_GSTREAMER=1 \ -I$(srcdir)/WebCore/accessibility/gtk \ @@ -92,7 +93,7 @@ webcore_built_sources += \ DerivedSources/WebCore/CSSValueKeywords.h \ DerivedSources/WebCore/HTMLElementFactory.cpp \ DerivedSources/WebCore/HTMLElementFactory.h \ - DerivedSources/WebCore/HTMLEntityNames.cpp \ + DerivedSources/WebCore/HTMLEntityTable.cpp \ DerivedSources/WebCore/HTMLNames.cpp \ DerivedSources/WebCore/HTMLNames.h \ DerivedSources/WebCore/InspectorBackendDispatcher.cpp \ @@ -1314,6 +1315,8 @@ webcore_sources += \ WebCore/html/Blob.h \ WebCore/html/BlobBuilder.cpp \ WebCore/html/BlobBuilder.h \ + WebCore/html/BlobURL.cpp \ + WebCore/html/BlobURL.h \ WebCore/html/canvas/CanvasContextAttributes.h \ WebCore/html/canvas/CanvasGradient.cpp \ WebCore/html/canvas/CanvasGradient.h \ @@ -1422,6 +1425,8 @@ webcore_sources += \ WebCore/html/HTMLElement.h \ WebCore/html/HTMLElementStack.cpp \ WebCore/html/HTMLElementStack.h \ + WebCore/html/HTMLEntitySearch.cpp \ + WebCore/html/HTMLEntitySearch.h \ WebCore/html/HTMLEmbedElement.cpp \ WebCore/html/HTMLEmbedElement.h \ WebCore/html/HTMLFieldSetElement.cpp \ @@ -1544,12 +1549,12 @@ webcore_sources += \ WebCore/html/HTMLTextAreaElement.h \ WebCore/html/HTMLTitleElement.cpp \ WebCore/html/HTMLTitleElement.h \ - WebCore/html/LegacyHTMLDocumentParser.cpp \ - WebCore/html/LegacyHTMLDocumentParser.h \ WebCore/html/HTMLUListElement.cpp \ WebCore/html/HTMLUListElement.h \ WebCore/html/HTMLViewSourceDocument.cpp \ WebCore/html/HTMLViewSourceDocument.h \ + WebCore/html/HTMLViewSourceParser.cpp \ + WebCore/html/HTMLViewSourceParser.h \ WebCore/html/ImageData.cpp \ WebCore/html/ImageData.h \ WebCore/html/ImageResizerThread.cpp \ @@ -1557,11 +1562,11 @@ webcore_sources += \ WebCore/html/LabelsNodeList.cpp \ WebCore/html/LabelsNodeList.h \ WebCore/html/MediaError.h \ - WebCore/html/LegacyPreloadScanner.cpp \ - WebCore/html/LegacyPreloadScanner.h \ WebCore/html/StepRange.cpp \ WebCore/html/StepRange.h \ WebCore/html/TextMetrics.h \ + WebCore/html/ThreadableBlobRegistry.cpp \ + WebCore/html/ThreadableBlobRegistry.h \ WebCore/html/ValidityState.cpp \ WebCore/html/ValidityState.h \ WebCore/html/VoidCallback.h \ @@ -1685,6 +1690,7 @@ webcore_sources += \ WebCore/loader/FrameLoaderStateMachine.cpp \ WebCore/loader/FrameLoaderStateMachine.h \ WebCore/loader/FrameLoaderTypes.h \ + WebCore/loader/FrameNetworkingContext.h \ WebCore/loader/HistoryController.cpp \ WebCore/loader/HistoryController.h \ WebCore/loader/ImageDocument.cpp \ @@ -1795,6 +1801,8 @@ webcore_sources += \ WebCore/page/GeolocationPositionCache.cpp \ WebCore/page/GeolocationPositionCache.h \ WebCore/page/Geoposition.h \ + WebCore/page/GroupSettings.cpp \ + WebCore/page/GroupSettings.h \ WebCore/page/HaltablePlugin.h \ WebCore/page/History.cpp \ WebCore/page/History.h \ @@ -1893,6 +1901,7 @@ webcore_sources += \ WebCore/platform/EventLoop.h \ WebCore/platform/FileChooser.cpp \ WebCore/platform/FileChooser.h \ + WebCore/platform/FileSystem.cpp \ WebCore/platform/FileSystem.h \ WebCore/platform/FloatConversion.h \ WebCore/platform/GeolocationService.cpp \ @@ -2080,6 +2089,12 @@ webcore_sources += \ WebCore/platform/network/AuthenticationChallengeBase.cpp \ WebCore/platform/network/AuthenticationChallengeBase.h \ WebCore/platform/network/AuthenticationClient.h \ + WebCore/platform/network/BlobData.cpp \ + WebCore/platform/network/BlobData.h \ + WebCore/platform/network/BlobRegistry.h \ + WebCore/platform/network/BlobRegistryImpl.cpp \ + WebCore/platform/network/BlobRegistryImpl.h \ + WebCore/platform/network/BlobStorageData.h \ WebCore/platform/network/Credential.cpp \ WebCore/platform/network/Credential.h \ WebCore/platform/network/DNS.h \ @@ -2093,6 +2108,7 @@ webcore_sources += \ WebCore/platform/network/HTTPParsers.h \ WebCore/platform/network/NetworkStateNotifier.cpp \ WebCore/platform/network/NetworkStateNotifier.h \ + WebCore/platform/network/NetworkingContext.h \ WebCore/platform/network/ProtectionSpace.cpp \ WebCore/platform/network/ProtectionSpace.h \ WebCore/platform/network/ResourceErrorBase.cpp \ @@ -2106,8 +2122,6 @@ webcore_sources += \ WebCore/platform/network/ResourceRequestBase.h \ WebCore/platform/network/ResourceResponseBase.cpp \ WebCore/platform/network/ResourceResponseBase.h \ - WebCore/platform/text/AtomicString.h \ - WebCore/platform/text/AtomicStringHash.h \ WebCore/platform/text/AtomicStringImpl.h \ WebCore/platform/text/Base64.cpp \ WebCore/platform/text/Base64.h \ @@ -2432,6 +2446,8 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/FontPlatformData.h \ WebCore/platform/graphics/cairo/GOwnPtrCairo.cpp \ WebCore/platform/graphics/cairo/GOwnPtrCairo.h \ + WebCore/platform/graphics/cairo/GRefPtrCairo.cpp \ + WebCore/platform/graphics/cairo/GRefPtrCairo.h \ WebCore/platform/graphics/cairo/GradientCairo.cpp \ WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp \ WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h \ @@ -2473,6 +2489,7 @@ webcoregtk_sources += \ WebCore/platform/gtk/gtkdrawing.h \ WebCore/platform/gtk/GtkPluginWidget.cpp \ WebCore/platform/gtk/GtkPluginWidget.h \ + WebCore/platform/gtk/GtkVersioning.cpp \ WebCore/platform/gtk/GtkVersioning.h \ WebCore/platform/gtk/KeyEventGtk.cpp \ WebCore/platform/gtk/KURLGtk.cpp \ @@ -2982,6 +2999,55 @@ FEATURE_DEFINES += ENABLE_FILE_SYSTEM=1 webcore_cppflags += -DENABLE_FILE_SYSTEM=1 endif # END ENABLE_FILE_SYSTEM +webcore_built_sources += \ + DerivedSources/WebCore/JSDirectoryEntry.cpp \ + DerivedSources/WebCore/JSDirectoryEntry.h \ + DerivedSources/WebCore/JSDirectoryReader.cpp \ + DerivedSources/WebCore/JSDirectoryReader.h \ + DerivedSources/WebCore/JSDOMFileSystem.cpp \ + DerivedSources/WebCore/JSDOMFileSystem.h \ + DerivedSources/WebCore/JSEntriesCallback.cpp \ + DerivedSources/WebCore/JSEntriesCallback.h \ + DerivedSources/WebCore/JSEntry.cpp \ + DerivedSources/WebCore/JSEntry.h \ + DerivedSources/WebCore/JSEntryArray.cpp \ + DerivedSources/WebCore/JSEntryArray.h \ + DerivedSources/WebCore/JSEntryCallback.cpp \ + DerivedSources/WebCore/JSEntryCallback.h \ + DerivedSources/WebCore/JSErrorCallback.cpp \ + DerivedSources/WebCore/JSErrorCallback.h \ + DerivedSources/WebCore/JSFileEntry.cpp \ + DerivedSources/WebCore/JSFileEntry.h \ + DerivedSources/WebCore/JSFileSystemCallback.cpp \ + DerivedSources/WebCore/JSFileSystemCallback.h \ + DerivedSources/WebCore/JSFlags.cpp \ + DerivedSources/WebCore/JSFlags.h \ + DerivedSources/WebCore/JSMetadata.cpp \ + DerivedSources/WebCore/JSMetadata.h \ + DerivedSources/WebCore/JSMetadataCallback.cpp \ + DerivedSources/WebCore/JSMetadataCallback.h + +webcore_sources += \ + WebCore/storage/DirectoryEntry.cpp \ + WebCore/storage/DirectoryEntry.h \ + WebCore/storage/DirectoryReader.cpp \ + WebCore/storage/DirectoryReader.h \ + WebCore/storage/DOMFileSystem.cpp \ + WebCore/storage/DOMFileSystem.h \ + WebCore/storage/EntriesCallback.h \ + WebCore/storage/Entry.cpp \ + WebCore/storage/Entry.h \ + WebCore/storage/EntryArray.cpp \ + WebCore/storage/EntryArray.h \ + WebCore/storage/EntryCallback.h \ + WebCore/storage/ErrorCallback.h \ + WebCore/storage/FileEntry.cpp \ + WebCore/storage/FileEntry.h \ + WebCore/storage/FileSystemCallback.h \ + WebCore/storage/Flags.h \ + WebCore/storage/Metadata.h \ + WebCore/storage/MetadataCallback.h + # ---- # Speech Input API support # ---- @@ -3472,7 +3538,6 @@ DerivedSources/WebCore/MathMLNames.h: DerivedSources/WebCore/MathMLNames.cpp DerivedSources/WebCore/MathMLElementFactory.cpp DerivedSources/WebCore/MathMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/mathml/mathtags.in $(WebCore)/mathml/mathattrs.in $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/mathml/mathtags.in --attrs $(WebCore)/mathml/mathattrs.in --factory --wrapperFactory --outputDir "$(GENSOURCES_WEBCORE)" - # ---- # Notifications support # ---- @@ -3866,6 +3931,8 @@ webcore_sources += \ WebCore/rendering/SVGCharacterLayoutInfo.h \ WebCore/rendering/SVGInlineFlowBox.cpp \ WebCore/rendering/SVGInlineFlowBox.h \ + WebCore/rendering/SVGImageBufferTools.cpp \ + WebCore/rendering/SVGImageBufferTools.h \ WebCore/rendering/SVGInlineTextBox.cpp \ WebCore/rendering/SVGInlineTextBox.h \ WebCore/rendering/SVGMarkerData.h \ @@ -4072,6 +4139,8 @@ webcore_sources += \ WebCore/svg/SVGPaint.h \ WebCore/svg/SVGParserUtilities.cpp \ WebCore/svg/SVGParserUtilities.h \ + WebCore/svg/SVGPathBlender.cpp \ + WebCore/svg/SVGPathBlender.h \ WebCore/svg/SVGPathBuilder.cpp \ WebCore/svg/SVGPathBuilder.h \ WebCore/svg/SVGPathByteStream.h \ @@ -4119,6 +4188,8 @@ webcore_sources += \ WebCore/svg/SVGPathStringBuilder.h \ WebCore/svg/SVGPathStringSource.cpp \ WebCore/svg/SVGPathStringSource.h \ + WebCore/svg/SVGPathTraversalStateBuilder.cpp \ + WebCore/svg/SVGPathTraversalStateBuilder.h \ WebCore/svg/SVGPatternElement.cpp \ WebCore/svg/SVGPatternElement.h \ WebCore/svg/SVGPointList.cpp \ @@ -4384,8 +4455,8 @@ DerivedSources/WebCore/DocTypeStrings.cpp : $(WebCore)/html/DocTypeStrings.gperf $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES_WEBCORE) $(WebCore)/html/DocTypeStrings.gperf # HTML entity names -DerivedSources/WebCore/HTMLEntityNames.cpp : $(WebCore)/html/HTMLEntityNames.gperf $(WebCore)/make-hash-tools.pl - $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES_WEBCORE) $(WebCore)/html/HTMLEntityNames.gperf +DerivedSources/WebCore/HTMLEntityTable.cpp : $(WebCore)/html/HTMLEntityNames.json $(WebCore)/../WebKitTools/Scripts/create-html-entity-table + $(PYTHON) $(WebCore)/../WebKitTools/Scripts/create-html-entity-table -o $(GENSOURCES_WEBCORE)/HTMLEntityTable.cpp $(WebCore)/html/HTMLEntityNames.json # color names DerivedSources/WebCore/ColorData.cpp: $(WebCore)/platform/ColorData.gperf $(WebCore)/make-hash-tools.pl @@ -4549,6 +4620,7 @@ EXTRA_DIST += \ webinspectordir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/webinspector dist_webinspector_DATA = \ $(WebCore)/English.lproj/localizedStrings.js \ + DerivedSources/WebCore/InspectorBackendStub.js \ $(shell ls $(WebCore)/inspector/front-end/*.js) \ $(shell ls $(WebCore)/inspector/front-end/*.html) \ $(shell ls $(WebCore)/inspector/front-end/*.css) @@ -4558,7 +4630,14 @@ dist_webinspectorimages_DATA = \ $(shell ls $(WebCore)/inspector/front-end/Images/*.gif) \ $(shell ls $(WebCore)/inspector/front-end/Images/*.png) -webresourcesdir = ${datadir}/webkit-@WEBKITGTK_API_VERSION@/images +noinst_webinspectordir = ${GENSOURCES_INSPECTOR} +noinst_webinspector_SCRIPTS = ${GENSOURCES_INSPECTOR}/inspector.html +${GENSOURCES_INSPECTOR}/inspector.html : + mkdir -p ${GENSOURCES_INSPECTOR}/images + cp ${dist_webinspector_DATA} ${GENSOURCES_INSPECTOR} + cp ${dist_webinspectorimages_DATA} ${GENSOURCES_INSPECTOR}/images + +webresourcesdir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/images dist_webresources_DATA = \ $(WebCore)/Resources/textAreaResizeCorner.png \ $(WebCore)/Resources/nullPlugin.png \ diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in index 2da4dee..1369296 100644 --- a/WebCore/WebCore.exp.in +++ b/WebCore/WebCore.exp.in @@ -820,7 +820,7 @@ __ZN7WebCore9PageGroup18addVisitedLinkHashEy __ZN7WebCore9PageGroup20addUserScriptToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLENS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE __ZN7WebCore9PageGroup20removeAllUserContentEv __ZN7WebCore9PageGroup21removeAllVisitedLinksEv -__ZN7WebCore9PageGroup24addUserStyleSheetToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLENS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_25UserContentInjectedFramesE +__ZN7WebCore9PageGroup24addUserStyleSheetToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLENS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_25UserContentInjectedFramesENS_14UserStyleSheet5LevelE __ZN7WebCore9PageGroup25removeUserScriptFromWorldEPNS_15DOMWrapperWorldERKNS_4KURLE __ZN7WebCore9PageGroup26removeUserScriptsFromWorldEPNS_15DOMWrapperWorldE __ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index a28ee5d..fed9c0d 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -127,6 +127,7 @@ '../loader/appcache', '../loader/archive', '../loader/icon', + '../mathml', '../notifications', '../page', '../page/animation', @@ -266,6 +267,51 @@ }, 'targets': [ { + 'target_name': 'inspector_protocol_sources', + 'type': 'none', + 'actions': [ + { + 'action_name': 'generateInspectorProtocolSources', + # The second input item will be used as item name in vcproj. + # It is not possible to put Inspector.idl there because + # all idl files are marking as excluded by gyp generator. + 'inputs': [ + '../bindings/scripts/generate-bindings.pl', + '../inspector/CodeGeneratorInspector.pm', + '../bindings/scripts/CodeGenerator.pm', + '../bindings/scripts/IDLParser.pm', + '../bindings/scripts/IDLStructure.pm', + '../inspector/Inspector.idl', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendDispatcher.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js', + '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorBackendDispatcher.h', + '<(SHARED_INTERMEDIATE_DIR)/webcore/RemoteInspectorFrontend.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/RemoteInspectorFrontend.h', + ], + 'variables': { + 'generator_include_dirs': [ + ], + }, + 'action': [ + 'python', + 'scripts/rule_binding.py', + '../inspector/Inspector.idl', + '<(SHARED_INTERMEDIATE_DIR)/webcore', + '<(SHARED_INTERMEDIATE_DIR)/webkit', + '--', + '<@(_inputs)', + '--', + '--defines', '<(feature_defines) LANGUAGE_JAVASCRIPT', + '--generator', 'Inspector', + '<@(generator_include_dirs)' + ], + 'message': 'Generating Inspector protocol sources from Inspector.idl', + }, + ] + }, + { 'target_name': 'webcore_bindings_sources', 'type': 'none', 'hard_dependency': 1, @@ -276,9 +322,11 @@ # gperf rule '../html/DocTypeStrings.gperf', - '../html/HTMLEntityNames.gperf', '../platform/ColorData.gperf', + # json rule + '../html/HTMLEntityNames.json', + # idl rules '<@(bindings_idl_files)', ], @@ -397,6 +445,8 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLNames.h', + '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLElementFactory.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLElementFactory.h', ], 'action': [ 'python', @@ -405,6 +455,7 @@ '--', '<@(_inputs)', '--', + '--factory', '--extraDefines', '<(feature_defines)' ], }, @@ -419,6 +470,7 @@ '../css/themeWin.css', '../css/themeWinQuirks.css', '../css/svg.css', + '../css/mathml.css', '../css/mediaControls.css', '../css/mediaControlsChromium.css', ], @@ -475,44 +527,6 @@ ], }, { - 'action_name': 'RemoteInspectorFrontend', - # The second input item will be used as item name in vcproj. - # It is not possible to put Inspector.idl there because - # all idl files are marking as excluded by gyp generator. - 'inputs': [ - '../bindings/scripts/generate-bindings.pl', - '../inspector/CodeGeneratorInspector.pm', - '../bindings/scripts/CodeGenerator.pm', - '../bindings/scripts/IDLParser.pm', - '../bindings/scripts/IDLStructure.pm', - '../inspector/Inspector.idl', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/InspectorBackendDispatcher.cpp', - '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/InspectorBackendDispatcher.h', - '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/RemoteInspectorFrontend.cpp', - '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/RemoteInspectorFrontend.h', - ], - 'variables': { - 'generator_include_dirs': [ - ], - }, - 'action': [ - 'python', - 'scripts/rule_binding.py', - '../inspector/Inspector.idl', - '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings', - '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings', - '--', - '<@(_inputs)', - '--', - '--defines', '<(feature_defines) LANGUAGE_JAVASCRIPT', - '--generator', 'Inspector', - '<@(generator_include_dirs)' - ], - 'message': 'Generating Inspector interface classes from Inspector.idl', - }, - { 'action_name': 'XMLNames', 'inputs': [ '../dom/make_names.pl', @@ -598,7 +612,7 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit/<(RULE_INPUT_ROOT).cpp', ], - 'dependencies': [ + 'inputs': [ '../make-hash-tools.pl', ], 'action': [ @@ -609,6 +623,26 @@ ], 'process_outputs_as_sources': 0, }, + { + 'rule_name': 'json', + 'extension': 'json', + # + # json outputs are generated by WebKitTools/Scripts/create-html-entity-table + # + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityTable.cpp', + ], + 'inputs': [ + '../../WebKitTools/Scripts/create-html-entity-table', + ], + 'action': [ + 'python', + '../../WebKitTools/Scripts/create-html-entity-table', + '-o', + '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityTable.cpp', + '<(RULE_INPUT_PATH)', + ], + }, # Rule to build generated JavaScript (V8) bindings from .idl source. { 'rule_name': 'binding', @@ -670,6 +704,7 @@ 'hard_dependency': 1, 'dependencies': [ 'webcore_bindings_sources', + 'inspector_protocol_sources', '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre', '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', @@ -711,15 +746,19 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLElementFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLNames.cpp', + # Generated from HTMLEntityNames.json + '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityTable.cpp', + # Additional .cpp files from the webcore_bindings_sources rules. '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSGrammar.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/XPathGrammar.cpp', # Additional .cpp files from the webcore_inspector_sources list. - '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/RemoteInspectorFrontend.cpp', - '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/InspectorBackendDispatcher.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webcore/RemoteInspectorFrontend.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendDispatcher.cpp', ], 'conditions': [ ['javascript_engine=="v8"', { diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index 33645b5..d906385 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -231,10 +231,15 @@ 'storage/Database.idl', 'storage/DatabaseCallback.idl', 'storage/DatabaseSync.idl', + 'storage/DirectoryEntry.idl', + 'storage/DirectoryReader.idl', 'storage/DOMFileSystem.idl', + 'storage/EntriesCallback.idl', 'storage/Entry.idl', + 'storage/EntryArray.idl', 'storage/EntryCallback.idl', 'storage/ErrorCallback.idl', + 'storage/FileEntry.idl', 'storage/FileSystemCallback.idl', 'storage/Flags.idl', 'storage/IDBAny.idl', @@ -1432,6 +1437,8 @@ 'html/Blob.h', 'html/BlobBuilder.cpp', 'html/BlobBuilder.h', + 'html/BlobURL.cpp', + 'html/BlobURL.h', 'html/canvas/ArrayBufferView.cpp', 'html/canvas/ArrayBufferView.h', 'html/canvas/ArrayBuffer.cpp', @@ -1583,6 +1590,8 @@ 'html/HTMLElement.h', 'html/HTMLElementStack.cpp', 'html/HTMLElementStack.h', + 'html/HTMLEntitySearch.cpp', + 'html/HTMLEntitySearch.h', 'html/HTMLEmbedElement.cpp', 'html/HTMLEmbedElement.h', 'html/HTMLFieldSetElement.cpp', @@ -1708,14 +1717,14 @@ 'html/HTMLTextAreaElement.h', 'html/HTMLTitleElement.cpp', 'html/HTMLTitleElement.h', - 'html/LegacyHTMLDocumentParser.cpp', - 'html/LegacyHTMLDocumentParser.h', 'html/HTMLUListElement.cpp', 'html/HTMLUListElement.h', 'html/HTMLVideoElement.cpp', 'html/HTMLVideoElement.h', 'html/HTMLViewSourceDocument.cpp', 'html/HTMLViewSourceDocument.h', + 'html/HTMLViewSourceParser.cpp', + 'html/HTMLViewSourceParser.h', 'html/ImageData.cpp', 'html/ImageData.h', 'html/ImageResizerThread.cpp', @@ -1723,11 +1732,11 @@ 'html/LabelsNodeList.cpp', 'html/LabelsNodeList.h', 'html/MediaError.h', - 'html/LegacyPreloadScanner.cpp', - 'html/LegacyPreloadScanner.h', 'html/StepRange.cpp', 'html/StepRange.h', 'html/TextMetrics.h', + 'html/ThreadableBlobRegistry.cpp', + 'html/ThreadableBlobRegistry.h', 'html/TimeRanges.cpp', 'html/TimeRanges.h', 'html/ValidityState.cpp', @@ -1867,6 +1876,7 @@ 'loader/FrameLoaderStateMachine.cpp', 'loader/FrameLoaderStateMachine.h', 'loader/FrameLoaderTypes.h', + 'loader/FrameNetworkingContext.h', 'loader/HistoryController.cpp', 'loader/HistoryController.h', 'loader/ImageDocument.cpp', @@ -1920,6 +1930,34 @@ 'loader/WorkerThreadableLoader.h', 'loader/loader.cpp', 'loader/loader.h', + 'mathml/MathMLElement.cpp', + 'mathml/MathMLElement.h', + 'mathml/MathMLInlineContainerElement.cpp', + 'mathml/MathMLInlineContainerElement.h', + 'mathml/MathMLMathElement.cpp', + 'mathml/MathMLMathElement.h', + 'mathml/MathMLTextElement.cpp', + 'mathml/MathMLTextElement.h', + 'mathml/RenderMathMLBlock.cpp', + 'mathml/RenderMathMLBlock.h', + 'mathml/RenderMathMLFenced.cpp', + 'mathml/RenderMathMLFenced.h', + 'mathml/RenderMathMLFraction.cpp', + 'mathml/RenderMathMLFraction.h', + 'mathml/RenderMathMLMath.cpp', + 'mathml/RenderMathMLMath.h', + 'mathml/RenderMathMLOperator.cpp', + 'mathml/RenderMathMLOperator.h', + 'mathml/RenderMathMLRoot.cpp', + 'mathml/RenderMathMLRoot.h', + 'mathml/RenderMathMLRow.cpp', + 'mathml/RenderMathMLRow.h', + 'mathml/RenderMathMLSquareRoot.cpp', + 'mathml/RenderMathMLSquareRoot.h', + 'mathml/RenderMathMLSubSup.cpp', + 'mathml/RenderMathMLSubSup.h', + 'mathml/RenderMathMLUnderOver.cpp', + 'mathml/RenderMathMLUnderOver.h', 'notifications/Notification.cpp', 'notifications/Notification.h', 'notifications/NotificationCenter.cpp', @@ -2013,6 +2051,8 @@ 'page/GeolocationPositionCache.cpp', 'page/GeolocationPositionCache.h', 'page/Geoposition.h', + 'page/GroupSettings.cpp', + 'page/GroupSettings.h', 'page/HaltablePlugin.h', 'page/History.cpp', 'page/History.h', @@ -2227,6 +2267,8 @@ 'platform/graphics/chromium/PlatformIcon.h', 'platform/graphics/chromium/SimpleFontDataChromiumWin.cpp', 'platform/graphics/chromium/SimpleFontDataLinux.cpp', + 'platform/graphics/chromium/TilingData.h', + 'platform/graphics/chromium/TilingData.cpp', 'platform/graphics/chromium/TransformLayerChromium.cpp', 'platform/graphics/chromium/TransformLayerChromium.h', 'platform/graphics/chromium/TransparencyWin.cpp', @@ -2743,6 +2785,12 @@ 'platform/network/AuthenticationChallengeBase.cpp', 'platform/network/AuthenticationChallengeBase.h', 'platform/network/AuthenticationClient.h', + 'platform/network/BlobData.cpp', + 'platform/network/BlobData.h', + 'platform/network/BlobRegistry.h', + 'platform/network/BlobRegistryImpl.cpp', + 'platform/network/BlobRegistryImpl.h', + 'platform/network/BlobStorageData.h', 'platform/network/Credential.cpp', 'platform/network/Credential.h', 'platform/network/DNS.h', @@ -2754,6 +2802,7 @@ 'platform/network/HTTPHeaderMap.h', 'platform/network/HTTPParsers.cpp', 'platform/network/HTTPParsers.h', + 'platform/network/NetworkingContext.h', 'platform/network/NetworkStateNotifier.cpp', 'platform/network/NetworkStateNotifier.h', 'platform/network/ProtectionSpace.cpp', @@ -2854,8 +2903,6 @@ 'platform/text/transcoder/FontTranscoder.h', 'platform/text/win/TextBreakIteratorInternalICUWin.cpp', 'platform/text/wx/StringWx.cpp', - 'platform/text/AtomicString.h', - 'platform/text/AtomicStringHash.h', 'platform/text/AtomicStringImpl.h', 'platform/text/Base64.cpp', 'platform/text/Base64.h', @@ -3013,6 +3060,7 @@ 'platform/EventLoop.h', 'platform/FileChooser.cpp', 'platform/FileChooser.h', + 'platform/FileSystem.cpp', 'platform/FileSystem.h', 'platform/FloatConversion.h', 'platform/GeolocationService.cpp', @@ -3440,6 +3488,8 @@ 'rendering/SVGCharacterLayoutInfo.h', 'rendering/SVGInlineFlowBox.cpp', 'rendering/SVGInlineFlowBox.h', + 'rendering/SVGImageBufferTools.cpp', + 'rendering/SVGImageBufferTools.h', 'rendering/SVGInlineTextBox.cpp', 'rendering/SVGInlineTextBox.h', 'rendering/SVGMarkerData.h', @@ -3497,11 +3547,21 @@ 'storage/DatabaseTracker.cpp', 'storage/DatabaseTracker.h', 'storage/DatabaseTrackerClient.h', + 'storage/DirectoryEntry.cpp', + 'storage/DirectoryEntry.h', + 'storage/DirectoryReader.cpp', + 'storage/DirectoryReader.h', 'storage/DOMFileSystem.cpp', 'storage/DOMFileSystem.h', + 'storage/EntriesCallback.h', 'storage/Entry.cpp', 'storage/Entry.h', + 'storage/EntryArray.cpp', + 'storage/EntryArray.h', 'storage/EntryCallback.h', + 'storage/ErrorCallback.h', + 'storage/FileEntry.cpp', + 'storage/FileEntry.h', 'storage/FileSystemCallback.h', 'storage/Flags.h', 'storage/IDBAny.cpp', @@ -3536,6 +3596,8 @@ 'storage/IDBIndexBackendImpl.h', 'storage/IDBKey.cpp', 'storage/IDBKey.h', + 'storage/IDBKeyPath.cpp', + 'storage/IDBKeyPath.h', 'storage/IDBKeyRange.cpp', 'storage/IDBKeyRange.h', 'storage/IDBKeyTree.h', @@ -3822,6 +3884,8 @@ 'svg/SVGPaint.h', 'svg/SVGParserUtilities.cpp', 'svg/SVGParserUtilities.h', + 'svg/SVGPathBlender.cpp', + 'svg/SVGPathBlender.h', 'svg/SVGPathBuilder.cpp', 'svg/SVGPathBuilder.h', 'svg/SVGPathByteStream.h', @@ -3869,6 +3933,8 @@ 'svg/SVGPathStringBuilder.h', 'svg/SVGPathStringSource.cpp', 'svg/SVGPathStringSource.h', + 'svg/SVGPathTraversalStateBuilder.cpp', + 'svg/SVGPathTraversalStateBuilder.h', 'svg/SVGPatternElement.cpp', 'svg/SVGPatternElement.h', 'svg/SVGPointList.cpp', @@ -4098,7 +4164,6 @@ 'inspector/front-end/HAREntry.js', 'inspector/front-end/HelpScreen.js', 'inspector/front-end/ImageView.js', - 'inspector/front-end/InspectorBackendStub.js', 'inspector/front-end/InspectorFrontendHostStub.js', 'inspector/front-end/InjectedFakeWorker.js', 'inspector/front-end/InjectedScript.js', @@ -4107,7 +4172,6 @@ 'inspector/front-end/KeyboardShortcut.js', 'inspector/front-end/MetricsSidebarPane.js', 'inspector/front-end/Object.js', - 'inspector/front-end/ObjectProxy.js', 'inspector/front-end/ObjectPropertiesSection.js', 'inspector/front-end/Panel.js', 'inspector/front-end/PanelEnablerView.js', @@ -4118,6 +4182,7 @@ 'inspector/front-end/ProfileView.js', 'inspector/front-end/PropertiesSection.js', 'inspector/front-end/PropertiesSidebarPane.js', + 'inspector/front-end/RemoteObject.js', 'inspector/front-end/Resource.js', 'inspector/front-end/ResourceCategory.js', 'inspector/front-end/ResourcesPanel.js', diff --git a/WebCore/WebCore.order b/WebCore/WebCore.order index c815bbe..4124777 100644 --- a/WebCore/WebCore.order +++ b/WebCore/WebCore.order @@ -7340,8 +7340,8 @@ __ZN7WebCore27JSHTMLMediaElementPrototype18getOwnPropertySlotEPN3JSC9ExecStateER __ZNK7WebCore18JSHTMLAudioElement9classInfoEv __ZN7WebCore21jsHTMLMediaElementSrcEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE __ZN7WebCore39jsHTMLMediaElementPrototypeFunctionLoadEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE -__ZN7WebCore21processingUserGestureEPN3JSC9ExecStateE -__ZNK7WebCore16ScriptController21processingUserGestureEPNS_15DOMWrapperWorldE +__ZN7WebCore21processingUserGestureEv +__ZN7WebCore16ScriptController21processingUserGestureEv __ZN7WebCore16HTMLMediaElement4loadEbRi __ZN7WebCore11MediaPlayerD0Ev __ZN7WebCore18MediaPlayerPrivateD0Ev diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index b0effee..de9638f 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -29,7 +29,7 @@ XML_NAMES = $$PWD/xml/xmlattrs.in XMLNS_NAMES = $$PWD/xml/xmlnsattrs.in -ENTITIES_GPERF = $$PWD/html/HTMLEntityNames.gperf +HTML_ENTITIES = $$PWD/html/HTMLEntityNames.json COLORDATA_GPERF = $$PWD/platform/ColorData.gperf @@ -291,6 +291,17 @@ IDL_BINDINGS += \ storage/Database.idl \ storage/DatabaseCallback.idl \ storage/DatabaseSync.idl \ + storage/DirectoryEntry.idl \ + storage/DirectoryReader.idl \ + storage/DOMFileSystem.idl \ + storage/EntriesCallback.idl \ + storage/Entry.idl \ + storage/EntryArray.idl \ + storage/EntryCallback.idl \ + storage/ErrorCallback.idl \ + storage/FileEntry.idl \ + storage/FileSystemCallback.idl \ + storage/Flags.idl \ storage/IDBAny.idl \ storage/IDBCursor.idl \ storage/IDBDatabaseError.idl \ @@ -306,6 +317,8 @@ IDL_BINDINGS += \ storage/IDBRequest.idl \ storage/IDBSuccessEvent.idl \ storage/IDBTransaction.idl \ + storage/Metadata.idl \ + storage/MetadataCallback.idl \ storage/Storage.idl \ storage/StorageEvent.idl \ storage/SQLError.idl \ @@ -477,6 +490,7 @@ IDL_BINDINGS += \ INSPECTOR_INTERFACES = inspector/Inspector.idl +INSPECTOR_BACKEND_STUB_QRC = inspector/front-end/InspectorBackendStub.qrc mathmlnames.output = $${WC_GENERATED_SOURCES_DIR}/MathMLNames.cpp mathmlnames.input = MATHML_NAMES @@ -551,6 +565,13 @@ inspectorIDL.depends = $$PWD/bindings/scripts/CodeGenerator.pm \ $$PWD/bindings/scripts/InFilesParser.pm addExtraCompiler(inspectorIDL) +inspectorBackendStub.wkAddOutputToSources = false +inspectorBackendStub.output = generated/InspectorBackendStub.qrc +inspectorBackendStub.input = INSPECTOR_BACKEND_STUB_QRC +inspectorBackendStub.tempNames = $$PWD/$$INSPECTOR_BACKEND_STUB_QRC $${WC_GENERATED_SOURCES_DIR}/InspectorBackendStub.qrc +inspectorBackendStub.commands = $$QMAKE_COPY $$replace(inspectorBackendStub.tempNames, "/", $$QMAKE_DIR_SEP) +addExtraCompiler(inspectorBackendStub) + # GENERATOR 3: tokenizer (flex) tokenizer.output = $${WC_GENERATED_SOURCES_DIR}/${QMAKE_FILE_BASE}.cpp tokenizer.input = TOKENIZER @@ -590,12 +611,12 @@ xmlnames.commands = perl -I$$PWD/bindings/scripts $$xmlnames.wkScript --attrs $$ addExtraCompiler(xmlnames) # GENERATOR 8-A: -entities.output = $${WC_GENERATED_SOURCES_DIR}/HTMLEntityNames.cpp -entities.input = ENTITIES_GPERF -entities.wkScript = $$PWD/make-hash-tools.pl -entities.commands = perl $$entities.wkScript $${WC_GENERATED_SOURCES_DIR} $$ENTITIES_GPERF +entities.output = $${WC_GENERATED_SOURCES_DIR}/HTMLEntityTable.cpp +entities.input = HTML_ENTITIES +entities.wkScript = $$PWD/../WebKitTools/Scripts/create-html-entity-table +entities.commands = python $$entities.wkScript -o $${WC_GENERATED_SOURCES_DIR}/HTMLEntityTable.cpp $$HTML_ENTITIES entities.clean = ${QMAKE_FILE_OUT} -entities.depends = $$PWD/make-hash-tools.pl +entities.depends = $$PWD/../WebKitTools/Scripts/create-html-entity-table addExtraCompiler(entities) # GENERATOR 8-B: diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 652d443..2f5769c 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -136,17 +136,11 @@ symbian { RESOURCES += \ $$PWD/../WebCore/WebCore.qrc -!symbian:!maemo5 { - RESOURCES += $$PWD/../WebCore/inspector/front-end/WebKit.qrc -} +include_webinspector: RESOURCES += $$PWD/../WebCore/inspector/front-end/WebKit.qrc $$WC_GENERATED_SOURCES_DIR/InspectorBackendStub.qrc -maemo5|symbian|embedded { - DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1 -} +enable_fast_mobile_scrolling: DEFINES += ENABLE_FAST_MOBILE_SCROLLING=1 -maemo5|symbian { - DEFINES += WTF_USE_QT_MOBILE_THEME=1 -} +use_qt_mobile_theme: DEFINES += WTF_USE_QT_MOBILE_THEME=1 contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) { DEFINES += ENABLE_NO_LISTBOX_RENDERING=1 @@ -625,6 +619,7 @@ SOURCES += \ html/AsyncImageResizer.cpp \ html/Blob.cpp \ html/BlobBuilder.cpp \ + html/BlobURL.cpp \ html/canvas/CanvasGradient.cpp \ html/canvas/CanvasPattern.cpp \ html/canvas/CanvasPixelArray.cpp \ @@ -675,6 +670,7 @@ SOURCES += \ html/HTMLDocument.cpp \ html/HTMLElement.cpp \ html/HTMLElementStack.cpp \ + html/HTMLEntitySearch.cpp \ html/HTMLEmbedElement.cpp \ html/HTMLFieldSetElement.cpp \ html/HTMLFontElement.cpp \ @@ -735,13 +731,13 @@ SOURCES += \ html/HTMLTableSectionElement.cpp \ html/HTMLTextAreaElement.cpp \ html/HTMLTitleElement.cpp \ - html/LegacyHTMLDocumentParser.cpp \ html/HTMLUListElement.cpp \ html/HTMLViewSourceDocument.cpp \ + html/HTMLViewSourceParser.cpp \ html/ImageData.cpp \ html/ImageResizerThread.cpp \ html/LabelsNodeList.cpp \ - html/LegacyPreloadScanner.cpp \ + html/ThreadableBlobRegistry.cpp \ html/StepRange.cpp \ html/ValidityState.cpp \ inspector/ConsoleMessage.cpp \ @@ -838,6 +834,7 @@ SOURCES += \ page/Geolocation.cpp \ page/GeolocationController.cpp \ page/GeolocationPositionCache.cpp \ + page/GroupSettings.cpp \ page/History.cpp \ page/Location.cpp \ page/MemoryInfo.cpp \ @@ -878,6 +875,7 @@ SOURCES += \ platform/DragData.cpp \ platform/DragImage.cpp \ platform/FileChooser.cpp \ + platform/FileSystem.cpp \ platform/GeolocationService.cpp \ platform/image-decoders/qt/RGBA32BufferQt.cpp \ platform/graphics/FontDescription.cpp \ @@ -896,6 +894,7 @@ SOURCES += \ platform/graphics/GeneratedImage.cpp \ platform/graphics/Gradient.cpp \ platform/graphics/GraphicsContext.cpp \ + platform/graphics/GraphicsLayer.cpp \ platform/graphics/GraphicsTypes.cpp \ platform/graphics/Image.cpp \ platform/graphics/ImageBuffer.cpp \ @@ -929,6 +928,8 @@ SOURCES += \ platform/mock/GeolocationServiceMock.cpp \ platform/mock/SpeechInputClientMock.cpp \ platform/network/AuthenticationChallengeBase.cpp \ + platform/network/BlobData.cpp \ + platform/network/BlobRegistryImpl.cpp \ platform/network/Credential.cpp \ platform/network/FormData.cpp \ platform/network/FormDataBuilder.cpp \ @@ -1004,6 +1005,8 @@ SOURCES += \ rendering/RenderIndicator.cpp \ rendering/RenderInline.cpp \ rendering/RenderLayer.cpp \ + rendering/RenderLayerBacking.cpp \ + rendering/RenderLayerCompositor.cpp \ rendering/RenderLineBoxList.cpp \ rendering/RenderListBox.cpp \ rendering/RenderListItem.cpp \ @@ -1390,6 +1393,7 @@ HEADERS += \ html/AsyncImageResizer.h \ html/Blob.h \ html/BlobBuilder.h \ + html/BlobURL.h \ html/canvas/CanvasGradient.h \ html/canvas/CanvasPattern.h \ html/canvas/CanvasPixelArray.h \ @@ -1495,14 +1499,13 @@ HEADERS += \ html/HTMLTableSectionElement.h \ html/HTMLTextAreaElement.h \ html/HTMLTitleElement.h \ - html/LegacyHTMLDocumentParser.h \ html/HTMLUListElement.h \ html/HTMLVideoElement.h \ html/HTMLViewSourceDocument.h \ + html/HTMLViewSourceParser.h \ html/ImageData.h \ html/ImageResizerThread.h \ html/LabelsNodeList.h \ - html/LegacyPreloadScanner.h \ html/StepRange.h \ html/TimeRanges.h \ html/ValidityState.h \ @@ -1615,6 +1618,7 @@ HEADERS += \ page/Geolocation.h \ page/GeolocationPositionCache.h \ page/Geoposition.h \ + page/GroupSettings.h \ page/HaltablePlugin.h \ page/History.h \ page/Location.h \ @@ -1649,6 +1653,7 @@ HEADERS += \ platform/DragData.h \ platform/DragImage.h \ platform/FileChooser.h \ + platform/FileSystem.h \ platform/GeolocationService.h \ platform/image-decoders/ImageDecoder.h \ platform/mock/DeviceOrientationClientMock.h \ @@ -1676,6 +1681,8 @@ HEADERS += \ platform/graphics/GeneratedImage.h \ platform/graphics/Gradient.h \ platform/graphics/GraphicsContext.h \ + platform/graphics/GraphicsLayer.h \ + platform/graphics/GraphicsLayerClient.h \ platform/graphics/GraphicsTypes.h \ platform/graphics/Image.h \ platform/graphics/ImageSource.h \ @@ -1687,9 +1694,12 @@ HEADERS += \ platform/graphics/PathTraversalState.h \ platform/graphics/Pattern.h \ platform/graphics/Pen.h \ + platform/graphics/qt/ContextShadow.h \ platform/graphics/qt/FontCustomPlatformData.h \ + platform/graphics/qt/GraphicsLayerQt.h \ platform/graphics/qt/ImageDecoderQt.h \ platform/graphics/qt/StillImageQt.h \ + platform/graphics/qt/TransparencyLayer.h \ platform/graphics/SegmentedFontData.h \ platform/graphics/SimpleFontData.h \ platform/graphics/Tile.h \ @@ -1713,11 +1723,16 @@ HEADERS += \ platform/MIMETypeRegistry.h \ platform/network/AuthenticationChallengeBase.h \ platform/network/AuthenticationClient.h \ + platform/network/BlobData.h \ + platform/network/BlobRegistry.h \ + platform/network/BlobRegistryImpl.h \ + platform/network/BlobStorageData.h \ platform/network/Credential.h \ platform/network/FormDataBuilder.h \ platform/network/FormData.h \ platform/network/HTTPHeaderMap.h \ platform/network/HTTPParsers.h \ + platform/network/NetworkingContext.h \ platform/network/NetworkStateNotifier.h \ platform/network/ProtectionSpace.h \ platform/network/qt/QNetworkReplyHandler.h \ @@ -1744,7 +1759,6 @@ HEADERS += \ platform/sql/SQLiteStatement.h \ platform/sql/SQLiteTransaction.h \ platform/sql/SQLValue.h \ - platform/text/AtomicString.h \ platform/text/Base64.h \ platform/text/BidiContext.h \ platform/text/Hyphenation.h \ @@ -1752,7 +1766,6 @@ HEADERS += \ platform/text/RegularExpression.h \ platform/text/SegmentedString.h \ platform/text/StringBuilder.h \ - platform/text/StringImpl.h \ platform/text/TextCodec.h \ platform/text/TextCodecLatin1.h \ platform/text/TextCodecUserDefined.h \ @@ -1817,6 +1830,8 @@ HEADERS += \ rendering/RenderInline.h \ rendering/RenderInputSpeech.h \ rendering/RenderLayer.h \ + rendering/RenderLayerBacking.h \ + rendering/RenderLayerCompositor.h \ rendering/RenderLineBoxList.h \ rendering/RenderListBox.h \ rendering/RenderListItem.h \ @@ -1913,6 +1928,7 @@ HEADERS += \ rendering/style/SVGRenderStyle.h \ rendering/SVGCharacterData.h \ rendering/SVGCharacterLayoutInfo.h \ + rendering/SVGImageBufferTools.h \ rendering/SVGInlineFlowBox.h \ rendering/SVGInlineTextBox.h \ rendering/SVGMarkerData.h \ @@ -2164,6 +2180,7 @@ HEADERS += \ $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ $$PWD/../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \ $$PWD/../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \ $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \ $$PWD/../WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \ @@ -2183,12 +2200,14 @@ SOURCES += \ page/qt/FrameQt.cpp \ platform/graphics/qt/TransformationMatrixQt.cpp \ platform/graphics/qt/ColorQt.cpp \ + platform/graphics/qt/ContextShadow.cpp \ platform/graphics/qt/FontQt.cpp \ platform/graphics/qt/FontPlatformDataQt.cpp \ platform/graphics/qt/FloatPointQt.cpp \ platform/graphics/qt/FloatRectQt.cpp \ platform/graphics/qt/GradientQt.cpp \ platform/graphics/qt/GraphicsContextQt.cpp \ + platform/graphics/qt/GraphicsLayerQt.cpp \ platform/graphics/qt/IconQt.cpp \ platform/graphics/qt/ImageBufferQt.cpp \ platform/graphics/qt/ImageDecoderQt.cpp \ @@ -2253,6 +2272,7 @@ SOURCES += \ ../WebKit/qt/WebCoreSupport/EditorClientQt.cpp \ ../WebKit/qt/WebCoreSupport/EditCommandQt.cpp \ ../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \ ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \ ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \ @@ -2342,6 +2362,9 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { CONFIG += x11 LIBS += -lXrender } + maemo5 { + DEFINES += MOZ_PLATFORM_MAEMO=5 + } SOURCES += \ plugins/qt/PluginContainerQt.cpp \ plugins/qt/PluginPackageQt.cpp \ @@ -2541,6 +2564,31 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) { storage/StorageSyncManager.cpp } +contains(DEFINES, ENABLE_FILE_SYSTEM=1) { + HEADERS += \ + storage/DirectoryEntry.h \ + storage/DirectoryReader.h \ + storage/DOMFileSystem.h \ + storage/EntriesCallback.h \ + storage/Entry.h \ + storage/EntryArray.h \ + storage/EntryCallback.h \ + storage/ErrorCallback.h \ + storage/FileEntry.h \ + storage/FileSystemCallback.h \ + storage/Flags.h \ + storage/Metadata.h \ + storage/MetadataCallback.h + + SOURCES += \ + storage/DirectoryEntry.cpp \ + storage/DirectoryReader.cpp \ + storage/DOMFileSystem.cpp \ + storage/Entry.cpp \ + storage/EntryArray.cpp \ + storage/FileEntry.cpp +} + contains(DEFINES, ENABLE_ICONDATABASE=1) { SOURCES += \ loader/icon/IconDatabase.cpp \ @@ -2857,6 +2905,7 @@ contains(DEFINES, ENABLE_SVG=1) { svg/SVGNumberList.cpp \ svg/SVGPaint.cpp \ svg/SVGParserUtilities.cpp \ + svg/SVGPathBlender.cpp \ svg/SVGPathBuilder.cpp \ svg/SVGPathByteStreamBuilder.cpp \ svg/SVGPathByteStreamSource.cpp \ @@ -2879,6 +2928,7 @@ contains(DEFINES, ENABLE_SVG=1) { svg/SVGPathSegMoveto.cpp \ svg/SVGPathStringBuilder.cpp \ svg/SVGPathStringSource.cpp \ + svg/SVGPathTraversalStateBuilder.cpp \ svg/SVGPatternElement.cpp \ svg/SVGPointList.cpp \ svg/SVGPolyElement.cpp \ @@ -2966,6 +3016,7 @@ contains(DEFINES, ENABLE_SVG=1) { rendering/RenderSVGViewportContainer.cpp \ rendering/SVGCharacterData.cpp \ rendering/SVGCharacterLayoutInfo.cpp \ + rendering/SVGImageBufferTools.cpp \ rendering/SVGInlineFlowBox.cpp \ rendering/SVGInlineTextBox.cpp \ rendering/SVGMarkerLayoutInfo.cpp \ @@ -3213,19 +3264,6 @@ win32:!win32-g++*:contains(QMAKE_HOST.arch, x86_64):{ plugins/win/PaintHooks.asm } } -contains(DEFINES, WTF_USE_ACCELERATED_COMPOSITING) { -HEADERS += \ - rendering/RenderLayerBacking.h \ - rendering/RenderLayerCompositor.h \ - platform/graphics/GraphicsLayer.h \ - platform/graphics/GraphicsLayerClient.h \ - platform/graphics/qt/GraphicsLayerQt.h -SOURCES += \ - platform/graphics/GraphicsLayer.cpp \ - platform/graphics/qt/GraphicsLayerQt.cpp \ - rendering/RenderLayerBacking.cpp \ - rendering/RenderLayerCompositor.cpp -} symbian { shared { diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index cee21ac..d2f6d3d 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -67,7 +67,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\cg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\transcoder\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\jsc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\websockets\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="cmd /C copyForwardingHeaders.cmd cg cf
cmd /C copyInspectorFiles.cmd
"
/>
</Configuration>
<Configuration
@@ -123,7 +123,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\cg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\transcoder\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\jsc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\websockets\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="cmd /C copyForwardingHeaders.cmd cg cf
cmd /C copyInspectorFiles.cmd
"
/>
</Configuration>
<Configuration
@@ -178,7 +178,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\cg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\transcoder\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\jsc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\websockets\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="cmd /C copyForwardingHeaders.cmd cg cf
cmd /C copyInspectorFiles.cmd
"
/>
</Configuration>
<Configuration
@@ -233,7 +233,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\cairo\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\transcoder\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\curl\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\jsc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\websockets\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="cmd /C copyForwardingHeaders.cmd cairo curl
cmd /C copyInspectorFiles.cmd
"
/>
</Configuration>
<Configuration
@@ -289,7 +289,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\cairo\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\transcoder\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\curl\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\jsc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\websockets\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="cmd /C copyForwardingHeaders.cmd cairo curl
cmd /C copyInspectorFiles.cmd
"
/>
</Configuration>
<Configuration
@@ -344,7 +344,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\cg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\transcoder\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\jsc\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\websockets\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\text\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\text"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="cmd /C copyForwardingHeaders.cmd cg cf
cmd /C copyInspectorFiles.cmd
"
/>
</Configuration>
</Configurations>
@@ -3017,6 +3017,118 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDirectoryEntry.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDirectoryEntry.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDirectoryReader.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDirectoryReader.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDocument.cpp"
>
<FileConfiguration
@@ -3297,6 +3409,62 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMFileSystem.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMFileSystem.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSDOMFormData.cpp"
>
<FileConfiguration
@@ -4085,6 +4253,286 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntriesCallback.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntriesCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntry.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntry.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntryArray.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntryArray.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntryCallback.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEntryCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSErrorCallback.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSErrorCallback.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSErrorEvent.cpp"
>
<FileConfiguration
@@ -4533,6 +4981,118 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFileSystemCallback.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFileSystemCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFlags.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFlags.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSGeolocation.cpp"
>
<FileConfiguration
@@ -9405,6 +9965,118 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMetadata.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMetadata.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMetadataCallback.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="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMetadataCallback.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSMouseEvent.cpp"
>
<FileConfiguration
@@ -22337,6 +23009,14 @@ >
</File>
<File
+ RelativePath="..\page\GroupSettings.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\GroupSettings.h"
+ >
+ </File>
+ <File
RelativePath="..\page\HaltablePlugin.h"
>
</File>
@@ -22853,6 +23533,10 @@ >
</File>
<File
+ RelativePath="..\loader\FrameNetworkingContext.h"
+ >
+ </File>
+ <File
RelativePath="..\loader\FTPDirectoryDocument.cpp"
>
</File>
@@ -23349,6 +24033,10 @@ >
</File>
<File
+ RelativePath="..\platform\FileSystem.cpp"
+ >
+ </File>
+ <File
RelativePath="..\platform\FileSystem.h"
>
</File>
@@ -26112,6 +26800,30 @@ >
</File>
<File
+ RelativePath="..\platform\network\BlobData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\BlobData.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\BlobRegistry.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\BlobRegistryImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\BlobRegistryImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\BlobStorageData.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\network\Credential.cpp"
>
</File>
@@ -26168,6 +26880,10 @@ >
</File>
<File
+ RelativePath="..\platform\network\NetworkingContext.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\network\ProtectionSpace.cpp"
>
</File>
@@ -27172,14 +27888,6 @@ Name="text"
>
<File
- RelativePath="..\platform\text\AtomicString.h"
- >
- </File>
- <File
- RelativePath="..\platform\text\AtomicStringHash.h"
- >
- </File>
- <File
RelativePath="..\platform\text\AtomicStringImpl.h"
>
</File>
@@ -36273,6 +36981,14 @@ >
</File>
<File
+ RelativePath="..\html\BlobURL.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\BlobURL.h"
+ >
+ </File>
+ <File
RelativePath="..\html\canvas\CanvasGradient.cpp"
>
</File>
@@ -37633,6 +38349,14 @@ >
</File>
<File
+ RelativePath="..\html\HTMLEntitySearch.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTMLEntitySearch.h"
+ >
+ </File>
+ <File
RelativePath="..\html\HTMLEmbedElement.cpp"
>
<FileConfiguration
@@ -40893,35 +41617,35 @@ >
</File>
<File
- RelativePath="..\html\ImageData.cpp"
+ RelativePath="..\html\HTMLViewSourceParser.cpp"
>
</File>
<File
- RelativePath="..\html\ImageData.h"
+ RelativePath="..\html\HTMLViewSourceParser.h"
>
</File>
<File
- RelativePath="..\html\ImageResizerThread.cpp"
+ RelativePath="..\html\ImageData.cpp"
>
</File>
<File
- RelativePath="..\html\ImageResizerThread.h"
+ RelativePath="..\html\ImageData.h"
>
</File>
<File
- RelativePath="..\html\LabelsNodeList.cpp"
+ RelativePath="..\html\ImageResizerThread.cpp"
>
</File>
<File
- RelativePath="..\html\LabelsNodeList.h"
+ RelativePath="..\html\ImageResizerThread.h"
>
</File>
<File
- RelativePath="..\html\LegacyHTMLDocumentParser.cpp"
+ RelativePath="..\html\LabelsNodeList.cpp"
>
</File>
<File
- RelativePath="..\html\LegacyHTMLDocumentParser.h"
+ RelativePath="..\html\LabelsNodeList.h"
>
</File>
<File
@@ -40933,23 +41657,23 @@ >
</File>
<File
- RelativePath="..\html\LegacyPreloadScanner.cpp"
+ RelativePath="..\html\MediaError.h"
>
</File>
<File
- RelativePath="..\html\LegacyPreloadScanner.h"
+ RelativePath="..\html\StepRange.cpp"
>
</File>
<File
- RelativePath="..\html\MediaError.h"
+ RelativePath="..\html\StepRange.h"
>
</File>
<File
- RelativePath="..\html\StepRange.cpp"
+ RelativePath="..\html\ThreadableBlobRegistry.cpp"
>
</File>
<File
- RelativePath="..\html\StepRange.h"
+ RelativePath="..\html\ThreadableBlobRegistry.h"
>
</File>
<File
@@ -49353,6 +50077,10 @@ >
</File>
<File
+ RelativePath="..\svg\SVGPathBlender.h"
+ >
+ </File>
+ <File
RelativePath="..\svg\SVGPathBuilder.h"
>
</File>
@@ -49453,6 +50181,10 @@ >
</File>
<File
+ RelativePath="..\svg\SVGPathTraversalStateBuilder.h"
+ >
+ </File>
+ <File
RelativePath="..\svg\SVGPatternElement.h"
>
</File>
@@ -50353,6 +51085,74 @@ >
</File>
<File
+ RelativePath="..\storage\DirectoryEntry.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\DirectoryEntry.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\DirectoryReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\DirectoryReader.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\DOMFileSystem.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\DOMFileSystem.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\EntriesCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\Entry.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\Entry.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\EntryArray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\EntryArray.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\EntryCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\ErrorCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\FileEntry.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\FileEntry.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\FileSystemCallback.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\Flags.h"
+ >
+ </File>
+ <File
RelativePath="..\storage\IDBAny.cpp"
>
</File>
@@ -50541,6 +51341,14 @@ >
</File>
<File
+ RelativePath="..\storage\Metadata.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\MetadataCallback.h"
+ >
+ </File>
+ <File
RelativePath="..\storage\LocalStorageThread.cpp"
>
</File>
@@ -51264,10 +52072,6 @@ >
</File>
<File
- RelativePath="..\inspector\front-end\ObjectProxy.js"
- >
- </File>
- <File
RelativePath="..\inspector\front-end\Panel.js"
>
</File>
@@ -51308,6 +52112,10 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\RemoteObject.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\Resource.js"
>
</File>
diff --git a/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd new file mode 100755 index 0000000..7ad3217 --- /dev/null +++ b/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -0,0 +1,80 @@ +rem %1 argument is used for graphics. It can be cg or cairo +rem %2 argument is used for network. It can be cf or curl + +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\bindings" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\parser" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\runtime" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\masm" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\pcre" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\profiler" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wrec" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf\text" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf\unicode" +mkdir 2>NUL "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf\unicode\icu" + +xcopy /y /d "%ProjectDir%..\config.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%WebKitOutputDir%\obj\WebCore\DerivedSources\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\accessibility\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\accessibility\win\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\inspector\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\loader\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\loader\appcache\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\loader\archive\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\loader\archive\cf\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\loader\icon\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\history\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\history\cf\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\html\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\notifications\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\css\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\animation\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\cf\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\%1\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\transforms\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\win\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\opentype\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\text\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\text\transcoder\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\win\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\network\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\network\%2\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\network\win\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\sql\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\cairo\cairo\src\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\bindings\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\bindings\js\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\page\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\page\animation\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\page\win\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\bridge\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\bridge\jsc\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\plugins\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\plugins\win\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\rendering\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\rendering\style\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\editing\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\dom\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\xml\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\svg\animation\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\svg\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\storage\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\websockets\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\workers\*.h" "%WebKitOutputDir%\include\WebCore" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\bindings\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\bindings" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\parser\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\parser" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\runtime\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\runtime" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\masm\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\masm" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\pcre\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\pcre" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\profiler\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\profiler" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\wrec\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wrec" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\wtf\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\wtf\text\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf\text" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\wtf\unicode\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf\unicode" +xcopy /y /d "%ProjectDir%..\ForwardingHeaders\wtf\unicode\icu\*.h" "%WebKitOutputDir%\include\WebCore\ForwardingHeaders\wtf\unicode\icu" + +if exist "%WebKitOutputDir%\buildfailed" del "%WebKitOutputDir%\buildfailed" diff --git a/WebCore/WebCore.vcproj/copyInspectorFiles.cmd b/WebCore/WebCore.vcproj/copyInspectorFiles.cmd new file mode 100755 index 0000000..316fddc --- /dev/null +++ b/WebCore/WebCore.vcproj/copyInspectorFiles.cmd @@ -0,0 +1,5 @@ +mkdir 2>NUL "%WebKitOutputDir%\bin\WebKit.resources\inspector" +xcopy /y /d /s /exclude:xcopy.excludes "%ProjectDir%..\inspector\front-end\*" "%WebKitOutputDir%\bin\WebKit.resources\inspector" +xcopy /y /d /s /exclude:xcopy.excludes "%WebKitOutputDir%\obj\WebCore\DerivedSources\InspectorBackendStub.js" "%WebKitOutputDir%\bin\WebKit.resources\inspector" +mkdir 2>NUL "%WebKitOutputDir%\bin\WebKit.resources\en.lproj" +xcopy /y /d /s /exclude:xcopy.excludes "%ProjectDir%..\English.lproj\localizedStrings.js" "%WebKitOutputDir%\bin\WebKit.resources\en.lproj" diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 9e54ab5..2953b96 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -179,6 +179,8 @@ 08C34AF81179C057002D7456 /* RenderSVGResourceLinearGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C34AF41179C057002D7456 /* RenderSVGResourceLinearGradient.h */; }; 08C34AFD1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C34AFB1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp */; }; 08C34AFE1179C072002D7456 /* RenderSVGResourceRadialGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C34AFC1179C072002D7456 /* RenderSVGResourceRadialGradient.h */; }; + 08C46B691212F15E0011AF40 /* SVGImageBufferTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C46B671212F15D0011AF40 /* SVGImageBufferTools.cpp */; }; + 08C46B6A1212F15E0011AF40 /* SVGImageBufferTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C46B681212F15D0011AF40 /* SVGImageBufferTools.h */; }; 08C4C5180EF19A4000E4840F /* WMLImageElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C4C5140EF19A4000E4840F /* WMLImageElement.cpp */; }; 08C4C5190EF19A4000E4840F /* WMLImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C4C5150EF19A4000E4840F /* WMLImageElement.h */; }; 08C4C51A0EF19A4000E4840F /* WMLImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08C4C5160EF19A4000E4840F /* WMLImageLoader.cpp */; }; @@ -237,7 +239,6 @@ 0F69B9CA120FE1D6000E1FC7 /* RenderMathMLFenced.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F69B9C8120FE1D6000E1FC7 /* RenderMathMLFenced.h */; }; 0F6ECD450F252F3700BDE271 /* CSSPropertyLonghand.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6ECD430F252F3700BDE271 /* CSSPropertyLonghand.h */; }; 0F6ECD460F252F3700BDE271 /* CSSPropertyLonghand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6ECD440F252F3700BDE271 /* CSSPropertyLonghand.cpp */; }; - 0FC705210EB1815600B90AD8 /* AtomicStringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC705200EB1815600B90AD8 /* AtomicStringHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0FCF33240F2B9715004B6795 /* ColorCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FCF33230F2B9715004B6795 /* ColorCG.cpp */; }; 0FCF332C0F2B9A25004B6795 /* WebTiledLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FCF33280F2B9A25004B6795 /* WebTiledLayer.mm */; }; 0FCF332D0F2B9A25004B6795 /* WebTiledLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCF33290F2B9A25004B6795 /* WebTiledLayer.h */; }; @@ -709,6 +710,16 @@ 2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */; }; 2ED609BC1145B07100C8684E /* DOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ED609BA1145B07100C8684E /* DOMFormData.cpp */; }; 2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ED609BB1145B07100C8684E /* DOMFormData.h */; }; + 2EDEF1F3121B0EFC00726DB2 /* BlobData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEF1ED121B0EFC00726DB2 /* BlobData.cpp */; }; + 2EDEF1F4121B0EFC00726DB2 /* BlobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */; }; + 2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EF121B0EFC00726DB2 /* BlobRegistry.h */; }; + 2EDEF1F6121B0EFC00726DB2 /* BlobRegistryImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEF1F0121B0EFC00726DB2 /* BlobRegistryImpl.cpp */; }; + 2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1F1121B0EFC00726DB2 /* BlobRegistryImpl.h */; }; + 2EDEF1F8121B0EFC00726DB2 /* BlobStorageData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1F2121B0EFC00726DB2 /* BlobStorageData.h */; }; + 2EED575512109ED0007656BB /* BlobURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EED575012109ED0007656BB /* BlobURL.cpp */; }; + 2EED575612109ED0007656BB /* BlobURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED575112109ED0007656BB /* BlobURL.h */; }; + 2EED57FD1214A9C2007656BB /* ThreadableBlobRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EED57FB1214A9C2007656BB /* ThreadableBlobRegistry.cpp */; }; + 2EED57FE1214A9C2007656BB /* ThreadableBlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED57FC1214A9C2007656BB /* ThreadableBlobRegistry.h */; }; 31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */; }; 31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */; }; 31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */; }; @@ -890,6 +901,8 @@ 46F9D5DD0B0D60170028EE36 /* aliasCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DA0B0D60170028EE36 /* aliasCursor.png */; }; 46F9D5DE0B0D60170028EE36 /* noDropCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DB0B0D60170028EE36 /* noDropCursor.png */; }; 46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46F9D5DC0B0D60170028EE36 /* progressCursor.png */; }; + 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; }; + 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; }; 492273A31083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */; }; 49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */; }; 49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 49484FB4102CF23C00187DD3 /* CanvasGradient.h */; }; @@ -1256,6 +1269,8 @@ 5DFE8F570D16477C0076E937 /* ScheduledAction.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA378BB0D15F64200B793D6 /* ScheduledAction.h */; }; 626CDE0E1140424C001E5A68 /* SpatialNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */; }; 626CDE0F1140424C001E5A68 /* SpatialNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 626CDE0D1140424C001E5A68 /* SpatialNavigation.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 628D214B12131ED10055DCFC /* NetworkingContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 628D214E12131EF40055DCFC /* FrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 628D214D12131EF40055DCFC /* FrameNetworkingContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 62C1217C11AB9E77003C462C /* SuspendableTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */; }; 62C1217D11AB9E77003C462C /* SuspendableTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 62C1217B11AB9E77003C462C /* SuspendableTimer.h */; }; 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62CD32561157E57C0063B0A7 /* CustomEvent.cpp */; }; @@ -1488,6 +1503,10 @@ 84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */; }; 84BDA16B11358D2A00DBF64C /* RenderSVGResourceClipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84BDA16911358D2A00DBF64C /* RenderSVGResourceClipper.cpp */; }; 84BDA16C11358D2A00DBF64C /* RenderSVGResourceClipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 84BDA16A11358D2A00DBF64C /* RenderSVGResourceClipper.h */; }; + 84C5B2FA1216DC810088B53A /* SVGPathTraversalStateBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84C5B2F81216DC810088B53A /* SVGPathTraversalStateBuilder.cpp */; }; + 84C5B2FB1216DC810088B53A /* SVGPathTraversalStateBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84C5B2F91216DC810088B53A /* SVGPathTraversalStateBuilder.h */; }; + 84C6784C1214814700A92902 /* SVGPathBlender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84C6784A1214814700A92902 /* SVGPathBlender.cpp */; }; + 84C6784D1214814700A92902 /* SVGPathBlender.h in Headers */ = {isa = PBXBuildFile; fileRef = 84C6784B1214814700A92902 /* SVGPathBlender.h */; }; 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */; }; 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D0C4051115F1EA0018AA34 /* AffineTransform.h */; settings = {ATTRIBUTES = (Private, ); }; }; 85004D940ACEEAEF00C438F6 /* DOMSVGDefsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */; }; @@ -2365,6 +2384,45 @@ 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, ); }; }; + 899ABC261215E4A300F9F219 /* DirectoryEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC201215E4A300F9F219 /* DirectoryEntry.cpp */; }; + 899ABC271215E4A300F9F219 /* DirectoryEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC211215E4A300F9F219 /* DirectoryEntry.h */; }; + 899ABC291215E4A300F9F219 /* DirectoryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC231215E4A300F9F219 /* DirectoryReader.cpp */; }; + 899ABC2A1215E4A300F9F219 /* DirectoryReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC241215E4A300F9F219 /* DirectoryReader.h */; }; + 899ABC341215E4BE00F9F219 /* EntriesCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC2C1215E4BE00F9F219 /* EntriesCallback.h */; }; + 899ABC361215E4BE00F9F219 /* EntryArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC2E1215E4BE00F9F219 /* EntryArray.cpp */; }; + 899ABC371215E4BE00F9F219 /* EntryArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC2F1215E4BE00F9F219 /* EntryArray.h */; }; + 899ABC391215E4BE00F9F219 /* FileEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC311215E4BE00F9F219 /* FileEntry.cpp */; }; + 899ABC3A1215E4BE00F9F219 /* FileEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC321215E4BE00F9F219 /* FileEntry.h */; }; + 899ABC5D1215EB2A00F9F219 /* JSDirectoryEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC551215EB2A00F9F219 /* JSDirectoryEntry.cpp */; }; + 899ABC5E1215EB2A00F9F219 /* JSDirectoryEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC561215EB2A00F9F219 /* JSDirectoryEntry.h */; }; + 899ABC5F1215EB2A00F9F219 /* JSEntriesCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC571215EB2A00F9F219 /* JSEntriesCallback.cpp */; }; + 899ABC601215EB2A00F9F219 /* JSEntriesCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC581215EB2A00F9F219 /* JSEntriesCallback.h */; }; + 899ABC611215EB2A00F9F219 /* JSEntryArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC591215EB2A00F9F219 /* JSEntryArray.cpp */; }; + 899ABC621215EB2A00F9F219 /* JSEntryArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC5A1215EB2A00F9F219 /* JSEntryArray.h */; }; + 899ABC631215EB2A00F9F219 /* JSFileEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC5B1215EB2A00F9F219 /* JSFileEntry.cpp */; }; + 899ABC641215EB2A00F9F219 /* JSFileEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC5C1215EB2A00F9F219 /* JSFileEntry.h */; }; + 899ABC6D1215ECEF00F9F219 /* JSDirectoryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 899ABC6B1215ECEF00F9F219 /* JSDirectoryReader.cpp */; }; + 899ABC6E1215ECEF00F9F219 /* JSDirectoryReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 899ABC6C1215ECEF00F9F219 /* JSDirectoryReader.h */; }; + 899ABC791215F03100F9F219 /* JSDOMFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D8D1200035F0082740C /* JSDOMFileSystem.cpp */; }; + 899ABC7A1215F03100F9F219 /* JSDOMFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D8E1200035F0082740C /* JSDOMFileSystem.h */; }; + 899ABC7B1215F03300F9F219 /* JSEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D4911FF6C900082740C /* JSEntry.cpp */; }; + 899ABC7C1215F03300F9F219 /* JSEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D4A11FF6C900082740C /* JSEntry.h */; }; + 899ABC7D1215F03600F9F219 /* JSEntryCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D4B11FF6C900082740C /* JSEntryCallback.cpp */; }; + 899ABC7E1215F03700F9F219 /* JSEntryCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D4C11FF6C900082740C /* JSEntryCallback.h */; }; + 899ABC7F1215F03800F9F219 /* JSErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D4D11FF6C900082740C /* JSErrorCallback.cpp */; }; + 899ABC801215F03800F9F219 /* JSErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D4E11FF6C900082740C /* JSErrorCallback.h */; }; + 899ABC811215F03B00F9F219 /* JSFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D92120003760082740C /* JSFlags.h */; }; + 899ABC821215F03B00F9F219 /* JSFlags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D91120003760082740C /* JSFlags.cpp */; }; + 899ABC831215F03C00F9F219 /* JSFileSystemCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D5611FF6CA40082740C /* JSFileSystemCallback.h */; }; + 899ABC841215F03D00F9F219 /* JSFileSystemCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D5511FF6CA40082740C /* JSFileSystemCallback.cpp */; }; + 899ABC861215F0D800F9F219 /* DOMFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D1911FF58A50082740C /* DOMFileSystem.cpp */; }; + 899ABC871215F0DF00F9F219 /* DOMFileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D1A11FF58A50082740C /* DOMFileSystem.h */; }; + 899ABC961215F9DA00F9F219 /* ErrorCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D2011FF58A50082740C /* ErrorCallback.h */; }; + 899ABC971215F9DF00F9F219 /* EntryCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D1E11FF58A50082740C /* EntryCallback.h */; }; + 899ABCAA1215FA5500F9F219 /* FileSystemCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D2111FF58A50082740C /* FileSystemCallback.h */; }; + 899ABCAB1215FA5A00F9F219 /* Flags.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D60120001220082740C /* Flags.h */; }; + 899ABCB91215FAB500F9F219 /* Entry.h in Headers */ = {isa = PBXBuildFile; fileRef = 897A2D1D11FF58A50082740C /* Entry.h */; }; + 899ABCBA1215FAB800F9F219 /* Entry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 897A2D1C11FF58A50082740C /* Entry.cpp */; }; 89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89B5EA9F11E8003D00F2367E /* LineEnding.cpp */; }; 89B5EAA211E8003D00F2367E /* LineEnding.h in Headers */ = {isa = PBXBuildFile; fileRef = 89B5EAA011E8003D00F2367E /* LineEnding.h */; settings = {ATTRIBUTES = (Private, ); }; }; 89BED5EB11BE11CE00448492 /* BlobBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */; }; @@ -2592,7 +2650,6 @@ 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 /* 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, ); }; }; @@ -2622,7 +2679,6 @@ 93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23B02DE4396018635CA /* HTMLDocument.cpp */; }; 93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23E02DE4396018635CA /* HTMLElement.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 */; }; @@ -2667,6 +2723,8 @@ 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 */; }; + 978B6FC912128821001595EF /* HTMLViewSourceParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 978B6FC712128821001595EF /* HTMLViewSourceParser.cpp */; }; + 978B6FCA12128821001595EF /* HTMLViewSourceParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 978B6FC812128821001595EF /* HTMLViewSourceParser.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 */; }; @@ -3170,6 +3228,9 @@ A8A564A611DC0E59003AC2F0 /* HTMLFormattingElementList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A564A411DC0E59003AC2F0 /* HTMLFormattingElementList.cpp */; }; A8A909AC0CBCD6B50029B807 /* RenderSVGTransformableContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A909AA0CBCD6B50029B807 /* RenderSVGTransformableContainer.h */; }; A8A909AD0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A909AB0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp */; }; + A8BC044E1214EB2A00B5F122 /* HTMLEntitySearch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 970C4FDF1211266200C3D393 /* HTMLEntitySearch.cpp */; }; + A8BC044F1214EB2B00B5F122 /* HTMLEntitySearch.h in Headers */ = {isa = PBXBuildFile; fileRef = 970C4FE01211266200C3D393 /* HTMLEntitySearch.h */; }; + A8BC04921214F69600B5F122 /* HTMLEntityTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8BC04911214F69600B5F122 /* HTMLEntityTable.cpp */; }; A8BCFD05120A046100B5F122 /* SVGPathSeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8BCFD04120A046100B5F122 /* SVGPathSeg.cpp */; }; A8C2280E11D4A59700D5A7D3 /* DocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */; }; A8C228A111D5722E00D5A7D3 /* DecodedDataDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C2289F11D5722E00D5A7D3 /* DecodedDataDocumentParser.h */; }; @@ -4022,7 +4083,7 @@ B2A015A90AF6CD53006BCE0E /* GraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A015930AF6CD53006BCE0E /* GraphicsContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2A015AA0AF6CD53006BCE0E /* GraphicsTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A015940AF6CD53006BCE0E /* GraphicsTypes.cpp */; }; B2A015AB0AF6CD53006BCE0E /* GraphicsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A015950AF6CD53006BCE0E /* GraphicsTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; - B2A10B920B3818BD00099AA4 /* ImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A10B910B3818BD00099AA4 /* ImageBuffer.h */; }; + B2A10B920B3818BD00099AA4 /* ImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A10B910B3818BD00099AA4 /* ImageBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2A10B940B3818D700099AA4 /* ImageBufferCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A10B930B3818D700099AA4 /* ImageBufferCG.cpp */; }; B2A1F2AA0CEF0ABF00442F6A /* SVGFontElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A1F2A10CEF0ABF00442F6A /* SVGFontElement.cpp */; }; B2A1F2AB0CEF0ABF00442F6A /* SVGFontElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A1F2A20CEF0ABF00442F6A /* SVGFontElement.h */; }; @@ -4053,8 +4114,6 @@ B2B2645D0D00A77E000ACC1D /* StringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */; }; B2B33A5F0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */; }; B2B33A600B887CEF00C15984 /* SVGCharacterLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = B2B33A5E0B887CEF00C15984 /* SVGCharacterLayoutInfo.h */; }; - B2C3DA1F0D006C1D00EF6F26 /* AtomicString.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9EE0D006C1D00EF6F26 /* AtomicString.h */; settings = {ATTRIBUTES = (Private, ); }; }; - B2C3DA200D006C1D00EF6F26 /* AtomicStringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9EF0D006C1D00EF6F26 /* AtomicStringImpl.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */; }; B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F10D006C1D00EF6F26 /* Base64.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA230D006C1D00EF6F26 /* BidiContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */; }; @@ -4068,8 +4127,6 @@ B2C3DA2E0D006C1D00EF6F26 /* SegmentedString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9FE0D006C1D00EF6F26 /* SegmentedString.cpp */; }; B2C3DA2F0D006C1D00EF6F26 /* SegmentedString.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9FF0D006C1D00EF6F26 /* SegmentedString.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA300D006C1D00EF6F26 /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA000D006C1D00EF6F26 /* String.cpp */; }; - B2C3DA310D006C1D00EF6F26 /* StringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA010D006C1D00EF6F26 /* StringHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; - B2C3DA330D006C1D00EF6F26 /* StringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA030D006C1D00EF6F26 /* StringImpl.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA360D006C1D00EF6F26 /* TextBreakIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA370D006C1D00EF6F26 /* TextBreakIteratorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA070D006C1D00EF6F26 /* TextBreakIteratorICU.cpp */; }; @@ -4758,6 +4815,7 @@ BCA8C83111E3D53200812FB7 /* BackForwardControllerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8C83011E3D53200812FB7 /* BackForwardControllerClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */; }; BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BCA979171215D055005C485C /* ImageBufferData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA979161215D055005C485C /* ImageBufferData.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCAA90C30A7EBA60008B1229 /* Scrollbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */; }; BCACF3BC1072921A00C0C8A3 /* UserContentURLPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCACF3BA1072921A00C0C8A3 /* UserContentURLPattern.cpp */; }; BCACF3BD1072921A00C0C8A3 /* UserContentURLPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = BCACF3BB1072921A00C0C8A3 /* UserContentURLPattern.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -4951,6 +5009,8 @@ C0DFC8700DB6841A003EAE7C /* JSConsoleCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */; }; C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; }; C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; }; + C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; }; + C50B561712119D23008B46E0 /* GroupSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C50B561512119D23008B46E0 /* GroupSettings.h */; settings = {ATTRIBUTES = (Private, ); }; }; C50D0E820FF4272900AC2644 /* StorageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */; }; C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = C50D0E810FF4272900AC2644 /* StorageNamespace.h */; }; C5102D940FD9AA2D00FAFF04 /* StorageSyncManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */; }; @@ -4972,6 +5032,7 @@ C572EE0F1201C736007D8F82 /* IDBIndexBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */; }; C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */; }; C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */; }; + C57FEDE11212EE9C0097BE65 /* FileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */; }; C585A65E11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A65C11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp */; }; C585A65F11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A65D11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp */; }; C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */; }; @@ -5204,8 +5265,6 @@ 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 /* 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, ); }; }; @@ -5883,6 +5942,8 @@ 08C34AF41179C057002D7456 /* RenderSVGResourceLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceLinearGradient.h; sourceTree = "<group>"; }; 08C34AFB1179C072002D7456 /* RenderSVGResourceRadialGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceRadialGradient.cpp; sourceTree = "<group>"; }; 08C34AFC1179C072002D7456 /* RenderSVGResourceRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceRadialGradient.h; sourceTree = "<group>"; }; + 08C46B671212F15D0011AF40 /* SVGImageBufferTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGImageBufferTools.cpp; sourceTree = "<group>"; }; + 08C46B681212F15D0011AF40 /* SVGImageBufferTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageBufferTools.h; sourceTree = "<group>"; }; 08C4C5140EF19A4000E4840F /* WMLImageElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLImageElement.cpp; sourceTree = "<group>"; }; 08C4C5150EF19A4000E4840F /* WMLImageElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLImageElement.h; sourceTree = "<group>"; }; 08C4C5160EF19A4000E4840F /* WMLImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLImageLoader.cpp; sourceTree = "<group>"; }; @@ -5943,7 +6004,6 @@ 0F69B9C8120FE1D6000E1FC7 /* RenderMathMLFenced.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLFenced.h; sourceTree = "<group>"; }; 0F6ECD430F252F3700BDE271 /* CSSPropertyLonghand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPropertyLonghand.h; sourceTree = "<group>"; }; 0F6ECD440F252F3700BDE271 /* CSSPropertyLonghand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSPropertyLonghand.cpp; sourceTree = "<group>"; }; - 0FC705200EB1815600B90AD8 /* AtomicStringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringHash.h; sourceTree = "<group>"; }; 0FCF33230F2B9715004B6795 /* ColorCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorCG.cpp; sourceTree = "<group>"; }; 0FCF33280F2B9A25004B6795 /* WebTiledLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTiledLayer.mm; sourceTree = "<group>"; }; 0FCF33290F2B9A25004B6795 /* WebTiledLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTiledLayer.h; sourceTree = "<group>"; }; @@ -6463,6 +6523,16 @@ 2ECF7AE010162B5800427DE7 /* ErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ErrorEvent.idl; sourceTree = "<group>"; }; 2ED609BA1145B07100C8684E /* DOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMFormData.cpp; sourceTree = "<group>"; }; 2ED609BB1145B07100C8684E /* DOMFormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFormData.h; sourceTree = "<group>"; }; + 2EDEF1ED121B0EFC00726DB2 /* BlobData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobData.cpp; sourceTree = "<group>"; }; + 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobData.h; sourceTree = "<group>"; }; + 2EDEF1EF121B0EFC00726DB2 /* BlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobRegistry.h; sourceTree = "<group>"; }; + 2EDEF1F0121B0EFC00726DB2 /* BlobRegistryImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobRegistryImpl.cpp; sourceTree = "<group>"; }; + 2EDEF1F1121B0EFC00726DB2 /* BlobRegistryImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobRegistryImpl.h; sourceTree = "<group>"; }; + 2EDEF1F2121B0EFC00726DB2 /* BlobStorageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobStorageData.h; sourceTree = "<group>"; }; + 2EED575012109ED0007656BB /* BlobURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobURL.cpp; sourceTree = "<group>"; }; + 2EED575112109ED0007656BB /* BlobURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobURL.h; sourceTree = "<group>"; }; + 2EED57FB1214A9C2007656BB /* ThreadableBlobRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadableBlobRegistry.cpp; sourceTree = "<group>"; }; + 2EED57FC1214A9C2007656BB /* ThreadableBlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadableBlobRegistry.h; sourceTree = "<group>"; }; 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframeRule.cpp; sourceTree = "<group>"; }; 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSKeyframeRule.h; sourceTree = "<group>"; }; 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframesRule.cpp; sourceTree = "<group>"; }; @@ -6660,6 +6730,8 @@ 46F9D5DA0B0D60170028EE36 /* aliasCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = aliasCursor.png; sourceTree = "<group>"; }; 46F9D5DB0B0D60170028EE36 /* noDropCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = noDropCursor.png; sourceTree = "<group>"; }; 46F9D5DC0B0D60170028EE36 /* progressCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = progressCursor.png; sourceTree = "<group>"; }; + 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; }; + 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; }; 492273A21083B3B100EE5C84 /* JSArrayBufferViewCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferViewCustom.cpp; sourceTree = "<group>"; }; 49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasGradient.cpp; path = canvas/CanvasGradient.cpp; sourceTree = "<group>"; }; 49484FB4102CF23C00187DD3 /* CanvasGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasGradient.h; path = canvas/CanvasGradient.h; sourceTree = "<group>"; }; @@ -7077,6 +7149,8 @@ 5DC87EEF11716DF2001C0E6D /* EmptyProtocolDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyProtocolDefinitions.h; sourceTree = "<group>"; }; 626CDE0C1140424C001E5A68 /* SpatialNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpatialNavigation.cpp; sourceTree = "<group>"; }; 626CDE0D1140424C001E5A68 /* SpatialNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpatialNavigation.h; sourceTree = "<group>"; }; + 628D214B12131ED10055DCFC /* NetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkingContext.h; sourceTree = "<group>"; }; + 628D214D12131EF40055DCFC /* FrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameNetworkingContext.h; sourceTree = "<group>"; }; 62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SuspendableTimer.cpp; sourceTree = "<group>"; }; 62C1217B11AB9E77003C462C /* SuspendableTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuspendableTimer.h; sourceTree = "<group>"; }; 62CD32561157E57C0063B0A7 /* CustomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomEvent.cpp; sourceTree = "<group>"; }; @@ -7332,6 +7406,10 @@ 84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListSource.h; sourceTree = "<group>"; }; 84BDA16911358D2A00DBF64C /* RenderSVGResourceClipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGResourceClipper.cpp; sourceTree = "<group>"; }; 84BDA16A11358D2A00DBF64C /* RenderSVGResourceClipper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGResourceClipper.h; sourceTree = "<group>"; }; + 84C5B2F81216DC810088B53A /* SVGPathTraversalStateBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathTraversalStateBuilder.cpp; sourceTree = "<group>"; }; + 84C5B2F91216DC810088B53A /* SVGPathTraversalStateBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathTraversalStateBuilder.h; sourceTree = "<group>"; }; + 84C6784A1214814700A92902 /* SVGPathBlender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathBlender.cpp; sourceTree = "<group>"; }; + 84C6784B1214814700A92902 /* SVGPathBlender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathBlender.h; sourceTree = "<group>"; }; 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AffineTransform.cpp; path = transforms/AffineTransform.cpp; sourceTree = "<group>"; }; 84D0C4051115F1EA0018AA34 /* AffineTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AffineTransform.h; path = transforms/AffineTransform.h; sourceTree = "<group>"; }; 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGDefsElement.h; sourceTree = "<group>"; }; @@ -8184,6 +8262,30 @@ 897A2D92120003760082740C /* JSFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFlags.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>"; }; + 899ABC201215E4A300F9F219 /* DirectoryEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryEntry.cpp; sourceTree = "<group>"; }; + 899ABC211215E4A300F9F219 /* DirectoryEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryEntry.h; sourceTree = "<group>"; }; + 899ABC221215E4A300F9F219 /* DirectoryEntry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DirectoryEntry.idl; sourceTree = "<group>"; }; + 899ABC231215E4A300F9F219 /* DirectoryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryReader.cpp; sourceTree = "<group>"; }; + 899ABC241215E4A300F9F219 /* DirectoryReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryReader.h; sourceTree = "<group>"; }; + 899ABC251215E4A300F9F219 /* DirectoryReader.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DirectoryReader.idl; sourceTree = "<group>"; }; + 899ABC2C1215E4BE00F9F219 /* EntriesCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntriesCallback.h; sourceTree = "<group>"; }; + 899ABC2D1215E4BE00F9F219 /* EntriesCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EntriesCallback.idl; sourceTree = "<group>"; }; + 899ABC2E1215E4BE00F9F219 /* EntryArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EntryArray.cpp; sourceTree = "<group>"; }; + 899ABC2F1215E4BE00F9F219 /* EntryArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntryArray.h; sourceTree = "<group>"; }; + 899ABC301215E4BE00F9F219 /* EntryArray.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EntryArray.idl; sourceTree = "<group>"; }; + 899ABC311215E4BE00F9F219 /* FileEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileEntry.cpp; sourceTree = "<group>"; }; + 899ABC321215E4BE00F9F219 /* FileEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileEntry.h; sourceTree = "<group>"; }; + 899ABC331215E4BE00F9F219 /* FileEntry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileEntry.idl; sourceTree = "<group>"; }; + 899ABC551215EB2A00F9F219 /* JSDirectoryEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDirectoryEntry.cpp; sourceTree = "<group>"; }; + 899ABC561215EB2A00F9F219 /* JSDirectoryEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDirectoryEntry.h; sourceTree = "<group>"; }; + 899ABC571215EB2A00F9F219 /* JSEntriesCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntriesCallback.cpp; sourceTree = "<group>"; }; + 899ABC581215EB2A00F9F219 /* JSEntriesCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEntriesCallback.h; sourceTree = "<group>"; }; + 899ABC591215EB2A00F9F219 /* JSEntryArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntryArray.cpp; sourceTree = "<group>"; }; + 899ABC5A1215EB2A00F9F219 /* JSEntryArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEntryArray.h; sourceTree = "<group>"; }; + 899ABC5B1215EB2A00F9F219 /* JSFileEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileEntry.cpp; sourceTree = "<group>"; }; + 899ABC5C1215EB2A00F9F219 /* JSFileEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileEntry.h; sourceTree = "<group>"; }; + 899ABC6B1215ECEF00F9F219 /* JSDirectoryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDirectoryReader.cpp; sourceTree = "<group>"; }; + 899ABC6C1215ECEF00F9F219 /* JSDirectoryReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDirectoryReader.h; sourceTree = "<group>"; }; 89B5EA9F11E8003D00F2367E /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; }; 89B5EAA011E8003D00F2367E /* LineEnding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineEnding.h; sourceTree = "<group>"; }; 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobBuilder.cpp; sourceTree = "<group>"; }; @@ -8460,6 +8562,10 @@ 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>"; }; + 970C4FDF1211266200C3D393 /* HTMLEntitySearch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLEntitySearch.cpp; sourceTree = "<group>"; }; + 970C4FE01211266200C3D393 /* HTMLEntitySearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLEntitySearch.h; sourceTree = "<group>"; }; + 970C4FE11211266200C3D393 /* HTMLEntityTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLEntityTable.cpp; sourceTree = "<group>"; }; + 970C4FE21211266200C3D393 /* HTMLEntityTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLEntityTable.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>"; }; @@ -8469,6 +8575,8 @@ 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>"; }; + 978B6FC712128821001595EF /* HTMLViewSourceParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceParser.cpp; sourceTree = "<group>"; }; + 978B6FC812128821001595EF /* HTMLViewSourceParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceParser.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>"; }; @@ -8843,6 +8951,7 @@ A8A564A411DC0E59003AC2F0 /* HTMLFormattingElementList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFormattingElementList.cpp; sourceTree = "<group>"; }; A8A909AA0CBCD6B50029B807 /* RenderSVGTransformableContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTransformableContainer.h; sourceTree = "<group>"; }; A8A909AB0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGTransformableContainer.cpp; sourceTree = "<group>"; }; + A8BC04911214F69600B5F122 /* HTMLEntityTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLEntityTable.cpp; sourceTree = "<group>"; }; A8BCFD04120A046100B5F122 /* SVGPathSeg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSeg.cpp; sourceTree = "<group>"; }; A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentParser.cpp; sourceTree = "<group>"; }; A8C2289F11D5722E00D5A7D3 /* DecodedDataDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodedDataDocumentParser.h; sourceTree = "<group>"; }; @@ -9753,8 +9862,6 @@ B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StringImplCF.cpp; sourceTree = "<group>"; }; B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGCharacterLayoutInfo.cpp; sourceTree = "<group>"; }; B2B33A5E0B887CEF00C15984 /* SVGCharacterLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGCharacterLayoutInfo.h; sourceTree = "<group>"; }; - B2C3D9EE0D006C1D00EF6F26 /* AtomicString.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AtomicString.h; sourceTree = "<group>"; }; - B2C3D9EF0D006C1D00EF6F26 /* AtomicStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AtomicStringImpl.h; sourceTree = "<group>"; }; B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; }; B2C3D9F10D006C1D00EF6F26 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; }; B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BidiContext.cpp; sourceTree = "<group>"; }; @@ -9768,8 +9875,6 @@ B2C3D9FE0D006C1D00EF6F26 /* SegmentedString.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SegmentedString.cpp; sourceTree = "<group>"; }; B2C3D9FF0D006C1D00EF6F26 /* SegmentedString.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SegmentedString.h; sourceTree = "<group>"; }; B2C3DA000D006C1D00EF6F26 /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = String.cpp; sourceTree = "<group>"; }; - B2C3DA010D006C1D00EF6F26 /* StringHash.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StringHash.h; sourceTree = "<group>"; }; - B2C3DA030D006C1D00EF6F26 /* StringImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StringImpl.h; sourceTree = "<group>"; }; B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBoundaries.h; sourceTree = "<group>"; }; B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBreakIterator.h; sourceTree = "<group>"; }; B2C3DA070D006C1D00EF6F26 /* TextBreakIteratorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorICU.cpp; sourceTree = "<group>"; }; @@ -10494,6 +10599,7 @@ BCA8C83011E3D53200812FB7 /* BackForwardControllerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardControllerClient.h; sourceTree = "<group>"; }; BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardListImpl.cpp; sourceTree = "<group>"; }; BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardListImpl.h; sourceTree = "<group>"; }; + BCA979161215D055005C485C /* ImageBufferData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferData.h; sourceTree = "<group>"; }; BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Scrollbar.cpp; path = platform/Scrollbar.cpp; sourceTree = SOURCE_ROOT; }; BCACF3BA1072921A00C0C8A3 /* UserContentURLPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserContentURLPattern.cpp; sourceTree = "<group>"; }; BCACF3BB1072921A00C0C8A3 /* UserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserContentURLPattern.h; sourceTree = "<group>"; }; @@ -10698,6 +10804,8 @@ C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsoleCustom.cpp; sourceTree = "<group>"; }; C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextEncodingDetectorICU.cpp; sourceTree = "<group>"; }; C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEncodingDetector.h; sourceTree = "<group>"; }; + C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; }; + C50B561512119D23008B46E0 /* GroupSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupSettings.h; sourceTree = "<group>"; }; C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespace.cpp; sourceTree = "<group>"; }; C50D0E810FF4272900AC2644 /* StorageNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespace.h; sourceTree = "<group>"; }; C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageSyncManager.h; sourceTree = "<group>"; }; @@ -10721,6 +10829,7 @@ C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexBackendInterface.h; sourceTree = "<group>"; }; C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndex.cpp; sourceTree = "<group>"; }; C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndex.h; sourceTree = "<group>"; }; + C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystem.cpp; sourceTree = "<group>"; }; C585A65C11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAnyCustom.cpp; sourceTree = "<group>"; }; C585A65D11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKeyCustom.cpp; sourceTree = "<group>"; }; C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBBindingUtilities.cpp; sourceTree = "<group>"; }; @@ -10927,7 +11036,6 @@ E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGlobalData.cpp; sourceTree = "<group>"; }; E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocTypeStrings.cpp; sourceTree = "<group>"; }; E406F3FB1198307D009D59D6 /* ColorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorData.cpp; sourceTree = "<group>"; }; - E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLEntityNames.cpp; sourceTree = "<group>"; }; E415F10C0D9A05870033CE97 /* ElementTimeControl.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ElementTimeControl.idl; sourceTree = "<group>"; }; E415F1680D9A165D0033CE97 /* DOMElementTimeControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMElementTimeControl.h; sourceTree = "<group>"; }; E415F1830D9A1A830033CE97 /* ElementTimeControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementTimeControl.h; sourceTree = "<group>"; }; @@ -10994,8 +11102,6 @@ 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 /* 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>"; }; @@ -11024,8 +11130,6 @@ F523D23F02DE4396018635CA /* HTMLElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElement.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; }; @@ -11459,16 +11563,30 @@ 1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */, 1AD51A120CB59CD300953D11 /* DatabaseTracker.h */, 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */, + 899ABC201215E4A300F9F219 /* DirectoryEntry.cpp */, + 899ABC211215E4A300F9F219 /* DirectoryEntry.h */, + 899ABC221215E4A300F9F219 /* DirectoryEntry.idl */, + 899ABC231215E4A300F9F219 /* DirectoryReader.cpp */, + 899ABC241215E4A300F9F219 /* DirectoryReader.h */, + 899ABC251215E4A300F9F219 /* DirectoryReader.idl */, 897A2D1911FF58A50082740C /* DOMFileSystem.cpp */, 897A2D1A11FF58A50082740C /* DOMFileSystem.h */, 897A2D1B11FF58A50082740C /* DOMFileSystem.idl */, + 899ABC2C1215E4BE00F9F219 /* EntriesCallback.h */, + 899ABC2D1215E4BE00F9F219 /* EntriesCallback.idl */, 897A2D1C11FF58A50082740C /* Entry.cpp */, 897A2D1D11FF58A50082740C /* Entry.h */, 897A2D3B11FF63860082740C /* Entry.idl */, + 899ABC2E1215E4BE00F9F219 /* EntryArray.cpp */, + 899ABC2F1215E4BE00F9F219 /* EntryArray.h */, + 899ABC301215E4BE00F9F219 /* EntryArray.idl */, 897A2D1E11FF58A50082740C /* EntryCallback.h */, 897A2D1F11FF58A50082740C /* EntryCallback.idl */, 897A2D2011FF58A50082740C /* ErrorCallback.h */, 897A2D5D120000FF0082740C /* ErrorCallback.idl */, + 899ABC311215E4BE00F9F219 /* FileEntry.cpp */, + 899ABC321215E4BE00F9F219 /* FileEntry.h */, + 899ABC331215E4BE00F9F219 /* FileEntry.idl */, 897A2D2111FF58A50082740C /* FileSystemCallback.h */, 897A2D5F120001220082740C /* FileSystemCallback.idl */, 897A2D60120001220082740C /* Flags.h */, @@ -12278,7 +12396,7 @@ E406F3FA1198304D009D59D6 /* DocTypeStrings.cpp */, A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */, A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */, - E406F4021198329A009D59D6 /* HTMLEntityNames.cpp */, + A8BC04911214F69600B5F122 /* HTMLEntityTable.cpp */, A8D06B380A265DCD005E7203 /* HTMLNames.cpp */, A8D06B370A265DCD005E7203 /* HTMLNames.h */, 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */, @@ -12316,11 +12434,18 @@ 656B84D70AEA1CE900A095B4 /* network */ = { isa = PBXGroup; children = ( + 628D214B12131ED10055DCFC /* NetworkingContext.h */, B2F34FE70E82F81700F627CD /* cf */, 656B84E70AEA1DAE00A095B4 /* mac */, 934F71370D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp */, 934F71390D5A6F1000018D69 /* AuthenticationChallengeBase.h */, E124748310AA161D00B79493 /* AuthenticationClient.h */, + 2EDEF1ED121B0EFC00726DB2 /* BlobData.cpp */, + 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */, + 2EDEF1EF121B0EFC00726DB2 /* BlobRegistry.h */, + 2EDEF1F0121B0EFC00726DB2 /* BlobRegistryImpl.cpp */, + 2EDEF1F1121B0EFC00726DB2 /* BlobRegistryImpl.h */, + 2EDEF1F2121B0EFC00726DB2 /* BlobStorageData.h */, 514C76580CE923A1007EF3CD /* Credential.cpp */, 514C76590CE923A1007EF3CD /* Credential.h */, 51A052321058774F00CC9E95 /* CredentialStorage.cpp */, @@ -12514,6 +12639,8 @@ 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */, FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */, FE80D7BC0E9C1F25000D6F75 /* Geoposition.idl */, + C50B561412119D23008B46E0 /* GroupSettings.cpp */, + C50B561512119D23008B46E0 /* GroupSettings.h */, 7693BACE106C2DCA007B0823 /* HaltablePlugin.h */, BC94D1500C275C8B006BC617 /* History.cpp */, BC94D1510C275C8B006BC617 /* History.h */, @@ -13850,6 +13977,8 @@ 89BED5E911BE11CE00448492 /* BlobBuilder.cpp */, 89BED5EA11BE11CE00448492 /* BlobBuilder.h */, 89CD027911C859A80070B791 /* BlobBuilder.idl */, + 2EED575012109ED0007656BB /* BlobURL.cpp */, + 2EED575112109ED0007656BB /* BlobURL.h */, 93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */, 93C441EE0F813A1A00C1A634 /* CollectionCache.h */, 93C441FF0F813AE100C1A634 /* CollectionType.h */, @@ -13971,6 +14100,10 @@ 859128790AB222EC00202265 /* HTMLEmbedElement.idl */, 976E895E11C0CA3A00EA9CA9 /* HTMLEntityParser.cpp */, 976E895F11C0CA3A00EA9CA9 /* HTMLEntityParser.h */, + 970C4FDF1211266200C3D393 /* HTMLEntitySearch.cpp */, + 970C4FE01211266200C3D393 /* HTMLEntitySearch.h */, + 970C4FE11211266200C3D393 /* HTMLEntityTable.cpp */, + 970C4FE21211266200C3D393 /* HTMLEntityTable.h */, A81369B9097374F500D74463 /* HTMLFieldSetElement.cpp */, A81369B8097374F500D74463 /* HTMLFieldSetElement.h */, 1AE2A9F40A1CDA5700B42B25 /* HTMLFieldSetElement.idl */, @@ -14160,6 +14293,8 @@ E446139A0CD6331000FADA75 /* HTMLVideoElement.idl */, BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */, BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */, + 978B6FC712128821001595EF /* HTMLViewSourceParser.cpp */, + 978B6FC812128821001595EF /* HTMLViewSourceParser.h */, A77979130D6B9D0C003851B9 /* ImageData.cpp */, A77979140D6B9D0C003851B9 /* ImageData.h */, A77979150D6B9D0C003851B9 /* ImageData.idl */, @@ -14167,18 +14302,16 @@ B0149E7C11A4B21500196A7B /* ImageResizerThread.h */, A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */, A456FA2511AD4A830020B420 /* LabelsNodeList.h */, - F523D25202DE4396018635CA /* LegacyHTMLDocumentParser.cpp */, - F523D25302DE4396018635CA /* LegacyHTMLDocumentParser.h */, F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */, F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */, - E4D4ABE00D7542F000F96869 /* LegacyPreloadScanner.cpp */, - E4D4ABE10D7542F100F96869 /* LegacyPreloadScanner.h */, E446139B0CD6331000FADA75 /* MediaError.h */, E446139C0CD6331000FADA75 /* MediaError.idl */, A5AFB34D115151A700B045CB /* StepRange.cpp */, A5AFB34E115151A700B045CB /* StepRange.h */, BCEF45E80E687767001C1287 /* TextMetrics.h */, BCEF453F0E676AC1001C1287 /* TextMetrics.idl */, + 2EED57FB1214A9C2007656BB /* ThreadableBlobRegistry.cpp */, + 2EED57FC1214A9C2007656BB /* ThreadableBlobRegistry.h */, E446139D0CD6331000FADA75 /* TimeRanges.cpp */, E446139E0CD6331000FADA75 /* TimeRanges.h */, E446139F0CD6331000FADA75 /* TimeRanges.idl */, @@ -14938,14 +15071,24 @@ B59DD697119029E5007E9684 /* JSDatabaseCallback.h */, B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */, B58CEB6711913607002A6790 /* JSDatabaseSync.h */, + 899ABC551215EB2A00F9F219 /* JSDirectoryEntry.cpp */, + 899ABC561215EB2A00F9F219 /* JSDirectoryEntry.h */, + 899ABC6B1215ECEF00F9F219 /* JSDirectoryReader.cpp */, + 899ABC6C1215ECEF00F9F219 /* JSDirectoryReader.h */, 897A2D8D1200035F0082740C /* JSDOMFileSystem.cpp */, 897A2D8E1200035F0082740C /* JSDOMFileSystem.h */, + 899ABC571215EB2A00F9F219 /* JSEntriesCallback.cpp */, + 899ABC581215EB2A00F9F219 /* JSEntriesCallback.h */, 897A2D4911FF6C900082740C /* JSEntry.cpp */, 897A2D4A11FF6C900082740C /* JSEntry.h */, + 899ABC591215EB2A00F9F219 /* JSEntryArray.cpp */, + 899ABC5A1215EB2A00F9F219 /* JSEntryArray.h */, 897A2D4B11FF6C900082740C /* JSEntryCallback.cpp */, 897A2D4C11FF6C900082740C /* JSEntryCallback.h */, 897A2D4D11FF6C900082740C /* JSErrorCallback.cpp */, 897A2D4E11FF6C900082740C /* JSErrorCallback.h */, + 899ABC5B1215EB2A00F9F219 /* JSFileEntry.cpp */, + 899ABC5C1215EB2A00F9F219 /* JSFileEntry.h */, 897A2D5511FF6CA40082740C /* JSFileSystemCallback.cpp */, 897A2D5611FF6CA40082740C /* JSFileSystemCallback.h */, 897A2D91120003760082740C /* JSFlags.cpp */, @@ -15318,6 +15461,8 @@ B22278BF0D00BF200071B782 /* SVGPaint.idl */, B22278C00D00BF200071B782 /* SVGParserUtilities.cpp */, B22278C10D00BF200071B782 /* SVGParserUtilities.h */, + 84C6784A1214814700A92902 /* SVGPathBlender.cpp */, + 84C6784B1214814700A92902 /* SVGPathBlender.h */, 8476C9E711DF6A2900555B02 /* SVGPathBuilder.cpp */, 8476C9E811DF6A2900555B02 /* SVGPathBuilder.h */, 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */, @@ -15387,6 +15532,8 @@ 8419D2B8120E0C7600141F8F /* SVGPathStringBuilder.h */, 84300BD9120C9AED0021954A /* SVGPathStringSource.cpp */, 84300BD5120C9AAC0021954A /* SVGPathStringSource.h */, + 84C5B2F81216DC810088B53A /* SVGPathTraversalStateBuilder.cpp */, + 84C5B2F91216DC810088B53A /* SVGPathTraversalStateBuilder.h */, B22278F10D00BF210071B782 /* SVGPatternElement.cpp */, B22278F20D00BF210071B782 /* SVGPatternElement.h */, B22278F30D00BF210071B782 /* SVGPatternElement.idl */, @@ -15573,6 +15720,7 @@ B2ED97700B1F55CE00257D0F /* GraphicsContextCG.cpp */, A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */, B2A10B930B3818D700099AA4 /* ImageBufferCG.cpp */, + BCA979161215D055005C485C /* ImageBufferData.h */, B27535300B053814002CE64F /* ImageCG.cpp */, B27535310B053814002CE64F /* ImageSourceCG.cpp */, 4B3480920EEF50D400AC1B41 /* ImageSourceCG.h */, @@ -15642,6 +15790,8 @@ B27535490B053814002CE64F /* mac */, F4EAF4AB10C74268009100D3 /* opentype */, 49E911B20EF86D27009D0CAF /* transforms */, + 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */, + 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */, A89943270B42338700D7C802 /* BitmapImage.cpp */, A89943260B42338700D7C802 /* BitmapImage.h */, B27535380B053814002CE64F /* Color.cpp */, @@ -15751,9 +15901,6 @@ B2B264590D00A77E000ACC1D /* cf */, B2C3D9F90D006C1D00EF6F26 /* mac */, B734B17F119B98DB006587BD /* transcoder */, - B2C3D9EE0D006C1D00EF6F26 /* AtomicString.h */, - 0FC705200EB1815600B90AD8 /* AtomicStringHash.h */, - B2C3D9EF0D006C1D00EF6F26 /* AtomicStringImpl.h */, 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */, B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */, B2C3D9F10D006C1D00EF6F26 /* Base64.h */, @@ -15774,8 +15921,6 @@ 939B3E4D0D3C1E8400B4A92B /* StringBuffer.h */, E1A302C00DE8376900C52F2C /* StringBuilder.cpp */, E1A302BB0DE8370300C52F2C /* StringBuilder.h */, - B2C3DA010D006C1D00EF6F26 /* StringHash.h */, - B2C3DA030D006C1D00EF6F26 /* StringImpl.h */, 97C0784F1165D5BE003A32EF /* SuffixTree.h */, B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */, B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */, @@ -16246,6 +16391,7 @@ BCB16BFB0979C38700467741 /* loader */ = { isa = PBXGroup; children = ( + 628D214D12131EF40055DCFC /* FrameNetworkingContext.h */, 1A8F6BB00DB55CDC001DB794 /* appcache */, 512DD8E80D91E691000F89EE /* archive */, 5126E6B60A2E3AEF005C29FA /* icon */, @@ -16448,6 +16594,7 @@ 1CA19E150DC255CA0065A994 /* EventLoop.h */, 934FE9E40B5CA539003E4A73 /* FileChooser.cpp */, 066C772A0AB603B700238CC4 /* FileChooser.h */, + C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */, 514B3F720C722047000530DF /* FileSystem.h */, BC073BA90C399B1F000F5979 /* FloatConversion.h */, BC3BC29B0E91AB0F00835588 /* HostWindow.h */, @@ -17081,6 +17228,8 @@ 0842BC711190144000C7D08F /* SVGCharacterData.h */, B2B33A5D0B887CEF00C15984 /* SVGCharacterLayoutInfo.cpp */, B2B33A5E0B887CEF00C15984 /* SVGCharacterLayoutInfo.h */, + 08C46B671212F15D0011AF40 /* SVGImageBufferTools.cpp */, + 08C46B681212F15D0011AF40 /* SVGImageBufferTools.h */, 853CA9E20AEEC608002372DC /* SVGInlineFlowBox.cpp */, 853CA9E30AEEC608002372DC /* SVGInlineFlowBox.h */, AA0972CA0B6947A800A705E9 /* SVGInlineTextBox.cpp */, @@ -17502,9 +17651,6 @@ 49EECDE010503C2400099FAB /* ArrayBufferView.h in Headers */, B0149E7E11A4B21500196A7B /* AsyncImageResizer.h in Headers */, 8A413AE01207BBA50082016E /* AsyncScriptRunner.h in Headers */, - B2C3DA1F0D006C1D00EF6F26 /* AtomicString.h in Headers */, - 0FC705210EB1815600B90AD8 /* AtomicStringHash.h in Headers */, - B2C3DA200D006C1D00EF6F26 /* AtomicStringImpl.h in Headers */, 37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */, A8C4A80D09D563270003AC8D /* Attr.h in Headers */, A8C4A80B09D563270003AC8D /* Attribute.h in Headers */, @@ -17534,6 +17680,7 @@ 2EAFAF0F10E2AF2D007ED3D6 /* Blob.h in Headers */, 89BED5EC11BE11CE00448492 /* BlobBuilder.h in Headers */, 8988E10F11A3508B00DB732E /* BlobItem.h in Headers */, + 2EED575612109ED0007656BB /* BlobURL.h in Headers */, 93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */, BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */, BC5EB5DB0E81B7EA00B25965 /* BorderValue.h in Headers */, @@ -18575,6 +18722,7 @@ D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */, 93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */, 658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */, + 628D214E12131EF40055DCFC /* FrameNetworkingContext.h in Headers */, 65A21485097A3F5300B9050A /* FrameTree.h in Headers */, 65CBFEFA0974F607001DAC25 /* FrameView.h in Headers */, 51E4ADB70C42B4CF0042BC55 /* FTPDirectoryDocument.h in Headers */, @@ -18642,6 +18790,7 @@ A8A563B411DB3D10003AC2F0 /* HTMLElementStack.h in Headers */, A871D45C0A127CBC00B12A68 /* HTMLEmbedElement.h in Headers */, 976E896111C0CA3A00EA9CA9 /* HTMLEntityParser.h in Headers */, + A8BC044F1214EB2B00B5F122 /* HTMLEntitySearch.h in Headers */, A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */, A8CFF7A60A156978000A4234 /* HTMLFontElement.h in Headers */, A8A564A511DC0E59003AC2F0 /* HTMLFormattingElementList.h in Headers */, @@ -18715,6 +18864,7 @@ A8EA79F20A1916DF00A8EF5F /* HTMLUListElement.h in Headers */, E44613AB0CD6331000FADA75 /* HTMLVideoElement.h in Headers */, BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */, + 978B6FCA12128821001595EF /* HTMLViewSourceParser.h in Headers */, 514C76710CE923A1007EF3CD /* HTTPHeaderMap.h in Headers */, 514C76730CE923A1007EF3CD /* HTTPParsers.h in Headers */, 375CD232119D43C800A2A859 /* Hyphenation.h in Headers */, @@ -18794,6 +18944,7 @@ F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */, 7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */, 41F062010F5F0B6600A07EAC /* InspectorResource.h in Headers */, + 7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */, 754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */, 4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */, F375CC071150D300008DDB81 /* InspectorWorkerResource.h in Headers */, @@ -19262,9 +19413,7 @@ A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */, 85EC9AFB0A71A2C600EEEAED /* Language.h in Headers */, 2D9066070BE141D400956998 /* LayoutState.h in Headers */, - 93F198F008245E59001E9ABC /* LegacyHTMLDocumentParser.h in Headers */, 93F198EF08245E59001E9ABC /* LegacyHTMLTreeBuilder.h in Headers */, - E49626C30D80D94900E3405C /* LegacyPreloadScanner.h in Headers */, 512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */, BCE65BEB0EACDF16007E4533 /* Length.h in Headers */, BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */, @@ -19325,6 +19474,7 @@ A9C6E5A60D746458006442E9 /* Navigator.h in Headers */, E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */, 656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */, + 628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */, 1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */, BCEF43DD0E674012001C1287 /* NinePieceImage.h in Headers */, 14115B5209F84B7100CA4FC1 /* Node.h in Headers */, @@ -19688,8 +19838,6 @@ C5102D940FD9AA2D00FAFF04 /* StorageSyncManager.h in Headers */, 939B3E4E0D3C1E8400B4A92B /* StringBuffer.h in Headers */, E1A302BC0DE8370300C52F2C /* StringBuilder.h in Headers */, - B2C3DA310D006C1D00EF6F26 /* StringHash.h in Headers */, - B2C3DA330D006C1D00EF6F26 /* StringImpl.h in Headers */, 65488D6B0DD5A83D009D83B2 /* StringSourceProvider.h in Headers */, B23540F30D00782E002382FA /* StringTruncator.h in Headers */, 849F77760EFEC6200090849D /* StrokeStyleApplier.h in Headers */, @@ -19814,6 +19962,7 @@ B2227A2A0D00BF220071B782 /* SVGGradientElement.h in Headers */, 650FBF2B0D9AF047008FC292 /* SVGHKernElement.h in Headers */, B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */, + 08C46B6A1212F15E0011AF40 /* SVGImageBufferTools.h in Headers */, B2227A2D0D00BF220071B782 /* SVGImageElement.h in Headers */, B28C6A2A0D00C44800334AA4 /* SVGImageLoader.h in Headers */, 853CA9E70AEEC608002372DC /* SVGInlineFlowBox.h in Headers */, @@ -19837,6 +19986,7 @@ B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */, B2227A540D00BF220071B782 /* SVGPaint.h in Headers */, B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */, + 84C6784D1214814700A92902 /* SVGPathBlender.h in Headers */, 8476C9EB11DF6A2900555B02 /* SVGPathBuilder.h in Headers */, 8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */, 8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */, @@ -19862,6 +20012,7 @@ 84300BD8120C9AD40021954A /* SVGPathSource.h in Headers */, 8419D2BA120E0C7600141F8F /* SVGPathStringBuilder.h in Headers */, 84300BD6120C9AAC0021954A /* SVGPathStringSource.h in Headers */, + 84C5B2FB1216DC810088B53A /* SVGPathTraversalStateBuilder.h in Headers */, B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */, B25599950D00D8BA00BB825C /* SVGPointLightSource.h in Headers */, B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */, @@ -19949,6 +20100,7 @@ BCE658FF0EA9248A007E4533 /* Theme.h in Headers */, BCE659E60EA92FB2007E4533 /* ThemeMac.h in Headers */, BCE659A90EA927B9007E4533 /* ThemeTypes.h in Headers */, + 2EED57FE1214A9C2007656BB /* ThreadableBlobRegistry.h in Headers */, 0B90561B0F2578BF0095FF6A /* ThreadableLoader.h in Headers */, 0B90561C0F2578BF0095FF6A /* ThreadableLoaderClient.h in Headers */, 5112247410CFB8D8008099D7 /* ThreadableWebSocketChannel.h in Headers */, @@ -20139,7 +20291,35 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, - 7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */, + C50B561712119D23008B46E0 /* GroupSettings.h in Headers */, + BCA979171215D055005C485C /* ImageBufferData.h in Headers */, + 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */, + 899ABC271215E4A300F9F219 /* DirectoryEntry.h in Headers */, + 899ABC2A1215E4A300F9F219 /* DirectoryReader.h in Headers */, + 899ABC341215E4BE00F9F219 /* EntriesCallback.h in Headers */, + 899ABC371215E4BE00F9F219 /* EntryArray.h in Headers */, + 899ABC3A1215E4BE00F9F219 /* FileEntry.h in Headers */, + 899ABC5E1215EB2A00F9F219 /* JSDirectoryEntry.h in Headers */, + 899ABC601215EB2A00F9F219 /* JSEntriesCallback.h in Headers */, + 899ABC621215EB2A00F9F219 /* JSEntryArray.h in Headers */, + 899ABC641215EB2A00F9F219 /* JSFileEntry.h in Headers */, + 899ABC6E1215ECEF00F9F219 /* JSDirectoryReader.h in Headers */, + 899ABC7A1215F03100F9F219 /* JSDOMFileSystem.h in Headers */, + 899ABC7C1215F03300F9F219 /* JSEntry.h in Headers */, + 899ABC7E1215F03700F9F219 /* JSEntryCallback.h in Headers */, + 899ABC801215F03800F9F219 /* JSErrorCallback.h in Headers */, + 899ABC811215F03B00F9F219 /* JSFlags.h in Headers */, + 899ABC831215F03C00F9F219 /* JSFileSystemCallback.h in Headers */, + 899ABC871215F0DF00F9F219 /* DOMFileSystem.h in Headers */, + 899ABC961215F9DA00F9F219 /* ErrorCallback.h in Headers */, + 899ABC971215F9DF00F9F219 /* EntryCallback.h in Headers */, + 899ABCAA1215FA5500F9F219 /* FileSystemCallback.h in Headers */, + 899ABCAB1215FA5A00F9F219 /* Flags.h in Headers */, + 899ABCB91215FAB500F9F219 /* Entry.h in Headers */, + 2EDEF1F4121B0EFC00726DB2 /* BlobData.h in Headers */, + 2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */, + 2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */, + 2EDEF1F8121B0EFC00726DB2 /* BlobStorageData.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -20284,7 +20464,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Don't do anything for Debug builds, so the Inspector is easier to debug.\nif [[ ${CONFIGURATION:=Debug} == \"Debug\" ]]; then\n exit\nfi\n\n# Combine all script resources in the inspector.html file.\n\"$SRCROOT/combine-javascript-resources\" --input-html \"${SRCROOT}/inspector/front-end/inspector.html\" --output-dir \"${DERIVED_FILE_DIR}/WebCore\" --output-script-name inspector.js\n\nif [ -d \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\" ]; then\n # Remove any JavaScript files, since they will be replaced with the combined file.\n cd \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\n rm *.js\n\n # Copy the modified HTML file and the combined script.\n cp \"${DERIVED_FILE_DIR}/WebCore/inspector.html\" inspector.html\n cp \"${DERIVED_FILE_DIR}/WebCore/inspector.js\" inspector.js\nfi\n"; + shellScript = "# Don't do anything for Debug builds, so the Inspector is easier to debug.\nif [[ ${CONFIGURATION:=Debug} == \"Debug\" ]]; then\n exit\nfi\n\n# Combine all script resources in the inspector.html file.\n\"$SRCROOT/combine-javascript-resources\" --input-html \"${SRCROOT}/inspector/front-end/inspector.html\" --generated-scripts-dir ${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore --output-dir \"${DERIVED_FILE_DIR}/WebCore\" --output-script-name inspector.js\n\nif [ -d \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\" ]; then\n # Remove any JavaScript files, since they will be replaced with the combined file.\n cd \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\n rm *.js\n\n # Copy the modified HTML file and the combined script.\n cp \"${DERIVED_FILE_DIR}/WebCore/inspector.html\" inspector.html\n cp \"${DERIVED_FILE_DIR}/WebCore/inspector.js\" inspector.js\nfi\n"; }; 1C81BA330E97357C00266E07 /* Copy Inspector Resources */ = { isa = PBXShellScriptBuildPhase; @@ -20300,7 +20480,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Copy all the Inspector front-end resources.\nditto \"${SRCROOT}/inspector/front-end\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\n\n# Remove the WebKit.qrc file since it is not used on the Mac (this file is for Qt)\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector/WebKit.qrc\"\n\n# Remove *.re2js files, they are only used to generate some .js files.\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector/\"*.re2js\n"; + shellScript = "# Copy all the Inspector front-end resources.\nditto \"${SRCROOT}/inspector/front-end\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\nditto \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore/InspectorBackendStub.js\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\n\n# Remove the WebKit.qrc file since it is not used on the Mac (this file is for Qt)\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector/WebKit.qrc\"\n\n# Remove *.re2js files, they are only used to generate some .js files.\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector/\"*.re2js\n"; }; 5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */ = { isa = PBXShellScriptBuildPhase; @@ -20507,6 +20687,7 @@ 2EAFAF0E10E2AF2D007ED3D6 /* Blob.cpp in Sources */, 89BED5EB11BE11CE00448492 /* BlobBuilder.cpp in Sources */, 8988E10E11A3508B00DB732E /* BlobItem.cpp in Sources */, + 2EED575512109ED0007656BB /* BlobURL.cpp in Sources */, 93F19AE108245E59001E9ABC /* BlockExceptions.mm in Sources */, BCEA4854097D93020094C9E4 /* break_lines.cpp in Sources */, 93309DDA099E64920056E581 /* BreakBlockquoteCommand.cpp in Sources */, @@ -21100,6 +21281,8 @@ A8A563B511DB3D10003AC2F0 /* HTMLElementStack.cpp in Sources */, A871D45F0A127CBC00B12A68 /* HTMLEmbedElement.cpp in Sources */, 976E896011C0CA3A00EA9CA9 /* HTMLEntityParser.cpp in Sources */, + A8BC044E1214EB2A00B5F122 /* HTMLEntitySearch.cpp in Sources */, + A8BC04921214F69600B5F122 /* HTMLEntityTable.cpp in Sources */, A81369D5097374F600D74463 /* HTMLFieldSetElement.cpp in Sources */, A8CFF7A20A156978000A4234 /* HTMLFontElement.cpp in Sources */, A8A564A611DC0E59003AC2F0 /* HTMLFormattingElementList.cpp in Sources */, @@ -21170,6 +21353,7 @@ A8EA79F30A1916DF00A8EF5F /* HTMLUListElement.cpp in Sources */, E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */, BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */, + 978B6FC912128821001595EF /* HTMLViewSourceParser.cpp in Sources */, 0B8C56D40F28627F000502E1 /* HTTPHeaderMap.cpp in Sources */, 514C76720CE923A1007EF3CD /* HTTPParsers.cpp in Sources */, 371A67CB11C6C7DB00047B8B /* HyphenationCF.cpp in Sources */, @@ -21237,6 +21421,7 @@ F344C75811294FF600F26EEE /* InspectorFrontendClientLocal.cpp in Sources */, 7A0E770E10C00A8800A0276E /* InspectorFrontendHost.cpp in Sources */, 41F062020F5F0B6600A07EAC /* InspectorResource.cpp in Sources */, + 7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */, 754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */, 4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */, 49EECDEB10503C2400099FAB /* Int16Array.cpp in Sources */, @@ -21798,9 +21983,7 @@ A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */, 9352084509BD43B900F2038D /* Language.mm in Sources */, 2D9066060BE141D400956998 /* LayoutState.cpp in Sources */, - 93F19A9C08245E59001E9ABC /* LegacyHTMLDocumentParser.cpp in Sources */, 93F19A9B08245E59001E9ABC /* LegacyHTMLTreeBuilder.cpp in Sources */, - E49626C20D80D94800E3405C /* LegacyPreloadScanner.cpp in Sources */, 512DD8F40D91E6AF000F89EE /* LegacyWebArchive.cpp in Sources */, 51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */, BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */, @@ -22284,6 +22467,7 @@ B2227A290D00BF220071B782 /* SVGGradientElement.cpp in Sources */, 650FBF2A0D9AF047008FC292 /* SVGHKernElement.cpp in Sources */, B25599A30D00D8BA00BB825C /* SVGImage.cpp in Sources */, + 08C46B691212F15E0011AF40 /* SVGImageBufferTools.cpp in Sources */, B2227A2C0D00BF220071B782 /* SVGImageElement.cpp in Sources */, B28C6A290D00C44800334AA4 /* SVGImageLoader.cpp in Sources */, 853CA9E60AEEC608002372DC /* SVGInlineFlowBox.cpp in Sources */, @@ -22305,6 +22489,7 @@ B2227A500D00BF220071B782 /* SVGNumberList.cpp in Sources */, B2227A530D00BF220071B782 /* SVGPaint.cpp in Sources */, B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */, + 84C6784C1214814700A92902 /* SVGPathBlender.cpp in Sources */, 8476C9EA11DF6A2900555B02 /* SVGPathBuilder.cpp in Sources */, 8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */, 8419D2AC120D92FC00141F8F /* SVGPathByteStreamSource.cpp in Sources */, @@ -22327,6 +22512,7 @@ B2227A830D00BF220071B782 /* SVGPathSegMoveto.cpp in Sources */, 8419D2B9120E0C7600141F8F /* SVGPathStringBuilder.cpp in Sources */, 84300BDA120C9AED0021954A /* SVGPathStringSource.cpp in Sources */, + 84C5B2FA1216DC810088B53A /* SVGPathTraversalStateBuilder.cpp in Sources */, B2227A870D00BF220071B782 /* SVGPatternElement.cpp in Sources */, B2227A8B0D00BF220071B782 /* SVGPointList.cpp in Sources */, B2227A8E0D00BF220071B782 /* SVGPolyElement.cpp in Sources */, @@ -22402,6 +22588,7 @@ B2C3DA4A0D006C1D00EF6F26 /* TextStream.cpp in Sources */, BCE65D320EAD1211007E4533 /* Theme.cpp in Sources */, BCE659E90EA92FFA007E4533 /* ThemeMac.mm in Sources */, + 2EED57FD1214A9C2007656BB /* ThreadableBlobRegistry.cpp in Sources */, 0B90561E0F257E930095FF6A /* ThreadableLoader.cpp in Sources */, 5112247210CFB8C6008099D7 /* ThreadableWebSocketChannel.cpp in Sources */, 51DF6D800B92A18E00C2DC85 /* ThreadCheck.mm in Sources */, @@ -22562,7 +22749,28 @@ 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - 7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */, + C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */, + 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */, + 899ABC261215E4A300F9F219 /* DirectoryEntry.cpp in Sources */, + 899ABC291215E4A300F9F219 /* DirectoryReader.cpp in Sources */, + 899ABC361215E4BE00F9F219 /* EntryArray.cpp in Sources */, + 899ABC391215E4BE00F9F219 /* FileEntry.cpp in Sources */, + 899ABC5D1215EB2A00F9F219 /* JSDirectoryEntry.cpp in Sources */, + 899ABC5F1215EB2A00F9F219 /* JSEntriesCallback.cpp in Sources */, + 899ABC611215EB2A00F9F219 /* JSEntryArray.cpp in Sources */, + 899ABC631215EB2A00F9F219 /* JSFileEntry.cpp in Sources */, + 899ABC6D1215ECEF00F9F219 /* JSDirectoryReader.cpp in Sources */, + 899ABC791215F03100F9F219 /* JSDOMFileSystem.cpp in Sources */, + 899ABC7B1215F03300F9F219 /* JSEntry.cpp in Sources */, + 899ABC7D1215F03600F9F219 /* JSEntryCallback.cpp in Sources */, + 899ABC7F1215F03800F9F219 /* JSErrorCallback.cpp in Sources */, + 899ABC821215F03B00F9F219 /* JSFlags.cpp in Sources */, + 899ABC841215F03D00F9F219 /* JSFileSystemCallback.cpp in Sources */, + 899ABC861215F0D800F9F219 /* DOMFileSystem.cpp in Sources */, + 899ABCBA1215FAB800F9F219 /* Entry.cpp in Sources */, + C57FEDE11212EE9C0097BE65 /* FileSystem.cpp in Sources */, + 2EDEF1F3121B0EFC00726DB2 /* BlobData.cpp in Sources */, + 2EDEF1F6121B0EFC00726DB2 /* BlobRegistryImpl.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index 24c29d4..6b90b63 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -354,10 +354,10 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const else if (isInlineWithContinuation(m_renderer->parent())) { RenderObject* continuation = toRenderInline(m_renderer->parent())->continuation(); - // Case 4a: continuation is a block - in this case the block itself is the next sibling. + // Case 5a: continuation is a block - in this case the block itself is the next sibling. if (continuation->isRenderBlock()) nextSibling = continuation; - // Case 4b: continuation is an inline - in this case the inline's first child is the next sibling + // Case 5b: continuation is an inline - in this case the inline's first child is the next sibling else nextSibling = firstChildConsideringContinuation(continuation); } @@ -368,6 +368,13 @@ AccessibilityObject* AccessibilityRenderObject::nextSibling() const return axObjectCache()->getOrCreate(nextSibling); } +static RenderBoxModelObject* nextContinuation(RenderObject* renderer) +{ + if (renderer->isInline() && !renderer->isReplaced()) + return toRenderInline(renderer)->continuation(); + return toRenderBlock(renderer)->inlineElementContinuation(); +} + RenderObject* AccessibilityRenderObject::renderParentObject() const { if (!m_renderer) @@ -377,7 +384,8 @@ RenderObject* AccessibilityRenderObject::renderParentObject() const // Case 1: node is a block and is an inline's continuation. Parent // is the start of the continuation chain. - RenderInline* startOfConts = 0; + RenderObject* startOfConts = 0; + RenderObject* firstChild = 0; if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_renderer))) parent = startOfConts; @@ -386,6 +394,20 @@ RenderObject* AccessibilityRenderObject::renderParentObject() const else if (parent && parent->isRenderInline() && (startOfConts = startOfContinuations(parent))) parent = startOfConts; + // Case 3: The first sibling is the beginning of a continuation chain. Find the origin of that continuation. + else if (parent && (firstChild = parent->firstChild()) && firstChild->node()) { + // Get the node's renderer and follow that continuation chain until the first child is found + RenderObject* nodeRenderFirstChild = firstChild->node()->renderer(); + if (nodeRenderFirstChild != firstChild) { + for (RenderObject* contsTest = nodeRenderFirstChild; contsTest; contsTest = nextContinuation(contsTest)) { + if (contsTest == firstChild) { + parent = nodeRenderFirstChild->parent(); + break; + } + } + } + } + return parent; } @@ -486,8 +508,9 @@ bool AccessibilityRenderObject::isFileUploadButton() const bool AccessibilityRenderObject::isInputImage() const { - if (m_renderer && m_renderer->node() && m_renderer->node()->hasTagName(inputTag)) { - HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->node()); + Node* elementNode = node(); + if (roleValue() == ButtonRole && elementNode && elementNode->hasTagName(inputTag)) { + HTMLInputElement* input = static_cast<HTMLInputElement*>(elementNode); return input->inputType() == HTMLInputElement::IMAGE; } @@ -569,8 +592,11 @@ bool AccessibilityRenderObject::isIndeterminate() const bool AccessibilityRenderObject::isNativeCheckboxOrRadio() const { Node* elementNode = node(); - if (elementNode && elementNode->isElementNode()) - return toInputElement(static_cast<Element*>(elementNode)); + if (elementNode && elementNode->isElementNode()) { + InputElement* input = toInputElement(static_cast<Element*>(elementNode)); + if (input) + return input->isCheckbox() || input->isRadioButton(); + } return false; } @@ -3299,8 +3325,10 @@ void AccessibilityRenderObject::addChildren() unsigned length = children.size(); for (unsigned i = 0; i < length; ++i) m_children.append(children[i]); - } else + } else { + ASSERT(obj->parentObject() == this); m_children.append(obj); + } } // for a RenderImage, add the <area> elements as individual accessibility objects diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index fd5d6bb..b162346 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -41,7 +41,6 @@ #include "AccessibilityTableCell.h" #include "AccessibilityTableColumn.h" #include "AccessibilityTableRow.h" -#include "AtomicString.h" #include "Document.h" #include "DocumentType.h" #include "Editor.h" @@ -58,6 +57,7 @@ #include "RenderText.h" #include "TextEncoding.h" #include <wtf/text/CString.h> +#include <wtf/text/AtomicString.h> #include <atk/atk.h> #include <glib.h> diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp index 9bea8ae..01911d8 100644 --- a/WebCore/bindings/ScriptControllerBase.cpp +++ b/WebCore/bindings/ScriptControllerBase.cpp @@ -72,12 +72,19 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, if (!protocolIsJavaScript(url)) return false; - if (m_frame->page() && !m_frame->page()->javaScriptURLsAreAllowed()) + if (!m_frame->page()) + return true; + + if (!m_frame->page()->javaScriptURLsAreAllowed()) return true; if (m_frame->inViewSourceMode()) return true; + // We need to hold onto the Frame here because executing script can + // destroy the frame. + RefPtr<Frame> protector(m_frame); + const int javascriptSchemeLength = sizeof("javascript:") - 1; String decodedURL = decodeURLEscapeSequences(url.string()); @@ -85,6 +92,11 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, if (xssAuditor()->canEvaluateJavaScriptURL(decodedURL)) result = executeScript(decodedURL.substring(javascriptSchemeLength), userGesture, AllowXSS); + // If executing script caused this frame to be removed from the page, we + // don't want to try to replace its document! + if (!m_frame->page()) + return true; + String scriptResult; #if USE(JSC) JSDOMWindowShell* shell = windowShell(mainThreadNormalWorld()); diff --git a/WebCore/platform/text/AtomicStringHash.h b/WebCore/bindings/cpp/WebDOMCustomVoidCallback.cpp index d13332b..d79eaae 100644 --- a/WebCore/platform/text/AtomicStringHash.h +++ b/WebCore/bindings/cpp/WebDOMCustomVoidCallback.cpp @@ -1,18 +1,18 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2010 Kevin Ollivier <kevino@theolliviers.com>. 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. + * 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. + * 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. + * 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 @@ -26,39 +26,23 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AtomicStringHash_h -#define AtomicStringHash_h - -#include "AtomicString.h" -#include <wtf/HashTraits.h> - -namespace WebCore { - - struct AtomicStringHash { - static unsigned hash(const AtomicString& key) - { - return key.impl()->existingHash(); - } - - static bool equal(const AtomicString& a, const AtomicString& b) - { - return a == b; - } - - static const bool safeToCompareToEmptyOrDeleted = false; - }; - +#include "config.h" +#include "WebDOMCustomVoidCallback.h" + +WebDOMCustomVoidCallback::WebDOMCustomVoidCallback() +{ } -namespace WTF { - - // WebCore::AtomicStringHash is the default hash for AtomicString - template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> { - static const bool emptyValueIsZero = true; - static void constructDeletedValue(WTF::AtomicString& slot) { new (&slot) WTF::AtomicString(HashTableDeletedValue); } - static bool isDeletedValue(const WTF::AtomicString& slot) { return slot.isHashTableDeletedValue(); } - }; +WebDOMCustomVoidCallback::~WebDOMCustomVoidCallback() +{ +} + +void WebDOMCustomVoidCallback::handleEvent() +{ } -#endif +WebCore::VoidCallback* toWebCore(const WebDOMCustomVoidCallback& callback) +{ + return const_cast<WebCore::VoidCallback*>((WebCore::VoidCallback*)&callback); +}
\ No newline at end of file diff --git a/WebCore/bindings/cpp/WebDOMCustomVoidCallback.h b/WebCore/bindings/cpp/WebDOMCustomVoidCallback.h new file mode 100644 index 0000000..0fd8f96 --- /dev/null +++ b/WebCore/bindings/cpp/WebDOMCustomVoidCallback.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) Kevin Ollivier <kevino@theolliviers.com>. 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 WebDOMCustomVoidCallback_h +#define WebDOMCustomVoidCallback_h + +#include "VoidCallback.h" +#include <wtf/PassRefPtr.h> + +// FIXME: This is just a stub to keep compilation working. We need to revisit +// this when we add support for these callbacks to the WebDOM bindings. + +class WebDOMCustomVoidCallback : public WebCore::VoidCallback { +public: + static PassRefPtr<WebDOMCustomVoidCallback> create() + { + return adoptRef(new WebDOMCustomVoidCallback()); + } + + virtual ~WebDOMCustomVoidCallback(); + + virtual void handleEvent(); + +private: + WebDOMCustomVoidCallback(); +}; + +WebCore::VoidCallback* toWebCore(const WebDOMCustomVoidCallback&); + +#endif // WebDOMCustomVoidCallback_h diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.cpp b/WebCore/bindings/cpp/WebDOMEventTarget.cpp index b24bc84..7dee138 100644 --- a/WebCore/bindings/cpp/WebDOMEventTarget.cpp +++ b/WebCore/bindings/cpp/WebDOMEventTarget.cpp @@ -197,3 +197,10 @@ WebDOMEventTarget toWebKit(WebCore::EventTarget* value) ASSERT_NOT_REACHED(); return WebDOMEventTarget(); } + +WebDOMEventTarget& WebDOMEventTarget::operator=(const WebDOMEventTarget& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMEventTargetPrivate(copy.impl()) : 0; + return *this; +} diff --git a/WebCore/bindings/cpp/WebDOMEventTarget.h b/WebCore/bindings/cpp/WebDOMEventTarget.h index d514372..4548a8b 100644 --- a/WebCore/bindings/cpp/WebDOMEventTarget.h +++ b/WebCore/bindings/cpp/WebDOMEventTarget.h @@ -64,6 +64,7 @@ public: WebDOMNotification toNotification(); WebDOMWebSocket toWebSocket(); + WebDOMEventTarget& operator=(const WebDOMEventTarget&); protected: struct WebDOMEventTargetPrivate; WebDOMEventTargetPrivate* m_impl; diff --git a/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp b/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp index 3f3378c..a16a329 100644 --- a/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp +++ b/WebCore/bindings/cpp/WebDOMHTMLCollectionCustom.cpp @@ -20,10 +20,10 @@ #include "config.h" #include "WebDOMHTMLCollection.h" -#include "AtomicString.h" #include "HTMLCollection.h" #include "WebDOMNode.h" #include <wtf/GetPtr.h> +#include <wtf/text/AtomicString.h> WebDOMNode WebDOMHTMLCollection::item(unsigned index) { diff --git a/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp b/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp index 3bab0c1..d608b0f 100644 --- a/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp +++ b/WebCore/bindings/cpp/WebDOMHTMLDocumentCustom.cpp @@ -25,11 +25,13 @@ #include "SegmentedString.h" #include "WebExceptionHandler.h" +#include <wtf/Forward.h> + static inline void documentWrite(const WebDOMString& text, WebCore::HTMLDocument* document, bool addNewline) { WebCore::SegmentedString segmentedString = WTF::String(text); if (addNewline) - segmentedString.append(WebCore::SegmentedString(&WebCore::newlineCharacter, 1)); + segmentedString.append(WebCore::SegmentedString(WTF::String(&WebCore::newlineCharacter))); document->write(segmentedString); } diff --git a/WebCore/bindings/cpp/WebDOMString.cpp b/WebCore/bindings/cpp/WebDOMString.cpp index 59d98f7..debd4f4 100644 --- a/WebCore/bindings/cpp/WebDOMString.cpp +++ b/WebCore/bindings/cpp/WebDOMString.cpp @@ -110,7 +110,7 @@ WebDOMString::operator WTF::AtomicString() const bool WebDOMString::equals(const char* string) const { - return WebCore::equal(m_private, string); + return WTF::equal(m_private, string); } void WebDOMString::assign(WebDOMStringPrivate* p) diff --git a/WebCore/bindings/generic/ActiveDOMCallback.cpp b/WebCore/bindings/generic/ActiveDOMCallback.cpp index 2e69d10..c42c93a 100644 --- a/WebCore/bindings/generic/ActiveDOMCallback.cpp +++ b/WebCore/bindings/generic/ActiveDOMCallback.cpp @@ -123,7 +123,6 @@ static void destroyOnContextThread(PassOwnPtr<ActiveDOMObjectCallbackImpl> impl) ActiveDOMCallback::ActiveDOMCallback(ScriptExecutionContext* context) : m_impl(new ActiveDOMObjectCallbackImpl(context)) { - ASSERT(context->isContextThread()); } ActiveDOMCallback::~ActiveDOMCallback() diff --git a/WebCore/bindings/generic/BindingDOMWindow.h b/WebCore/bindings/generic/BindingDOMWindow.h index dda5644..0c450a5 100644 --- a/WebCore/bindings/generic/BindingDOMWindow.h +++ b/WebCore/bindings/generic/BindingDOMWindow.h @@ -108,11 +108,9 @@ Frame* BindingDOMWindow<Binding>::createWindow(State<Binding>* state, // issues to pass the URL instead of "". bool created; - // We pass in the opener frame here so it can be used for looking up the - // frame name, in case the active frame is different from the opener frame, - // and the name references a frame relative to the opener frame, for example - // "_self" or "_parent". - Frame* newFrame = callingFrame->loader()->createWindow(openerFrame->loader(), frameRequest, windowFeatures, created); + // We pass the opener frame for the lookupFrame in case the active frame is different from + // the opener frame, and the name references a frame relative to the opener frame. + Frame* newFrame = WebCore::createWindow(callingFrame, openerFrame, frameRequest, windowFeatures, created); if (!newFrame) return 0; diff --git a/WebCore/bindings/gobject/GObjectEventListener.cpp b/WebCore/bindings/gobject/GObjectEventListener.cpp index 1a4f680..3ce8461 100644 --- a/WebCore/bindings/gobject/GObjectEventListener.cpp +++ b/WebCore/bindings/gobject/GObjectEventListener.cpp @@ -21,6 +21,7 @@ #include "Event.h" #include "EventListener.h" +#include "webkit/WebKitDOMEvent.h" #include "webkit/WebKitDOMEventPrivate.h" #include <wtf/HashMap.h> #include <wtf/text/CString.h> @@ -30,7 +31,7 @@ namespace WebCore { void GObjectEventListener::handleEvent(ScriptExecutionContext*, Event* event) { gboolean handled = FALSE; - WebKitDOMEvent* gobjectEvent = WebKit::wrapEvent(event); + WebKitDOMEvent* gobjectEvent = WEBKIT_DOM_EVENT(WebKit::kit(event)); g_signal_emit_by_name(m_object, m_signalName.utf8().data(), gobjectEvent, &handled); } diff --git a/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/WebCore/bindings/gobject/WebKitDOMBinding.cpp index 1154d6c..3c066e3 100644 --- a/WebCore/bindings/gobject/WebKitDOMBinding.cpp +++ b/WebCore/bindings/gobject/WebKitDOMBinding.cpp @@ -32,6 +32,7 @@ #include "UIEvent.h" #include "WebKitDOMDOMWindowPrivate.h" #include "WebKitDOMElementPrivate.h" +#include "WebKitDOMEventPrivate.h" #include "WebKitDOMNode.h" #include "WebKitDOMNodePrivate.h" #include "WebKitHTMLElementWrapperFactory.h" @@ -140,7 +141,7 @@ gpointer kit(Event* event) else if (event->isUIEvent()) wrappedEvent = wrapUIEvent(static_cast<UIEvent*>(event)); else - wrappedEvent = 0; + wrappedEvent = wrapEvent(event); return DOMObjectCache::put(event, wrappedEvent); } diff --git a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp index 22bfee4..3b3465e 100644 --- a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp +++ b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "JSCSSStyleDeclarationCustom.h" -#include "AtomicString.h" #include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "CSSValue.h" @@ -34,6 +33,7 @@ #include <runtime/StringObjectThatMasqueradesAsUndefined.h> #include <runtime/StringPrototype.h> #include <wtf/ASCIICType.h> +#include <wtf/text/AtomicString.h> using namespace JSC; using namespace WTF; @@ -66,17 +66,17 @@ static bool hasCSSPropertyNamePrefix(const Identifier& propertyName, const char* ASSERT(*prefix); for (const char* p = prefix; *p; ++p) ASSERT(isASCIILower(*p)); - ASSERT(propertyName.size()); + ASSERT(propertyName.length()); #endif - if (toASCIILower(propertyName.data()[0]) != prefix[0]) + if (toASCIILower(propertyName.characters()[0]) != prefix[0]) return false; - unsigned length = propertyName.size(); + unsigned length = propertyName.length(); for (unsigned i = 1; i < length; ++i) { if (!prefix[i]) - return isASCIIUpper(propertyName.data()[i]); - if (propertyName.data()[i] != prefix[i]) + return isASCIIUpper(propertyName.characters()[i]); + if (propertyName.characters()[i] != prefix[i]) return false; } return false; @@ -87,7 +87,7 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo if (hadPixelOrPosPrefix) *hadPixelOrPosPrefix = false; - unsigned length = propertyName.size(); + unsigned length = propertyName.length(); if (!length) return String(); @@ -111,14 +111,14 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo || hasCSSPropertyNamePrefix(propertyName, "apple")) name.append('-'); else { - if (isASCIIUpper(propertyName.data()[0])) + if (isASCIIUpper(propertyName.characters()[0])) return String(); } - name.append(toASCIILower(propertyName.data()[i++])); + name.append(toASCIILower(propertyName.characters()[i++])); for (; i < length; ++i) { - UChar c = propertyName.data()[i]; + UChar c = propertyName.characters()[i]; if (!isASCIIUpper(c)) name.append(c); else { diff --git a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp index 8221fed..532b38b 100644 --- a/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp +++ b/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp @@ -57,9 +57,9 @@ static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState*, JSValue value) return 0; JSObject* object = asObject(value); if (object->inherits(&JSCanvasGradient::s_info)) - return CanvasStyle::create(static_cast<JSCanvasGradient*>(object)->impl()); + return CanvasStyle::createFromGradient(static_cast<JSCanvasGradient*>(object)->impl()); if (object->inherits(&JSCanvasPattern::s_info)) - return CanvasStyle::create(static_cast<JSCanvasPattern*>(object)->impl()); + return CanvasStyle::createFromPattern(static_cast<JSCanvasPattern*>(object)->impl()); return 0; } diff --git a/WebCore/bindings/js/JSClipboardCustom.cpp b/WebCore/bindings/js/JSClipboardCustom.cpp index 9bdffdb..2a8d309 100644 --- a/WebCore/bindings/js/JSClipboardCustom.cpp +++ b/WebCore/bindings/js/JSClipboardCustom.cpp @@ -37,10 +37,10 @@ #include "JSNode.h" #include "Node.h" #include "PlatformString.h" -#include "StringHash.h" #include <runtime/ArrayPrototype.h> #include <runtime/Error.h> #include <wtf/HashSet.h> +#include <wtf/text/StringHash.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp index 4d7b6e1..263f2f9 100644 --- a/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp +++ b/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp @@ -28,7 +28,6 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) -#include "AtomicString.h" #include "DOMApplicationCache.h" #include "DOMWindow.h" #include "Event.h" @@ -37,6 +36,7 @@ #include "JSDOMWindowCustom.h" #include "JSEvent.h" #include "JSEventListener.h" +#include <wtf/text/AtomicString.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 8220f51..96394eb 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -501,7 +501,7 @@ AtomicStringImpl* findAtomicString(const Identifier& identifier) { if (identifier.isNull()) return 0; - UStringImpl* impl = identifier.ustring().rep(); + StringImpl* impl = identifier.impl(); ASSERT(impl->existingHash()); return AtomicString::find(impl->characters(), impl->length(), impl->existingHash()); } @@ -679,10 +679,9 @@ Frame* toDynamicFrame(ExecState* exec) return asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame(); } -bool processingUserGesture(ExecState* exec) +bool processingUserGesture() { - Frame* frame = toDynamicFrame(exec); - return frame && frame->script()->processingUserGesture(currentWorld(exec)); + return ScriptController::processingUserGesture(); } KURL completeURL(ExecState* exec, const String& relativeURL) diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h index 7086a89..749b0d7 100644 --- a/WebCore/bindings/js/JSDOMBinding.h +++ b/WebCore/bindings/js/JSDOMBinding.h @@ -313,7 +313,7 @@ namespace WebCore { Frame* toLexicalFrame(JSC::ExecState*); Frame* toDynamicFrame(JSC::ExecState*); - bool processingUserGesture(JSC::ExecState*); + bool processingUserGesture(); KURL completeURL(JSC::ExecState*, const String& relativeURL); inline JSC::JSValue jsString(JSC::ExecState* exec, const String& s) @@ -339,7 +339,7 @@ namespace WebCore { inline String ustringToString(const JSC::UString& u) { - return u.rep(); + return u.impl(); } inline JSC::UString stringToUString(const String& s) @@ -349,17 +349,17 @@ namespace WebCore { inline String identifierToString(const JSC::Identifier& i) { - return i.ustring().rep(); + return i.impl(); } inline AtomicString ustringToAtomicString(const JSC::UString& u) { - return AtomicString(u.rep()); + return AtomicString(u.impl()); } inline AtomicString identifierToAtomicString(const JSC::Identifier& identifier) { - return AtomicString(identifier.ustring().rep()); + return AtomicString(identifier.impl()); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp b/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp index 2d41843..0194962 100644 --- a/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp +++ b/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp @@ -20,9 +20,9 @@ #include "config.h" #include "JSDOMMimeTypeArray.h" -#include "AtomicString.h" #include "DOMMimeTypeArray.h" #include "JSDOMMimeType.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp b/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp index abf3148..20ce5e5 100644 --- a/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp +++ b/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp @@ -20,9 +20,9 @@ #include "config.h" #include "JSDOMPluginArray.h" -#include "AtomicString.h" #include "DOMPluginArray.h" #include "JSDOMPlugin.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/bindings/js/JSDOMPluginCustom.cpp b/WebCore/bindings/js/JSDOMPluginCustom.cpp index c8d187e..319cb3c 100644 --- a/WebCore/bindings/js/JSDOMPluginCustom.cpp +++ b/WebCore/bindings/js/JSDOMPluginCustom.cpp @@ -19,9 +19,9 @@ #include "config.h" #include "JSDOMPlugin.h" -#include "AtomicString.h" #include "DOMPlugin.h" #include "JSDOMMimeType.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/bindings/js/JSDOMStringMapCustom.cpp b/WebCore/bindings/js/JSDOMStringMapCustom.cpp index 455c7b1..d1c1d69 100644 --- a/WebCore/bindings/js/JSDOMStringMapCustom.cpp +++ b/WebCore/bindings/js/JSDOMStringMapCustom.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "JSDOMStringMap.h" -#include "AtomicString.h" #include "DOMStringMap.h" +#include <wtf/text/AtomicString.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 252ea93..2ad71f0 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -20,7 +20,6 @@ #include "config.h" #include "JSDOMWindowCustom.h" -#include "AtomicString.h" #include "Chrome.h" #include "DOMWindow.h" #include "Document.h" @@ -87,6 +86,7 @@ #include <runtime/JSFunction.h> #include <runtime/JSObject.h> #include <runtime/PrototypeFunction.h> +#include <wtf/text/AtomicString.h> using namespace JSC; @@ -271,7 +271,7 @@ bool JSDOMWindow::getOwnPropertySlot(ExecState* exec, const Identifier& property // allow window[1] or parent[1] etc. (#56983) bool ok; - unsigned i = propertyName.toArrayIndex(&ok); + unsigned i = propertyName.toArrayIndex(ok); if (ok && i < impl()->frame()->tree()->childCount()) { slot.setCustomIndex(this, i, indexGetter); return true; @@ -345,7 +345,7 @@ bool JSDOMWindow::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pr } bool ok; - unsigned i = propertyName.toArrayIndex(&ok); + unsigned i = propertyName.toArrayIndex(ok); if (ok && i < impl()->frame()->tree()->childCount()) { PropertySlot slot; slot.setCustomIndex(this, i, indexGetter); @@ -512,7 +512,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value) if (!protocolIsJavaScript(url) || allowsAccessFrom(exec)) { // We want a new history item if this JS was called via a user gesture - frame->redirectScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture(exec)); + frame->redirectScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture()); } } @@ -606,47 +606,6 @@ JSValue JSDOMWindow::float32Array(ExecState* exec) const return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this); } -// Temporary aliases to keep current WebGL content working during transition period to TypedArray spec. -// To be removed before WebGL spec is finalized. (FIXME) -JSValue JSDOMWindow::webGLArrayBuffer(ExecState* exec) const -{ - return getDOMConstructor<JSArrayBufferConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLByteArray(ExecState* exec) const -{ - return getDOMConstructor<JSInt8ArrayConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLUnsignedByteArray(ExecState* exec) const -{ - return getDOMConstructor<JSUint8ArrayConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLIntArray(ExecState* exec) const -{ - return getDOMConstructor<JSInt32ArrayConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLUnsignedIntArray(ExecState* exec) const -{ - return getDOMConstructor<JSUint32ArrayConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLShortArray(ExecState* exec) const -{ - return getDOMConstructor<JSInt16ArrayConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLUnsignedShortArray(ExecState* exec) const -{ - return getDOMConstructor<JSUint16ArrayConstructor>(exec, this); -} - -JSValue JSDOMWindow::webGLFloatArray(ExecState* exec) const -{ - return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this); -} #endif JSValue JSDOMWindow::xmlHttpRequest(ExecState* exec) const @@ -724,10 +683,9 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF // We'd have to resolve all those issues to pass the URL instead of "". bool created; - // We pass in the opener frame here so it can be used for looking up the frame name, in case the active frame - // is different from the opener frame, and the name references a frame relative to the opener frame, for example - // "_self" or "_parent". - Frame* newFrame = lexicalFrame->loader()->createWindow(openerFrame->loader(), frameRequest, windowFeatures, created); + // We pass the opener frame for the lookupFrame in case the active frame is different from + // the opener frame, and the name references a frame relative to the opener frame. + Frame* newFrame = createWindow(lexicalFrame, openerFrame, frameRequest, windowFeatures, created); if (!newFrame) return 0; @@ -742,7 +700,7 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF if (!protocolIsJavaScript(url) || newWindow->allowsAccessFrom(exec)) { KURL completedURL = url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(exec, url); - bool userGesture = processingUserGesture(exec); + bool userGesture = processingUserGesture(); if (created) newFrame->loader()->changeLocation(completedURL, referrer, false, false, userGesture); @@ -753,10 +711,10 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF return newFrame; } -static bool domWindowAllowPopUp(Frame* activeFrame, ExecState* exec) +static bool domWindowAllowPopUp(Frame* activeFrame) { ASSERT(activeFrame); - if (activeFrame->script()->processingUserGesture(currentWorld(exec))) + if (ScriptController::processingUserGesture()) return true; return DOMWindow::allowPopUp(activeFrame); } @@ -781,7 +739,7 @@ JSValue JSDOMWindow::open(ExecState* exec) // Because FrameTree::find() returns true for empty strings, we must check for empty framenames. // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker. - if (!domWindowAllowPopUp(dynamicFrame, exec) && (frameName.isEmpty() || !frame->tree()->find(frameName))) + if (!domWindowAllowPopUp(dynamicFrame) && (frameName.isEmpty() || !frame->tree()->find(frameName))) return jsUndefined(); // Get the target frame for the special cases of _top and _parent. In those @@ -805,7 +763,7 @@ JSValue JSDOMWindow::open(ExecState* exec) const JSDOMWindow* targetedWindow = toJSDOMWindow(frame, currentWorld(exec)); if (!completedURL.isEmpty() && (!protocolIsJavaScript(completedURL) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) { - bool userGesture = processingUserGesture(exec); + bool userGesture = processingUserGesture(); // For whatever reason, Firefox uses the dynamicGlobalObject to // determine the outgoingReferrer. We replicate that behavior @@ -851,7 +809,7 @@ JSValue JSDOMWindow::showModalDialog(ExecState* exec) if (!dynamicFrame) return jsUndefined(); - if (!DOMWindow::canShowModalDialogNow(frame) || !domWindowAllowPopUp(dynamicFrame, exec)) + if (!DOMWindow::canShowModalDialogNow(frame) || !domWindowAllowPopUp(dynamicFrame)) return jsUndefined(); HashMap<String, String> features; diff --git a/WebCore/bindings/js/JSDataGridColumnListCustom.cpp b/WebCore/bindings/js/JSDataGridColumnListCustom.cpp index 5ee790c..cc41093 100644 --- a/WebCore/bindings/js/JSDataGridColumnListCustom.cpp +++ b/WebCore/bindings/js/JSDataGridColumnListCustom.cpp @@ -29,10 +29,10 @@ #include "JSDataGridColumnList.h" -#include "AtomicString.h" #include "DataGridColumn.h" #include "DataGridColumnList.h" #include "JSDataGridColumn.h" +#include <wtf/text/AtomicString.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSDocumentCustom.cpp b/WebCore/bindings/js/JSDocumentCustom.cpp index 7407e86..ec66cbd 100644 --- a/WebCore/bindings/js/JSDocumentCustom.cpp +++ b/WebCore/bindings/js/JSDocumentCustom.cpp @@ -88,7 +88,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue value) if (activeFrame) str = activeFrame->document()->completeURL(str).string(); - bool userGesture = activeFrame->script()->processingUserGesture(currentWorld(exec)); + bool userGesture = ScriptController::processingUserGesture(); frame->redirectScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture); } diff --git a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp index a504f25..64615b9 100644 --- a/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "JSHTMLAllCollection.h" -#include "AtomicString.h" #include "HTMLAllCollection.h" #include "JSDOMBinding.h" #include "JSHTMLAllCollection.h" @@ -36,6 +35,7 @@ #include "StaticNodeList.h" #include <runtime/JSValue.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> using namespace JSC; @@ -74,7 +74,7 @@ static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) // Support for document.all(<index>) etc. bool ok; UString string = exec->argument(0).toString(exec); - unsigned index = string.toUInt32(&ok, false); + unsigned index = Identifier::toUInt32(string, ok); if (ok) return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index))); @@ -85,7 +85,7 @@ static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec) // The second arg, if set, is the index of the item we want bool ok; UString string = exec->argument(0).toString(exec); - unsigned index = exec->argument(1).toString(exec).toUInt32(&ok, false); + unsigned index = Identifier::toUInt32(exec->argument(1).toString(exec), ok); if (ok) { String pstr = ustringToString(string); Node* node = collection->namedItem(pstr); @@ -122,7 +122,7 @@ JSValue JSHTMLAllCollection::nameGetter(ExecState* exec, JSValue slotBase, const JSValue JSHTMLAllCollection::item(ExecState* exec) { bool ok; - uint32_t index = exec->argument(0).toString(exec).toUInt32(&ok, false); + uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec), ok); if (ok) return toJS(exec, globalObject(), impl()->item(index)); return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec))); diff --git a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp index b0cfd99..6b2f350 100644 --- a/WebCore/bindings/js/JSHTMLCollectionCustom.cpp +++ b/WebCore/bindings/js/JSHTMLCollectionCustom.cpp @@ -20,7 +20,6 @@ #include "config.h" #include "JSHTMLCollection.h" -#include "AtomicString.h" #include "HTMLCollection.h" #include "HTMLOptionsCollection.h" #include "HTMLAllCollection.h" @@ -32,6 +31,7 @@ #include "Node.h" #include "StaticNodeList.h" #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> using namespace JSC; @@ -70,7 +70,7 @@ static EncodedJSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) // Support for document.all(<index>) etc. bool ok; UString string = exec->argument(0).toString(exec); - unsigned index = string.toUInt32(&ok, false); + unsigned index = Identifier::toUInt32(string, ok); if (ok) return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection->item(index))); @@ -81,7 +81,7 @@ static EncodedJSValue JSC_HOST_CALL callHTMLCollection(ExecState* exec) // The second arg, if set, is the index of the item we want bool ok; UString string = exec->argument(0).toString(exec); - unsigned index = exec->argument(1).toString(exec).toUInt32(&ok, false); + unsigned index = Identifier::toUInt32(exec->argument(1).toString(exec), ok); if (ok) { String pstr = ustringToString(string); Node* node = collection->namedItem(pstr); @@ -118,7 +118,7 @@ JSValue JSHTMLCollection::nameGetter(ExecState* exec, JSValue slotBase, const Id JSValue JSHTMLCollection::item(ExecState* exec) { bool ok; - uint32_t index = exec->argument(0).toString(exec).toUInt32(&ok, false); + uint32_t index = Identifier::toUInt32(exec->argument(0).toString(exec), ok); if (ok) return toJS(exec, globalObject(), impl()->item(index)); return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec))); diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index 0c891a3..06360fb 100644 --- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -183,6 +183,9 @@ InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState) if (injectedScript) return InjectedScript(ScriptObject(scriptState, injectedScript)); + if (!canAccessInspectedWindow(scriptState)) + return InjectedScript(); + ASSERT(!m_injectedScriptSource.isEmpty()); pair<long, ScriptObject> injectedScriptObject = injectScript(m_injectedScriptSource, scriptState); globalObject->setInjectedScript(injectedScriptObject.second.jsObject()); diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp index 76005fa..99166cd 100644 --- a/WebCore/bindings/js/JSLocationCustom.cpp +++ b/WebCore/bindings/js/JSLocationCustom.cpp @@ -191,7 +191,7 @@ static void navigateIfAllowed(ExecState* exec, Frame* frame, const KURL& url, bo return; if (!protocolIsJavaScript(url) || allowsAccessFromFrame(exec, frame)) - frame->redirectScheduler()->scheduleLocationChange(url.string(), lexicalFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture(exec)); + frame->redirectScheduler()->scheduleLocationChange(url.string(), lexicalFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture()); } void JSLocation::setHref(ExecState* exec, JSValue value) @@ -253,7 +253,7 @@ void JSLocation::setPort(ExecState* exec, JSValue value) KURL url = frame->loader()->url(); // FIXME: Could make this a little less ugly if String provided a toUnsignedShort function. const UString& portString = value.toString(exec); - int port = charactersToInt(portString.data(), portString.size()); + int port = charactersToInt(portString.characters(), portString.length()); if (port < 0 || port > 0xFFFF) url.removePort(); else @@ -325,7 +325,7 @@ JSValue JSLocation::reload(ExecState* exec) return jsUndefined(); if (!protocolIsJavaScript(frame->loader()->url())) - frame->redirectScheduler()->scheduleRefresh(processingUserGesture(exec)); + frame->redirectScheduler()->scheduleRefresh(processingUserGesture()); return jsUndefined(); } diff --git a/WebCore/bindings/js/JSMessagePortCustom.cpp b/WebCore/bindings/js/JSMessagePortCustom.cpp index 227d6ed..06b4178 100644 --- a/WebCore/bindings/js/JSMessagePortCustom.cpp +++ b/WebCore/bindings/js/JSMessagePortCustom.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "JSMessagePort.h" -#include "AtomicString.h" #include "Event.h" #include "ExceptionCode.h" #include "Frame.h" @@ -36,6 +35,7 @@ #include "JSMessagePortCustom.h" #include "MessagePort.h" #include <runtime/Error.h> +#include <wtf/text/AtomicString.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSNodeListCustom.cpp b/WebCore/bindings/js/JSNodeListCustom.cpp index dd59c15..c81914c 100644 --- a/WebCore/bindings/js/JSNodeListCustom.cpp +++ b/WebCore/bindings/js/JSNodeListCustom.cpp @@ -26,10 +26,10 @@ #include "config.h" #include "JSNodeList.h" -#include "AtomicString.h" #include "JSNode.h" #include "Node.h" #include "NodeList.h" +#include <wtf/text/AtomicString.h> using namespace JSC; @@ -39,7 +39,7 @@ namespace WebCore { static EncodedJSValue JSC_HOST_CALL callNodeList(ExecState* exec) { bool ok; - unsigned index = exec->argument(0).toString(exec).toUInt32(&ok); + unsigned index = Identifier::toUInt32(exec->argument(0).toString(exec), ok); if (!ok) return JSValue::encode(jsUndefined()); return JSValue::encode(toJS(exec, static_cast<JSNodeList*>(exec->callee())->impl()->item(index))); diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp index 98022d9..d318cbb 100644 --- a/WebCore/bindings/js/ScriptController.cpp +++ b/WebCore/bindings/js/ScriptController.cpp @@ -244,14 +244,26 @@ int ScriptController::eventHandlerLineNumber() const return 0; } -bool ScriptController::processingUserGesture(DOMWrapperWorld* world) const +bool ScriptController::processingUserGesture() { - if (m_allowPopupsFromPlugin || isJavaScriptAnchorNavigation()) + ExecState* exec = JSMainThreadExecState::currentState(); + Frame* frame = exec ? toDynamicFrame(exec) : 0; + // No script is running, so it is user-initiated unless the gesture stack + // explicitly says it is not. + if (!frame) + return UserGestureIndicator::getUserGestureState() != DefinitelyNotProcessingUserGesture; + + // FIXME: We check the plugin popup flag and javascript anchor navigation + // from the dynamic frame becuase they should only be initiated on the + // dynamic frame in which execution began if they do happen. + ScriptController* scriptController = frame->script(); + ASSERT(scriptController); + if (scriptController->allowPopupsFromPlugin() || scriptController->isJavaScriptAnchorNavigation()) return true; // If a DOM event is being processed, check that it was initiated by the user // and that it is in the whitelist of event types allowed to generate pop-ups. - if (JSDOMWindowShell* shell = existingWindowShell(world)) + if (JSDOMWindowShell* shell = scriptController->existingWindowShell(currentWorld(exec))) if (Event* event = shell->window()->currentEvent()) return event->fromUserGesture(); diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index 8dae637..2ec71b9 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -110,7 +110,7 @@ public: int eventHandlerLineNumber() const; void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; } - bool processingUserGesture(DOMWrapperWorld*) const; + static bool processingUserGesture(); bool anyPageIsProcessingUserGesture() const; static bool canAccessFromCurrentOrigin(Frame*); diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp index d71034b..cd80de4 100644 --- a/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/WebCore/bindings/js/ScriptDebugServer.cpp @@ -268,7 +268,7 @@ void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener) void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, ScriptWorldType worldType) { - String sourceID = ustringToString(JSC::UString::from(source.provider()->asID())); + String sourceID = ustringToString(JSC::UString::number(source.provider()->asID())); String url = ustringToString(source.provider()->url()); String data = ustringToString(JSC::UString(source.data(), source.length())); int firstLine = source.firstLine(); @@ -497,6 +497,10 @@ void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + // detach may have been called during pauseIfNeeded + if (!m_currentCallFrame) + return; + // Treat stepping over a return statement like stepping out. if (m_currentCallFrame == m_pauseOnCallFrame) m_pauseOnCallFrame = m_currentCallFrame->caller(); diff --git a/WebCore/bindings/js/ScriptProfile.cpp b/WebCore/bindings/js/ScriptProfile.cpp index 1fbd040..0eb2814 100644 --- a/WebCore/bindings/js/ScriptProfile.cpp +++ b/WebCore/bindings/js/ScriptProfile.cpp @@ -84,8 +84,8 @@ static PassRefPtr<InspectorObject> buildInspectorObjectFor(const JSC::ProfileNod const ProfileNodesList& children = node->children(); ProfileNodesList::const_iterator end = children.end(); for (ProfileNodesList::const_iterator iter = children.begin(); iter != end; ++iter) - childrenArray->push(buildInspectorObjectFor(iter->get())); - result->set("children", childrenArray); + childrenArray->pushObject(buildInspectorObjectFor(iter->get())); + result->setArray("children", childrenArray); return result; } diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/ScriptString.h index 558ad33..7401818 100644 --- a/WebCore/bindings/js/ScriptString.h +++ b/WebCore/bindings/js/ScriptString.h @@ -51,7 +51,7 @@ public: const JSC::UString& ustring() const { return m_str; } bool isNull() const { return m_str.isNull(); } - size_t size() const { return m_str.size(); } + size_t size() const { return m_str.length(); } ScriptString& operator=(const char* s) { diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp index 23934cd..a58e0c7 100644 --- a/WebCore/bindings/js/ScriptValue.cpp +++ b/WebCore/bindings/js/ScriptValue.cpp @@ -109,7 +109,7 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ScriptState* scriptState, J return InspectorBasicValue::create(value.uncheckedGetNumber()); if (value.isString()) { UString s = value.getString(scriptState); - return InspectorString::create(String(s.data(), s.size())); + return InspectorString::create(String(s.characters(), s.length())); } if (value.isObject()) { if (isJSArray(&scriptState->globalData(), value)) { @@ -123,7 +123,7 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ScriptState* scriptState, J ASSERT_NOT_REACHED(); elementValue = InspectorValue::null(); } - inspectorArray->push(elementValue); + inspectorArray->pushValue(elementValue); } return inspectorArray; } @@ -139,7 +139,7 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ScriptState* scriptState, J ASSERT_NOT_REACHED(); inspectorValue = InspectorValue::null(); } - inspectorObject->set(String(name.data(), name.size()), inspectorValue); + inspectorObject->setValue(String(name.characters(), name.length()), inspectorValue); } return inspectorObject; } diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp index 6d6fa21..00ec25f 100644 --- a/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/WebCore/bindings/js/SerializedScriptValue.cpp @@ -27,9 +27,11 @@ #include "config.h" #include "SerializedScriptValue.h" +#include "Blob.h" #include "File.h" #include "FileList.h" #include "ImageData.h" +#include "JSBlob.h" #include "JSDOMGlobalObject.h" #include "JSFile.h" #include "JSFileList.h" @@ -147,26 +149,86 @@ private: unsigned m_length; }; +class SerializedBlob : public SharedSerializedData { +public: + static PassRefPtr<SerializedBlob> create(const Blob* blob) + { + return adoptRef(new SerializedBlob(blob)); + } + + const KURL& url() const { return m_url; } + const String& type() const { return m_type; } + unsigned long long size() const { return m_size; } + +private: + SerializedBlob(const Blob* blob) + : m_url(blob->url().copy()) + , m_type(blob->type().crossThreadString()) + , m_size(blob->size()) + { + } + + KURL m_url; + String m_type; + unsigned long long m_size; +}; + +class SerializedFile : public SharedSerializedData { +public: + static PassRefPtr<SerializedFile> create(const File* file) + { + return adoptRef(new SerializedFile(file)); + } + + const String& path() const { return m_path; } + const KURL& url() const { return m_url; } + const String& type() const { return m_type; } + +private: + SerializedFile(const File* file) + : m_path(file->path().crossThreadString()) + , m_url(file->url().copy()) + , m_type(file->type().crossThreadString()) + { + } + + String m_path; + KURL m_url; + String m_type; +}; + class SerializedFileList : public SharedSerializedData { public: + struct FileData { + String path; + KURL url; + String type; + }; + static PassRefPtr<SerializedFileList> create(const FileList* list) { return adoptRef(new SerializedFileList(list)); } unsigned length() const { return m_files.size(); } - const String& item(unsigned idx) { return m_files[idx]; } + const FileData& item(unsigned idx) { return m_files[idx]; } private: SerializedFileList(const FileList* list) { unsigned length = list->length(); m_files.reserveCapacity(length); - for (unsigned i = 0; i < length; i++) - m_files.append(list->item(i)->path().crossThreadString()); + for (unsigned i = 0; i < length; i++) { + File* file = list->item(i); + FileData fileData; + fileData.path = file->path().crossThreadString(); + fileData.url = file->url().copy(); + fileData.type = file->type().crossThreadString(); + m_files.append(fileData); + } } - Vector<String> m_files; + Vector<FileData> m_files; }; class SerializedImageData : public SharedSerializedData { @@ -217,9 +279,15 @@ SerializedScriptValueData::SerializedScriptValueData(const ImageData* imageData) { } +SerializedScriptValueData::SerializedScriptValueData(const Blob* blob) + : m_type(BlobType) + , m_sharedData(SerializedBlob::create(blob)) +{ +} + SerializedScriptValueData::SerializedScriptValueData(const File* file) : m_type(FileType) - , m_string(file->path().crossThreadString()) + , m_sharedData(SerializedFile::create(file)) { } @@ -233,6 +301,16 @@ SerializedObject* SharedSerializedData::asObject() return static_cast<SerializedObject*>(this); } +SerializedBlob* SharedSerializedData::asBlob() +{ + return static_cast<SerializedBlob*>(this); +} + +SerializedFile* SharedSerializedData::asFile() +{ + return static_cast<SerializedFile*>(this); +} + SerializedFileList* SharedSerializedData::asFileList() { return static_cast<SerializedFileList*>(this); @@ -570,6 +648,8 @@ struct SerializingTreeWalker : public BaseWalker { JSObject* obj = asObject(value); if (obj->inherits(&JSFile::s_info)) return SerializedScriptValueData(toFile(obj)); + if (obj->inherits(&JSBlob::s_info)) + return SerializedScriptValueData(toBlob(obj)); if (obj->inherits(&JSFileList::s_info)) return SerializedScriptValueData(toFileList(obj)); if (obj->inherits(&JSImageData::s_info)) @@ -736,12 +816,21 @@ struct DeserializingTreeWalker : public BaseWalker { return jsNumber(m_exec, value.asDouble()); case SerializedScriptValueData::DateType: return new (m_exec) DateInstance(m_exec, m_globalObject->dateStructure(), value.asDouble()); + case SerializedScriptValueData::BlobType: { + if (!m_isDOMGlobalObject) + return jsNull(); + SerializedBlob* serializedBlob = value.asBlob(); + ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext(); + ASSERT(scriptExecutionContext); + return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), Blob::create(scriptExecutionContext, serializedBlob->url(), serializedBlob->type(), serializedBlob->size())); + } case SerializedScriptValueData::FileType: { if (!m_isDOMGlobalObject) return jsNull(); + SerializedFile* serializedFile = value.asFile(); ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext(); ASSERT(scriptExecutionContext); - return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), File::create(scriptExecutionContext, value.asString().crossThreadString())); + return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), File::create(scriptExecutionContext, serializedFile->path(), serializedFile->url(), serializedFile->type())); } case SerializedScriptValueData::FileListType: { if (!m_isDOMGlobalObject) @@ -751,8 +840,10 @@ struct DeserializingTreeWalker : public BaseWalker { unsigned length = serializedFileList->length(); ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext(); ASSERT(scriptExecutionContext); - for (unsigned i = 0; i < length; i++) - result->append(File::create(scriptExecutionContext, serializedFileList->item(i))); + for (unsigned i = 0; i < length; i++) { + const SerializedFileList::FileData& fileData = serializedFileList->item(i); + result->append(File::create(scriptExecutionContext, fileData.path, fileData.url, fileData.type)); + } return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get()); } case SerializedScriptValueData::ImageDataType: { @@ -920,6 +1011,7 @@ struct TeardownTreeWalker { case SerializedScriptValueData::NumberType: case SerializedScriptValueData::DateType: case SerializedScriptValueData::EmptyType: + case SerializedScriptValueData::BlobType: case SerializedScriptValueData::FileType: case SerializedScriptValueData::FileListType: case SerializedScriptValueData::ImageDataType: diff --git a/WebCore/bindings/js/SerializedScriptValue.h b/WebCore/bindings/js/SerializedScriptValue.h index 93bd0de..2b7d222 100644 --- a/WebCore/bindings/js/SerializedScriptValue.h +++ b/WebCore/bindings/js/SerializedScriptValue.h @@ -33,10 +33,13 @@ typedef const struct OpaqueJSContext* JSContextRef; typedef const struct OpaqueJSValue* JSValueRef; namespace WebCore { + class Blob; class File; class FileList; class ImageData; class SerializedArray; + class SerializedBlob; + class SerializedFile; class SerializedFileList; class SerializedImageData; class SerializedObject; @@ -46,6 +49,8 @@ namespace WebCore { virtual ~SharedSerializedData() { } SerializedArray* asArray(); SerializedObject* asObject(); + SerializedBlob* asBlob(); + SerializedFile* asFile(); SerializedFileList* asFileList(); SerializedImageData* asImageData(); }; @@ -62,6 +67,7 @@ namespace WebCore { ObjectType, ArrayType, StringType, + BlobType, FileType, FileListType, ImageDataType @@ -84,10 +90,11 @@ namespace WebCore { explicit SerializedScriptValueData(const String& string) : m_type(StringType) - , m_string(string.crossThreadString()) // FIXME: Should be able to just share the Rep + , m_string(string.crossThreadString()) // FIXME: Should be able to just share the StringImpl { } - + + explicit SerializedScriptValueData(const Blob*); explicit SerializedScriptValueData(const File*); explicit SerializedScriptValueData(const FileList*); explicit SerializedScriptValueData(const ImageData*); @@ -122,7 +129,7 @@ namespace WebCore { String asString() const { - ASSERT(m_type == StringType || m_type == FileType); + ASSERT(m_type == StringType); return m_string; } @@ -140,6 +147,20 @@ namespace WebCore { return m_sharedData->asArray(); } + SerializedBlob* asBlob() const + { + ASSERT(m_type == BlobType); + ASSERT(m_sharedData); + return m_sharedData->asBlob(); + } + + SerializedFile* asFile() const + { + ASSERT(m_type == FileType); + ASSERT(m_sharedData); + return m_sharedData->asFile(); + } + SerializedFileList* asFileList() const { ASSERT(m_type == FileListType); diff --git a/WebCore/bindings/objc/WebScriptObject.mm b/WebCore/bindings/objc/WebScriptObject.mm index 37874ac..a26c315 100644 --- a/WebCore/bindings/objc/WebScriptObject.mm +++ b/WebCore/bindings/objc/WebScriptObject.mm @@ -557,7 +557,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root if (value.isString()) { ExecState* exec = rootObject->globalObject()->globalExec(); const UString& u = asString(value)->value(exec); - return [NSString stringWithCharacters:u.data() length:u.size()]; + return [NSString stringWithCharacters:u.characters() length:u.length()]; } if (value.isNumber()) diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm index ff63615..6bafb1e 100644 --- a/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -149,6 +149,7 @@ sub GetClassName return "WebDOMObject" if $name eq "DOMObject"; return "bool" if $name eq "boolean"; return $name if $codeGenerator->IsPrimitiveType($name); + return "WebDOMCustomVoidCallback" if $name eq "VoidCallback"; return "WebDOM$name"; } @@ -284,7 +285,7 @@ sub AddIncludesForType return if $type =~ /Constructor/; if ($codeGenerator->IsStringType($type)) { - $implIncludes{"AtomicString.h"} = 1; + $implIncludes{"wtf/text/AtomicString.h"} = 1; $implIncludes{"KURL.h"} = 1; $implIncludes{"WebDOMString.h"} = 1; return; @@ -304,6 +305,11 @@ sub AddIncludesForType $implIncludes{"SerializedScriptValue.h"} = 1; return; } + + if ($type eq "VoidCallback") { + $implIncludes{"WebDOMCustomVoidCallback.h"} = 1; + return; + } $implIncludes{"Node.h"} = 1 if $type eq "NodeList"; $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration"; @@ -379,9 +385,10 @@ sub GenerateHeader push(@headerContent, " $className();\n"); push(@headerContent, " explicit $className($implClassNameWithNamespace*);\n"); - # Copy constructor on classes which have the d-ptr + # Copy constructor and assignment operator on classes which have the d-ptr if ($parentName eq "WebDOMObject") { push(@headerContent, " $className(const $className&);\n"); + push(@headerContent, " ${className}& operator=(const $className&);\n"); } # Destructor @@ -634,6 +641,13 @@ sub GenerateImplementation push(@implContent, " m_impl = copy.impl() ? new ${className}Private(copy.impl()) : 0;\n"); push(@implContent, "}\n\n"); + push(@implContent, "${className}& ${className}::operator\=(const ${className}& copy)\n"); + push(@implContent, "{\n"); + push(@implContent, " delete m_impl;\n"); + push(@implContent, " m_impl = copy.impl() ? new ${className}Private(copy.impl()) : 0;\n"); + push(@implContent, " return *this;\n"); + push(@implContent, "}\n\n"); + push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n"); push(@implContent, "{\n"); push(@implContent, " return m_impl ? m_impl->impl.get() : 0;\n"); @@ -774,9 +788,6 @@ sub GenerateImplementation my $parameterIndex = 0; - # FIXME: Handle Callback support, we're just passing 0 as ScriptExecutionContext for now. - push(@parameterNames, "0") if ($dataNode->extendedAttributes->{"Callback"}); - my $functionSig = "$returnType $className\:\:$functionName("; foreach my $param (@{$function->parameters}) { my $paramName = $param->name; diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 200a95d..0b18d95 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -426,7 +426,7 @@ sub GenerateGetOwnPropertySlotBody if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertySlotImpl, " bool ok;\n"); - push(@getOwnPropertySlotImpl, " unsigned index = propertyName.toUInt32(&ok, false);\n"); + push(@getOwnPropertySlotImpl, " unsigned index = propertyName.toUInt32(ok);\n"); # If the item function returns a string then we let the ConvertNullStringTo handle the cases # where the index is out of range. @@ -450,9 +450,9 @@ sub GenerateGetOwnPropertySlotBody push(@getOwnPropertySlotImpl, " return true;\n"); push(@getOwnPropertySlotImpl, " }\n"); if ($inlined) { - $headerIncludes{"AtomicString.h"} = 1; + $headerIncludes{"wtf/text/AtomicString.h"} = 1; } else { - $implIncludes{"AtomicString.h"} = 1; + $implIncludes{"wtf/text/AtomicString.h"} = 1; } } @@ -520,7 +520,7 @@ sub GenerateGetOwnPropertyDescriptorBody if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertyDescriptorImpl, " bool ok;\n"); - push(@getOwnPropertyDescriptorImpl, " unsigned index = propertyName.toUInt32(&ok, false);\n"); + push(@getOwnPropertyDescriptorImpl, " unsigned index = propertyName.toUInt32(ok);\n"); push(@getOwnPropertyDescriptorImpl, " if (ok && index < static_cast<$implClassName*>(impl())->length()) {\n"); if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { # Assume that if there's a setter, the index will be writable @@ -551,9 +551,9 @@ sub GenerateGetOwnPropertyDescriptorBody push(@getOwnPropertyDescriptorImpl, " return true;\n"); push(@getOwnPropertyDescriptorImpl, " }\n"); if ($inlined) { - $headerIncludes{"AtomicString.h"} = 1; + $headerIncludes{"wtf/text/AtomicString.h"} = 1; } else { - $implIncludes{"AtomicString.h"} = 1; + $implIncludes{"wtf/text/AtomicString.h"} = 1; } } @@ -1135,7 +1135,7 @@ sub GenerateParametersCheckExpression # these are acceptable values for a DOMString argument (any Object can # be converted to a string via .toString). push(@andExpression, "(${value}.isNull() || ${value}.isUndefined() || ${value}.isString() || ${value}.isObject())") if $codeGenerator->IsStringType($type); - push(@andExpression, "(${value}.isNull() || ${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info))") unless IsNativeType($type); + push(@andExpression, "(${value}.isNull() || (${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info)))") unless IsNativeType($type); $parameterIndex++; } @@ -1648,7 +1648,7 @@ sub GenerateImplementation push(@implContent, "{\n"); if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { push(@implContent, " bool ok;\n"); - push(@implContent, " unsigned index = propertyName.toUInt32(&ok, false);\n"); + push(@implContent, " unsigned index = propertyName.toUInt32(ok);\n"); push(@implContent, " if (ok) {\n"); push(@implContent, " indexSetter(exec, index, value);\n"); push(@implContent, " return;\n"); @@ -1993,7 +1993,7 @@ sub GenerateImplementation if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { $functionString .= ", " if $paramIndex; - $functionString .= "processingUserGesture(exec)"; + $functionString .= "processingUserGesture()"; $paramIndex++; } diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 4da8150..ebbcf8b 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -172,7 +172,7 @@ sub AddIncludesForType if ($type eq "Plugin" or $type eq "PluginArray" or $type eq "MimeTypeArray") { # So we can get String -> AtomicString conversion for namedItem(). - $implIncludes{"AtomicString.h"} = 1; + $implIncludes{"wtf/text/AtomicString.h"} = 1; } } @@ -231,7 +231,7 @@ sub GenerateHeader my %headerInclues = (); $headerIncludes{"$podType.h"} = 1 if $podType and ($podType ne "double" and $podType ne "float" and $podType ne "RGBA32"); - $headerIncludes{"StringHash.h"} = 1; + $headerIncludes{"wtf/text/StringHash.h"} = 1; $headerIncludes{"WrapperTypeInfo.h"} = 1; my $headerClassInclude = GetHeaderClassInclude($implClassName); $headerIncludes{$headerClassInclude} = 1 if $headerClassInclude ne ""; @@ -275,6 +275,13 @@ END END } + if ($implClassName eq "HTMLDocument") { + push(@headerContent, <<END); + static v8::Local<v8::Object> WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl); + static v8::Handle<v8::Value> GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key); +END + } + my @enabledAtRuntime; foreach my $function (@{$dataNode->functions}) { my $name = $function->signature->name; @@ -362,9 +369,6 @@ sub GetInternalFields if (IsSubType($dataNode, "Document")) { push(@customInternalFields, "implementationIndex"); - if ($name eq "HTMLDocument") { - push(@customInternalFields, ("markerIndex", "shadowIndex")); - } } elsif ($name eq "DOMWindow") { push(@customInternalFields, "enteredIsolatedWorldIndex"); } @@ -401,7 +405,6 @@ END my %indexerSpecialCases = ( "Storage" => 1, "HTMLAppletElement" => 1, - "HTMLDocument" => 1, "HTMLEmbedElement" => 1, "HTMLObjectElement" => 1 ); @@ -428,6 +431,10 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors if ($interfaceName eq "HTMLSelectElement" || $interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") { $hasCustomNamedGetter = 1; } + if ($interfaceName eq "HTMLDocument") { + $hasCustomNamedGetter = 0; + $hasCustomIndexedGetter = 0; + } my $isIndexerSpecialCase = exists $indexerSpecialCases{$interfaceName}; if ($hasCustomIndexedGetter || $isIndexerSpecialCase) { @@ -456,7 +463,7 @@ END static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&); END } - if ($hasCustomDeleters || $interfaceName eq "HTMLDocument") { + if ($hasCustomDeleters) { push(@headerContent, <<END); static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String>, const v8::AccessorInfo&); END @@ -1503,6 +1510,10 @@ sub GenerateImplementationNamedPropertyGetter $hasCustomGetter = 1; } + if ($interfaceName eq "HTMLDocument") { + $hasCustomGetter = 0; + } + my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter; if (!$hasGetter) { return; @@ -1518,8 +1529,7 @@ END } my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; - # FIXME: Try to remove hard-coded HTMLDocument reference by aligning handling of document.all with JSC bindings. - my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"} || $interfaceName eq "HTMLDocument"; + my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; my $setOn = "Instance"; @@ -2004,6 +2014,11 @@ END instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info), false); END } + if ($interfaceName eq "HTMLDocument") { + push(@implContent, <<END); + desc->SetHiddenPrototype(true); +END + } if ($interfaceName eq "Location") { push(@implContent, <<END); diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp index 7235793..a58da40 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp @@ -24,7 +24,6 @@ #include "WebDOMTestCallback.h" -#include "AtomicString.h" #include "Class1.h" #include "Class2.h" #include "Class3.h" @@ -35,6 +34,7 @@ #include "WebDOMClass3.h" #include "WebDOMString.h" #include "WebExceptionHandler.h" +#include "wtf/text/AtomicString.h" #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> @@ -65,6 +65,13 @@ WebDOMTestCallback::WebDOMTestCallback(const WebDOMTestCallback& copy) m_impl = copy.impl() ? new WebDOMTestCallbackPrivate(copy.impl()) : 0; } +WebDOMTestCallback& WebDOMTestCallback::operator=(const WebDOMTestCallback& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMTestCallbackPrivate(copy.impl()) : 0; + return *this; +} + WebCore::TestCallback* WebDOMTestCallback::impl() const { return m_impl ? m_impl->impl.get() : 0; @@ -81,7 +88,7 @@ bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param if (!impl()) return false; - return impl()->callbackWithClass1Param(0, toWebCore(class1Param)); + return impl()->callbackWithClass1Param(toWebCore(class1Param)); } bool WebDOMTestCallback::callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg) @@ -89,7 +96,7 @@ bool WebDOMTestCallback::callbackWithClass2Param(const WebDOMClass2& class2Param if (!impl()) return false; - return impl()->callbackWithClass2Param(0, toWebCore(class2Param), strArg); + return impl()->callbackWithClass2Param(toWebCore(class2Param), strArg); } int WebDOMTestCallback::callbackWithNonBoolReturnType(const WebDOMClass3& class3Param) @@ -97,7 +104,7 @@ int WebDOMTestCallback::callbackWithNonBoolReturnType(const WebDOMClass3& class3 if (!impl()) return 0; - return impl()->callbackWithNonBoolReturnType(0, toWebCore(class3Param)); + return impl()->callbackWithNonBoolReturnType(toWebCore(class3Param)); } WebCore::TestCallback* toWebCore(const WebDOMTestCallback& wrapper) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h index 3fe6837..a4d130e 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h @@ -43,6 +43,7 @@ public: WebDOMTestCallback(); explicit WebDOMTestCallback(WebCore::TestCallback*); WebDOMTestCallback(const WebDOMTestCallback&); + WebDOMTestCallback& operator=(const WebDOMTestCallback&); ~WebDOMTestCallback(); bool callbackWithClass1Param(const WebDOMClass1& class1Param); diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp index 0436e13..7fa4af3 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -56,6 +56,13 @@ WebDOMTestInterface::WebDOMTestInterface(const WebDOMTestInterface& copy) m_impl = copy.impl() ? new WebDOMTestInterfacePrivate(copy.impl()) : 0; } +WebDOMTestInterface& WebDOMTestInterface::operator=(const WebDOMTestInterface& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMTestInterfacePrivate(copy.impl()) : 0; + return *this; +} + WebCore::TestInterface* WebDOMTestInterface::impl() const { return m_impl ? m_impl->impl.get() : 0; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h index 4e7af6d..ca20c4e 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -38,6 +38,7 @@ public: WebDOMTestInterface(); explicit WebDOMTestInterface(WebCore::TestInterface*); WebDOMTestInterface(const WebDOMTestInterface&); + WebDOMTestInterface& operator=(const WebDOMTestInterface&); ~WebDOMTestInterface(); diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 20de4fc..882e633 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "WebDOMTestObj.h" -#include "AtomicString.h" #include "HTMLNames.h" #include "IDBKey.h" #include "KURL.h" @@ -31,6 +30,7 @@ #include "WebDOMString.h" #include "WebExceptionHandler.h" #include "WebNativeEventListener.h" +#include "wtf/text/AtomicString.h" #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> @@ -61,6 +61,13 @@ WebDOMTestObj::WebDOMTestObj(const WebDOMTestObj& copy) m_impl = copy.impl() ? new WebDOMTestObjPrivate(copy.impl()) : 0; } +WebDOMTestObj& WebDOMTestObj::operator=(const WebDOMTestObj& copy) +{ + delete m_impl; + m_impl = copy.impl() ? new WebDOMTestObjPrivate(copy.impl()) : 0; + return *this; +} + WebCore::TestObj* WebDOMTestObj::impl() const { return m_impl ? m_impl->impl.get() : 0; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index c3b65ca..2fedf41 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -40,6 +40,7 @@ public: WebDOMTestObj(); explicit WebDOMTestObj(WebCore::TestObj*); WebDOMTestObj(const WebDOMTestObj&); + WebDOMTestObj& operator=(const WebDOMTestObj&); ~WebDOMTestObj(); enum { @@ -104,12 +105,18 @@ public: int customAttr() const; void setCustomAttr(int); WebDOMString scriptStringAttr() const; +#if ENABLE(Condition1) int conditionalAttr1() const; void setConditionalAttr1(int); +#endif +#if ENABLE(Condition1) && ENABLE(Condition2) int conditionalAttr2() const; void setConditionalAttr2(int); +#endif +#if ENABLE(Condition1) || ENABLE(Condition2) int conditionalAttr3() const; void setConditionalAttr3(int); +#endif int description() const; int id() const; void setId(int); diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index 8f69a9f..e547d35 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -56,7 +56,7 @@ gpointer kit(WebCore::TestCallback* obj) } // namespace WebKit // gboolean -webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) +webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); @@ -69,7 +69,7 @@ webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, } gboolean -webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg) +webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, const gchar* str_arg) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); @@ -84,7 +84,7 @@ webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, } glong -webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param) +webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h index cfc883d..4f0ac91 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h @@ -47,13 +47,13 @@ WEBKIT_API GType webkit_dom_test_callback_get_type (void); WEBKIT_API gboolean -webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param); +webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param); WEBKIT_API gboolean -webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg); +webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, const gchar* str_arg); WEBKIT_API glong -webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param); +webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param); G_END_DECLS diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 8cad49d..56c6e14 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -62,7 +62,7 @@ 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) +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -86,7 +86,7 @@ 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) +webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); @@ -100,19 +100,19 @@ webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, return res; } -WebKitDOMTestObj* +WebKitDOMTestObj* webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; 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())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } -WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +WebKitDOMTestObj* +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); @@ -123,12 +123,12 @@ webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_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())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } -WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg) +WebKitDOMTestObj* +webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); @@ -139,12 +139,12 @@ webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* 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())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } -WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) +WebKitDOMTestObj* +webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); @@ -161,12 +161,12 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* s WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } void -webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg) +webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -178,7 +178,7 @@ webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerialized } void -webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key) +webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -238,21 +238,21 @@ 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) +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg, gboolean isUserGesture) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - item->withDynamicFrameAndUserGesture(int_arg); + item->withDynamicFrameAndUserGesture(int_arg, false); } void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg, gboolean isUserGesture) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); WebCore::TestObj * item = WebKit::core(self); - item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg); + item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg, false); } void @@ -264,14 +264,14 @@ webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) item->withScriptStateVoid(); } -WebKitDOMTestObj* +WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; 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())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } @@ -290,7 +290,7 @@ webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GEr } } -WebKitDOMTestObj* +WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error) { WebCore::JSMainThreadNullState state; @@ -303,7 +303,7 @@ webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GErr WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } @@ -353,24 +353,24 @@ webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) return res; } -gchar* +gchar* webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->readOnlyStringAttr()); + gchar* res = convertToUTF8String(item->readOnlyStringAttr()); return res; } -WebKitDOMTestObj* +WebKitDOMTestObj* webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; 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())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } @@ -431,18 +431,18 @@ webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 item->setUnsignedLongLongAttr(value); } -gchar* +gchar* webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->stringAttr()); + gchar* res = convertToUTF8String(item->stringAttr()); return res; } void -webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -452,19 +452,19 @@ webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value) item->setStringAttr(converted_value); } -WebKitDOMTestObj* +WebKitDOMTestObj* webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; 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())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } void -webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) +webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -475,19 +475,19 @@ webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* item->setTestObjAttr(converted_value); } -WebKitDOMTestObj* +WebKitDOMTestObj* webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->xmlObjAttr()); - WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } void -webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) +webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -517,18 +517,18 @@ webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value) item->setCreate(value); } -gchar* +gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); + gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); return res; } void -webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -576,18 +576,18 @@ webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean item->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value); } -gchar* +gchar* webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); + gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); return res; } void -webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -597,18 +597,18 @@ webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, gchar* value item->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, converted_value); } -gchar* +gchar* webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)); + gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)); return res; } void -webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -618,18 +618,18 @@ webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, gch item->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, converted_value); } -gchar* +gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); + gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); return res; } void -webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -677,18 +677,18 @@ webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gb item->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value); } -gchar* +gchar* webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); + gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); return res; } void -webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -698,18 +698,18 @@ webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, gchar* item->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, converted_value); } -gchar* +gchar* webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)); + gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)); return res; } void -webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value) +webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -775,19 +775,19 @@ webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong } } -gchar* +gchar* webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; - gchar* res = convertToUTF8String(item->stringAttrWithGetterException(ec)); + gchar* res = convertToUTF8String(item->stringAttrWithGetterException(ec)); return res; } void -webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, gchar* value, GError **error) +webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -803,18 +803,18 @@ webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self } } -gchar* +gchar* webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->stringAttrWithSetterException()); + gchar* res = convertToUTF8String(item->stringAttrWithSetterException()); return res; } void -webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, gchar* value, GError **error) +webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error) { WebCore::JSMainThreadNullState state; g_return_if_fail(self); @@ -830,13 +830,13 @@ webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self } } -gchar* +gchar* webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->scriptStringAttr()); + gchar* res = convertToUTF8String(item->scriptStringAttr()); return res; } @@ -938,13 +938,13 @@ webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) item->setId(value); } -gchar* +gchar* webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) { WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->hash()); + gchar* res = convertToUTF8String(item->hash()); return res; } @@ -1363,14 +1363,14 @@ G_MAXLONG, /* max */ PROP_READ_ONLY_STRING_ATTR, g_param_spec_string("read-only-string-attr", /* name */ "test_obj_read-only-string-attr", /* short description */ - "read-only gchar* TestObj.read-only-string-attr", /* longer - could do with some extra doc stuff here */ + "read-only gchar* TestObj.read-only-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); g_object_class_install_property(gobjectClass, PROP_READ_ONLY_TEST_OBJ_ATTR, g_param_spec_object("read-only-test-obj-attr", /* name */ "test_obj_read-only-test-obj-attr", /* short description */ - "read-only WebKitDOMTestObj* TestObj.read-only-test-obj-attr", /* longer - could do with some extra doc stuff here */ + "read-only WebKitDOMTestObj* TestObj.read-only-test-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READABLE)); g_object_class_install_property(gobjectClass, @@ -1404,21 +1404,21 @@ G_MAXUINT64, /* min */ PROP_STRING_ATTR, g_param_spec_string("string-attr", /* name */ "test_obj_string-attr", /* short description */ - "read-write gchar* TestObj.string-attr", /* longer - could do with some extra doc stuff here */ + "read-write gchar* TestObj.string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, PROP_TEST_OBJ_ATTR, g_param_spec_object("test-obj-attr", /* name */ "test_obj_test-obj-attr", /* short description */ - "read-write WebKitDOMTestObj* TestObj.test-obj-attr", /* longer - could do with some extra doc stuff here */ + "read-write WebKitDOMTestObj* TestObj.test-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, PROP_XML_OBJ_ATTR, g_param_spec_object("xml-obj-attr", /* name */ "test_obj_xml-obj-attr", /* short description */ - "read-write WebKitDOMTestObj* TestObj.xml-obj-attr", /* longer - could do with some extra doc stuff here */ + "read-write WebKitDOMTestObj* TestObj.xml-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, @@ -1432,7 +1432,7 @@ G_MAXUINT64, /* min */ 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 */ + "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, @@ -1455,21 +1455,21 @@ G_MAXLONG, /* max */ 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 */ + "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_NON_EMPTY_URL_ATTR, g_param_spec_string("reflected-non-empty-url-attr", /* name */ "test_obj_reflected-non-empty-url-attr", /* short description */ - "read-write gchar* TestObj.reflected-non-empty-url-attr", /* longer - could do with some extra doc stuff here */ + "read-write gchar* TestObj.reflected-non-empty-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 */ + "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, @@ -1492,14 +1492,14 @@ G_MAXLONG, /* max */ PROP_REFLECTED_CUSTOM_URL_ATTR, g_param_spec_string("reflected-custom-url-attr", /* name */ "test_obj_reflected-custom-url-attr", /* short description */ - "read-write gchar* TestObj.reflected-custom-url-attr", /* longer - could do with some extra doc stuff here */ + "read-write gchar* TestObj.reflected-custom-url-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR, g_param_spec_string("reflected-custom-non-empty-url-attr", /* name */ "test_obj_reflected-custom-non-empty-url-attr", /* short description */ - "read-write gchar* TestObj.reflected-custom-non-empty-url-attr", /* longer - could do with some extra doc stuff here */ + "read-write gchar* TestObj.reflected-custom-non-empty-url-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, @@ -1524,21 +1524,21 @@ G_MAXLONG, /* max */ 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 */ + "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 */ + "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 */ + "read-only gchar* TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); #if ENABLE(Condition1) @@ -1596,7 +1596,7 @@ G_MAXLONG, /* max */ PROP_HASH, g_param_spec_string("hash", /* name */ "test_obj_hash", /* short description */ - "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */ + "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index c9a1821..4cc796d 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -50,31 +50,31 @@ WEBKIT_API void webkit_dom_test_obj_void_method(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API glong webkit_dom_test_obj_int_method(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg); -WEBKIT_API WebKitDOMTestObj* +WEBKIT_API WebKitDOMTestObj* webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self); -WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg); -WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg); +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg); -WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); WEBKIT_API void -webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg); +webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg); WEBKIT_API void -webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key); +webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key); WEBKIT_API void webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error); @@ -95,21 +95,21 @@ WEBKIT_API void webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg); +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg, gboolean isUserGesture); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg, gboolean isUserGesture); WEBKIT_API void webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self); -WEBKIT_API WebKitDOMTestObj* +WEBKIT_API WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error); -WEBKIT_API WebKitDOMTestObj* +WEBKIT_API WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API void @@ -127,10 +127,10 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOM WEBKIT_API glong webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self); -WEBKIT_API gchar* +WEBKIT_API gchar* webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self); -WEBKIT_API WebKitDOMTestObj* +WEBKIT_API WebKitDOMTestObj* webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self); WEBKIT_API glong @@ -151,23 +151,23 @@ webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value); -WEBKIT_API gchar* +WEBKIT_API gchar* webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value); +webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, const gchar* value); -WEBKIT_API WebKitDOMTestObj* +WEBKIT_API WebKitDOMTestObj* 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_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); -WEBKIT_API WebKitDOMTestObj* +WEBKIT_API WebKitDOMTestObj* webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); +webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); WEBKIT_API gboolean webkit_dom_test_obj_get_create(WebKitDOMTestObj* self); @@ -175,11 +175,11 @@ webkit_dom_test_obj_get_create(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value); -WEBKIT_API gchar* +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_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value); WEBKIT_API glong webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self); @@ -193,23 +193,23 @@ 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_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_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar* value); -WEBKIT_API gchar* +WEBKIT_API gchar* webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value); +webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value); -WEBKIT_API gchar* +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_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value); WEBKIT_API glong webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self); @@ -223,17 +223,17 @@ 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_API gchar* webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, gchar* value); +webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const gchar* value); -WEBKIT_API gchar* +WEBKIT_API gchar* webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, gchar* value); +webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value); WEBKIT_API glong webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error); @@ -247,19 +247,19 @@ 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_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_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error); -WEBKIT_API gchar* +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_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error); -WEBKIT_API gchar* +WEBKIT_API gchar* webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self); #if ENABLE(Condition1) @@ -301,7 +301,7 @@ webkit_dom_test_obj_get_id(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value); -WEBKIT_API gchar* +WEBKIT_API gchar* webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self); G_END_DECLS diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 01a860c..2a39ac4 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -1105,7 +1105,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe if (exec->hadException()) return JSValue::encode(jsUndefined()); - imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); + imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture()); return JSValue::encode(jsUndefined()); } @@ -1133,7 +1133,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe if (exec->hadException()) return JSValue::encode(jsUndefined()); - imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); + imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture()); return JSValue::encode(jsUndefined()); } @@ -1417,9 +1417,9 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4( EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { - 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()))) + 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() || 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)))) + 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); diff --git a/WebCore/bindings/scripts/test/V8/V8TestInterface.h b/WebCore/bindings/scripts/test/V8/V8TestInterface.h index d2192ca..afdf381 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestInterface.h +++ b/WebCore/bindings/scripts/test/V8/V8TestInterface.h @@ -23,9 +23,9 @@ #ifndef V8TestInterface_h #define V8TestInterface_h -#include "StringHash.h" #include "TestInterface.h" #include "WrapperTypeInfo.h" +#include "wtf/text/StringHash.h" #include <v8.h> #include <wtf/HashMap.h> diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.h b/WebCore/bindings/scripts/test/V8/V8TestObj.h index 5d6770a..d9715c9 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.h +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.h @@ -21,9 +21,9 @@ #ifndef V8TestObj_h #define V8TestObj_h -#include "StringHash.h" #include "TestObj.h" #include "WrapperTypeInfo.h" +#include "wtf/text/StringHash.h" #include <v8.h> #include <wtf/HashMap.h> diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp index 4b38a61..a000a7d 100644 --- a/WebCore/bindings/v8/IDBBindingUtilities.cpp +++ b/WebCore/bindings/v8/IDBBindingUtilities.cpp @@ -29,7 +29,10 @@ #if ENABLE(INDEXED_DATABASE) #include "IDBKey.h" +#include "IDBKeyPath.h" +#include "SerializedScriptValue.h" #include "V8Binding.h" +#include <wtf/Vector.h> namespace WebCore { @@ -45,6 +48,37 @@ PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value) return 0; } +template<typename T> +bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value) +{ + v8::Local<v8::Object> object = v8Value->ToObject(); + if (!object->Has(indexOrName)) + return false; + v8Value = object->Get(indexOrName); + return true; +} + +PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const Vector<IDBKeyPathElement>& keyPath) +{ + v8::HandleScope scope; + v8::Handle<v8::Value> v8Value(value->deserialize()); + for (size_t i = 0; i < keyPath.size(); ++i) { + switch (keyPath[i].type) { + case IDBKeyPathElement::IsIndexed: + if (!v8Value->IsArray() || !getValueFrom(keyPath[i].index, v8Value)) + return 0; + break; + case IDBKeyPathElement::IsNamed: + if (!v8Value->IsObject() || !getValueFrom(v8String(keyPath[i].identifier), v8Value)) + return 0; + break; + default: + ASSERT_NOT_REACHED(); + } + } + return createIDBKeyFromValue(v8Value); +} + } // namespace WebCore #endif diff --git a/WebCore/bindings/v8/IDBBindingUtilities.h b/WebCore/bindings/v8/IDBBindingUtilities.h index 76f2bba..1a794b0 100644 --- a/WebCore/bindings/v8/IDBBindingUtilities.h +++ b/WebCore/bindings/v8/IDBBindingUtilities.h @@ -34,8 +34,11 @@ namespace WebCore { class IDBKey; +class SerializedScriptValue; +struct IDBKeyPathElement; PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value>); +PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const Vector<IDBKeyPathElement, 0>& keyPath); } diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp index 98ddb90..7c07829 100644 --- a/WebCore/bindings/v8/ScriptCallStack.cpp +++ b/WebCore/bindings/v8/ScriptCallStack.cpp @@ -171,7 +171,7 @@ bool ScriptCallStack::stackTrace(int frameLimit, const RefPtr<InspectorArray>& s frameObject->setString("functionName", functionName.IsEmpty() ? "" : toWebCoreString(functionName)); frameObject->setNumber("lineNumber", frame->GetLineNumber()); frameObject->setNumber("column", frame->GetColumn()); - stackTrace->push(frameObject); + stackTrace->pushObject(frameObject); } return true; #else diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index a27c5cf..903b11c 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -160,15 +160,18 @@ void ScriptController::updatePlatformScriptObjects() notImplemented(); } -bool ScriptController::processingUserGesture(DOMWrapperWorld*) const +bool ScriptController::processingUserGesture() { + Frame* activeFrame = V8Proxy::retrieveFrameForEnteredContext(); // No script is running, so it is user-initiated unless the gesture stack // explicitly says it is not. - if (!m_proxy->executingScript()) + if (!activeFrame) return UserGestureIndicator::getUserGestureState() != DefinitelyNotProcessingUserGesture; + V8Proxy* activeProxy = activeFrame->script()->proxy(); + v8::HandleScope handleScope; - v8::Handle<v8::Context> v8Context = m_proxy->mainWorldContext(); + v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(activeFrame); // FIXME: find all cases context can be empty: // 1) JS is disabled; // 2) page is NULL; @@ -188,7 +191,11 @@ bool ScriptController::processingUserGesture(DOMWrapperWorld*) const // Event::fromUserGesture will return false when UserGestureIndicator::processingUserGesture() returns false. return event->fromUserGesture(); } - if (m_sourceURL && m_sourceURL->isNull() && !m_proxy->timerCallback()) { + // FIXME: We check the javascript anchor navigation from the last entered + // frame becuase it should only be initiated on the last entered frame in + // which execution began if it does happen. + const String* sourceURL = activeFrame->script()->sourceURL(); + if (sourceURL && sourceURL->isNull() && !activeProxy->timerCallback()) { // This is the <a href="javascript:window.open('...')> case -> we let it through. return true; } @@ -201,7 +208,7 @@ bool ScriptController::processingUserGesture(DOMWrapperWorld*) const bool ScriptController::anyPageIsProcessingUserGesture() const { // FIXME: is this right? - return processingUserGesture(); + return ScriptController::processingUserGesture(); } void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources) @@ -484,10 +491,12 @@ void ScriptController::updateDocument() void ScriptController::namedItemAdded(HTMLDocument* doc, const AtomicString& name) { + m_proxy->windowShell()->namedItemAdded(doc, name); } void ScriptController::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) { + m_proxy->windowShell()->namedItemRemoved(doc, name); } } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h index cd20cda..525476d 100644 --- a/WebCore/bindings/v8/ScriptController.h +++ b/WebCore/bindings/v8/ScriptController.h @@ -154,7 +154,7 @@ public: void setProcessingTimerCallback(bool processingTimerCallback) { m_processingTimerCallback = processingTimerCallback; } // FIXME: Currently we don't use the parameter world at all. // See http://trac.webkit.org/changeset/54182 - bool processingUserGesture(DOMWrapperWorld* world = 0) const; + static bool processingUserGesture(); bool anyPageIsProcessingUserGesture() const; void setPaused(bool paused) { m_paused = paused; } diff --git a/WebCore/bindings/v8/ScriptDebugServer.cpp b/WebCore/bindings/v8/ScriptDebugServer.cpp index 0a432b7..0c24678 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.cpp +++ b/WebCore/bindings/v8/ScriptDebugServer.cpp @@ -44,6 +44,19 @@ namespace WebCore { +namespace { + +class ClientDataImpl : public v8::Debug::ClientData { +public: + ClientDataImpl(PassOwnPtr<ScriptDebugServer::Task> task) : m_task(task) { } + virtual ~ClientDataImpl() { } + ScriptDebugServer::Task* task() const { return m_task.get(); } +private: + OwnPtr<ScriptDebugServer::Task> m_task; +}; + +} + static Frame* retrieveFrame(v8::Handle<v8::Context> context) { if (context.IsEmpty()) @@ -209,6 +222,12 @@ void ScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pauseOn setPauseOnExceptionsFunction->Call(m_debuggerScript.get(), 1, argv); } +void ScriptDebugServer::pause() +{ + if (!m_pausedPage) + v8::Debug::DebugBreak(); +} + void ScriptDebugServer::continueProgram() { if (m_pausedPage) @@ -294,6 +313,16 @@ bool ScriptDebugServer::isDebuggerAlwaysEnabled() return m_enabled; } +void ScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task) +{ + v8::Debug::DebugBreakForCommand(new ClientDataImpl(task)); +} + +void ScriptDebugServer::runPendingTasks() +{ + v8::Debug::ProcessDebugMessages(); +} + void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails) { ScriptDebugServer::shared().handleV8DebugEvent(eventDetails); @@ -302,6 +331,13 @@ void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& even void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails) { v8::DebugEvent event = eventDetails.GetEvent(); + + if (event == v8::BreakForCommand) { + ClientDataImpl* data = static_cast<ClientDataImpl*>(eventDetails.GetClientData()); + data->task()->run(); + return; + } + if (event != v8::Break && event != v8::Exception && event != v8::AfterCompile) return; diff --git a/WebCore/bindings/v8/ScriptDebugServer.h b/WebCore/bindings/v8/ScriptDebugServer.h index a55388f..a1e0a47 100644 --- a/WebCore/bindings/v8/ScriptDebugServer.h +++ b/WebCore/bindings/v8/ScriptDebugServer.h @@ -36,12 +36,12 @@ #include "JavaScriptCallFrame.h" #include "PlatformString.h" #include "ScriptBreakpoint.h" -#include "StringHash.h" #include "Timer.h" #include <v8-debug.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { @@ -70,7 +70,7 @@ public: PauseOnExceptionsState pauseOnExceptionsState(); void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState); - void pause() { } + void pause(); void continueProgram(); void stepIntoStatement(); void stepOverStatement(); @@ -99,6 +99,14 @@ public: void setEnabled(bool); bool isDebuggerAlwaysEnabled(); + class Task { + public: + virtual ~Task() { } + virtual void run() = 0; + }; + static void interruptAndRun(PassOwnPtr<Task>); + void runPendingTasks(); + private: ScriptDebugServer(); ~ScriptDebugServer() { } diff --git a/WebCore/bindings/v8/ScriptProfile.cpp b/WebCore/bindings/v8/ScriptProfile.cpp index 32e0066..95ac0de 100644 --- a/WebCore/bindings/v8/ScriptProfile.cpp +++ b/WebCore/bindings/v8/ScriptProfile.cpp @@ -72,9 +72,9 @@ static PassRefPtr<InspectorObject> buildInspectorObjectFor(const v8::CpuProfileN const int childrenCount = node->GetChildrenCount(); for (int i = 0; i < childrenCount; i++) { const v8::CpuProfileNode* child = node->GetChild(i); - children->push(buildInspectorObjectFor(child)); + children->pushObject(buildInspectorObjectFor(child)); } - result->set("children", children); + result->setArray("children", children); return result; } diff --git a/WebCore/bindings/v8/ScriptValue.cpp b/WebCore/bindings/v8/ScriptValue.cpp index 6d3fe20..ebe9ccc 100755 --- a/WebCore/bindings/v8/ScriptValue.cpp +++ b/WebCore/bindings/v8/ScriptValue.cpp @@ -93,7 +93,7 @@ static PassRefPtr<InspectorValue> v8ToInspectorValue(v8::Handle<v8::Value> value ASSERT_NOT_REACHED(); element = InspectorValue::null(); } - inspectorArray->push(element); + inspectorArray->pushValue(element); } return inspectorArray; } @@ -105,14 +105,14 @@ static PassRefPtr<InspectorValue> v8ToInspectorValue(v8::Handle<v8::Value> value for (uint32_t i = 0; i < length; i++) { v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(i)); // FIXME(yurys): v8::Object should support GetOwnPropertyNames - if (!object->HasRealNamedProperty(v8::Handle<v8::String>::Cast(name))) + if (name->IsString() && !object->HasRealNamedProperty(v8::Handle<v8::String>::Cast(name))) continue; RefPtr<InspectorValue> propertyValue = v8ToInspectorValue(object->Get(name)); if (!propertyValue) { ASSERT_NOT_REACHED(); continue; } - inspectorObject->set(toWebCoreStringWithNullCheck(name), propertyValue); + inspectorObject->setValue(toWebCoreStringWithNullCheck(name), propertyValue); } return inspectorObject; } diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp index 9dc4d0f..395ef1a 100644 --- a/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -183,16 +183,20 @@ public: doWriteNumber(number); } - void writeBlob(const String& path) + void writeBlob(const String& url, const String& type, unsigned long long size) { append(BlobTag); - doWriteWebCoreString(path); + doWriteWebCoreString(url); + doWriteWebCoreString(type); + doWriteUint64(size); } - void writeFile(const String& path) + void writeFile(const String& path, const String& url, const String& type) { append(FileTag); doWriteWebCoreString(path); + doWriteWebCoreString(url); + doWriteWebCoreString(type); } void writeFileList(const FileList& fileList) @@ -200,8 +204,11 @@ public: append(FileListTag); uint32_t length = fileList.length(); doWriteUint32(length); - for (unsigned i = 0; i < length; ++i) + for (unsigned i = 0; i < length; ++i) { doWriteWebCoreString(fileList.item(i)->path()); + doWriteWebCoreString(fileList.item(i)->url().string()); + doWriteWebCoreString(fileList.item(i)->type()); + } } void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelData, uint32_t pixelDataLength) @@ -251,7 +258,8 @@ private: doWriteString(buffer->data(), buffer->size()); } - void doWriteUint32(uint32_t value) + template<class T> + void doWriteUintHelper(T value) { while (true) { uint8_t b = (value & varIntMask); @@ -264,6 +272,16 @@ private: } } + void doWriteUint32(uint32_t value) + { + doWriteUintHelper(value); + } + + void doWriteUint64(uint64_t value) + { + doWriteUintHelper(value); + } + void doWriteNumber(double number) { append(reinterpret_cast<uint8_t*>(&number), sizeof(number)); @@ -560,7 +578,7 @@ private: Blob* blob = V8Blob::toNative(value.As<v8::Object>()); if (!blob) return; - m_writer.writeBlob(blob->path()); + m_writer.writeBlob(blob->url().string(), blob->type(), blob->size()); } void writeFile(v8::Handle<v8::Value> value) @@ -568,7 +586,7 @@ private: File* file = V8File::toNative(value.As<v8::Object>()); if (!file) return; - m_writer.writeFile(file->path()); + m_writer.writeFile(file->path(), file->url().string(), file->type()); } void writeFileList(v8::Handle<v8::Value> value) @@ -852,10 +870,16 @@ private: bool readBlob(v8::Handle<v8::Value>* value) { - String path; - if (!readWebCoreString(&path)) + String url; + String type; + uint64_t size; + if (!readWebCoreString(&url)) return false; - PassRefPtr<Blob> blob = Blob::create(getScriptExecutionContext(), path); + if (!readWebCoreString(&type)) + return false; + if (!doReadUint64(&size)) + return false; + PassRefPtr<Blob> blob = Blob::create(getScriptExecutionContext(), KURL(ParsedURLString, url), type, size); *value = toV8(blob); return true; } @@ -863,9 +887,15 @@ private: bool readFile(v8::Handle<v8::Value>* value) { String path; + String url; + String type; if (!readWebCoreString(&path)) return false; - PassRefPtr<File> file = File::create(getScriptExecutionContext(), path); + if (!readWebCoreString(&url)) + return false; + if (!readWebCoreString(&type)) + return false; + PassRefPtr<File> file = File::create(getScriptExecutionContext(), path, KURL(ParsedURLString, url), type); *value = toV8(file); return true; } @@ -878,15 +908,22 @@ private: PassRefPtr<FileList> fileList = FileList::create(); for (unsigned i = 0; i < length; ++i) { String path; + String urlString; + String type; if (!readWebCoreString(&path)) return false; - fileList->append(File::create(getScriptExecutionContext(), path)); + if (!readWebCoreString(&urlString)) + return false; + if (!readWebCoreString(&type)) + return false; + fileList->append(File::create(getScriptExecutionContext(), path, KURL(ParsedURLString, urlString), type)); } *value = toV8(fileList); return true; } - bool doReadUint32(uint32_t* value) + template<class T> + bool doReadUintHelper(T* value) { *value = 0; uint8_t currentByte; @@ -901,6 +938,16 @@ private: return true; } + bool doReadUint32(uint32_t* value) + { + return doReadUintHelper(value); + } + + bool doReadUint64(uint64_t* value) + { + return doReadUintHelper(value); + } + bool doReadNumber(double* number) { if (m_position + sizeof(double) > m_length) diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp index 1272fd4..3799cdb 100644 --- a/WebCore/bindings/v8/V8Binding.cpp +++ b/WebCore/bindings/v8/V8Binding.cpp @@ -31,18 +31,18 @@ #include "config.h" #include "V8Binding.h" -#include "AtomicString.h" #include "Element.h" #include "MathExtras.h" #include "PlatformString.h" #include "QualifiedName.h" #include "StdLibExtras.h" -#include "StringBuffer.h" -#include "StringHash.h" #include "Threading.h" #include "V8Element.h" #include "V8Proxy.h" +#include <wtf/text/AtomicString.h> #include <wtf/text/CString.h> +#include <wtf/text/StringBuffer.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h index 4656aa2..087c128 100644 --- a/WebCore/bindings/v8/V8Binding.h +++ b/WebCore/bindings/v8/V8Binding.h @@ -31,11 +31,11 @@ #ifndef V8Binding_h #define V8Binding_h -#include "AtomicString.h" #include "BindingSecurity.h" #include "MathExtras.h" #include "PlatformString.h" #include "V8DOMWrapper.h" +#include <wtf/text/AtomicString.h> #include <v8.h> diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp index 6676f6c..435876c 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -50,6 +50,7 @@ #include "V8DOMWindow.h" #include "V8Document.h" #include "V8GCForContextDispose.h" +#include "V8HTMLDocument.h" #include "V8HiddenPropertyName.h" #include "V8History.h" #include "V8Location.h" @@ -418,6 +419,12 @@ void V8DOMWindowShell::clearDocumentWrapper() } } +static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document) +{ + ASSERT(V8Document::toNative(wrapper) == document); + ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document)); +} + void V8DOMWindowShell::updateDocumentWrapperCache() { v8::HandleScope handleScope; @@ -436,6 +443,10 @@ void V8DOMWindowShell::updateDocumentWrapperCache() } v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document()); + ASSERT(documentWrapper == m_document || m_document.IsEmpty()); + if (m_document.IsEmpty()) + updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper)); + checkDocumentWrapper(m_document, m_frame->document()); // If instantiation of the document wrapper fails, clear the cache // and let the DOMWindow accessor handle access to the document. @@ -513,6 +524,37 @@ void V8DOMWindowShell::updateDocument() updateSecurityOrigin(); } +v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info) +{ + // FIXME(antonm): consider passing AtomicStringImpl directly. + AtomicString name = v8StringToAtomicWebCoreString(property); + HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); + ASSERT(htmlDocument); + v8::Handle<v8::Value> result = V8HTMLDocument::GetNamedProperty(htmlDocument, name); + if (!result.IsEmpty()) + return result; + v8::Handle<v8::Value> prototype = info.Holder()->GetPrototype(); + if (prototype->IsObject()) + return prototype.As<v8::Object>()->Get(property); + return v8::Undefined(); +} + +void V8DOMWindowShell::namedItemAdded(HTMLDocument* doc, const AtomicString& name) +{ + initContextIfNeeded(); + + v8::HandleScope handleScope; + v8::Context::Scope contextScope(m_context); + + ASSERT(!m_document.IsEmpty()); + checkDocumentWrapper(m_document, doc); + m_document->SetAccessor(v8String(name), getter); +} + +void V8DOMWindowShell::namedItemRemoved(HTMLDocument* doc, const AtomicString& name) +{ +} + void V8DOMWindowShell::updateSecurityOrigin() { v8::HandleScope scope; diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h index 2ccb410..7958bf1 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.h +++ b/WebCore/bindings/v8/V8DOMWindowShell.h @@ -37,11 +37,13 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicString.h> namespace WebCore { class DOMWindow; class Frame; +class HTMLDocument; // V8WindowShell represents all the per-global object state for a Frame that // persist between navigations. @@ -54,6 +56,9 @@ public: // Update document object of the frame. void updateDocument(); + void namedItemAdded(HTMLDocument*, const AtomicString&); + void namedItemRemoved(HTMLDocument*, const AtomicString&); + // Update the security origin of a document // (e.g., after setting docoument.domain). void updateSecurityOrigin(); diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp index d6f05f4..8a72a3a 100644 --- a/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -284,6 +284,8 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperT if (!instance.IsEmpty()) { // Avoid setting the DOM wrapper for failed allocations. setDOMWrapper(instance, type, impl); + if (type == &V8HTMLDocument::info) + instance = V8HTMLDocument::WrapInShadowObject(instance, static_cast<Node*>(impl)); } return instance; } diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp index 26fc626..3491170 100644 --- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp +++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp @@ -63,13 +63,13 @@ static v8::Handle<v8::Value> toV8Object(CanvasStyle* style) static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value) { if (value->IsString()) - return CanvasStyle::create(toWebCoreString(value)); + return CanvasStyle::createFromString(toWebCoreString(value)); if (V8CanvasGradient::HasInstance(value)) - return CanvasStyle::create(V8CanvasGradient::toNative(v8::Handle<v8::Object>::Cast(value))); + return CanvasStyle::createFromGradient(V8CanvasGradient::toNative(v8::Handle<v8::Object>::Cast(value))); if (V8CanvasPattern::HasInstance(value)) - return CanvasStyle::create(V8CanvasPattern::toNative(v8::Handle<v8::Object>::Cast(value))); + return CanvasStyle::createFromPattern(V8CanvasPattern::toNative(v8::Handle<v8::Object>::Cast(value))); return 0; } diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp index 18f27cb..97d0dde 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "V8CustomPositionCallback.h" +#if ENABLE(GEOLOCATION) + #include "ScriptExecutionContext.h" #include "V8CustomVoidCallback.h" // For invokeCallback #include "V8Geoposition.h" @@ -76,3 +78,5 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position) } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp index 36b5e04..906a909 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "V8CustomPositionErrorCallback.h" +#if ENABLE(GEOLOCATION) + #include "ScriptExecutionContext.h" #include "V8CustomVoidCallback.h" // For invokeCallback #include "V8PositionError.h" @@ -76,3 +78,5 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error) } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index a74faee..45cb1b4 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -67,16 +67,6 @@ #if ENABLE(WEB_SOCKETS) #include "WebSocket.h" #endif -#if ENABLE(3D_CANVAS) -#include "V8ArrayBuffer.h" -#include "V8Int8Array.h" -#include "V8Float32Array.h" -#include "V8Int32Array.h" -#include "V8Int16Array.h" -#include "V8Uint8Array.h" -#include "V8Uint32Array.h" -#include "V8Uint16Array.h" -#endif #include "WindowFeatures.h" namespace WebCore { @@ -253,61 +243,6 @@ v8::Handle<v8::Value> V8DOMWindow::OptionAccessorGetter(v8::Local<v8::String> na return V8DOMWrapper::getConstructor(&V8HTMLOptionElementConstructor::info, window); } -#if ENABLE(3D_CANVAS) - -// Temporary aliases to keep current WebGL content working during transition period to TypedArray spec. -// To be removed before WebGL spec is finalized. (FIXME) -v8::Handle<v8::Value> V8DOMWindow::WebGLArrayBufferAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8ArrayBuffer::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLByteArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Int8Array::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLUnsignedByteArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Uint8Array::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLShortArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Int16Array::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLUnsignedShortArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Uint16Array::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLIntArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Int32Array::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLUnsignedIntArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Uint32Array::info, window); -} - -v8::Handle<v8::Value> V8DOMWindow::WebGLFloatArrayAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - DOMWindow* window = V8DOMWindow::toNative(info.Holder()); - return V8DOMWrapper::getConstructor(&V8Float32Array::info, window); -} - -#endif - - v8::Handle<v8::Value> V8DOMWindow::addEventListenerCallback(const v8::Arguments& args) { INC_STATS("DOM.DOMWindow.addEventListener()"); diff --git a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp index 649c45f..54bd11c 100644 --- a/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp +++ b/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "V8Geolocation.h" +#if ENABLE(GEOLOCATION) + #include "Frame.h" #include "Geolocation.h" #include "V8Binding.h" @@ -215,3 +217,5 @@ v8::Handle<v8::Value> V8Geolocation::watchPositionCallback(const v8::Arguments& } } // namespace WebCore + +#endif // ENABLE(GEOLOCATION) diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp index 86f2eb5..24ac47c 100644 --- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp @@ -49,48 +49,38 @@ namespace WebCore { -v8::Handle<v8::Boolean> V8HTMLDocument::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +v8::Local<v8::Object> V8HTMLDocument::WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl) { - // Only handle document.all. Insert the marker object into the - // shadow internal field to signal that document.all is no longer - // shadowed. - AtomicString key = v8StringToAtomicWebCoreString(name); - DEFINE_STATIC_LOCAL(const AtomicString, all, ("all")); - if (key != all) - return deletionNotHandledByInterceptor(); - - ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex); - info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, marker); - return v8::True(); -} - -v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.HTMLDocument.NamedPropertyGetter"); - AtomicString key = v8StringToAtomicWebCoreString(name); - - // Special case for document.all. If the value in the shadow - // internal field is not the marker object, then document.all has - // been temporarily shadowed and we return the value. - DEFINE_STATIC_LOCAL(const AtomicString, all, ("all")); - if (key == all) { - ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Value> marker = info.Holder()->GetInternalField(V8HTMLDocument::markerIndex); - v8::Local<v8::Value> value = info.Holder()->GetInternalField(V8HTMLDocument::shadowIndex); - if (marker != value) - return value; + DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, shadowTemplate, ()); + if (shadowTemplate.IsEmpty()) { + shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New()); + if (shadowTemplate.IsEmpty()) + return v8::Local<v8::Object>(); + shadowTemplate->SetClassName(v8::String::New("HTMLDocument")); + shadowTemplate->Inherit(V8HTMLDocument::GetTemplate()); + shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount); } - HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder()); + v8::Local<v8::Function> shadowConstructor = shadowTemplate->GetFunction(); + if (shadowConstructor.IsEmpty()) + return v8::Local<v8::Object>(); - // Fast case for named elements that are not there. + v8::Local<v8::Object> shadow = shadowConstructor->NewInstance(); + if (shadow.IsEmpty()) + return v8::Local<v8::Object>(); + V8DOMWrapper::setDOMWrapper(shadow, &V8HTMLDocument::info, impl); + shadow->SetPrototype(wrapper); + return shadow; +} + +v8::Handle<v8::Value> V8HTMLDocument::GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key) +{ if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl())) return v8::Handle<v8::Value>(); RefPtr<HTMLCollection> items = htmlDocument->documentNamedItems(key); if (!items->length()) - return notHandledByInterceptor(); + return v8::Handle<v8::Value>(); if (items->length() == 1) { Node* node = items->firstItem(); @@ -104,13 +94,6 @@ v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> return toV8(items.release()); } -v8::Handle<v8::Value> V8HTMLDocument::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo &info) -{ - INC_STATS("DOM.HTMLDocument.IndexedPropertyGetter"); - v8::Local<v8::Integer> indexV8 = v8::Integer::NewFromUnsigned(index); - return namedPropertyGetter(indexV8->ToString(), info); -} - // HTMLDocument ---------------------------------------------------------------- // Concatenates "args" to a string. If args is empty, returns empty string. @@ -193,10 +176,8 @@ v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> na void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { - INC_STATS("DOM.HTMLDocument.all._set"); - v8::Handle<v8::Object> holder = info.Holder(); - ASSERT(info.Holder()->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, value); + // Just emulate a normal JS behaviour---install a property on this. + info.This()->ForceSet(name, value); } v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject) @@ -210,12 +191,6 @@ v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject) if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame())) proxy->windowShell()->updateDocumentWrapper(wrapper); } - // Create marker object and insert it in two internal fields. - // This is used to implement temporary shadowing of document.all. - ASSERT(wrapper->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Object> marker = v8::Object::New(); - wrapper->SetInternalField(V8HTMLDocument::markerIndex, marker); - wrapper->SetInternalField(V8HTMLDocument::shadowIndex, marker); return wrapper; } diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 435cf73..1b069cf 100644 --- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -211,6 +211,9 @@ InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScrip if (!val.IsEmpty() && val->IsObject()) return InjectedScript(ScriptObject(inspectedScriptState, v8::Local<v8::Object>::Cast(val))); + if (!canAccessInspectedWindow(inspectedScriptState)) + return InjectedScript(); + ASSERT(!m_injectedScriptSource.isEmpty()); pair<long, ScriptObject> injectedScript = injectScript(m_injectedScriptSource, inspectedScriptState); InjectedScript result(injectedScript.second); diff --git a/WebCore/bindings/v8/specialization/V8BindingState.cpp b/WebCore/bindings/v8/specialization/V8BindingState.cpp index d95d578..ccdd7c8 100644 --- a/WebCore/bindings/v8/specialization/V8BindingState.cpp +++ b/WebCore/bindings/v8/specialization/V8BindingState.cpp @@ -81,8 +81,7 @@ void State<V8Binding>::immediatelyReportUnsafeAccessTo(Frame* target) bool State<V8Binding>::processingUserGesture() { - Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); - return frame && frame->script()->processingUserGesture(); + return ScriptController::processingUserGesture(); } } // namespace WebCore diff --git a/WebCore/bridge/IdentifierRep.cpp b/WebCore/bridge/IdentifierRep.cpp index bc599de..fed47ca 100644 --- a/WebCore/bridge/IdentifierRep.cpp +++ b/WebCore/bridge/IdentifierRep.cpp @@ -78,7 +78,7 @@ IdentifierRep* IdentifierRep::get(int intID) return result.first->second; } -typedef HashMap<RefPtr<JSC::UString::Rep>, IdentifierRep*> StringIdentifierMap; +typedef HashMap<RefPtr<StringImpl>, IdentifierRep*> StringIdentifierMap; static StringIdentifierMap& stringIdentifierMap() { @@ -93,7 +93,7 @@ IdentifierRep* IdentifierRep::get(const char* name) return 0; UString string = stringToUString(String::fromUTF8WithLatin1Fallback(name, strlen(name))); - pair<StringIdentifierMap::iterator, bool> result = stringIdentifierMap().add(string.rep(), 0); + pair<StringIdentifierMap::iterator, bool> result = stringIdentifierMap().add(string.impl(), 0); if (result.second) { ASSERT(!result.first->second); result.first->second = new IdentifierRep(name); diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp index d454c74..17270eb 100644 --- a/WebCore/bridge/NP_jsobject.cpp +++ b/WebCore/bridge/NP_jsobject.cpp @@ -474,7 +474,7 @@ bool _NPN_Enumerate(NPP, NPObject* o, NPIdentifier** identifier, uint32_t* count NPIdentifier* identifiers = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier) * size)); for (unsigned i = 0; i < size; ++i) - identifiers[i] = _NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().data()); + identifiers[i] = _NPN_GetStringIdentifier(propertyNames[i].ustring().utf8().data()); *identifier = identifiers; *count = size; diff --git a/WebCore/bridge/c/c_class.cpp b/WebCore/bridge/c/c_class.cpp index ea71638..f4ae5ca 100644 --- a/WebCore/bridge/c/c_class.cpp +++ b/WebCore/bridge/c/c_class.cpp @@ -75,20 +75,20 @@ MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance { MethodList methodList; - Method* method = _methods.get(identifier.ustring().rep()); + Method* method = _methods.get(identifier.ustring().impl()); if (method) { methodList.append(method); return methodList; } - NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii()); + NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii().data()); const CInstance* inst = static_cast<const CInstance*>(instance); NPObject* obj = inst->getObject(); if (_isa->hasMethod && _isa->hasMethod(obj, ident)){ Method* aMethod = new CMethod(ident); // deleted in the CClass destructor { JSLock lock(SilenceAssertionsOnly); - _methods.set(identifier.ustring().rep(), aMethod); + _methods.set(identifier.ustring().impl(), aMethod); } methodList.append(aMethod); } @@ -98,18 +98,18 @@ MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance Field* CClass::fieldNamed(const Identifier& identifier, Instance* instance) const { - Field* aField = _fields.get(identifier.ustring().rep()); + Field* aField = _fields.get(identifier.ustring().impl()); if (aField) return aField; - NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii()); + NPIdentifier ident = _NPN_GetStringIdentifier(identifier.ascii().data()); const CInstance* inst = static_cast<const CInstance*>(instance); NPObject* obj = inst->getObject(); if (_isa->hasProperty && _isa->hasProperty(obj, ident)){ aField = new CField(ident); // deleted in the CClass destructor { JSLock lock(SilenceAssertionsOnly); - _fields.set(identifier.ustring().rep(), aField); + _fields.set(identifier.ustring().impl(), aField); } } return aField; diff --git a/WebCore/bridge/c/c_utility.cpp b/WebCore/bridge/c/c_utility.cpp index 443ecca..b160f9f 100644 --- a/WebCore/bridge/c/c_utility.cpp +++ b/WebCore/bridge/c/c_utility.cpp @@ -74,7 +74,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) if (value.isString()) { UString ustring = value.toString(exec); - CString cstring = ustring.UTF8String(); + CString cstring = ustring.utf8(); NPString string = { (const NPUTF8*)cstring.data(), static_cast<uint32_t>(cstring.length()) }; NPN_InitializeVariantWithStringCopy(result, &string); } else if (value.isNumber()) { diff --git a/WebCore/bridge/jni/JNIBridge.cpp b/WebCore/bridge/jni/JNIBridge.cpp index 35a0d34..8fa2678 100644 --- a/WebCore/bridge/jni/JNIBridge.cpp +++ b/WebCore/bridge/jni/JNIBridge.cpp @@ -41,7 +41,7 @@ using namespace WebCore; JavaParameter::JavaParameter(JNIEnv* env, jstring type) { m_type = JavaString(env, type); - m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + m_JNIType = JNITypeFromClassName(m_type.utf8()); } JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod) @@ -55,7 +55,7 @@ JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod) env->DeleteLocalRef(returnType); } m_returnType = JavaString(env, returnTypeName); - m_JNIReturnType = JNITypeFromClassName(m_returnType.UTF8String()); + m_JNIReturnType = JNITypeFromClassName(m_returnType.utf8()); env->DeleteLocalRef(returnTypeName); // Get method name @@ -148,7 +148,7 @@ const char* JavaMethod::signature() const } signatureBuilder.append(")"); - const char* returnType = m_returnType.UTF8String(); + const char* returnType = m_returnType.utf8(); if (m_JNIReturnType == array_type) appendClassName(signatureBuilder, returnType); else { @@ -174,7 +174,7 @@ JNIType JavaMethod::JNIReturnType() const jmethodID JavaMethod::methodID(jobject obj) const { if (!m_methodID) - m_methodID = getMethodID(obj, m_name.UTF8String(), signature()); + m_methodID = getMethodID(obj, m_name.utf8(), signature()); return m_methodID; } diff --git a/WebCore/bridge/jni/JNIBridge.h b/WebCore/bridge/jni/JNIBridge.h index 78202ae..4f5e6b7 100644 --- a/WebCore/bridge/jni/JNIBridge.h +++ b/WebCore/bridge/jni/JNIBridge.h @@ -61,7 +61,7 @@ public: m_impl.init(getJNIEnv(), s); } - const char* UTF8String() const { return m_impl.UTF8String(); } + const char* utf8() const { return m_impl.utf8(); } const jchar* uchars() const { return m_impl.uchars(); } int length() const { return m_impl.length(); } #if USE(JSC) @@ -78,7 +78,7 @@ public: JavaParameter(JNIEnv*, jstring type); virtual ~JavaParameter() { } - RuntimeType type() const { return m_type.UTF8String(); } + RuntimeType type() const { return m_type.utf8(); } JNIType getJNIType() const { return m_JNIType; } private: @@ -92,7 +92,7 @@ public: ~JavaMethod(); const JavaString& name() const { return m_name; } - RuntimeType returnType() const { return m_returnType.UTF8String(); } + RuntimeType returnType() const { return m_returnType.utf8(); } JavaParameter* parameterAt(int i) const { return &m_parameters[i]; } int numParameters() const { return m_numParameters; } diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index 7793070..d7d3a54 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -276,7 +276,7 @@ RootObject* JavaJSObject::rootObject() const jobject JavaJSObject::call(jstring methodName, jobjectArray args) const { - LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).utf8()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -305,7 +305,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const jobject JavaJSObject::eval(jstring script) const { - LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).UTF8String()); + LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).utf8()); JSValue result; @@ -332,7 +332,7 @@ jobject JavaJSObject::eval(jstring script) const jobject JavaJSObject::getMember(jstring memberName) const { - LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).utf8()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -348,7 +348,7 @@ jobject JavaJSObject::getMember(jstring memberName) const void JavaJSObject::setMember(jstring memberName, jobject value) const { - LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).UTF8String(), value); + LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).utf8(), value); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -364,7 +364,7 @@ void JavaJSObject::setMember(jstring memberName, jobject value) const void JavaJSObject::removeMember(jstring memberName) const { - LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).utf8()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -500,7 +500,7 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const } else if (value.isString()) { UString stringValue = value.toString(exec); JNIEnv *env = getJNIEnv(); - result = env->NewString ((const jchar *)stringValue.data(), stringValue.size()); + result = env->NewString ((const jchar *)stringValue.characters(), stringValue.length()); } else if (value.isBoolean()) { jclass JSObjectClass = env->FindClass ("java/lang/Boolean"); jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(Z)V"); @@ -572,7 +572,7 @@ JSValue JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject) // created above to wrap internal browser objects. The constructor of this class takes the native // pointer and stores it in this object, so that it can be retrieved below. jstring className = (jstring)callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;"); - if (!className || (strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject") != 0)) { + if (!className || (strcmp(JavaString(className).utf8(), "sun.plugin.javascript.webkit.JSObject") != 0)) { JSLock lock(SilenceAssertionsOnly); return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); } diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp index d5dc1cb..8a34ced 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -49,7 +49,7 @@ JavaField::JavaField(JNIEnv* env, jobject aField) fieldTypeName = env->NewStringUTF("<Unknown>"); m_type = JavaString(env, fieldTypeName); - m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + m_JNIType = JNITypeFromClassName(m_type.utf8()); // Get field name jstring fieldName = static_cast<jstring>(callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;")); @@ -150,7 +150,7 @@ JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const break; } - LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).UTF8String().data(), jsresult.toString(exec).ascii()); + LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).utf8().data(), jsresult.toString(exec).ascii().data()); return jsresult; } @@ -186,7 +186,7 @@ void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue a const JavaInstance* instance = static_cast<const JavaInstance*>(i); jvalue javaValue = convertValueToJValue(exec, i->rootObject(), aValue, m_JNIType, type()); - LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).UTF8String().data(), aValue.toString(exec).ascii()); + LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).utf8().data(), aValue.toString(exec).ascii().data()); switch (m_JNIType) { case array_type: diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h index dd65417..afb1bce 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h @@ -45,7 +45,7 @@ public: virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const; const JavaString& name() const { return m_name; } - virtual RuntimeType type() const { return m_type.UTF8String(); } + virtual RuntimeType type() const { return m_type.utf8(); } JNIType getJNIType() const { return m_JNIType; } diff --git a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp index 2048d8e..2fb72e9 100644 --- a/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp +++ b/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp @@ -63,7 +63,7 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray JSValue item = jsArray->get(exec, i); UString stringValue = item.toString(exec); env->SetObjectArrayElement(jarray, i, - env->functions->NewString(env, (const jchar *)stringValue.data(), stringValue.size())); + env->functions->NewString(env, (const jchar *)stringValue.characters(), stringValue.length())); } } break; @@ -98,8 +98,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray JSValue item = jsArray->get(exec, i); UString stringValue = item.toString(exec); jchar value = 0; - if (stringValue.size() > 0) - value = ((const jchar*)stringValue.data())[0]; + if (stringValue.length() > 0) + value = ((const jchar*)stringValue.characters())[0]; env->SetCharArrayRegion((jcharArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -218,7 +218,7 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val if (value.isString()) { UString stringValue = asString(value)->value(exec); JNIEnv* env = getJNIEnv(); - jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length()); result.l = javaString; } else if (value.isNumber()) { double doubleValue = value.uncheckedGetNumber(); @@ -237,7 +237,7 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val } else if (value.isUndefined()) { UString stringValue = "undefined"; JNIEnv* env = getJNIEnv(); - jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length()); result.l = javaString; } } @@ -248,7 +248,7 @@ jvalue convertValueToJValue(ExecState* exec, RootObject* rootObject, JSValue val if (!value.isNull()) { UString stringValue = value.toString(exec); JNIEnv* env = getJNIEnv(); - jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.characters(), stringValue.length()); result.l = javaString; } } diff --git a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp index 780c4fc..43cdc96 100644 --- a/WebCore/bridge/jni/jsc/JavaClassJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaClassJSC.cpp @@ -63,7 +63,7 @@ JavaClass::JavaClass(jobject anInstance) JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor { JSLock lock(SilenceAssertionsOnly); - m_fields.set(((UString)aField->name()).rep(), aField); + m_fields.set(((UString)aField->name()).impl(), aField); } env->DeleteLocalRef(aJField); } @@ -80,10 +80,10 @@ JavaClass::JavaClass(jobject anInstance) { JSLock lock(SilenceAssertionsOnly); - methodList = m_methods.get(((UString)aMethod->name()).rep()); + methodList = m_methods.get(((UString)aMethod->name()).impl()); if (!methodList) { methodList = new MethodList(); - m_methods.set(((UString)aMethod->name()).rep(), methodList); + m_methods.set(((UString)aMethod->name()).impl(), methodList); } } methodList->append(aMethod); @@ -115,7 +115,7 @@ JavaClass::~JavaClass() MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) const { - MethodList* methodList = m_methods.get(identifier.ustring().rep()); + MethodList* methodList = m_methods.get(identifier.ustring().impl()); if (methodList) return *methodList; @@ -124,7 +124,7 @@ MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) cons Field* JavaClass::fieldNamed(const Identifier& identifier, Instance*) const { - return m_fields.get(identifier.ustring().rep()); + return m_fields.get(identifier.ustring().impl()); } bool JavaClass::isNumberClass() const diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp index 2c9a4ad..1e584af 100644 --- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp @@ -167,14 +167,14 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod } const JavaMethod* jMethod = static_cast<const JavaMethod*>(method); - LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).UTF8String().data(), jMethod->signature(), m_instance->m_instance); + LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).utf8().data(), jMethod->signature(), m_instance->m_instance); Vector<jvalue> jArgs(count); for (i = 0; i < count; i++) { JavaParameter* aParameter = jMethod->parameterAt(i); jArgs[i] = convertValueToJValue(exec, m_rootObject.get(), exec->argument(i), aParameter->getJNIType(), aParameter->type()); - LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii()); + LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, exec->argument(i).toString(exec).ascii().data()); } jvalue result; @@ -258,7 +258,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod else { jobject classOfInstance = callJNIMethod<jobject>(result.l, "getClass", "()Ljava/lang/Class;"); jstring className = static_cast<jstring>(callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;")); - if (!strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject")) { + if (!strcmp(JavaString(className).utf8(), "sun.plugin.javascript.webkit.JSObject")) { // Pull the nativeJSObject value from the Java instance. This is a pointer to the JSObject. JNIEnv* env = getJNIEnv(); jfieldID fieldID = env->GetFieldID(static_cast<jclass>(classOfInstance), "nativeJSObject", "J"); diff --git a/WebCore/bridge/jni/jsc/JavaStringJSC.h b/WebCore/bridge/jni/jsc/JavaStringJSC.h index 0a7dad5..cf575b2 100644 --- a/WebCore/bridge/jni/jsc/JavaStringJSC.h +++ b/WebCore/bridge/jni/jsc/JavaStringJSC.h @@ -40,13 +40,13 @@ public: ~JavaStringImpl() { JSLock lock(SilenceAssertionsOnly); - m_rep = 0; + m_impl = 0; } void init() { JSLock lock(SilenceAssertionsOnly); - m_rep = UString().rep(); + m_impl = UString().impl(); } void init(JNIEnv* e, jstring s) @@ -55,25 +55,25 @@ public: const jchar* uc = getUCharactersFromJStringInEnv(e, s); { JSLock lock(SilenceAssertionsOnly); - m_rep = UString(reinterpret_cast<const UChar*>(uc), size).rep(); + m_impl = UString(reinterpret_cast<const UChar*>(uc), size).impl(); } releaseUCharactersForJStringInEnv(e, s, uc); } - const char* UTF8String() const + const char* utf8() const { if (!m_utf8String.data()) { JSLock lock(SilenceAssertionsOnly); - m_utf8String = UString(m_rep).UTF8String(); + m_utf8String = UString(m_impl).utf8(); } return m_utf8String.data(); } - const jchar* uchars() const { return (const jchar*)m_rep->characters(); } - int length() const { return m_rep->length(); } - UString uString() const { return UString(m_rep); } + const jchar* uchars() const { return (const jchar*)m_impl->characters(); } + int length() const { return m_impl->length(); } + UString uString() const { return UString(m_impl); } private: - RefPtr<UString::Rep> m_rep; + RefPtr<StringImpl> m_impl; mutable CString m_utf8String; }; diff --git a/WebCore/bridge/jni/v8/JNIBridgeV8.cpp b/WebCore/bridge/jni/v8/JNIBridgeV8.cpp index 9fb1bf3..35775dc 100644 --- a/WebCore/bridge/jni/v8/JNIBridgeV8.cpp +++ b/WebCore/bridge/jni/v8/JNIBridgeV8.cpp @@ -34,7 +34,7 @@ JavaField::JavaField(JNIEnv* env, jobject aField) jobject fieldType = callJNIMethod<jobject>(aField, "getType", "()Ljava/lang/Class;"); jstring fieldTypeName = static_cast<jstring>(callJNIMethod<jobject>(fieldType, "getName", "()Ljava/lang/String;")); m_type = JavaString(env, fieldTypeName); - m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + m_JNIType = JNITypeFromClassName(m_type.utf8()); // Get field name jstring fieldName = static_cast<jstring>(callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;")); diff --git a/WebCore/bridge/jni/v8/JNIBridgeV8.h b/WebCore/bridge/jni/v8/JNIBridgeV8.h index 23989ce..46cbd56 100644 --- a/WebCore/bridge/jni/v8/JNIBridgeV8.h +++ b/WebCore/bridge/jni/v8/JNIBridgeV8.h @@ -38,7 +38,7 @@ public: JavaField(JNIEnv*, jobject aField); const JavaString& name() const { return m_name; } - const char* type() const { return m_type.UTF8String(); } + const char* type() const { return m_type.utf8(); } JNIType getJNIType() const { return m_JNIType; } diff --git a/WebCore/bridge/jni/v8/JavaClassV8.cpp b/WebCore/bridge/jni/v8/JavaClassV8.cpp index 02a57ea..04f8822 100644 --- a/WebCore/bridge/jni/v8/JavaClassV8.cpp +++ b/WebCore/bridge/jni/v8/JavaClassV8.cpp @@ -53,7 +53,7 @@ JavaClass::JavaClass(jobject anInstance) jobject aJField = env->GetObjectArrayElement(static_cast<jobjectArray>(fields), i); JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor { - m_fields.set(aField->name().UTF8String(), aField); + m_fields.set(aField->name().utf8(), aField); } env->DeleteLocalRef(aJField); } @@ -66,10 +66,10 @@ JavaClass::JavaClass(jobject anInstance) JavaMethod* aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor MethodList* methodList; { - methodList = m_methods.get(aMethod->name().UTF8String()); + methodList = m_methods.get(aMethod->name().utf8()); if (!methodList) { methodList = new MethodList(); - m_methods.set(aMethod->name().UTF8String(), methodList); + m_methods.set(aMethod->name().utf8(), methodList); } } methodList->append(aMethod); diff --git a/WebCore/bridge/jni/v8/JavaClassV8.h b/WebCore/bridge/jni/v8/JavaClassV8.h index b7447b2..0c1d627 100644 --- a/WebCore/bridge/jni/v8/JavaClassV8.h +++ b/WebCore/bridge/jni/v8/JavaClassV8.h @@ -28,9 +28,9 @@ #include "JNIBridgeV8.h" #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace JSC { diff --git a/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp b/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp index 88e28d4..7aa55b5 100644 --- a/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp +++ b/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp @@ -165,7 +165,7 @@ bool JavaNPObjectGetProperty(NPObject* obj, NPIdentifier identifier, NPVariant* // will fail. jvalue value = getJNIField(instance->javaInstance(), field->getJNIType(), - field->name().UTF8String(), + field->name().utf8(), field->type()); #endif convertJValueToNPVariant(value, field->getJNIType(), field->type(), result); diff --git a/WebCore/bridge/jni/v8/JavaStringV8.h b/WebCore/bridge/jni/v8/JavaStringV8.h index 21420b7..827d9f5 100644 --- a/WebCore/bridge/jni/v8/JavaStringV8.h +++ b/WebCore/bridge/jni/v8/JavaStringV8.h @@ -46,7 +46,7 @@ public: releaseCharactersForJStringInEnv(e, s, cs); } - const char* UTF8String() const { return m_utf8String.data(); } + const char* utf8() const { return m_utf8String.data(); } const jchar* uchars() const { return 0; } // Not implemented int length() const { return m_utf8String.length(); } diff --git a/WebCore/bridge/jsc/BridgeJSC.h b/WebCore/bridge/jsc/BridgeJSC.h index 44ce4d1..9cc9140 100644 --- a/WebCore/bridge/jsc/BridgeJSC.h +++ b/WebCore/bridge/jsc/BridgeJSC.h @@ -140,9 +140,9 @@ protected: const char* signatureForParameters(const ArgList&); -typedef HashMap<RefPtr<UString::Rep>, MethodList*> MethodListMap; -typedef HashMap<RefPtr<UString::Rep>, Method*> MethodMap; -typedef HashMap<RefPtr<UString::Rep>, Field*> FieldMap; +typedef HashMap<RefPtr<StringImpl>, MethodList*> MethodListMap; +typedef HashMap<RefPtr<StringImpl>, Method*> MethodMap; +typedef HashMap<RefPtr<StringImpl>, Field*> FieldMap; } // namespace Bindings diff --git a/WebCore/bridge/objc/objc_class.mm b/WebCore/bridge/objc/objc_class.mm index 62f0a34..2d29499 100644 --- a/WebCore/bridge/objc/objc_class.mm +++ b/WebCore/bridge/objc/objc_class.mm @@ -78,11 +78,11 @@ MethodList ObjcClass::methodsNamed(const Identifier& identifier, Instance*) cons MethodList methodList; char fixedSizeBuffer[1024]; char* buffer = fixedSizeBuffer; - const char* JSName = identifier.ascii(); - if (!convertJSMethodNameToObjc(JSName, buffer, sizeof(fixedSizeBuffer))) { - int length = strlen(JSName) + 1; + CString jsName = identifier.ascii(); + if (!convertJSMethodNameToObjc(jsName.data(), buffer, sizeof(fixedSizeBuffer))) { + int length = jsName.length() + 1; buffer = new char[length]; - if (!buffer || !convertJSMethodNameToObjc(JSName, buffer, length)) + if (!buffer || !convertJSMethodNameToObjc(jsName.data(), buffer, length)) return methodList; } @@ -153,8 +153,8 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c { ClassStructPtr thisClass = _isa; - const char* name = identifier.ascii(); - RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII)); + CString jsName = identifier.ascii(); + RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII)); Field* aField = (Field*)CFDictionaryGetValue(_fields.get(), fieldName.get()); if (aField) return aField; @@ -220,7 +220,7 @@ Field* ObjcClass::fieldNamed(const Identifier& identifier, Instance* instance) c if ([thisClass respondsToSelector:@selector(webScriptNameForKey:)]) mappedName = [thisClass webScriptNameForKey:objcIvarName]; - if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, name) == 0) { + if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, jsName.data()) == 0) { aField = new ObjcField(objcIVar); // deleted when the dictionary is destroyed CFDictionaryAddValue(_fields.get(), fieldName.get(), aField); break; diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 2b518b1..6c56458 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -391,7 +391,7 @@ bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier& p ObjcValue objcValue = convertValueToObjcValue(exec, aValue, ObjcObjectType); @try { - [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:property.ascii() encoding:NSASCIIStringEncoding]]; + [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:property.ascii().data() encoding:NSASCIIStringEncoding]]; } @catch(NSException* localException) { // Do nothing. Class did not override valueForUndefinedKey:. } @@ -417,7 +417,7 @@ JSValue ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifier setGlobalException(nil); @try { - id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:property.ascii() encoding:NSASCIIStringEncoding]]; + id objcValue = [targetObject valueForUndefinedKey:[NSString stringWithCString:property.ascii().data() encoding:NSASCIIStringEncoding]]; result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, m_rootObject.get()); } @catch(NSException* localException) { // Do nothing. Class did not override valueForUndefinedKey:. diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index e86cb1e..3c4ba23 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -237,7 +237,7 @@ static EncodedJSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) ObjcClass* objcClass = static_cast<ObjcClass*>(objcInstance->getClass()); OwnPtr<ObjcMethod> fallbackMethod(new ObjcMethod(objcClass->isa(), @selector(invokeUndefinedMethodFromWebScript:withArguments:))); const Identifier& nameIdentifier = static_cast<ObjcFallbackObjectImp*>(exec->callee())->propertyName(); - RetainPtr<CFStringRef> name(AdoptCF, CFStringCreateWithCharacters(0, nameIdentifier.data(), nameIdentifier.size())); + RetainPtr<CFStringRef> name(AdoptCF, CFStringCreateWithCharacters(0, nameIdentifier.characters(), nameIdentifier.length())); fallbackMethod->setJavaScriptName(name.get()); result = objcInstance->invokeObjcMethod(exec, fallbackMethod.get()); } diff --git a/WebCore/bridge/qt/qt_class.cpp b/WebCore/bridge/qt/qt_class.cpp index d809c81..4c29c69 100644 --- a/WebCore/bridge/qt/qt_class.cpp +++ b/WebCore/bridge/qt/qt_class.cpp @@ -71,8 +71,7 @@ JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, const Identifie QtInstance* qtinst = static_cast<QtInstance*>(inst); const UString& ustring = identifier.ustring(); - const QByteArray name = QString(reinterpret_cast<const QChar*>(ustring.data()), - ustring.size()).toAscii(); + const QByteArray name = QString(reinterpret_cast<const QChar*>(ustring.characters()), ustring.length()).toAscii(); // First see if we have a cache hit JSObject* val = qtinst->m_methods.value(name); @@ -131,7 +130,7 @@ Field* QtClass::fieldNamed(const Identifier& identifier, Instance* instance) con QObject* obj = qtinst->getObject(); const UString& ustring = identifier.ustring(); - const QString name(reinterpret_cast<const QChar*>(ustring.data()), ustring.size()); + const QString name(reinterpret_cast<const QChar*>(ustring.characters()), ustring.length()); const QByteArray ascii = name.toAscii(); // First check for a cached field diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index b9cf4b0..6881c2e 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -310,7 +310,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 6; } else { UString str = value.toString(exec); - ret = QVariant(QChar(str.size() ? *(const ushort*)str.rep()->characters() : 0)); + ret = QVariant(QChar(str.length() ? *(const ushort*)str.impl()->characters() : 0)); if (type == String) dist = 3; else @@ -325,7 +325,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type return QString(); } else { UString ustring = value.toString(exec); - ret = QVariant(QString((const QChar*)ustring.rep()->characters(), ustring.size())); + ret = QVariant(QString((const QChar*)ustring.impl()->characters(), ustring.length())); if (type == String) dist = 0; else @@ -349,7 +349,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type 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()); + QString id = QString((const QChar*)ustring.impl()->characters(), ustring.length()); result.insert(id, v); } } @@ -424,7 +424,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); UString ustring = val.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); result.append(qstring); } @@ -438,7 +438,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); UString ustring = val.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); result.append(qstring); } @@ -447,7 +447,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } else { // Make a single length array UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); QStringList result; result.append(qstring); ret = QVariant(result); @@ -463,7 +463,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 0; } else { UString ustring = value.toString(exec); - ret = QVariant(QString((const QChar*)ustring.rep()->characters(), ustring.size()).toLatin1()); + ret = QVariant(QString((const QChar*)ustring.impl()->characters(), ustring.length()).toLatin1()); if (type == String) dist = 5; else @@ -503,9 +503,10 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type ret = QTime(gdt.hour, gdt.minute, gdt.second); dist = 10; } +#ifndef QT_NO_DATESTRING } else if (type == String) { UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); if (hint == QMetaType::QDateTime) { QDateTime dt = QDateTime::fromString(qstring, Qt::ISODate); @@ -544,6 +545,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 3; } } +#endif // QT_NO_DATESTRING } break; @@ -554,7 +556,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type */ // Attempt to convert.. a bit risky UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); // this is of the form '/xxxxxx/i' int firstSlash = qstring.indexOf(QLatin1Char('/')); @@ -574,7 +576,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } } else if (type == String) { UString ustring = value.toString(exec); - QString qstring = QString((const QChar*)ustring.rep()->characters(), ustring.size()); + QString qstring = QString((const QChar*)ustring.impl()->characters(), ustring.length()); QRegExp re(qstring); if (re.isValid()) { diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp index 2cd7d66..ca12f48 100644 --- a/WebCore/bridge/runtime_array.cpp +++ b/WebCore/bridge/runtime_array.cpp @@ -82,7 +82,7 @@ bool RuntimeArray::getOwnPropertySlot(ExecState* exec, const Identifier& propert } bool ok; - unsigned index = propertyName.toArrayIndex(&ok); + unsigned index = propertyName.toArrayIndex(ok); if (ok) { if (index < getLength()) { slot.setCustomIndex(this, index, indexGetter); @@ -103,7 +103,7 @@ bool RuntimeArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& p } bool ok; - unsigned index = propertyName.toArrayIndex(&ok); + unsigned index = propertyName.toArrayIndex(ok); if (ok) { if (index < getLength()) { PropertySlot slot; @@ -134,7 +134,7 @@ void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue } bool ok; - unsigned index = propertyName.toArrayIndex(&ok); + unsigned index = propertyName.toArrayIndex(ok); if (ok) { getConcreteArray()->setValueAt(exec, index, value); return; diff --git a/WebCore/combine-javascript-resources b/WebCore/combine-javascript-resources index 96dfc88..428b6b7 100755 --- a/WebCore/combine-javascript-resources +++ b/WebCore/combine-javascript-resources @@ -31,12 +31,14 @@ use Getopt::Long; use File::Basename; use File::Path; +my $generatedScriptsDirectory; my $outputDirectory; my $scriptName; my $htmlFile; GetOptions('output-dir=s' => \$outputDirectory, 'output-script-name=s' => \$scriptName, + 'generated-scripts-dir=s' => \$generatedScriptsDirectory, 'input-html=s' => \$htmlFile); unless (defined $htmlFile and defined $scriptName and defined $outputDirectory) { @@ -62,7 +64,7 @@ open SCRIPT_OUT, ">", "$outputDirectory/$scriptName" or die "Can't open $outputD while ($headContents =~ m/<script.*src="([^"]*)"[^>]*>/gi) { local $/; - open SCRIPT_IN, "$htmlDirectory/$1" or die "Can't open $htmlDirectory/$1: $!"; + open SCRIPT_IN, "$generatedScriptsDirectory/$1" or open SCRIPT_IN, "$htmlDirectory/$1" or die "Can't open $htmlDirectory/$1: $!"; print SCRIPT_OUT "/* $1 */\n\n"; print SCRIPT_OUT <SCRIPT_IN>; close SCRIPT_IN; diff --git a/WebCore/css/CSSCanvasValue.cpp b/WebCore/css/CSSCanvasValue.cpp index 0c1c3f9..767c11e 100644 --- a/WebCore/css/CSSCanvasValue.cpp +++ b/WebCore/css/CSSCanvasValue.cpp @@ -90,7 +90,7 @@ Image* CSSCanvasValue::image(RenderObject* renderer, const IntSize& /*size*/) HTMLCanvasElement* elt = element(renderer->document()); if (!elt || !elt->buffer()) return 0; - return elt->buffer()->image(); + return elt->copiedImage(); } } // namespace WebCore diff --git a/WebCore/css/CSSFontFaceSource.h b/WebCore/css/CSSFontFaceSource.h index 278ba72..4ec54d6 100644 --- a/WebCore/css/CSSFontFaceSource.h +++ b/WebCore/css/CSSFontFaceSource.h @@ -26,10 +26,10 @@ #ifndef CSSFontFaceSource_h #define CSSFontFaceSource_h -#include "AtomicString.h" #include "CachedResourceClient.h" #include "CachedResourceHandle.h" #include <wtf/HashMap.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/css/CSSFontSelector.cpp b/WebCore/css/CSSFontSelector.cpp index 752798d..b98dcae 100644 --- a/WebCore/css/CSSFontSelector.cpp +++ b/WebCore/css/CSSFontSelector.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "CSSFontSelector.h" -#include "AtomicString.h" #include "CachedFont.h" #include "CSSFontFace.h" #include "CSSFontFaceRule.h" @@ -48,6 +47,7 @@ #include "RenderObject.h" #include "Settings.h" #include "SimpleFontData.h" +#include <wtf/text/AtomicString.h> #if ENABLE(SVG) #include "SVGFontFaceElement.h" diff --git a/WebCore/css/CSSFontSelector.h b/WebCore/css/CSSFontSelector.h index d9cce1c..abf82cd 100644 --- a/WebCore/css/CSSFontSelector.h +++ b/WebCore/css/CSSFontSelector.h @@ -27,10 +27,10 @@ #define CSSFontSelector_h #include "FontSelector.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/css/CSSNamespace.h b/WebCore/css/CSSNamespace.h index 0a1119d..d7fab4c 100644 --- a/WebCore/css/CSSNamespace.h +++ b/WebCore/css/CSSNamespace.h @@ -22,7 +22,7 @@ #ifndef CSSNamespace_h #define CSSNamespace_h -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index cdd6294..7528cd8 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -66,12 +66,12 @@ #include "Pair.h" #include "Rect.h" #include "ShadowValue.h" -#include "StringBuffer.h" #include "WebKitCSSKeyframeRule.h" #include "WebKitCSSKeyframesRule.h" #include "WebKitCSSTransformValue.h" #include <limits.h> #include <wtf/dtoa.h> +#include <wtf/text/StringBuffer.h> #if ENABLE(DASHBOARD_SUPPORT) #include "DashboardRegion.h" @@ -319,7 +319,7 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, cons // possible to set up a default color. bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict) { - // First try creating a color specified by name, rgb() or "#" syntax. + // First try creating a color specified by name, rgba(), rgb() or "#" syntax. if (parseColor(string, color, strict)) return true; @@ -3830,6 +3830,63 @@ static inline bool parseColorInt(const UChar*& string, const UChar* end, UChar t return true; } +static inline bool isTenthAlpha(const UChar* string, const int length) +{ + // "0.X" + if (length == 3 && string[0] == '0' && string[1] == '.' && isASCIIDigit(string[2])) + return true; + + // ".X" + if (length == 2 && string[0] == '.' && isASCIIDigit(string[1])) + return true; + + return false; +} + +static inline bool parseAlphaValue(const UChar*& string, const UChar* end, UChar terminator, int& value) +{ + while (string != end && isCSSWhitespace(*string)) + string++; + + value = 0; + + int length = end - string; + if (length < 2) + return false; + + if (string[0] != '0' && string[0] != '1' && string[0] != '.') + return false; + + if (string[length - 1] != terminator) + return false; + + if (length == 2 && string[0] != '.') { + value = string[0] == '1' ? 255 : 0; + string = end; + return true; + } + + if (isTenthAlpha(string, length - 1)) { + static const int tenthAlphaValues[] = { 0, 25, 51, 76, 102, 127, 153, 179, 204, 230 }; + value = tenthAlphaValues[string[length - 2] - '0']; + string = end; + return true; + } + + Vector<char, 8> bytes(length + 1); + for (int i = 0; i < length; ++i) { + if (!isASCIIDigit(string[i]) && string[i] != '.' && string[i] != terminator) + return false; + bytes[i] = string[i]; + } + bytes[length] = '\0'; + char* foundTerminator; + double d = WTF::strtod(bytes.data(), &foundTerminator); + value = static_cast<int>(d * nextafter(256.0, 0.0)); + string += (foundTerminator - bytes.data()) + 1; + return *foundTerminator == terminator; +} + bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict) { const UChar* characters = name.characters(); @@ -3845,6 +3902,28 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict) } } + // Try rgba() syntax. + if (name.startsWith("rgba(")) { + const UChar* current = characters + 5; + const UChar* end = characters + length; + int red; + int green; + int blue; + int alpha; + if (!parseColorInt(current, end, ',', red)) + return false; + if (!parseColorInt(current, end, ',', green)) + return false; + if (!parseColorInt(current, end, ',', blue)) + return false; + if (!parseAlphaValue(current, end, ')', alpha)) + return false; + if (current != end) + return false; + rgb = makeRGBA(red, green, blue, alpha); + return true; + } + // Try rgb() syntax. if (name.startsWith("rgb(")) { const UChar* current = characters + 4; @@ -3863,6 +3942,7 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict) rgb = makeRGB(red, green, blue); return true; } + // Try named colors. Color tc; tc.setNamedColor(name); diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h index 5d76a41..1e233c8 100644 --- a/WebCore/css/CSSParser.h +++ b/WebCore/css/CSSParser.h @@ -23,7 +23,6 @@ #ifndef CSSParser_h #define CSSParser_h -#include "AtomicString.h" #include "Color.h" #include "CSSParserValues.h" #include "CSSSelectorList.h" @@ -31,6 +30,7 @@ #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/css/CSSParserValues.h b/WebCore/css/CSSParserValues.h index a421fe0..5c6f55e 100644 --- a/WebCore/css/CSSParserValues.h +++ b/WebCore/css/CSSParserValues.h @@ -21,7 +21,7 @@ #ifndef CSSParserValues_h #define CSSParserValues_h -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 03974d9..1f336a2 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -67,42 +67,46 @@ private: Vector<CSSSelector*, 16> m_stack; }; -unsigned int CSSSelector::specificity() +unsigned CSSSelector::specificity() const { - if (m_isForPage) - return specificityForPage(); + // make sure the result doesn't overflow + static const unsigned maxValueMask = 0xffffff; + unsigned total = 0; + for (const CSSSelector* selector = this; selector; selector = selector->tagHistory()) { + if (selector->m_isForPage) + return (total + selector->specificityForPage()) & maxValueMask; + total = (total + selector->specificityForOneSelector()) & maxValueMask; + } + return total; +} +inline unsigned CSSSelector::specificityForOneSelector() const +{ // 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); + unsigned s = (m_tag.localName() == starAtom ? 0 : 1); switch (m_match) { - case Id: - s += 0x10000; - break; - case Exact: - case Class: - case Set: - case List: - case Hyphen: - case PseudoClass: - case PseudoElement: - case Contain: - case Begin: - case End: - s += 0x100; - case None: - break; + case Id: + s += 0x10000; + break; + case Exact: + case Class: + case Set: + case List: + case Hyphen: + case PseudoClass: + case PseudoElement: + case Contain: + case Begin: + case End: + s += 0x100; + case None: + break; } - - // FIXME: Avoid recursive calls to prevent possible stack overflow. - if (CSSSelector* tagHistory = this->tagHistory()) - s += tagHistory->specificity(); - - // make sure it doesn't overflow - return s & 0xffffff; + return s; } -unsigned CSSSelector::specificityForPage() +unsigned CSSSelector::specificityForPage() const { // See http://dev.w3.org/csswg/css3-page/#cascading-and-page-context unsigned s = (m_tag.localName() == starAtom ? 0 : 4); @@ -902,8 +906,8 @@ bool CSSSelector::RareData::parseNth() m_a = 2; m_b = 0; } else { - int n = argument.find('n'); - if (n != -1) { + size_t n = argument.find('n'); + if (n != notFound) { if (argument[0] == '-') { if (n == 1) m_a = -1; // -n == -1n @@ -914,12 +918,12 @@ bool CSSSelector::RareData::parseNth() else m_a = argument.substring(0, n).toInt(); - int p = argument.find('+', n); - if (p != -1) + size_t p = argument.find('+', n); + if (p != notFound) m_b = argument.substring(p + 1, argument.length() - p - 1).toInt(); else { p = argument.find('-', n); - if (p != -1) + if (p != notFound) m_b = -argument.substring(p + 1, argument.length() - p - 1).toInt(); } } else diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index 34e4af0..e253949 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -85,7 +85,7 @@ namespace WebCore { // tag == -1 means apply to all elements (Selector = *) - unsigned specificity(); + unsigned specificity() const; /* how the attribute value has to match.... Default is Exact */ enum Match { @@ -294,7 +294,8 @@ namespace WebCore { void releaseOwnedSelectorsToBag(CSSSelectorBag&); void deleteReachableSelectors(); - unsigned specificityForPage(); + unsigned specificityForOneSelector() const; + unsigned specificityForPage() const; void extractPseudoType() const; struct RareData : Noncopyable { diff --git a/WebCore/css/CSSStyleDeclaration.cpp b/WebCore/css/CSSStyleDeclaration.cpp index 404a978..996d573 100644 --- a/WebCore/css/CSSStyleDeclaration.cpp +++ b/WebCore/css/CSSStyleDeclaration.cpp @@ -82,8 +82,8 @@ bool CSSStyleDeclaration::isPropertyImplicit(const String& propertyName) void CSSStyleDeclaration::setProperty(const String& propertyName, const String& value, ExceptionCode& ec) { - int important = value.find("!important", 0, false); - if (important == -1) + size_t important = value.find("!important", 0, false); + if (important == notFound) setProperty(propertyName, value, "", ec); else setProperty(propertyName, value.left(important - 1), "important", ec); @@ -96,7 +96,7 @@ void CSSStyleDeclaration::setProperty(const String& propertyName, const String& // FIXME: Should we raise an exception here? return; } - bool important = priority.find("important", 0, false) != -1; + bool important = priority.find("important", 0, false) != notFound; setProperty(propID, value, important, ec); } diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index bd94b68..fd411d9 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -125,8 +125,6 @@ namespace WebCore { using namespace HTMLNames; -// #define STYLE_SHARING_STATS 1 - #define HANDLE_INHERIT(prop, Prop) \ if (isInherit) { \ m_style->set##Prop(m_parentStyle->prop()); \ @@ -460,32 +458,37 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C m_medium = new MediaQueryEvaluator(view->mediaType(), view->frame(), m_rootDefaultStyle.get()); } + m_authorStyle = new CSSRuleSet(); + // FIXME: This sucks! The user sheet is reparsed every time! - if (pageUserSheet || pageGroupUserSheets) { - m_userStyle = new CSSRuleSet(); - if (pageUserSheet) - m_userStyle->addRulesFromSheet(pageUserSheet, *m_medium, this); - if (pageGroupUserSheets) { - unsigned length = pageGroupUserSheets->size(); - for (unsigned i = 0; i < length; i++) - m_userStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this); + OwnPtr<CSSRuleSet> tempUserStyle(new CSSRuleSet); + if (pageUserSheet) + tempUserStyle->addRulesFromSheet(pageUserSheet, *m_medium, this); + if (pageGroupUserSheets) { + unsigned length = pageGroupUserSheets->size(); + for (unsigned i = 0; i < length; i++) { + if (pageGroupUserSheets->at(i)->isUserStyleSheet()) + tempUserStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this); + else + m_authorStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this); } } - // add stylesheets from document - m_authorStyle = new CSSRuleSet(); - + if (tempUserStyle->m_ruleCount > 0 || tempUserStyle->m_pageRuleCount > 0) + m_userStyle = tempUserStyle.leakPtr(); + // Add rules from elements like SVG's <font-face> if (mappedElementSheet) m_authorStyle->addRulesFromSheet(mappedElementSheet, *m_medium, this); + // add stylesheets from document unsigned length = styleSheets->length(); for (unsigned i = 0; i < length; i++) { StyleSheet* sheet = styleSheets->item(i); if (sheet->isCSSStyleSheet() && !sheet->disabled()) m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(sheet), *m_medium, this); } - + if (doc->renderer() && doc->renderer()->style()) doc->renderer()->style()->font().update(fontSelector()); } @@ -948,11 +951,6 @@ bool CSSStyleSelector::SelectorChecker::checkSelector(CSSSelector* sel, Element* return checkSelector(sel, element, 0, dynamicPseudo, false, false) == SelectorMatches; } -#ifdef STYLE_SHARING_STATS -static int fraction = 0; -static int total = 0; -#endif - static const unsigned cStyleSearchThreshold = 10; Node* CSSStyleSelector::locateCousinList(Element* parent, unsigned depth) @@ -1737,23 +1735,17 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e) style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect())) style->setZIndex(0); - // Button, legend, input, select and textarea all consider width values of 'auto' to be 'intrinsic'. - // This will be important when we use block flows for all form controls. - if (e && (e->hasTagName(legendTag) || e->hasTagName(buttonTag) || e->hasTagName(inputTag) || - e->hasTagName(selectTag) || e->hasTagName(textareaTag) || e->hasTagName(datagridTag) #if ENABLE(WML) - || e->hasTagName(WMLNames::insertedLegendTag) - || e->hasTagName(WMLNames::inputTag) + if (e && (e->hasTagName(WMLNames::insertedLegendTag) + || e->hasTagName(WMLNames::inputTag)) + && style->width().isAuto()) + style->setWidth(Length(Intrinsic)); #endif - )) { - if (style->width().isAuto()) - style->setWidth(Length(Intrinsic)); - // Textarea considers overflow visible as auto. - if (e && e->hasTagName(textareaTag)) { - style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX()); - style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY()); - } + // Textarea considers overflow visible as auto. + if (e && e->hasTagName(textareaTag)) { + style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX()); + style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->overflowY()); } // Finally update our text decorations in effect, but don't allow text-decoration to percolate through @@ -2127,18 +2119,18 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme if (sel->m_value.contains(' ') || sel->m_value.isEmpty()) return false; - int startSearchAt = 0; + unsigned startSearchAt = 0; while (true) { - int foundPos = value.find(sel->m_value, startSearchAt, caseSensitive); - if (foundPos == -1) + size_t foundPos = value.find(sel->m_value, startSearchAt, caseSensitive); + if (foundPos == notFound) return false; - if (foundPos == 0 || value[foundPos-1] == ' ') { + if (foundPos == 0 || value[foundPos - 1] == ' ') { unsigned endStr = foundPos + sel->m_value.length(); if (endStr == value.length() || value[endStr] == ' ') break; // We found a match. } - // No match. Keep looking. + // No match. Keep looking. startSearchAt = foundPos + 1; } break; @@ -2623,7 +2615,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme n = n->parent(); } const AtomicString& argument = sel->argument(); - if (value.isNull() || !value.startsWith(argument, false)) + if (value.isEmpty() || !value.startsWith(argument, false)) break; if (value.length() != argument.length() && value[argument.length()] != '-') break; diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h index 6e4a26b..ad801da 100644 --- a/WebCore/css/CSSStyleSelector.h +++ b/WebCore/css/CSSStyleSelector.h @@ -26,11 +26,11 @@ #include "LinkHash.h" #include "MediaQueryExp.h" #include "RenderStyle.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/css/CSSVariablesDeclaration.h b/WebCore/css/CSSVariablesDeclaration.h index f16b011..6838743 100644 --- a/WebCore/css/CSSVariablesDeclaration.h +++ b/WebCore/css/CSSVariablesDeclaration.h @@ -27,11 +27,11 @@ #define CSSVariablesDeclaration_h #include "PlatformString.h" -#include "StringHash.h" #include "StyleBase.h" #include <wtf/HashMap.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/css/MediaFeatureNames.h b/WebCore/css/MediaFeatureNames.h index b8f2720..1daa4e9 100644 --- a/WebCore/css/MediaFeatureNames.h +++ b/WebCore/css/MediaFeatureNames.h @@ -20,7 +20,7 @@ #ifndef MediaFeatureNames_h #define MediaFeatureNames_h -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { namespace MediaFeatureNames { diff --git a/WebCore/css/MediaQueryExp.h b/WebCore/css/MediaQueryExp.h index 24f2207..4b42611 100644 --- a/WebCore/css/MediaQueryExp.h +++ b/WebCore/css/MediaQueryExp.h @@ -29,10 +29,10 @@ #ifndef MediaQueryExp_h #define MediaQueryExp_h -#include "AtomicString.h" #include "CSSValue.h" #include "MediaFeatureNames.h" #include <wtf/RefPtr.h> +#include <wtf/text/AtomicString.h> namespace WebCore { class CSSParserValueList; diff --git a/WebCore/css/WebKitCSSKeyframesRule.h b/WebCore/css/WebKitCSSKeyframesRule.h index 2836942..6ac0243 100644 --- a/WebCore/css/WebKitCSSKeyframesRule.h +++ b/WebCore/css/WebKitCSSKeyframesRule.h @@ -29,7 +29,7 @@ #include "CSSRule.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/css/mathml.css b/WebCore/css/mathml.css index fd125c0..a5df17c 100644 --- a/WebCore/css/mathml.css +++ b/WebCore/css/mathml.css @@ -25,6 +25,9 @@ math > * { mrow, mfenced { display: inline-block; white-space: nowrap; +} + +mfenced { padding-left: 1px; padding-right: 1px; } diff --git a/WebCore/css/mediaControlsQt.css b/WebCore/css/mediaControlsQt.css index d49fe96..4ea444c 100644 --- a/WebCore/css/mediaControlsQt.css +++ b/WebCore/css/mediaControlsQt.css @@ -47,7 +47,7 @@ audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { } video:-webkit-full-page-media::-webkit-media-controls-panel { - display: none; + bottom: 0px; } audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { diff --git a/WebCore/dom/ActiveDOMObject.cpp b/WebCore/dom/ActiveDOMObject.cpp index 31afe98..98c9761 100644 --- a/WebCore/dom/ActiveDOMObject.cpp +++ b/WebCore/dom/ActiveDOMObject.cpp @@ -37,8 +37,10 @@ ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext, : m_scriptExecutionContext(scriptExecutionContext) , m_pendingActivityCount(0) { - ASSERT(m_scriptExecutionContext->isContextThread()); - m_scriptExecutionContext->createdActiveDOMObject(this, upcastPointer); + if (m_scriptExecutionContext) { + ASSERT(m_scriptExecutionContext->isContextThread()); + m_scriptExecutionContext->createdActiveDOMObject(this, upcastPointer); + } } ActiveDOMObject::~ActiveDOMObject() diff --git a/WebCore/dom/CustomEvent.h b/WebCore/dom/CustomEvent.h index d287a65..8372af2 100644 --- a/WebCore/dom/CustomEvent.h +++ b/WebCore/dom/CustomEvent.h @@ -26,9 +26,9 @@ #ifndef CustomEvent_h #define CustomEvent_h -#include "AtomicString.h" #include "Event.h" #include "ScriptValue.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 539d43f..20c6b16 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -89,7 +89,6 @@ #include "InspectorController.h" #include "InspectorTimelineAgent.h" #include "KeyboardEvent.h" -#include "LegacyHTMLDocumentParser.h" #include "LegacyHTMLTreeBuilder.h" #include "Logging.h" #include "MessageEvent.h" @@ -122,7 +121,6 @@ #include "SelectionController.h" #include "Settings.h" #include "StaticHashSetNodeList.h" -#include "StringBuffer.h" #include "StyleSheetList.h" #include "TextEvent.h" #include "TextIterator.h" @@ -146,6 +144,7 @@ #include <wtf/MainThread.h> #include <wtf/PassRefPtr.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringBuffer.h> #if ENABLE(SHARED_WORKERS) #include "SharedWorkerRepository.h" @@ -431,7 +430,8 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) m_pageGroupUserSheetCacheValid = false; m_printing = false; - + m_paginatedForScreen = false; + m_ignoreAutofocus = false; m_frame = frame; @@ -860,7 +860,7 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec) } default: if (source->hasTagName(iframeTag)) - static_cast<HTMLIFrameElement*>(source.get())->setRemainsAliveOnRemovalFromTree(attached()); + static_cast<HTMLIFrameElement*>(source.get())->setRemainsAliveOnRemovalFromTree(attached() && source->attached()); if (source->parentNode()) source->parentNode()->removeChild(source.get(), ec); @@ -2271,7 +2271,7 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist())) continue; RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::createInline(const_cast<Document*>(this), sheet->url()); - parsedSheet->setIsUserStyleSheet(true); + parsedSheet->setIsUserStyleSheet(sheet->level() == UserStyleSheet::UserLevel); parsedSheet->parseString(sheet->source(), !inCompatMode()); if (!m_pageGroupUserSheets) m_pageGroupUserSheets.set(new Vector<RefPtr<CSSStyleSheet> >); @@ -3707,8 +3707,8 @@ HTMLMapElement* Document::getImageMap(const String& url) const { if (url.isNull()) return 0; - int hashPos = url.find('#'); - String name = (hashPos < 0 ? url : url.substring(hashPos + 1)).impl(); + size_t hashPos = url.find('#'); + String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl(); AtomicString mapName = isHTMLDocument() ? name.lower() : name; m_imageMapsByName.checkConsistency(); return m_imageMapsByName.get(mapName.impl()); diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index ebe22cb..fc57ddb 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -32,7 +32,6 @@ #include "CollectionType.h" #include "Color.h" #include "ContainerNode.h" -#include "Document.h" #include "DocumentMarker.h" #include "QualifiedName.h" #include "ScriptExecutionContext.h" @@ -571,6 +570,11 @@ public: bool printing() const { return m_printing; } void setPrinting(bool p) { m_printing = p; } + bool paginatedForScreen() const { return m_paginatedForScreen; } + void setPaginatedForScreen(bool p) { m_paginatedForScreen = p; } + + bool paginated() const { return printing() || paginatedForScreen(); } + enum ParseMode { Compat, AlmostStrict, Strict }; void setParseMode(ParseMode m) { m_parseMode = m; } @@ -1121,7 +1125,8 @@ private: mutable bool m_pageGroupUserSheetCacheValid; bool m_printing; - + bool m_paginatedForScreen; + bool m_ignoreAutofocus; ParseMode m_parseMode; diff --git a/WebCore/dom/DocumentFragment.cpp b/WebCore/dom/DocumentFragment.cpp index 47485b7..70e57b9 100644 --- a/WebCore/dom/DocumentFragment.cpp +++ b/WebCore/dom/DocumentFragment.cpp @@ -25,7 +25,6 @@ #include "Document.h" #include "HTMLDocumentParser.h" -#include "LegacyHTMLDocumentParser.h" #include "Page.h" #include "Settings.h" #include "XMLDocumentParser.h" @@ -84,8 +83,6 @@ bool DocumentFragment::shouldUseLegacyHTMLParser() const void DocumentFragment::parseHTML(const String& source, Element* contextElement, FragmentScriptingPermission scriptingPermission) { - if (shouldUseLegacyHTMLParser()) - return LegacyHTMLDocumentParser::parseDocumentFragment(source, this, scriptingPermission); HTMLDocumentParser::parseDocumentFragment(source, this, contextElement, scriptingPermission); } diff --git a/WebCore/dom/DocumentParser.h b/WebCore/dom/DocumentParser.h index a3545b6..e942d1f 100644 --- a/WebCore/dom/DocumentParser.h +++ b/WebCore/dom/DocumentParser.h @@ -58,8 +58,8 @@ public: 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. + // and is very unclear as to what it actually means. The LegacyHTMLDocumentParser + // used to implements it. virtual bool processingData() const { return false; } // FIXME: Exposed for HTMLFormControlElement::removedFromTree. HTML DOM diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index 0e89e93..849b900 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -50,6 +50,7 @@ #include "RenderLayer.h" #include "RenderView.h" #include "RenderWidget.h" +#include "Settings.h" #include "TextIterator.h" #include "XMLNames.h" #include <wtf/text/CString.h> @@ -90,7 +91,7 @@ NodeRareData* Element::createRareData() return new ElementRareData; } -PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission) +PassRefPtr<DocumentFragment> Element::deprecatedCreateContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission) { RefPtr<DocumentFragment> fragment = document()->createDocumentFragment(); @@ -101,14 +102,14 @@ PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& mar // FIXME: We should propagate a syntax error exception out here. return 0; } - + // Exceptions are ignored because none ought to happen here. ExceptionCode ignoredExceptionCode; - + // We need to pop <html> and <body> elements and remove <head> to // accommodate folks passing complete HTML documents to make the // child of an element. - + RefPtr<Node> nextNode; for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) { nextNode = node->nextSibling(); @@ -131,7 +132,6 @@ PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& mar ASSERT(!ignoredExceptionCode); } } - return fragment.release(); } diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index a66809a..694db98 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -95,7 +95,7 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); #endif - virtual PassRefPtr<DocumentFragment> createContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed); + virtual PassRefPtr<DocumentFragment> deprecatedCreateContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed); bool hasAttribute(const QualifiedName&) const; const AtomicString& getAttribute(const QualifiedName&) const; diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp index 1aab5c7..c76f951 100644 --- a/WebCore/dom/Event.cpp +++ b/WebCore/dom/Event.cpp @@ -23,9 +23,9 @@ #include "config.h" #include "Event.h" -#include "AtomicString.h" #include "UserGestureIndicator.h" #include <wtf/CurrentTime.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h index e18258c..b992237 100644 --- a/WebCore/dom/Event.h +++ b/WebCore/dom/Event.h @@ -24,9 +24,9 @@ #ifndef Event_h #define Event_h -#include "AtomicString.h" #include "EventTarget.h" #include <wtf/RefCounted.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h index 6c67b9f..4c5a08a 100644 --- a/WebCore/dom/EventNames.h +++ b/WebCore/dom/EventNames.h @@ -22,8 +22,8 @@ #ifndef EventNames_h #define EventNames_h -#include "AtomicString.h" #include "ThreadGlobalData.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h index 406c2fd..b4aa542 100644 --- a/WebCore/dom/EventTarget.h +++ b/WebCore/dom/EventTarget.h @@ -32,11 +32,11 @@ #ifndef EventTarget_h #define EventTarget_h -#include "AtomicStringHash.h" #include "EventNames.h" #include "RegisteredEventListener.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/dom/InputElement.h b/WebCore/dom/InputElement.h index dc87b3d..56fc99d 100644 --- a/WebCore/dom/InputElement.h +++ b/WebCore/dom/InputElement.h @@ -21,8 +21,8 @@ #ifndef InputElement_h #define InputElement_h -#include "AtomicString.h" #include "PlatformString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { @@ -43,6 +43,9 @@ public: virtual bool isPasswordField() const = 0; virtual bool isSearchField() const = 0; virtual bool isTextField() const = 0; + virtual bool isRadioButton() const = 0; + virtual bool isCheckbox() const = 0; + virtual bool supportsMaxLength() const = 0; virtual bool hasSpinButton() const { return false; } #if ENABLE(INPUT_SPEECH) diff --git a/WebCore/dom/MessagePort.cpp b/WebCore/dom/MessagePort.cpp index 1051920..1b7aea7 100644 --- a/WebCore/dom/MessagePort.cpp +++ b/WebCore/dom/MessagePort.cpp @@ -20,14 +20,13 @@ * 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. * */ #include "config.h" #include "MessagePort.h" -#include "AtomicString.h" #include "DOMWindow.h" #include "Document.h" #include "EventException.h" @@ -35,6 +34,7 @@ #include "MessageEvent.h" #include "SecurityOrigin.h" #include "Timer.h" +#include <wtf/text/AtomicString.h> namespace WebCore { @@ -72,7 +72,7 @@ void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, Excepti void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec) { - if (!m_entangledChannel) + if (!isEntangled()) return; ASSERT(m_scriptExecutionContext); @@ -118,8 +118,8 @@ void MessagePort::messageAvailable() void MessagePort::start() { - // Do nothing if we've been cloned - if (!m_entangledChannel) + // Do nothing if we've been cloned or closed. + if (!isEntangled()) return; ASSERT(m_scriptExecutionContext); @@ -133,7 +133,7 @@ void MessagePort::start() void MessagePort::close() { m_closed = true; - if (!m_entangledChannel) + if (!isEntangled()) return; m_entangledChannel->close(); } @@ -152,8 +152,9 @@ void MessagePort::entangle(PassOwnPtr<MessagePortChannel> remote) void MessagePort::contextDestroyed() { ASSERT(m_scriptExecutionContext); - // Must close port before blowing away the cached context, to ensure that we get no more calls to messageAvailable(). - close(); + // Must be closed before blowing away the cached context, to ensure that we get no more calls to messageAvailable(). + // ScriptExecutionContext::closeMessagePorts() takes care of that. + ASSERT(m_closed); m_scriptExecutionContext = 0; } diff --git a/WebCore/dom/MessagePort.h b/WebCore/dom/MessagePort.h index 10426e5..1287834 100644 --- a/WebCore/dom/MessagePort.h +++ b/WebCore/dom/MessagePort.h @@ -27,7 +27,6 @@ #ifndef MessagePort_h #define MessagePort_h -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventTarget.h" #include "MessagePortChannel.h" @@ -37,6 +36,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/dom/NameNodeList.h b/WebCore/dom/NameNodeList.h index b7f5bfc..6a1b22e 100644 --- a/WebCore/dom/NameNodeList.h +++ b/WebCore/dom/NameNodeList.h @@ -24,9 +24,9 @@ #ifndef NameNodeList_h #define NameNodeList_h -#include "AtomicString.h" #include "DynamicNodeList.h" #include <wtf/Forward.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 6e1bd13..98fb2e5 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -784,11 +784,6 @@ void Node::lazyAttach() } } -bool Node::canLazyAttach() -{ - return shadowAncestorNode() == this; -} - void Node::setFocus(bool b) { if (b || hasRareData()) diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index b407ac4..a1a8878 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -86,14 +86,6 @@ enum StyleChangeType { SyntheticStyleChange = 3 << nodeStyleChangeShift }; -const unsigned short DOCUMENT_POSITION_EQUIVALENT = 0x00; -const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; -const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; -const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; -const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; -const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; -const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; - // this class implements nodes, which can have a parent but no children: class Node : public EventTarget, public TreeShared<Node>, public ScriptWrappable { friend class Document; @@ -113,7 +105,16 @@ public: NOTATION_NODE = 12, XPATH_NAMESPACE_NODE = 13 }; - + enum DocumentPosition { + DOCUMENT_POSITION_EQUIVALENT = 0x00, + DOCUMENT_POSITION_DISCONNECTED = 0x01, + DOCUMENT_POSITION_PRECEDING = 0x02, + DOCUMENT_POSITION_FOLLOWING = 0x04, + DOCUMENT_POSITION_CONTAINS = 0x08, + DOCUMENT_POSITION_CONTAINED_BY = 0x10, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20, + }; + static bool isSupported(const String& feature, const String& version); static void startIgnoringLeaks(); @@ -316,7 +317,7 @@ public: void clearIsLink() { clearFlag(IsLinkFlag); } void lazyAttach(); - virtual bool canLazyAttach(); + virtual bool canLazyAttach() { return true; } virtual void setFocus(bool b = true); virtual void setActive(bool f = true, bool /*pause*/ = false) { setFlag(f, IsActiveFlag); } diff --git a/WebCore/dom/Node.idl b/WebCore/dom/Node.idl index e15b210..07046d1 100644 --- a/WebCore/dom/Node.idl +++ b/WebCore/dom/Node.idl @@ -28,8 +28,7 @@ module core { EventTarget, GenerateNativeConverter, InlineGetOwnPropertySlot, - Polymorphic, - DontCheckEnums + Polymorphic ] Node #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C : Object, EventTarget diff --git a/WebCore/dom/NodeRareData.h b/WebCore/dom/NodeRareData.h index 531fc57..ab208d2 100644 --- a/WebCore/dom/NodeRareData.h +++ b/WebCore/dom/NodeRareData.h @@ -26,11 +26,11 @@ #include "DynamicNodeList.h" #include "NameNodeList.h" #include "QualifiedName.h" -#include "StringHash.h" #include "TagNodeList.h" #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/dom/OverflowEvent.h b/WebCore/dom/OverflowEvent.h index 9fd0ea1..f1cd2f3 100644 --- a/WebCore/dom/OverflowEvent.h +++ b/WebCore/dom/OverflowEvent.h @@ -33,8 +33,8 @@ namespace WebCore { class OverflowEvent : public Event { public: enum orientType { - VERTICAL = 0, - HORIZONTAL = 1, + HORIZONTAL = 0, + VERTICAL = 1, BOTH = 2 }; diff --git a/WebCore/dom/OverflowEvent.idl b/WebCore/dom/OverflowEvent.idl index 74cf56b..0c1fd50 100644 --- a/WebCore/dom/OverflowEvent.idl +++ b/WebCore/dom/OverflowEvent.idl @@ -23,8 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ module events { - // FIXME: Converge these consts and OverflowEvent::orientType values and remove DontCheckEnums attribute. - interface [DontCheckEnums] OverflowEvent : Event { + interface OverflowEvent : Event { const unsigned short HORIZONTAL = 0; const unsigned short VERTICAL = 1; const unsigned short BOTH = 2; diff --git a/WebCore/dom/PendingScript.h b/WebCore/dom/PendingScript.h index 805f7ff..44e1e49 100644 --- a/WebCore/dom/PendingScript.h +++ b/WebCore/dom/PendingScript.h @@ -28,7 +28,6 @@ #include "CachedResourceClient.h" #include "CachedResourceHandle.h" -#include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> namespace WebCore { @@ -41,7 +40,7 @@ class Element; // A CachedResourceHandle alone does not prevent the underlying CachedResource // from purging its data buffer. This class holds a dummy client open for its // lifetime in order to guarantee that the data buffer will not be purged. -class PendingScript : public Noncopyable, CachedResourceClient { +class PendingScript : public CachedResourceClient { public: PendingScript() : m_startingLineNumber(0) @@ -49,8 +48,30 @@ public: { } + PendingScript(const PendingScript& other) + : CachedResourceClient(other) + , m_startingLineNumber(other.m_startingLineNumber) + , m_watchingForLoad(other.m_watchingForLoad) + , m_element(other.m_element) + { + setCachedScript(other.cachedScript()); + } + ~PendingScript(); + PendingScript& operator=(const PendingScript& other) + { + if (this == &other) + return *this; + + m_startingLineNumber = other.m_startingLineNumber; + m_watchingForLoad = other.m_watchingForLoad; + m_element = other.m_element; + setCachedScript(other.cachedScript()); + + return *this; + } + // FIXME: No setter means this is never set to anything other than 0. // This is either unnecessary or incorrect. int startingLineNumber() const { return m_startingLineNumber; } diff --git a/WebCore/dom/QualifiedName.h b/WebCore/dom/QualifiedName.h index 4391570..ee90408 100644 --- a/WebCore/dom/QualifiedName.h +++ b/WebCore/dom/QualifiedName.h @@ -21,8 +21,8 @@ #ifndef QualifiedName_h #define QualifiedName_h -#include "AtomicString.h" #include <wtf/HashTraits.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp index 33a21bb..d93a58e 100644 --- a/WebCore/dom/Range.cpp +++ b/WebCore/dom/Range.cpp @@ -1061,7 +1061,10 @@ PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& marku return 0; } - RefPtr<DocumentFragment> fragment = static_cast<HTMLElement*>(element)->createContextualFragment(markup); + // Logic from deprecatedCreateContextualFragment should just be moved into + // this function. Range::createContextualFragment semantics do not make + // sense for the rest of the DOM implementation to use. + RefPtr<DocumentFragment> fragment = static_cast<HTMLElement*>(element)->deprecatedCreateContextualFragment(markup); if (!fragment) { ec = NOT_SUPPORTED_ERR; return 0; diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp index 0262e48..8626bb4 100644 --- a/WebCore/dom/ScriptElement.cpp +++ b/WebCore/dom/ScriptElement.cpp @@ -39,9 +39,9 @@ #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "Settings.h" -#include "StringHash.h" #include "Text.h" #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if ENABLE(SVG) #include "SVGNames.h" diff --git a/WebCore/dom/ScriptExecutionContext.cpp b/WebCore/dom/ScriptExecutionContext.cpp index f7ac603..d014d47 100644 --- a/WebCore/dom/ScriptExecutionContext.cpp +++ b/WebCore/dom/ScriptExecutionContext.cpp @@ -20,7 +20,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. * */ @@ -28,14 +28,15 @@ #include "ScriptExecutionContext.h" #include "ActiveDOMObject.h" +#include "Blob.h" +#include "BlobURL.h" #include "Database.h" #include "DatabaseTask.h" #include "DatabaseThread.h" -#if ENABLE(BLOB) || ENABLE(FILE_WRITER) #include "FileThread.h" -#endif #include "MessagePort.h" #include "SecurityOrigin.h" +#include "ThreadableBlobRegistry.h" #include "WorkerContext.h" #include "WorkerThread.h" #include <wtf/MainThread.h> @@ -92,6 +93,15 @@ ScriptExecutionContext::~ScriptExecutionContext() m_fileThread = 0; } #endif + + HashSet<Blob*>::iterator blobsEnd = m_blobs.end(); + for (HashSet<Blob*>::iterator iter = m_blobs.begin(); iter != blobsEnd; ++iter) + (*iter)->contextDestroyed(); +#if ENABLE(BLOB) + HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end(); + for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter) + ThreadableBlobRegistry::unregisterBlobURL(this, KURL(ParsedURLString, *iter)); +#endif } #if ENABLE(DATABASE) @@ -165,6 +175,18 @@ void ScriptExecutionContext::destroyedMessagePort(MessagePort* port) m_messagePorts.remove(port); } +void ScriptExecutionContext::addBlob(Blob* blob) +{ + ASSERT(blob); + m_blobs.add(blob); +} + +void ScriptExecutionContext::removeBlob(Blob* blob) +{ + ASSERT(blob); + m_blobs.remove(blob); +} + bool ScriptExecutionContext::canSuspendActiveDOMObjects() { // No protection against m_activeDOMObjects changing during iteration: canSuspend() shouldn't execute arbitrary JS. @@ -205,6 +227,9 @@ void ScriptExecutionContext::stopActiveDOMObjects() ASSERT(iter->first->scriptExecutionContext() == this); iter->first->stop(); } + + // Also close MessagePorts. If they were ActiveDOMObjects (they could be) then they could be stopped instead. + closeMessagePorts(); } void ScriptExecutionContext::createdActiveDOMObject(ActiveDOMObject* object, void* upcastPointer) @@ -220,6 +245,14 @@ void ScriptExecutionContext::destroyedActiveDOMObject(ActiveDOMObject* object) m_activeDOMObjects.remove(object); } +void ScriptExecutionContext::closeMessagePorts() { + HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end(); + for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) { + ASSERT((*iter)->scriptExecutionContext() == this); + (*iter)->close(); + } +} + void ScriptExecutionContext::setSecurityOrigin(PassRefPtr<SecurityOrigin> securityOrigin) { m_securityOrigin = securityOrigin; @@ -241,6 +274,24 @@ DOMTimer* ScriptExecutionContext::findTimeout(int timeoutId) return m_timeouts.get(timeoutId); } +#if ENABLE(BLOB) +KURL ScriptExecutionContext::createPublicBlobURL(Blob* blob) +{ + KURL publicURL = BlobURL::createURL(this); + ThreadableBlobRegistry::registerBlobURL(this, publicURL, blob->url()); + m_publicBlobURLs.add(publicURL.string()); + return publicURL; +} + +void ScriptExecutionContext::revokePublicBlobURL(const KURL& url) +{ + if (m_publicBlobURLs.contains(url.string())) { + ThreadableBlobRegistry::unregisterBlobURL(this, url); + m_publicBlobURLs.remove(url.string()); + } +} +#endif + #if ENABLE(BLOB) || ENABLE(FILE_WRITER) FileThread* ScriptExecutionContext::fileThread() { diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h index d2da307..30c12e5 100644 --- a/WebCore/dom/ScriptExecutionContext.h +++ b/WebCore/dom/ScriptExecutionContext.h @@ -20,7 +20,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. * */ @@ -36,10 +36,16 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> +#include <wtf/text/StringHash.h> + +#if USE(JSC) +#include <runtime/JSGlobalData.h> +#endif namespace WebCore { class ActiveDOMObject; + class Blob; #if ENABLE(DATABASE) class Database; class DatabaseTaskSynchronizer; @@ -88,7 +94,7 @@ namespace WebCore { virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0; - + // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked. bool canSuspendActiveDOMObjects(); // Active objects can be asked to suspend even if canSuspendActiveDOMObjects() returns 'false' - @@ -125,6 +131,13 @@ namespace WebCore { void removeTimeout(int timeoutId); DOMTimer* findTimeout(int timeoutId); + void addBlob(Blob*); + void removeBlob(Blob*); +#if ENABLE(BLOB) + KURL createPublicBlobURL(Blob*); + void revokePublicBlobURL(const KURL&); +#endif + #if USE(JSC) JSC::JSGlobalData* globalData(); #endif @@ -144,6 +157,8 @@ namespace WebCore { virtual const KURL& virtualURL() const = 0; virtual KURL virtualCompleteURL(const String&) const = 0; + void closeMessagePorts(); + RefPtr<SecurityOrigin> m_securityOrigin; HashSet<MessagePort*> m_messagePorts; @@ -152,6 +167,11 @@ namespace WebCore { HashMap<int, DOMTimer*> m_timeouts; + HashSet<Blob*> m_blobs; +#if ENABLE(BLOB) + HashSet<String> m_publicBlobURLs; +#endif + virtual void refScriptExecutionContext() = 0; virtual void derefScriptExecutionContext() = 0; diff --git a/WebCore/dom/SpaceSplitString.h b/WebCore/dom/SpaceSplitString.h index 9fd1832..f49670b 100644 --- a/WebCore/dom/SpaceSplitString.h +++ b/WebCore/dom/SpaceSplitString.h @@ -21,10 +21,10 @@ #ifndef SpaceSplitString_h #define SpaceSplitString_h -#include "AtomicString.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/TagNodeList.h b/WebCore/dom/TagNodeList.h index 1b1a038..9053b53 100644 --- a/WebCore/dom/TagNodeList.h +++ b/WebCore/dom/TagNodeList.h @@ -24,8 +24,8 @@ #ifndef TagNodeList_h #define TagNodeList_h -#include "AtomicString.h" #include "DynamicNodeList.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/dom/TextEvent.cpp b/WebCore/dom/TextEvent.cpp index 5dc39e3..68ed4b2 100644 --- a/WebCore/dom/TextEvent.cpp +++ b/WebCore/dom/TextEvent.cpp @@ -31,43 +31,63 @@ namespace WebCore { +TextEvent::InputType TextEvent::selectInputType(bool isLineBreak, bool isBackTab) +{ + if (isLineBreak) + return TextEvent::InputTypeLineBreak; + if (isBackTab) + return TextEvent::InputTypeBackTab; + return TextEvent::InputTypeKeyboard; +} + PassRefPtr<TextEvent> TextEvent::create() { return adoptRef(new TextEvent); } -PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data) +PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEvent::InputType inputType) { - return adoptRef(new TextEvent(view, data)); + return adoptRef(new TextEvent(view, data, inputType)); } PassRefPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace) { - return adoptRef(new TextEvent(view, data, 0, true, shouldSmartReplace)); + return adoptRef(new TextEvent(view, data, 0, shouldSmartReplace, false)); } PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle) { - return adoptRef(new TextEvent(view, "", data, true, shouldSmartReplace, shouldMatchStyle)); + return adoptRef(new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle)); +} + +PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, const String& data) +{ + return adoptRef(new TextEvent(view, data, TextEvent::InputTypeDrop)); } TextEvent::TextEvent() - : m_isLineBreak(false) - , m_isBackTab(false) - , m_isPaste(false) + : m_inputType(TextEvent::InputTypeKeyboard) + , m_shouldSmartReplace(false) + , m_shouldMatchStyle(false) +{ +} + +TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputType inputType) + : UIEvent(eventNames().textInputEvent, true, true, view, 0) + , m_inputType(inputType) + , m_data(data) + , m_pastingFragment(0) , m_shouldSmartReplace(false) , m_shouldMatchStyle(false) { } TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment, - bool isPaste, bool shouldSmartReplace, bool shouldMatchStyle) + bool shouldSmartReplace, bool shouldMatchStyle) : UIEvent(eventNames().textInputEvent, true, true, view, 0) + , m_inputType(TextEvent::InputTypePaste) , m_data(data) - , m_isLineBreak(false) - , m_isBackTab(false) , m_pastingFragment(pastingFragment) - , m_isPaste(isPaste) , m_shouldSmartReplace(shouldSmartReplace) , m_shouldMatchStyle(shouldMatchStyle) { diff --git a/WebCore/dom/TextEvent.h b/WebCore/dom/TextEvent.h index 2e2eb95..f1d24e9 100644 --- a/WebCore/dom/TextEvent.h +++ b/WebCore/dom/TextEvent.h @@ -34,10 +34,20 @@ namespace WebCore { class TextEvent : public UIEvent { public: + enum InputType { + InputTypeKeyboard, // any newline characters in the text are line breaks only, not paragraph separators. + InputTypeLineBreak, // any tab characters in the text are backtabs. + InputTypeBackTab, + InputTypePaste, + InputTypeDrop, + }; + + static InputType selectInputType(bool isLineBreak, bool isBackTab); static PassRefPtr<TextEvent> create(); - static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data); + static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data, InputType = InputTypeKeyboard); static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace); static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle); + static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data); virtual ~TextEvent(); @@ -47,30 +57,26 @@ namespace WebCore { virtual bool isTextEvent() const; - // If true, any newline characters in the text are line breaks only, not paragraph separators. - bool isLineBreak() const { return m_isLineBreak; } - void setIsLineBreak(bool isLineBreak) { m_isLineBreak = isLineBreak; } - - // If true, any tab characters in the text are backtabs. - bool isBackTab() const { return m_isBackTab; } - void setIsBackTab(bool isBackTab) { m_isBackTab = isBackTab; } + bool isLineBreak() const { return m_inputType == InputTypeLineBreak; } + bool isBackTab() const { return m_inputType == InputTypeBackTab; } + bool isPaste() const { return m_inputType == InputTypePaste; } + bool isDrop() const { return m_inputType == InputTypeDrop; } - bool isPaste() const { return m_isPaste; } bool shouldSmartReplace() const { return m_shouldSmartReplace; } bool shouldMatchStyle() const { return m_shouldMatchStyle; } DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); } private: TextEvent(); - TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment> = 0, - bool isPaste = false, bool shouldSmartReplace = false, bool shouldMatchStyle = false); + TextEvent(PassRefPtr<AbstractView>, const String& data, InputType = InputTypeKeyboard); + TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>, + bool shouldSmartReplace, bool shouldMatchStyle); + + InputType m_inputType; String m_data; - bool m_isLineBreak; - bool m_isBackTab; RefPtr<DocumentFragment> m_pastingFragment; - bool m_isPaste; // FIXME: Should use inputMode after it be available: http://webkit.org/b/42805 bool m_shouldSmartReplace; bool m_shouldMatchStyle; }; diff --git a/WebCore/dom/XMLDocumentParser.h b/WebCore/dom/XMLDocumentParser.h index e7e209a..141adf7 100644 --- a/WebCore/dom/XMLDocumentParser.h +++ b/WebCore/dom/XMLDocumentParser.h @@ -139,9 +139,9 @@ bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent #include "FragmentScriptingPermission.h" #include "ScriptableDocumentParser.h" #include "SegmentedString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/OwnPtr.h> +#include <wtf/text/StringHash.h> #if USE(QXMLSTREAM) #include <qxmlstream.h> diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp index a6e9cd0..1309827 100644 --- a/WebCore/dom/XMLDocumentParserLibxml2.cpp +++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp @@ -36,9 +36,9 @@ #include "Frame.h" #include "FrameLoader.h" #include "FrameView.h" +#include "HTMLEntityParser.h" #include "HTMLLinkElement.h" #include "HTMLStyleElement.h" -#include "LegacyHTMLDocumentParser.h" // for decodeNamedEntity #include "ProcessingInstruction.h" #include "ResourceError.h" #include "ResourceHandle.h" diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp index 678d141..715856c 100644 --- a/WebCore/dom/XMLDocumentParserQt.cpp +++ b/WebCore/dom/XMLDocumentParserQt.cpp @@ -36,9 +36,9 @@ #include "Frame.h" #include "FrameLoader.h" #include "FrameView.h" +#include "HTMLEntityParser.h" #include "HTMLLinkElement.h" #include "HTMLStyleElement.h" -#include "LegacyHTMLDocumentParser.h" #include "ProcessingInstruction.h" #include "ResourceError.h" #include "ResourceHandle.h" diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl index 4b4c7e3..e111eb7 100755 --- a/WebCore/dom/make_names.pl +++ b/WebCore/dom/make_names.pl @@ -647,13 +647,17 @@ printLicenseHeader($F); print F <<END #include "config.h" -#include "$parameters{namespace}ElementFactory.h" -#include "$parameters{namespace}Names.h" END ; print F "\n#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; +print F <<END +#include "$parameters{namespace}ElementFactory.h" +#include "$parameters{namespace}Names.h" +END +; + printElementIncludes($F); print F <<END diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp index a9d1509..bfbfab8 100644 --- a/WebCore/editing/ApplyStyleCommand.cpp +++ b/WebCore/editing/ApplyStyleCommand.cpp @@ -1311,6 +1311,9 @@ bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLEl } } + if (mode == RemoveNone) + return removed; + // No need to serialize <foo style=""> if we just removed the last css property if (decl->isEmpty()) removeNodeAttribute(elem, styleAttr); @@ -1321,24 +1324,17 @@ bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLEl return removed; } -static bool hasTextDecorationProperty(Node *node) +HTMLElement* ApplyStyleCommand::highestAncestorWithConflictingInlineStyle(CSSMutableStyleDeclaration* style, Node* node) { - if (!node->isElementNode()) - return false; - - RefPtr<CSSValue> value = computedStyle(node)->getPropertyCSSValue(CSSPropertyTextDecoration, DoNotUpdateLayout); - return value && !equalIgnoringCase(value->cssText(), "none"); -} + if (!node) + return 0; -static Node* highestAncestorWithTextDecoration(Node *node) -{ - ASSERT(node); - Node* result = 0; + HTMLElement* result = 0; Node* unsplittableElement = unsplittableElementForPosition(Position(node, 0)); for (Node *n = node; n; n = n->parentNode()) { - if (hasTextDecorationProperty(n)) - result = n; + if (n->isHTMLElement() && shouldRemoveInlineStyleFromElement(style, static_cast<HTMLElement*>(n))) + result = static_cast<HTMLElement*>(n); // Should stop at the editable root (cannot cross editing boundary) and // also stop at the unsplittable element to be consistent with other UAs if (n == unsplittableElement) @@ -1348,7 +1344,7 @@ static Node* highestAncestorWithTextDecoration(Node *node) return result; } -PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractTextDecorationStyle(Node* node) +PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractInlineStyleToPushDown(Node* node, const Vector<int>& properties) { ASSERT(node); ASSERT(node->isElementNode()); @@ -1362,72 +1358,108 @@ PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::extractTextDecorationS if (!style) return 0; - int properties[1] = { CSSPropertyTextDecoration }; - RefPtr<CSSMutableStyleDeclaration> textDecorationStyle = style->copyPropertiesInSet(properties, 1); + style = style->copyPropertiesInSet(properties.data(), properties.size()); + + for (size_t i = 0; i < properties.size(); i++) { + RefPtr<CSSValue> property = style->getPropertyCSSValue(properties[i]); + if (property) + removeCSSProperty(element, static_cast<CSSPropertyID>(properties[i])); + } - RefPtr<CSSValue> property = style->getPropertyCSSValue(CSSPropertyTextDecoration); - if (property && !equalIgnoringCase(property->cssText(), "none")) - removeCSSProperty(element, CSSPropertyTextDecoration); + if (element->inlineStyleDecl() && element->inlineStyleDecl()->isEmpty()) + removeNodeAttribute(element, styleAttr); - return textDecorationStyle.release(); + if (isSpanWithoutAttributesOrUnstyleStyleSpan(element)) + removeNodePreservingChildren(element); + + return style.release(); } -void ApplyStyleCommand::applyTextDecorationStyle(Node *node, CSSMutableStyleDeclaration *style) +void ApplyStyleCommand::applyInlineStyleToPushDown(Node* node, CSSMutableStyleDeclaration* style) { ASSERT(node); - if (!style || style->cssText().isEmpty()) + if (!style || !style->length() || !node->renderer()) return; - StyleChange styleChange(style, Position(node, 0)); - if (styleChange.cssStyle().length()) { - if (node->isTextNode()) { - RefPtr<HTMLElement> styleSpan = createStyleSpanElement(document()); - surroundNodeRangeWithElement(node, node, styleSpan.get()); - node = styleSpan.get(); - } + // Since addInlineStyleIfNeeded can't add styles to block-flow render objects, add style attribute instead. + // FIXME: applyInlineStyleToRange should be used here instead. + if ((node->renderer()->isBlockFlow() || node->childNodeCount()) && node->isHTMLElement()) { + HTMLElement* element = static_cast<HTMLElement*>(node); + CSSMutableStyleDeclaration* existingInlineStyle = element->inlineStyleDecl(); + + // Avoid overriding existing styles of node + if (existingInlineStyle) { + RefPtr<CSSMutableStyleDeclaration> newInlineStyle = existingInlineStyle->copy(); + CSSMutableStyleDeclaration::const_iterator end = style->end(); + for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { + ExceptionCode ec; + if (!existingInlineStyle->getPropertyCSSValue(it->id())) + newInlineStyle->setProperty(it->id(), it->value()->cssText(), it->isImportant(), ec); + + // text-decorations adds up + if (it->id() == CSSPropertyTextDecoration) { + ASSERT(it->value()->isValueList()); + RefPtr<CSSValue> textDecoration = newInlineStyle->getPropertyCSSValue(CSSPropertyTextDecoration); + if (textDecoration) { + ASSERT(textDecoration->isValueList()); + CSSValueList* textDecorationOfInlineStyle = static_cast<CSSValueList*>(textDecoration.get()); + CSSValueList* textDecorationOfStyleApplied = static_cast<CSSValueList*>(it->value()); + + DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline))); + DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough))); + + if (textDecorationOfStyleApplied->hasValue(underline.get()) && !textDecorationOfInlineStyle->hasValue(underline.get())) + textDecorationOfInlineStyle->append(underline.get()); + + if (textDecorationOfStyleApplied->hasValue(lineThrough.get()) && !textDecorationOfInlineStyle->hasValue(lineThrough.get())) + textDecorationOfInlineStyle->append(lineThrough.get()); + } + } + } - if (!node->isElementNode()) - return; + setNodeAttribute(element, styleAttr, newInlineStyle->cssText()); + } else + setNodeAttribute(element, styleAttr, style->cssText()); - HTMLElement *element = static_cast<HTMLElement *>(node); - String cssText = styleChange.cssStyle(); - CSSMutableStyleDeclaration *decl = element->inlineStyleDecl(); - if (decl) - cssText += decl->cssText(); - setNodeAttribute(element, styleAttr, cssText); + return; } - if (styleChange.applyUnderline()) - surroundNodeRangeWithElement(node, node, createHTMLElement(document(), uTag)); + if (node->renderer()->isText() && static_cast<RenderText*>(node->renderer())->isAllCollapsibleWhitespace()) + return; - if (styleChange.applyLineThrough()) - surroundNodeRangeWithElement(node, node, createHTMLElement(document(), sTag)); + // FIXME: addInlineStyleIfNeeded may override the style of node + addInlineStyleIfNeeded(style, node, node); } -void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node* targetNode) +void ApplyStyleCommand::pushDownInlineStyleAroundNode(CSSMutableStyleDeclaration* style, Node* targetNode) { - ASSERT(targetNode); - Node* highestAncestor = highestAncestorWithTextDecoration(targetNode); + HTMLElement* highestAncestor = highestAncestorWithConflictingInlineStyle(style, targetNode); if (!highestAncestor) return; + Vector<int> properties; + CSSMutableStyleDeclaration::const_iterator end = style->end(); + for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) + properties.append(it->id()); + // The outer loop is traversing the tree vertically from highestAncestor to targetNode Node* current = highestAncestor; while (current != targetNode) { ASSERT(current); + ASSERT(current->isHTMLElement()); ASSERT(current->contains(targetNode)); - RefPtr<CSSMutableStyleDeclaration> decoration = extractTextDecorationStyle(current); + Node* child = current->firstChild(); + RefPtr<CSSMutableStyleDeclaration> styleToPushDown = extractInlineStyleToPushDown(current, properties); // The inner loop will go through children on each level - Node* child = current->firstChild(); while (child) { Node* nextChild = child->nextSibling(); // Apply text decoration to all nodes containing targetNode and their siblings but NOT to targetNode if (child != targetNode) - applyTextDecorationStyle(child, decoration.get()); - + applyInlineStyleToPushDown(child, styleToPushDown.get()); + // We found the next node for the outer loop (contains targetNode) // When reached targetNode, stop the outer loop upon the completion of the current inner loop if (child == targetNode || child->contains(targetNode)) @@ -1447,19 +1479,23 @@ void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration> ASSERT(comparePositions(start, end) <= 0); RefPtr<CSSValue> textDecorationSpecialProperty = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); - if (textDecorationSpecialProperty) { - pushDownTextDecorationStyleAroundNode(start.downstream().node()); - pushDownTextDecorationStyleAroundNode(end.upstream().node()); style = style->copy(); style->setProperty(CSSPropertyTextDecoration, textDecorationSpecialProperty->cssText(), style->getPropertyPriority(CSSPropertyWebkitTextDecorationsInEffect)); } + Position pushDownStart = start.downstream(); + Position pushDownEnd = end.upstream(); + pushDownInlineStyleAroundNode(style.get(), pushDownStart.node()); + pushDownInlineStyleAroundNode(style.get(), pushDownEnd.node()); + // The s and e variables store the positions used to set the ending selection after style removal // takes place. This will help callers to recognize when either the start node or the end node // are removed from the document during the work of this function. - Position s = start; - Position e = end; + // If pushDownInlineStyleAroundNode has pruned start.node() or end.node(), + // use pushDownStart or pushDownEnd instead, which pushDownInlineStyleAroundNode won't prune. + Position s = start.isNull() || start.isOrphan() ? pushDownStart : start; + Position e = end.isNull() || end.isOrphan() ? pushDownEnd : end; Node* node = start.node(); while (node) { diff --git a/WebCore/editing/ApplyStyleCommand.h b/WebCore/editing/ApplyStyleCommand.h index 86c24da..f4ecc7c 100644 --- a/WebCore/editing/ApplyStyleCommand.h +++ b/WebCore/editing/ApplyStyleCommand.h @@ -78,12 +78,13 @@ private: bool removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); bool removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); bool removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + HTMLElement* highestAncestorWithConflictingInlineStyle(CSSMutableStyleDeclaration*, Node*); + PassRefPtr<CSSMutableStyleDeclaration> extractInlineStyleToPushDown(Node*, const Vector<int>&); + void applyInlineStyleToPushDown(Node*, CSSMutableStyleDeclaration *style); + void pushDownInlineStyleAroundNode(CSSMutableStyleDeclaration*, Node*); void removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>, const Position& start, const Position& end); bool nodeFullySelected(Node*, const Position& start, const Position& end) const; bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const; - PassRefPtr<CSSMutableStyleDeclaration> extractTextDecorationStyle(Node*); - void applyTextDecorationStyle(Node*, CSSMutableStyleDeclaration *style); - void pushDownTextDecorationStyleAroundNode(Node*); // style-application helpers void applyBlockStyle(CSSMutableStyleDeclaration*); diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp index 5ec87d6..f50929a 100644 --- a/WebCore/editing/CompositeEditCommand.cpp +++ b/WebCore/editing/CompositeEditCommand.cpp @@ -294,24 +294,24 @@ void CompositeEditCommand::joinTextNodes(PassRefPtr<Text> text1, PassRefPtr<Text void CompositeEditCommand::inputText(const String& text, bool selectInsertedText) { - int offset = 0; - int length = text.length(); + unsigned offset = 0; + unsigned length = text.length(); RefPtr<Range> startRange = Range::create(document(), Position(document()->documentElement(), 0), endingSelection().start()); - int startIndex = TextIterator::rangeLength(startRange.get()); - int newline; + unsigned startIndex = TextIterator::rangeLength(startRange.get()); + size_t newline; do { newline = text.find('\n', offset); if (newline != offset) { RefPtr<InsertTextCommand> command = InsertTextCommand::create(document()); applyCommandToComposite(command); - int substringLength = newline == -1 ? length - offset : newline - offset; + int substringLength = newline == notFound ? length - offset : newline - offset; command->input(text.substring(offset, substringLength), false); } - if (newline != -1) + if (newline != notFound) insertLineBreak(); offset = newline + 1; - } while (newline != -1 && offset != length); + } while (newline != notFound && offset != length); if (selectInsertedText) { RefPtr<Range> selectedRange = TextIterator::rangeFromLocationAndLength(document()->documentElement(), startIndex, length); @@ -489,7 +489,18 @@ void CompositeEditCommand::deleteInsignificantText(PassRefPtr<Text> textNode, un if (!textRenderer) return; - InlineTextBox* box = textRenderer->firstTextBox(); + Vector<InlineTextBox*> sortedTextBoxes; + size_t sortedTextBoxesPosition = 0; + + for (InlineTextBox* textBox = textRenderer->firstTextBox(); textBox; textBox = textBox->nextTextBox()) + sortedTextBoxes.append(textBox); + + // If there is mixed directionality text, the boxes can be out of order, + // (like Arabic with embedded LTR), so sort them first. + if (textRenderer->containsReversedText()) + std::sort(sortedTextBoxes.begin(), sortedTextBoxes.end(), InlineTextBox::compareByStart); + InlineTextBox* box = sortedTextBoxes.isEmpty() ? 0 : sortedTextBoxes[sortedTextBoxesPosition]; + if (!box) { // whole text node is empty removeNode(textNode); @@ -526,8 +537,12 @@ void CompositeEditCommand::deleteInsignificantText(PassRefPtr<Text> textNode, un } prevBox = box; - if (box) - box = box->nextTextBox(); + if (box) { + if (++sortedTextBoxesPosition < sortedTextBoxes.size()) + box = sortedTextBoxes[sortedTextBoxesPosition]; + else + box = 0; + } } if (!str.isNull()) { diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp index c37b0fc..5e025eb 100644 --- a/WebCore/editing/DeleteSelectionCommand.cpp +++ b/WebCore/editing/DeleteSelectionCommand.cpp @@ -630,7 +630,8 @@ void DeleteSelectionCommand::mergeParagraphs() // moveParagraphs will insert placeholders if it removes blocks that would require their use, don't let block // removals that it does cause the insertion of *another* placeholder. bool needPlaceholder = m_needPlaceholder; - moveParagraph(startOfParagraphToMove, endOfParagraphToMove, mergeDestination); + bool paragraphToMergeIsEmpty = (startOfParagraphToMove == endOfParagraphToMove); + moveParagraph(startOfParagraphToMove, endOfParagraphToMove, mergeDestination, false, !paragraphToMergeIsEmpty); m_needPlaceholder = needPlaceholder; // The endingPosition was likely clobbered by the move, so recompute it (moveParagraph selects the moved paragraph). m_endingPosition = endingSelection().start(); diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp index 7a1ad4d..196384a 100644 --- a/WebCore/editing/Editor.cpp +++ b/WebCore/editing/Editor.cpp @@ -130,6 +130,11 @@ void Editor::handleInputMethodKeydown(KeyboardEvent* event) bool Editor::handleTextEvent(TextEvent* event) { + // Default event handling for Drag and Drop will be handled by DragController + // so we leave the event for it. + if (event->isDrop()) + return false; + if (event->isPaste()) { if (event->pastingFragment()) replaceSelectionWithFragment(event->pastingFragment(), false, event->shouldSmartReplace(), event->shouldMatchStyle()); @@ -762,14 +767,20 @@ bool Editor::dispatchCPPEvent(const AtomicString &eventType, ClipboardAccessPoli return !noDefaultProcessing; } -Node* Editor::findEventTargetFromSelection() const +Node* Editor::findEventTargetFrom(const VisibleSelection& selection) const { - Node* target = m_frame->selection()->start().element(); + Node* target = selection.start().element(); if (!target) target = m_frame->document()->body(); if (!target) return 0; return target->shadowAncestorNode(); + +} + +Node* Editor::findEventTargetFromSelection() const +{ + return findEventTargetFrom(m_frame->selection()->selection()); } void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction) @@ -1514,10 +1525,13 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin if (!text.isEmpty()) { TypingCommand::insertText(m_frame->document(), text, true, true); - Node* baseNode = m_frame->selection()->base().node(); - unsigned baseOffset = m_frame->selection()->base().deprecatedEditingOffset(); - Node* extentNode = m_frame->selection()->extent().node(); - unsigned extentOffset = m_frame->selection()->extent().deprecatedEditingOffset(); + // Find out what node has the composition now. + Position base = m_frame->selection()->base().downstream(); + Position extent = m_frame->selection()->extent(); + Node* baseNode = base.node(); + unsigned baseOffset = base.deprecatedEditingOffset(); + Node* extentNode = extent.node(); + unsigned extentOffset = extent.deprecatedEditingOffset(); if (baseNode && baseNode == extentNode && baseNode->isTextNode() && baseOffset + text.length() == extentOffset) { m_compositionNode = static_cast<Text*>(baseNode); diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h index 13e6df5..06e7513 100644 --- a/WebCore/editing/Editor.h +++ b/WebCore/editing/Editor.h @@ -299,6 +299,7 @@ public: void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle); void pasteAsPlainText(const String&, bool smartReplace); + Node* findEventTargetFrom(const VisibleSelection& selection) const; private: Frame* m_frame; OwnPtr<DeleteButtonController> m_deleteButtonController; diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 1a77642..eb89593 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -28,7 +28,6 @@ #include "config.h" #include "Editor.h" -#include "AtomicString.h" #include "CSSComputedStyleDeclaration.h" #include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" @@ -58,6 +57,7 @@ #include "UnlinkCommand.h" #include "htmlediting.h" #include "markup.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/editing/InsertTextCommand.cpp b/WebCore/editing/InsertTextCommand.cpp index f10d71b..52eb12f 100644 --- a/WebCore/editing/InsertTextCommand.cpp +++ b/WebCore/editing/InsertTextCommand.cpp @@ -109,7 +109,7 @@ bool InsertTextCommand::performTrivialReplace(const String& text, bool selectIns void InsertTextCommand::input(const String& text, bool selectInsertedText) { - ASSERT(text.find('\n') == -1); + ASSERT(text.find('\n') == notFound); if (endingSelection().isNone()) return; diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp index 9589bff..39013c1 100644 --- a/WebCore/editing/TextIterator.cpp +++ b/WebCore/editing/TextIterator.cpp @@ -442,11 +442,6 @@ void TextIterator::advance() } } -static inline bool compareBoxStart(const InlineTextBox* first, const InlineTextBox* second) -{ - return first->start() < second->start(); -} - bool TextIterator::handleTextNode() { if (m_fullyClippedStack.top()) @@ -507,7 +502,7 @@ bool TextIterator::handleTextNode() for (InlineTextBox* textBox = renderer->firstTextBox(); textBox; textBox = textBox->nextTextBox()) { m_sortedTextBoxes.append(textBox); } - std::sort(m_sortedTextBoxes.begin(), m_sortedTextBoxes.end(), compareBoxStart); + std::sort(m_sortedTextBoxes.begin(), m_sortedTextBoxes.end(), InlineTextBox::compareByStart); m_sortedTextBoxesPosition = 0; } @@ -526,11 +521,11 @@ void TextIterator::handleTextBox() return; } String str = renderer->text(); - int start = m_offset; - int end = (m_node == m_endContainer) ? m_endOffset : INT_MAX; + unsigned start = m_offset; + unsigned end = (m_node == m_endContainer) ? m_endOffset : UINT_MAX; while (m_textBox) { - int textBoxStart = m_textBox->start(); - int runStart = max(textBoxStart, start); + unsigned textBoxStart = m_textBox->start(); + unsigned runStart = max(textBoxStart, start); // Check for collapsed space at the start of this run. InlineTextBox* firstTextBox = renderer->containsReversedText() ? m_sortedTextBoxes[0] : renderer->firstTextBox(); @@ -546,8 +541,8 @@ void TextIterator::handleTextBox() emitCharacter(' ', m_node, 0, runStart, runStart); return; } - int textBoxEnd = textBoxStart + m_textBox->len(); - int runEnd = min(textBoxEnd, end); + unsigned textBoxEnd = textBoxStart + m_textBox->len(); + unsigned runEnd = min(textBoxEnd, end); // Determine what the next text box will be, but don't advance yet InlineTextBox* nextTextBox = 0; @@ -565,8 +560,8 @@ void TextIterator::handleTextBox() emitCharacter(' ', m_node, 0, runStart, runStart + 1); m_offset = runStart + 1; } else { - int subrunEnd = str.find('\n', runStart); - if (subrunEnd == -1 || subrunEnd > runEnd) + size_t subrunEnd = str.find('\n', runStart); + if (subrunEnd == notFound || subrunEnd > runEnd) subrunEnd = runEnd; m_offset = subrunEnd; @@ -575,11 +570,11 @@ void TextIterator::handleTextBox() // If we are doing a subrun that doesn't go to the end of the text box, // come back again to finish handling this text box; don't advance to the next one. - if (m_positionEndOffset < textBoxEnd) + if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd) return; // Advance and return - int nextRunStart = nextTextBox ? nextTextBox->start() : str.length(); + unsigned nextRunStart = nextTextBox ? nextTextBox->start() : str.length(); if (nextRunStart > runEnd) m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end m_textBox = nextTextBox; diff --git a/WebCore/editing/TypingCommand.cpp b/WebCore/editing/TypingCommand.cpp index 7680084..bab3111 100644 --- a/WebCore/editing/TypingCommand.cpp +++ b/WebCore/editing/TypingCommand.cpp @@ -332,9 +332,9 @@ void TypingCommand::insertText(const String &text, bool selectInsertedText) // an existing selection; at the moment they can either put the caret after what's inserted or // select what's inserted, but there's no way to "extend selection" to include both an old selection // that ends just before where we want to insert text and the newly inserted text. - int offset = 0; - int newline; - while ((newline = text.find('\n', offset)) != -1) { + unsigned offset = 0; + size_t newline; + while ((newline = text.find('\n', offset)) != notFound) { if (newline != offset) insertTextRunWithoutNewlines(text.substring(offset, newline - offset), false); insertParagraphSeparator(); @@ -343,7 +343,7 @@ void TypingCommand::insertText(const String &text, bool selectInsertedText) if (!offset) insertTextRunWithoutNewlines(text, selectInsertedText); else { - int length = text.length(); + unsigned length = text.length(); if (length != offset) insertTextRunWithoutNewlines(text.substring(offset, length - offset), selectInsertedText); } diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index 26989c3..b1ec07c 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -591,52 +591,6 @@ static void appendEndMarkup(Vector<UChar>& result, const Node* node) result.append('>'); } -class MarkupAccumulator { -public: - MarkupAccumulator(Node* nodeToSkip, Vector<Node*>* nodes) - : m_nodeToSkip(nodeToSkip) - , m_nodes(nodes) - { - } - - void appendMarkup(Node* startNode, EChildrenOnly, EAbsoluteURLs, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0); - - String takeResult() { return String::adopt(m_result); } - -private: - Vector<UChar> m_result; - Node* m_nodeToSkip; - Vector<Node*>* m_nodes; -}; - -// FIXME: Would be nice to do this in a non-recursive way. -void MarkupAccumulator::appendMarkup(Node* startNode, EChildrenOnly childrenOnly, EAbsoluteURLs absoluteURLs, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces) -{ - if (startNode == m_nodeToSkip) - return; - - HashMap<AtomicStringImpl*, AtomicStringImpl*> namespaceHash; - if (namespaces) - namespaceHash = *namespaces; - - // start tag - if (!childrenOnly) { - if (m_nodes) - m_nodes->append(startNode); - 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, absoluteURLs, &namespaceHash); - } - - // end tag - if (!childrenOnly) - appendEndMarkup(m_result, startNode); -} - static void completeURLs(Node* node, const String& baseURL) { Vector<AttributeChange> changes; @@ -737,7 +691,8 @@ static bool shouldIncludeWrapperForFullySelectedRoot(Node* fullySelectedRoot, CS class MarkupAccumulatorWrapper { public: - MarkupAccumulatorWrapper() + MarkupAccumulatorWrapper(Vector<Node*>* nodes) + : m_nodes(nodes) { } @@ -746,11 +701,13 @@ public: postMarkups.append(s); } - void insertOpenTag(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) + void insertOpenTag(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, absoluteURLs, convertBlocksToInlines, 0, rangeFullySelectsNode); + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, namespaces, rangeFullySelectsNode); postMarkups.append(String::adopt(result)); + if (m_nodes) + m_nodes->append(const_cast<Node*>(node)); } void insertEndTag(const Node* node) @@ -760,12 +717,14 @@ public: postMarkups.append(String::adopt(result)); } - void wrapWithNode(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) + void wrapWithNode(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, absoluteURLs, convertBlocksToInlines, 0, rangeFullySelectsNode); + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, namespaces, rangeFullySelectsNode); preMarkups.append(String::adopt(result)); insertEndTag(node); + if (m_nodes) + m_nodes->append(const_cast<Node*>(node)); } void wrapWithStyleNode(CSSStyleDeclaration* style, Document* document, bool isBlock = false) @@ -814,11 +773,12 @@ public: } private: + Vector<Node*>* m_nodes; Vector<String> preMarkups; Vector<String> postMarkups; }; -static Node* serializeNodes(MarkupAccumulatorWrapper& accumulator, Node* startNode, Node* pastEnd, Vector<Node*>* nodes, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs) +static Node* serializeNodes(MarkupAccumulatorWrapper& accumulator, Node* startNode, Node* pastEnd, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs) { Vector<Node*> ancestorsToClose; Node* next; @@ -847,8 +807,6 @@ static Node* serializeNodes(MarkupAccumulatorWrapper& accumulator, Node* startNo } else { // Add the node to the markup if we're not skipping the descendants accumulator.insertOpenTag(n, range, annotate, absoluteURLs); - if (nodes) - nodes->append(n); // If node has no children, close the tag now. if (!n->childNodeCount()) { @@ -885,8 +843,6 @@ static Node* serializeNodes(MarkupAccumulatorWrapper& accumulator, Node* startNo // or b) ancestors that we never encountered during a pre-order traversal starting at startNode: ASSERT(startNode->isDescendantOf(parent)); accumulator.wrapWithNode(parent, range, annotate, absoluteURLs); - if (nodes) - nodes->append(parent); lastClosed = parent; } } @@ -932,7 +888,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc document->updateLayoutIgnorePendingStylesheets(); - MarkupAccumulatorWrapper accumulator; + MarkupAccumulatorWrapper accumulator(nodes); Node* pastEnd = updatedRange->pastLastNode(); Node* startNode = updatedRange->firstNode(); @@ -955,7 +911,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc } } - Node* lastClosed = serializeNodes(accumulator, startNode, pastEnd, nodes, range, annotate, absoluteURLs); + Node* lastClosed = serializeNodes(accumulator, startNode, pastEnd, range, annotate, absoluteURLs); // Include ancestors that aren't completely inside the range but are required to retain // the structure and appearance of the copied markup. @@ -1030,7 +986,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. - accumulator.wrapWithNode(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, DoesNotFullySelectNode); + accumulator.wrapWithNode(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, 0, DoesNotFullySelectNode); } if (nodes) nodes->append(ancestor); @@ -1087,7 +1043,8 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const String& markup, const String& baseURL, FragmentScriptingPermission scriptingPermission) { - RefPtr<DocumentFragment> fragment = document->documentElement()->createContextualFragment(markup, scriptingPermission); + // FIXME: This should not use deprecatedCreateContextualFragment + RefPtr<DocumentFragment> fragment = document->documentElement()->deprecatedCreateContextualFragment(markup, scriptingPermission); if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL()) completeURLs(fragment.get(), baseURL); @@ -1095,6 +1052,27 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const return fragment.release(); } +static void serializeNodesWithNamespaces(MarkupAccumulatorWrapper& accumulator, const Node* node, Node* nodeToSkip, EChildrenOnly childrenOnly, EAbsoluteURLs absoluteURLs, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces) +{ + if (node == nodeToSkip) + return; + + HashMap<AtomicStringImpl*, AtomicStringImpl*> namespaceHash; + if (namespaces) + namespaceHash = *namespaces; + + if (!childrenOnly) + accumulator.insertOpenTag(node, 0, DoNotAnnotateForInterchange, absoluteURLs, false, &namespaceHash); + + if (!(node->document()->isHTMLDocument() && doesHTMLForbidEndTag(node))) { + for (Node* current = node->firstChild(); current; current = current->nextSibling()) + serializeNodesWithNamespaces(accumulator, current, nodeToSkip, IncludeNode, absoluteURLs, &namespaceHash); + } + + if (!childrenOnly) + accumulator.insertEndTag(node); +} + String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* nodes, EAbsoluteURLs absoluteURLs) { if (!node) @@ -1107,9 +1085,9 @@ String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* return ""; } - MarkupAccumulator accumulator(deleteButtonContainerElement, nodes); - accumulator.appendMarkup(const_cast<Node*>(node), childrenOnly, absoluteURLs); - return accumulator.takeResult(); + MarkupAccumulatorWrapper accumulator(nodes); + serializeNodesWithNamespaces(accumulator, node, deleteButtonContainerElement, childrenOnly, absoluteURLs, 0); + return accumulator.takeResults(); } static void fillContainerFromString(ContainerNode* paragraph, const String& string) @@ -1123,7 +1101,7 @@ static void fillContainerFromString(ContainerNode* paragraph, const String& stri return; } - ASSERT(string.find('\n') == -1); + ASSERT(string.find('\n') == notFound); Vector<String> tabList; string.split('\t', true, tabList); @@ -1206,7 +1184,7 @@ PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String } // A string with no newlines gets added inline, rather than being put into a paragraph. - if (string.find('\n') == -1) { + if (string.find('\n') == notFound) { fillContainerFromString(fragment.get(), string); return fragment.release(); } diff --git a/WebCore/history/mac/HistoryItemMac.mm b/WebCore/history/mac/HistoryItemMac.mm index 52ae7be..09bf78d 100644 --- a/WebCore/history/mac/HistoryItemMac.mm +++ b/WebCore/history/mac/HistoryItemMac.mm @@ -26,7 +26,7 @@ #include "config.h" #include "HistoryItem.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/html/Blob.cpp b/WebCore/html/Blob.cpp index 977ffa6..3a62ab1 100644 --- a/WebCore/html/Blob.cpp +++ b/WebCore/html/Blob.cpp @@ -31,29 +31,93 @@ #include "config.h" #include "Blob.h" +#include "BlobData.h" #include "BlobItem.h" +#include "BlobURL.h" #include "FileSystem.h" +#include "ScriptExecutionContext.h" +#include "ThreadableBlobRegistry.h" namespace WebCore { -Blob::Blob(ScriptExecutionContext*, const String& type, const BlobItemList& items) - : m_type(type) +// FIXME: To be removed when we switch to using BlobData. +Blob::Blob(ScriptExecutionContext* scriptExecutionContext, const String& type, const BlobItemList& items) + : m_scriptExecutionContext(scriptExecutionContext) + , m_type(type) + , m_size(0) { + m_scriptExecutionContext->addBlob(this); for (size_t i = 0; i < items.size(); ++i) m_items.append(items[i]); } -Blob::Blob(ScriptExecutionContext*, const PassRefPtr<BlobItem>& item) +// FIXME: To be removed when we switch to using BlobData. +Blob::Blob(ScriptExecutionContext* scriptExecutionContext, const PassRefPtr<BlobItem>& item) + : m_scriptExecutionContext(scriptExecutionContext) + , m_size(0) { + m_scriptExecutionContext->addBlob(this); m_items.append(item); } -Blob::Blob(ScriptExecutionContext*, const String& path) +// FIXME: To be removed when we switch to using BlobData. +Blob::Blob(ScriptExecutionContext* scriptExecutionContext, const String& path) + : m_scriptExecutionContext(scriptExecutionContext) + , m_size(0) { + m_scriptExecutionContext->addBlob(this); // Note: this doesn't initialize the type unlike File(path). m_items.append(FileBlobItem::create(path)); } +Blob::Blob(ScriptExecutionContext* scriptExecutionContext, PassOwnPtr<BlobData> blobData, long long size) + : m_scriptExecutionContext(scriptExecutionContext) + , m_type(blobData->contentType()) + , m_size(size) +{ + ASSERT(blobData.get() && !blobData->items().isEmpty()); + + m_scriptExecutionContext->addBlob(this); + + // Create a new internal URL and register it with the provided blob data. + m_url = BlobURL::createURL(scriptExecutionContext); + ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext, m_url, blobData); +} + +Blob::Blob(ScriptExecutionContext* scriptExecutionContext, const KURL& srcURL, const String& type, long long size) + : m_scriptExecutionContext(scriptExecutionContext) + , m_type(type) + , m_size(size) +{ + m_scriptExecutionContext->addBlob(this); + + // FIXME: To be removed when we switch to using BlobData. + if (srcURL.isEmpty()) + return; + + // Create a new internal URL and register it with the same blob data as the source URL. + m_url = BlobURL::createURL(scriptExecutionContext); + ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext, m_url, srcURL); +} + +Blob::~Blob() +{ + // The internal URL is only used to refer to the Blob object. So we need to unregister the URL when the object is GC-ed. + if (m_scriptExecutionContext) { + m_scriptExecutionContext->removeBlob(this); + ThreadableBlobRegistry::unregisterBlobURL(m_scriptExecutionContext, m_url); + } +} + +void Blob::contextDestroyed() +{ + ASSERT(m_scriptExecutionContext); + + // Unregister the internal URL before the context is gone. + ThreadableBlobRegistry::unregisterBlobURL(m_scriptExecutionContext, m_url); + m_scriptExecutionContext = 0; +} + unsigned long long Blob::size() const { // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to @@ -64,6 +128,7 @@ unsigned long long Blob::size() const return size; } +// FIXME: To be removed when we switch to using BlobData. const String& Blob::path() const { ASSERT(m_items.size() == 1 && m_items[0]->toFileBlobItem()); diff --git a/WebCore/html/Blob.h b/WebCore/html/Blob.h index 7afc7a0..374a401 100644 --- a/WebCore/html/Blob.h +++ b/WebCore/html/Blob.h @@ -32,39 +32,45 @@ #define Blob_h #include "BlobItem.h" +#include "KURL.h" #include "PlatformString.h" +#include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> namespace WebCore { +class BlobData; class ScriptExecutionContext; class Blob : public RefCounted<Blob> { public: + // FIXME: To be removed when we switch to using BlobData. static PassRefPtr<Blob> create(ScriptExecutionContext* scriptExecutionContext, const String& type, const BlobItemList& items) { return adoptRef(new Blob(scriptExecutionContext, type, items)); } - // FIXME: Deprecated method. This is called only from - // bindings/v8/SerializedScriptValue.cpp and the usage in it will become invalid once - // BlobBuilder is introduced. - static PassRefPtr<Blob> create(ScriptExecutionContext* scriptExecutionContext, const String& path) + // For deserialization. + static PassRefPtr<Blob> create(ScriptExecutionContext* scriptExecutionContext, const KURL& srcURL, const String& type, long long size) { - return adoptRef(new Blob(scriptExecutionContext, path)); + return adoptRef(new Blob(scriptExecutionContext, srcURL, type, size)); } - virtual ~Blob() { } + virtual ~Blob(); + void contextDestroyed(); + + const KURL& url() const { return m_url; } unsigned long long size() const; const String& type() const { return m_type; } virtual bool isFile() const { return false; } - // FIXME: Deprecated method. + // FIXME: To be removed when we switch to using BlobData. const String& path() const; + // FIXME: To be removed when we switch to using BlobData. const BlobItemList& items() const { return m_items; } #if ENABLE(BLOB) @@ -72,14 +78,26 @@ public: #endif protected: + // FIXME: To be removed when we switch to using BlobData. Blob(ScriptExecutionContext*, const String& type, const BlobItemList&); Blob(ScriptExecutionContext*, const PassRefPtr<BlobItem>&); - - // FIXME: Deprecated constructor. See also the comment for Blob::create(path). Blob(ScriptExecutionContext*, const String& path); + Blob(ScriptExecutionContext*, PassOwnPtr<BlobData>, long long size); + + // For deserialization. + Blob(ScriptExecutionContext*, const KURL& srcURL, const String& type, long long size); + + // FIXME: To be removed when we switch to using BlobData. BlobItemList m_items; + + // This is an internal URL referring to the blob data associated with this object. + // It is only used by FileReader to read the blob data via loading from the blob URL resource. + KURL m_url; + + ScriptExecutionContext* m_scriptExecutionContext; String m_type; + long long m_size; }; } // namespace WebCore diff --git a/WebCore/html/BlobBuilder.cpp b/WebCore/html/BlobBuilder.cpp index 0592ff0..29a7595 100644 --- a/WebCore/html/BlobBuilder.cpp +++ b/WebCore/html/BlobBuilder.cpp @@ -32,11 +32,11 @@ #include "BlobBuilder.h" -#include "AtomicString.h" #include "Blob.h" #include "ExceptionCode.h" #include "LineEnding.h" #include "TextEncoding.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/html/BlobURL.cpp b/WebCore/html/BlobURL.cpp new file mode 100644 index 0000000..610aac4 --- /dev/null +++ b/WebCore/html/BlobURL.cpp @@ -0,0 +1,66 @@ +/* + * 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 "BlobURL.h" + +#include "KURL.h" +#include "PlatformString.h" +#include "ScriptExecutionContext.h" +#include "SecurityOrigin.h" +#include "UUID.h" + +namespace WebCore { + +KURL BlobURL::createURL(ScriptExecutionContext* scriptExecutionContext) +{ + // Create the blob URL in the following format: + // blob:%escaped_origin%/%UUID% + // The origin of the host page is encoded in the URL value to allow easy lookup of the origin when the security check needs + // to be performed. + String urlString = "blob:"; + urlString += encodeWithURLEscapeSequences(scriptExecutionContext->securityOrigin()->toString()); + urlString += "/"; + urlString += createCanonicalUUIDString(); + return KURL(ParsedURLString, urlString); +} + +KURL BlobURL::getOrigin(const KURL& url) +{ + ASSERT(url.protocolIs("blob")); + + unsigned startIndex = url.pathStart(); + unsigned afterEndIndex = url.pathAfterLastSlash(); + String origin = url.string().substring(startIndex, afterEndIndex - startIndex); + return KURL(ParsedURLString, decodeURLEscapeSequences(origin)); +} + +} // namespace WebCore diff --git a/WebCore/html/BlobURL.h b/WebCore/html/BlobURL.h new file mode 100644 index 0000000..2ce2c85 --- /dev/null +++ b/WebCore/html/BlobURL.h @@ -0,0 +1,48 @@ +/* + * 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 BlobURL_h +#define BlobURL_h + +#include "KURL.h" + +namespace WebCore { + +class ScriptExecutionContext; + +class BlobURL { +public: + static KURL createURL(ScriptExecutionContext*); + static KURL getOrigin(const KURL&); +}; + +} + +#endif // BlobURL_h diff --git a/WebCore/html/DataGridColumn.h b/WebCore/html/DataGridColumn.h index 3d480a9..555389c 100644 --- a/WebCore/html/DataGridColumn.h +++ b/WebCore/html/DataGridColumn.h @@ -28,10 +28,10 @@ #if ENABLE(DATAGRID) -#include "AtomicString.h" #include "RenderStyle.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/html/DataGridColumnList.cpp b/WebCore/html/DataGridColumnList.cpp index 9613402..15590b2 100644 --- a/WebCore/html/DataGridColumnList.cpp +++ b/WebCore/html/DataGridColumnList.cpp @@ -27,11 +27,11 @@ #if ENABLE(DATAGRID) -#include "AtomicString.h" #include "DataGridColumnList.h" #include "HTMLDataGridElement.h" #include "PlatformString.h" #include "RenderObject.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/html/File.cpp b/WebCore/html/File.cpp index 109e0d3..253cb4d 100644 --- a/WebCore/html/File.cpp +++ b/WebCore/html/File.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "File.h" +#include "BlobData.h" #include "FileSystem.h" #include "MIMETypeRegistry.h" @@ -37,6 +38,13 @@ File::File(ScriptExecutionContext* scriptExecutionContext, const String& path) Init(); } +File::File(ScriptExecutionContext* scriptExecutionContext, const String& path, const KURL& url, const String& type) + : Blob(scriptExecutionContext, url, type, BlobDataItem::toEndOfFile) +{ + // FIXME: To be removed when we switch to using BlobData. + m_items.append(FileBlobItem::create(path)); +} + #if ENABLE(DIRECTORY_UPLOAD) File::File(ScriptExecutionContext* scriptExecutionContext, const String& relativePath, const String& filePath) : Blob(scriptExecutionContext, FileBlobItem::create(filePath, relativePath)) @@ -49,8 +57,8 @@ void File::Init() { // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure. const String& fileName = name(); - int index = fileName.reverseFind('.'); - if (index != -1) + size_t index = fileName.reverseFind('.'); + if (index != notFound) m_type = MIMETypeRegistry::getMIMETypeForExtension(fileName.substring(index + 1)); } diff --git a/WebCore/html/File.h b/WebCore/html/File.h index c0aecc8..06a73c5 100644 --- a/WebCore/html/File.h +++ b/WebCore/html/File.h @@ -39,6 +39,12 @@ public: return adoptRef(new File(scriptExecutionContext, path)); } + // For deserialization. + static PassRefPtr<File> create(ScriptExecutionContext* scriptExecutionContext, const String& path, const KURL& url, const String& type) + { + return adoptRef(new File(scriptExecutionContext, path, url, type)); + } + #if ENABLE(DIRECTORY_UPLOAD) static PassRefPtr<File> create(ScriptExecutionContext* scriptExecutionContext, const String& relativePath, const String& path) { @@ -60,11 +66,15 @@ public: private: File(ScriptExecutionContext*, const String& path); - void Init(); + + // For deserialization. + File(ScriptExecutionContext*, const String& path, const KURL&, const String& type); #if ENABLE(DIRECTORY_UPLOAD) File(ScriptExecutionContext*, const String& relativePath, const String& path); #endif + + void Init(); }; } // namespace WebCore diff --git a/WebCore/html/FileReader.cpp b/WebCore/html/FileReader.cpp index 88f218f..e99fdc4 100644 --- a/WebCore/html/FileReader.cpp +++ b/WebCore/html/FileReader.cpp @@ -160,33 +160,70 @@ void FileReader::terminate() void FileReader::didStart() { m_state = Opening; - m_streamProxy->openForRead(m_fileBlob.get()); + + ASSERT(m_fileBlob->items().size() == 1 && m_fileBlob->items().at(0)->toFileBlobItem()); + const FileRangeBlobItem* fileRangeItem = m_fileBlob->items().at(0)->toFileRangeBlobItem(); + double expectedModificationTime = fileRangeItem ? fileRangeItem->snapshotModificationTime() : 0; + + m_streamProxy->getSize(m_fileBlob->path(), expectedModificationTime); } void FileReader::didGetSize(long long size) { + // If the size is -1, it means the file has been moved or changed. Fail now. + if (size == -1) { + didFail(NOT_FOUND_ERR); + return; + } + m_state = Reading; fireEvent(eventNames().loadstartEvent); - m_totalBytes = size; - m_streamProxy->read(&m_buffer.at(0), m_buffer.size()); + ASSERT(m_fileBlob->items().size() == 1 && m_fileBlob->items().at(0)->toFileBlobItem()); + const FileRangeBlobItem* fileRangeItem = m_fileBlob->items().at(0)->toFileRangeBlobItem(); + long long start = fileRangeItem ? fileRangeItem->start() : 0; + + // The size passed back is the size of the whole file. If the underlying item is a sliced file, we need to use the slice length. + m_totalBytes = fileRangeItem ? fileRangeItem->size() : size; + + m_streamProxy->openForRead(m_fileBlob->path(), start, m_totalBytes); } -void FileReader::didRead(const char* data, int bytesRead) +void FileReader::didOpen(ExceptionCode ec) { - ASSERT(data && bytesRead); + if (ec) { + didFail(ec); + return; + } + + m_streamProxy->read(m_buffer.data(), m_buffer.size()); +} +void FileReader::didRead(int bytesRead) +{ // Bail out if we have aborted the reading. if (m_state == Completed) - return; + return; + + // If bytesRead is -1, it means an error happens. + if (bytesRead == -1) { + didFail(NOT_READABLE_ERR); + return; + } + + // If bytesRead is 0, it means the reading is done. + if (!bytesRead) { + didFinish(); + return; + } switch (m_readType) { case ReadFileAsBinaryString: - m_result += String(data, static_cast<unsigned>(bytesRead)); + m_result += String(m_buffer.data(), static_cast<unsigned>(bytesRead)); break; case ReadFileAsText: case ReadFileAsDataURL: - m_rawData.append(data, static_cast<unsigned>(bytesRead)); + m_rawData.append(m_buffer.data(), static_cast<unsigned>(bytesRead)); m_isRawDataConverted = false; break; default: @@ -205,7 +242,7 @@ void FileReader::didRead(const char* data, int bytesRead) } // Continue reading. - m_streamProxy->read(&m_buffer.at(0), m_buffer.size()); + m_streamProxy->read(m_buffer.data(), m_buffer.size()); } void FileReader::didFinish() @@ -240,15 +277,15 @@ FileReader::ReadyState FileReader::readyState() const switch (m_state) { case None: case Starting: - return Empty; + return EMPTY; case Opening: case Reading: - return Loading; + return LOADING; case Completed: - return Done; + return DONE; } ASSERT_NOT_REACHED(); - return Empty; + return EMPTY; } const ScriptString& FileReader::result() diff --git a/WebCore/html/FileReader.h b/WebCore/html/FileReader.h index a5339a9..2237af5 100644 --- a/WebCore/html/FileReader.h +++ b/WebCore/html/FileReader.h @@ -63,9 +63,9 @@ public: virtual ~FileReader(); enum ReadyState { - Empty = 0, - Loading = 1, - Done = 2 + EMPTY = 0, + LOADING = 1, + DONE = 2 }; void readAsBinaryString(Blob*); @@ -89,9 +89,8 @@ public: // FileStreamClient virtual void didStart(); virtual void didGetSize(long long); - virtual void didRead(const char*, int); - virtual void didFinish(); - virtual void didFail(ExceptionCode); + virtual void didOpen(ExceptionCode); + virtual void didRead(int); using RefCounted<FileReader>::ref; using RefCounted<FileReader>::deref; @@ -130,6 +129,8 @@ private: void fireEvent(const AtomicString& type); void convertToText(); void convertToDataURL(); + void didFinish(); + void didFail(ExceptionCode); InternalState m_state; EventTargetData m_eventTargetData; diff --git a/WebCore/html/FileReader.idl b/WebCore/html/FileReader.idl index fb3b979..b36e9d3 100644 --- a/WebCore/html/FileReader.idl +++ b/WebCore/html/FileReader.idl @@ -34,8 +34,7 @@ module html { CanBeConstructed, CallWith=ScriptExecutionContext, EventTarget, - NoStaticTables, - DontCheckEnums + NoStaticTables ] FileReader { // ready states const unsigned short EMPTY = 0; diff --git a/WebCore/html/FileStream.cpp b/WebCore/html/FileStream.cpp index abe7bad..a89c67a 100644 --- a/WebCore/html/FileStream.cpp +++ b/WebCore/html/FileStream.cpp @@ -39,9 +39,8 @@ namespace WebCore { -FileStream::FileStream(FileStreamClient* client) - : m_client(client) - , m_handle(invalidPlatformFileHandle) +FileStream::FileStream() + : m_handle(invalidPlatformFileHandle) , m_bytesProcessed(0) , m_totalBytesToRead(0) { @@ -52,130 +51,99 @@ FileStream::~FileStream() ASSERT(!isHandleValid(m_handle)); } +// FIXME: To be removed when we switch to using BlobData. void FileStream::start() { - ASSERT(!isMainThread()); - m_client->didStart(); } void FileStream::stop() { - ASSERT(!isMainThread()); close(); - m_client->didStop(); } -void FileStream::openForRead(Blob* blob) +long long FileStream::getSize(const String& path, double expectedModificationTime) { - ASSERT(!isMainThread()); + // Check the modification time for the possible file change. + time_t modificationTime; + if (!getFileModificationTime(path, modificationTime)) + return -1; + if (expectedModificationTime) { + if (static_cast<time_t>(expectedModificationTime) != modificationTime) + return -1; + } + + // Now get the file size. + long long length; + if (!getFileSize(path, length)) + return -1; + + return length; +} +ExceptionCode FileStream::openForRead(const String& path, long long offset, long long length) +{ if (isHandleValid(m_handle)) - return; - - // FIXME: Need to handle multiple items that may include non-file ones when BlobBuilder is introduced. - ASSERT(blob->items().size() >= 1); - const FileBlobItem* fileItem = blob->items().at(0)->toFileBlobItem(); - if (!fileItem) { - ASSERT(false); - m_client->didFail(NOT_READABLE_ERR); - return; - } + return 0; - // Check if the file exists by querying its modification time. We choose not to call fileExists() in order to save an - // extra file system call when the modification time is needed to check the validity of the sliced file blob. - // Per the spec, we need to return different error codes to differentiate between non-existent file and permission error. - // openFile() could not tell use the failure reason. - time_t currentModificationTime; - if (!getFileModificationTime(fileItem->path(), currentModificationTime)) { - m_client->didFail(NOT_FOUND_ERR); - return; - } + // Open the file. + m_handle = openFile(path, OpenForRead); + if (!isHandleValid(m_handle)) + return NOT_READABLE_ERR; - // Open the file blob. - m_handle = openFile(fileItem->path(), OpenForRead); - if (!isHandleValid(m_handle)) { - m_client->didFail(NOT_READABLE_ERR); - return; + // Jump to the beginning position if the file has been sliced. + if (offset > 0) { + if (seekFile(m_handle, offset, SeekFromBeginning) < 0) + return NOT_READABLE_ERR; } - const FileRangeBlobItem* fileRangeItem = fileItem->toFileRangeBlobItem(); - if (fileRangeItem) { - // Check the modificationt time for the possible file change. - if (static_cast<time_t>(fileRangeItem->snapshotModificationTime()) != currentModificationTime) { - m_client->didFail(NOT_READABLE_ERR); - return; - } - - // Jump to the beginning position if the file has been sliced. - if (fileRangeItem->start() > 0) { - if (seekFile(m_handle, fileRangeItem->start(), SeekFromBeginning) < 0) { - m_client->didFail(NOT_READABLE_ERR); - return; - } - } - } + m_totalBytesToRead = length; + m_bytesProcessed = 0; - // Get the size. - m_totalBytesToRead = blob->size(); - m_client->didGetSize(m_totalBytesToRead); + return 0; } -void FileStream::openForWrite(const String&) +ExceptionCode FileStream::openForWrite(const String&) { - ASSERT(!isMainThread()); // FIXME: to be implemented. + return NOT_SUPPORTED_ERR; } void FileStream::close() { - ASSERT(!isMainThread()); if (isHandleValid(m_handle)) { closeFile(m_handle); m_handle = invalidPlatformFileHandle; } } -void FileStream::read(char* buffer, int length) +int FileStream::read(char* buffer, int bufferSize) { - ASSERT(!isMainThread()); - - if (!isHandleValid(m_handle)) { - m_client->didFail(NOT_READABLE_ERR); - return; - } - - if (m_bytesProcessed >= m_totalBytesToRead) { - m_client->didFinish(); - return; - } + if (!isHandleValid(m_handle)) + return -1; long long remaining = m_totalBytesToRead - m_bytesProcessed; - int bytesToRead = (remaining < length) ? static_cast<int>(remaining) : length; - int bytesRead = readFromFile(m_handle, buffer, bytesToRead); - if (bytesRead < 0) { - m_client->didFail(NOT_READABLE_ERR); - return; - } - - if (!bytesRead) { - m_client->didFinish(); - return; - } - - m_bytesProcessed += bytesRead; - m_client->didRead(buffer, bytesRead); + int bytesToRead = (remaining < bufferSize) ? static_cast<int>(remaining) : bufferSize; + int bytesRead = 0; + if (bytesToRead > 0) + bytesRead = readFromFile(m_handle, buffer, bytesToRead); + if (bytesRead < 0) + return -1; + if (bytesRead > 0) + m_bytesProcessed += bytesRead; + + return bytesRead; } -void FileStream::write(Blob*, long long, int) +int FileStream::write(Blob*, long long, int) { - ASSERT(!isMainThread()); // FIXME: to be implemented. + return -1; } -void FileStream::truncate(long long) +ExceptionCode FileStream::truncate(long long) { - ASSERT(!isMainThread()); // FIXME: to be implemented. + return NOT_SUPPORTED_ERR; } } // namespace WebCore diff --git a/WebCore/html/FileStream.h b/WebCore/html/FileStream.h index b5eccd4..e299fe4 100644 --- a/WebCore/html/FileStream.h +++ b/WebCore/html/FileStream.h @@ -33,7 +33,7 @@ #if ENABLE(BLOB) || ENABLE(FILE_WRITER) -#include "FileStreamClient.h" +#include "ExceptionCode.h" #include "FileSystem.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> @@ -43,29 +43,52 @@ namespace WebCore { class Blob; -// All methods are synchronous and should be called on File or Worker thread. +// All methods are synchronous. class FileStream : public RefCounted<FileStream> { public: - static PassRefPtr<FileStream> create(FileStreamClient* client) + static PassRefPtr<FileStream> create() { - return adoptRef(new FileStream(client)); + return adoptRef(new FileStream()); } virtual ~FileStream(); + // FIXME: To be removed when we switch to using BlobData. void start(); + + // Aborts the operation. void stop(); - void openForRead(Blob*); - void openForWrite(const String& path); + // Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero. + // Returns total number of bytes if successful. -1 otherwise. + long long getSize(const String& path, double expectedModificationTime); + + // Opens a file for reading. The reading starts at the specified offset and lasts till the specified length. + // Returns 0 on success. Exception code otherwise. + ExceptionCode openForRead(const String& path, long long offset, long long length); + + // Opens a file for writing. + // Returns 0 on success. Exception code otherwise. + ExceptionCode openForWrite(const String& path); + + // Closes the file. void close(); - void read(char* buffer, int length); - void write(Blob* blob, long long position, int length); - void truncate(long long position); + + // Reads a file into the provided data buffer. + // Returns number of bytes being read on success. -1 otherwise. + // If 0 is returned, it means that the reading is completed. + int read(char* buffer, int length); + + // Writes a blob to the file. + // Returns number of bytes being written on success. -1 otherwise. + int write(Blob*, long long position, int length); + + // Truncates the file to the specified position. + // Returns 0 on success. Exception code otherwise. + ExceptionCode truncate(long long position); private: - FileStream(FileStreamClient*); + FileStream(); - FileStreamClient* m_client; PlatformFileHandle m_handle; long long m_bytesProcessed; long long m_totalBytesToRead; diff --git a/WebCore/html/FileStreamClient.h b/WebCore/html/FileStreamClient.h index 2e7091f..440d2fb 100644 --- a/WebCore/html/FileStreamClient.h +++ b/WebCore/html/FileStreamClient.h @@ -40,16 +40,18 @@ namespace WebCore { class FileStreamClient { public: // For reading. - virtual void didRead(const char*, int) { } + virtual void didRead(int) { } // For writing. virtual void didWrite(int) { } + virtual void didTruncate(ExceptionCode) { } - // For both reading and writing. + // FIXME: To be removed when we switch to using BlobData. virtual void didStart() { } + + // For both reading and writing. + virtual void didOpen(ExceptionCode) { } virtual void didStop() { } - virtual void didFinish() { } - virtual void didFail(ExceptionCode) { } virtual void didGetSize(long long) { } protected: diff --git a/WebCore/html/FileStreamProxy.cpp b/WebCore/html/FileStreamProxy.cpp index e3b9e79..f50b7e8 100644 --- a/WebCore/html/FileStreamProxy.cpp +++ b/WebCore/html/FileStreamProxy.cpp @@ -37,6 +37,7 @@ #include "Blob.h" #include "CrossThreadTask.h" #include "FileStream.h" +#include "FileStreamClient.h" #include "FileThread.h" #include "FileThreadTask.h" #include "PlatformString.h" @@ -47,7 +48,7 @@ namespace WebCore { inline FileStreamProxy::FileStreamProxy(ScriptExecutionContext* context, FileStreamClient* client) : m_context(context) , m_client(client) - , m_stream(FileStream::create(this)) + , m_stream(FileStream::create()) { } @@ -59,7 +60,7 @@ PassRefPtr<FileStreamProxy> FileStreamProxy::create(ScriptExecutionContext* cont // This is balanced by the deref in derefProxyOnContext below. proxy->ref(); - proxy->fileThread()->postTask(createFileThreadTask(proxy->m_stream.get(), &FileStream::start)); + proxy->fileThread()->postTask(createFileThreadTask(proxy.get(), &FileStreamProxy::startOnFileThread)); return proxy.release(); } @@ -68,133 +69,150 @@ FileStreamProxy::~FileStreamProxy() { } -void FileStreamProxy::openForRead(Blob* blob) +FileThread* FileStreamProxy::fileThread() { - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::openForRead, blob)); + ASSERT(m_context->isContextThread()); + ASSERT(m_context->fileThread()); + return m_context->fileThread(); } -void FileStreamProxy::openForWrite(const String& path) +static void didStart(ScriptExecutionContext*, FileStreamProxy* proxy) { - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::openForWrite, path)); + if (proxy->client()) + proxy->client()->didStart(); } -void FileStreamProxy::close() +void FileStreamProxy::startOnFileThread() { - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::close)); + m_stream->start(); + m_context->postTask(createCallbackTask(&didStart, this)); } -void FileStreamProxy::read(char* buffer, int length) +void FileStreamProxy::stop() { - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::read, buffer, length)); + // Clear the client so that we won't be calling callbacks on the client. + m_client = 0; + + fileThread()->unscheduleTasks(m_stream.get()); + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::stopOnFileThread)); } -void FileStreamProxy::write(Blob* blob, long long position, int length) +static void derefProxyOnContext(ScriptExecutionContext*, FileStreamProxy* proxy) { - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::write, blob, position, length)); + ASSERT(proxy->hasOneRef()); + proxy->deref(); } -void FileStreamProxy::truncate(long long position) +void FileStreamProxy::stopOnFileThread() { - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::truncate, position)); + m_stream->stop(); + m_context->postTask(createCallbackTask(&derefProxyOnContext, this)); } -FileThread* FileStreamProxy::fileThread() +static void didGetSize(ScriptExecutionContext*, FileStreamProxy* proxy, long long size) { - ASSERT(m_context->isContextThread()); - ASSERT(m_context->fileThread()); - return m_context->fileThread(); + if (proxy->client()) + proxy->client()->didGetSize(size); } -void FileStreamProxy::stop() +void FileStreamProxy::getSize(const String& path, double expectedModificationTime) { - // Clear the client so that we won't be calling callbacks on the client. - m_client = 0; + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::getSizeOnFileThread, path, expectedModificationTime)); +} - fileThread()->unscheduleTasks(m_stream.get()); - fileThread()->postTask(createFileThreadTask(m_stream.get(), &FileStream::stop)); +void FileStreamProxy::getSizeOnFileThread(const String& path, double expectedModificationTime) +{ + long long size = m_stream->getSize(path, expectedModificationTime); + m_context->postTask(createCallbackTask(&didGetSize, this, size)); } -static void notifyGetSizeOnContext(ScriptExecutionContext*, FileStreamProxy* proxy, long long size) +static void didOpen(ScriptExecutionContext*, FileStreamProxy* proxy, ExceptionCode ec) { if (proxy->client()) - proxy->client()->didGetSize(size); + proxy->client()->didOpen(ec); } -void FileStreamProxy::didGetSize(long long size) +void FileStreamProxy::openForRead(const String& path, long long offset, long long length) { - ASSERT(!m_context->isContextThread()); - m_context->postTask(createCallbackTask(¬ifyGetSizeOnContext, this, size)); + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::openForReadOnFileThread, path, offset, length)); } -static void notifyReadOnContext(ScriptExecutionContext*, FileStreamProxy* proxy, const char* data, int bytesRead) +void FileStreamProxy::openForReadOnFileThread(const String& path, long long offset, long long length) { - if (proxy->client()) - proxy->client()->didRead(data, bytesRead); + ExceptionCode ec = m_stream->openForRead(path, offset, length); + m_context->postTask(createCallbackTask(&didOpen, this, ec)); +} + +void FileStreamProxy::openForWrite(const String& path) +{ + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::openForWriteOnFileThread, path)); } -void FileStreamProxy::didRead(const char* data, int bytesRead) +void FileStreamProxy::openForWriteOnFileThread(const String& path) { - ASSERT(!m_context->isContextThread()); - m_context->postTask(createCallbackTask(¬ifyReadOnContext, this, data, bytesRead)); + ExceptionCode ec = m_stream->openForWrite(path); + m_context->postTask(createCallbackTask(&didOpen, this, ec)); } -static void notifyWriteOnContext(ScriptExecutionContext*, FileStreamProxy* proxy, int bytesWritten) +void FileStreamProxy::close() { - if (proxy->client()) - proxy->client()->didWrite(bytesWritten); + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::closeOnFileThread)); } -void FileStreamProxy::didWrite(int bytesWritten) +void FileStreamProxy::closeOnFileThread() { - ASSERT(!m_context->isContextThread()); - m_context->postTask(createCallbackTask(¬ifyWriteOnContext, this, bytesWritten)); + m_stream->close(); } -static void notifyStartOnContext(ScriptExecutionContext*, FileStreamProxy* proxy) +static void didRead(ScriptExecutionContext*, FileStreamProxy* proxy, int bytesRead) { if (proxy->client()) - proxy->client()->didStart(); + proxy->client()->didRead(bytesRead); } -void FileStreamProxy::didStart() +void FileStreamProxy::read(char* buffer, int length) +{ + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::readOnFileThread, buffer, length)); +} + +void FileStreamProxy::readOnFileThread(char* buffer, int length) { - ASSERT(!m_context->isContextThread()); - m_context->postTask(createCallbackTask(¬ifyStartOnContext, this)); + int bytesRead = m_stream->read(buffer, length); + m_context->postTask(createCallbackTask(&didRead, this, bytesRead)); } -static void notifyFinishOnContext(ScriptExecutionContext*, FileStreamProxy* proxy) +static void didWrite(ScriptExecutionContext*, FileStreamProxy* proxy, int bytesWritten) { if (proxy->client()) - proxy->client()->didFinish(); + proxy->client()->didWrite(bytesWritten); } -void FileStreamProxy::didFinish() +void FileStreamProxy::write(Blob* blob, long long position, int length) { - ASSERT(!m_context->isContextThread()); - m_context->postTask(createCallbackTask(¬ifyFinishOnContext, this)); + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::writeOnFileThread, blob, position, length)); } -static void notifyFailOnContext(ScriptExecutionContext*, FileStreamProxy* proxy, ExceptionCode ec) +void FileStreamProxy::writeOnFileThread(Blob* blob, long long position, int length) { - if (proxy->client()) - proxy->client()->didFail(ec); + int bytesWritten = m_stream->write(blob, position, length); + m_context->postTask(createCallbackTask(&didWrite, this, bytesWritten)); } -void FileStreamProxy::didFail(ExceptionCode ec) +static void didTruncate(ScriptExecutionContext*, FileStreamProxy* proxy, ExceptionCode ec) { - ASSERT(!m_context->isContextThread()); - m_context->postTask(createCallbackTask(¬ifyFailOnContext, this, ec)); + if (proxy->client()) + proxy->client()->didTruncate(ec); } -static void derefProxyOnContext(ScriptExecutionContext*, FileStreamProxy* proxy) +void FileStreamProxy::truncate(long long position) { - ASSERT(proxy->hasOneRef()); - proxy->deref(); + fileThread()->postTask(createFileThreadTask(this, &FileStreamProxy::truncateOnFileThread, position)); } -void FileStreamProxy::didStop() +void FileStreamProxy::truncateOnFileThread(long long position) { - m_context->postTask(createCallbackTask(&derefProxyOnContext, this)); + ExceptionCode ec = m_stream->truncate(position); + m_context->postTask(createCallbackTask(&didTruncate, this, ec)); } } // namespace WebCore diff --git a/WebCore/html/FileStreamProxy.h b/WebCore/html/FileStreamProxy.h index 8523d4a..1d03a58 100644 --- a/WebCore/html/FileStreamProxy.h +++ b/WebCore/html/FileStreamProxy.h @@ -34,7 +34,6 @@ #if ENABLE(BLOB) || ENABLE(FILE_WRITER) -#include "FileStreamClient.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -44,20 +43,22 @@ namespace WebCore { class Blob; class FileStream; +class FileStreamClient; class FileThread; class ScriptExecutionContext; -// A proxy module that calls corresponding FileStream methods on the file thread. Note: you must call stop() first and then release the reference to destruct the FileStreamProxy instance. -class FileStreamProxy : public RefCounted<FileStreamProxy>, public FileStreamClient { +// A proxy module that asynchronously calls corresponding FileStream methods on the file thread. Note: you must call stop() first and then release the reference to destruct the FileStreamProxy instance. +class FileStreamProxy : public RefCounted<FileStreamProxy> { public: static PassRefPtr<FileStreamProxy> create(ScriptExecutionContext*, FileStreamClient*); virtual ~FileStreamProxy(); - void openForRead(Blob* blob); + void getSize(const String& path, double expectedModificationTime); + void openForRead(const String& path, long long offset, long long length); void openForWrite(const String& path); void close(); void read(char* buffer, int length); - void write(Blob* blob, long long position, int length); + void write(Blob*, long long position, int length); void truncate(long long position); // Stops the proxy and scedules it to be destructed. All the pending tasks will be aborted and the file stream will be closed. @@ -69,17 +70,19 @@ public: private: FileStreamProxy(ScriptExecutionContext*, FileStreamClient*); - // FileStreamClient methods. - virtual void didGetSize(long long); - virtual void didRead(const char*, int); - virtual void didWrite(int); - virtual void didFinish(); - virtual void didFail(ExceptionCode); - virtual void didStart(); - virtual void didStop(); - FileThread* fileThread(); + // Called on File thread. + void startOnFileThread(); + void stopOnFileThread(); + void getSizeOnFileThread(const String& path, double expectedModificationTime); + void openForReadOnFileThread(const String& path, long long offset, long long length); + void openForWriteOnFileThread(const String& path); + void closeOnFileThread(); + void readOnFileThread(char* buffer, int length); + void writeOnFileThread(Blob*, long long position, int length); + void truncateOnFileThread(long long position); + RefPtr<ScriptExecutionContext> m_context; FileStreamClient* m_client; RefPtr<FileStream> m_stream; diff --git a/WebCore/html/FileThreadTask.h b/WebCore/html/FileThreadTask.h index 09b647f..3443457 100644 --- a/WebCore/html/FileThreadTask.h +++ b/WebCore/html/FileThreadTask.h @@ -39,11 +39,11 @@ namespace WebCore { -template<typename R, typename T> +template<typename T> class FileThreadTask0 : public FileThread::Task { public: - typedef R (T::*Method)(); - typedef FileThreadTask0<R, T> FileThreadTaskImpl; + typedef void (T::*Method)(); + typedef FileThreadTask0<T> FileThreadTaskImpl; static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method) { @@ -66,11 +66,11 @@ private: Method m_method; }; -template<typename R, typename T, typename P1, typename MP1> +template<typename T, typename P1, typename MP1> class FileThreadTask1 : public FileThread::Task { public: - typedef R (T::*Method)(MP1); - typedef FileThreadTask1<R, T, P1, MP1> FileThreadTaskImpl; + typedef void (T::*Method)(MP1); + typedef FileThreadTask1<T, P1, MP1> FileThreadTaskImpl; typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1) @@ -96,11 +96,11 @@ private: P1 m_parameter1; }; -template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2> +template<typename T, typename P1, typename MP1, typename P2, typename MP2> class FileThreadTask2 : public FileThread::Task { public: - typedef R (T::*Method)(MP1, MP2); - typedef FileThreadTask2<R, T, P1, MP1, P2, MP2> FileThreadTaskImpl; + typedef void (T::*Method)(MP1, MP2); + typedef FileThreadTask2<T, P1, MP1, P2, MP2> FileThreadTaskImpl; typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; @@ -129,11 +129,11 @@ private: P2 m_parameter2; }; -template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> +template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> class FileThreadTask3 : public FileThread::Task { public: typedef void (T::*Method)(MP1, MP2, MP3); - typedef FileThreadTask3<R, T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl; + typedef FileThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl; typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; typedef typename CrossThreadTaskTraits<P3>::ParamType Param3; @@ -165,56 +165,56 @@ private: P3 m_parameter3; }; -template<typename R, typename T> +template<typename T> PassOwnPtr<FileThread::Task> createFileThreadTask( T* const callee, - R (T::*method)()); + void (T::*method)()); -template<typename R, typename T> +template<typename T> PassOwnPtr<FileThread::Task> createFileThreadTask( T* const callee, - R (T::*method)()) + void (T::*method)()) { - return FileThreadTask0<R, T>::create( + return FileThreadTask0<T>::create( callee, method); } -template<typename R, typename T, typename P1, typename MP1> +template<typename T, typename P1, typename MP1> PassOwnPtr<FileThread::Task> createFileThreadTask( T* const callee, - R (T::*method)(MP1), + void (T::*method)(MP1), const P1& parameter1) { - return FileThreadTask1<R, T, typename CrossThreadCopier<P1>::Type, MP1>::create( + return FileThreadTask1<T, typename CrossThreadCopier<P1>::Type, MP1>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1)); } -template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2> +template<typename T, typename P1, typename MP1, typename P2, typename MP2> PassOwnPtr<FileThread::Task> createFileThreadTask( T* const callee, - R (T::*method)(MP1, MP2), + void (T::*method)(MP1, MP2), const P1& parameter1, const P2& parameter2) { - return FileThreadTask2<R, T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( + return FileThreadTask2<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2)); } -template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> +template<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> PassOwnPtr<FileThread::Task> createFileThreadTask( T* const callee, - R (T::*method)(MP1, MP2, MP3), + void (T::*method)(MP1, MP2, MP3), const P1& parameter1, const P2& parameter2, const P3& parameter3) { - return FileThreadTask3<R, T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( + return FileThreadTask3<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1), diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp index 0d2e92d..e1ee86a 100644 --- a/WebCore/html/HTMLAnchorElement.cpp +++ b/WebCore/html/HTMLAnchorElement.cpp @@ -381,11 +381,11 @@ void HTMLAnchorElement::setHost(const String& value) if (!url.canSetHostOrPort()) return; - int separator = value.find(':'); + size_t separator = value.find(':'); if (!separator) return; - if (separator == -1) + if (separator == notFound) url.setHostAndPort(value); else { unsigned portEnd; diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp index ef5574a..84ab227 100644 --- a/WebCore/html/HTMLCanvasElement.cpp +++ b/WebCore/html/HTMLCanvasElement.cpp @@ -209,8 +209,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas void HTMLCanvasElement::willDraw(const FloatRect& rect) { - if (m_imageBuffer) - m_imageBuffer->clearImage(); + m_copiedImage.clear(); // Clear our image snapshot if we have one. if (RenderBox* ro = renderBox()) { FloatRect destRect = ro->contentBoxRect(); @@ -233,6 +232,7 @@ void HTMLCanvasElement::reset() return; bool ok; + bool hadImageBuffer = hasCreatedImageBuffer(); int w = getAttribute(widthAttr).toInt(&ok); if (!ok || w < 0) w = DefaultWidth; @@ -241,14 +241,13 @@ void HTMLCanvasElement::reset() h = DefaultHeight; IntSize oldSize = size(); - setSurfaceSize(IntSize(w, h)); + setSurfaceSize(IntSize(w, h)); // The image buffer gets cleared here. #if ENABLE(3D_CANVAS) - if (m_context && m_context->is3d()) + if (m_context && m_context->is3d() && oldSize != size()) static_cast<WebGLRenderingContext*>(m_context.get())->reshape(width(), height()); #endif - bool hadImageBuffer = hasCreatedImageBuffer(); if (m_context && m_context->is2d()) static_cast<CanvasRenderingContext2D*>(m_context.get())->reset(); @@ -277,23 +276,21 @@ void HTMLCanvasElement::paint(GraphicsContext* context, const IntRect& r) WebGLRenderingContext* context3D = 0; if (m_context && m_context->is3d()) { context3D = static_cast<WebGLRenderingContext*>(m_context.get()); - context3D->beginPaint(); + if (!context3D->paintsIntoCanvasBuffer()) + return; + context3D->paintRenderingResultsToCanvas(); } #endif if (hasCreatedImageBuffer()) { ImageBuffer* imageBuffer = buffer(); if (imageBuffer) { - Image* image = imageBuffer->imageForRendering(); - if (image) - context->drawImage(image, DeviceColorSpace, r); + if (imageBuffer->drawsUsingCopy()) + context->drawImage(copiedImage(), DeviceColorSpace, r); + else + context->drawImageBuffer(imageBuffer, DeviceColorSpace, r); } } - -#if ENABLE(3D_CANVAS) - if (context3D) - context3D->endPaint(); -#endif } #if ENABLE(3D_CANVAS) @@ -325,6 +322,7 @@ void HTMLCanvasElement::setSurfaceSize(const IntSize& size) m_size = size; m_hasCreatedImageBuffer = false; m_imageBuffer.clear(); + m_copiedImage.clear(); } String HTMLCanvasElement::toDataURL(const String& mimeType, const double* quality, ExceptionCode& ec) @@ -405,6 +403,7 @@ void HTMLCanvasElement::createImageBuffer() const return; m_imageBuffer->context()->scale(FloatSize(size.width() / unscaledSize.width(), size.height() / unscaledSize.height())); m_imageBuffer->context()->setShadowsIgnoreTransforms(true); + m_imageBuffer->context()->setImageInterpolationQuality(CanvasInterpolationQuality); } GraphicsContext* HTMLCanvasElement::drawingContext() const @@ -419,6 +418,18 @@ ImageBuffer* HTMLCanvasElement::buffer() const return m_imageBuffer.get(); } +Image* HTMLCanvasElement::copiedImage() const +{ + if (!m_copiedImage && buffer()) + m_copiedImage = buffer()->copyImage(); + return m_copiedImage.get(); +} + +void HTMLCanvasElement::clearCopiedImage() +{ + m_copiedImage.clear(); +} + AffineTransform HTMLCanvasElement::baseTransform() const { ASSERT(m_hasCreatedImageBuffer); diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h index 2e3570d..3270667 100644 --- a/WebCore/html/HTMLCanvasElement.h +++ b/WebCore/html/HTMLCanvasElement.h @@ -38,6 +38,7 @@ class CanvasContextAttributes; class CanvasRenderingContext; class GraphicsContext; class HTMLCanvasElement; +class Image; class ImageBuffer; class IntSize; @@ -93,6 +94,8 @@ public: CanvasRenderingContext* renderingContext() const { return m_context.get(); } ImageBuffer* buffer() const; + Image* copiedImage() const; + void clearCopiedImage(); IntRect convertLogicalToDevice(const FloatRect&) const; IntSize convertLogicalToDevice(const FloatSize&) const; @@ -165,6 +168,8 @@ private: // m_createdImageBuffer means we tried to malloc the buffer. We didn't necessarily get it. mutable bool m_hasCreatedImageBuffer; mutable OwnPtr<ImageBuffer> m_imageBuffer; + + mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platforms that have to copy the image buffer to render (and for CSSCanvasValue). }; } //namespace diff --git a/WebCore/html/HTMLConstructionSite.cpp b/WebCore/html/HTMLConstructionSite.cpp index 1a9a373..a25c7d9 100644 --- a/WebCore/html/HTMLConstructionSite.cpp +++ b/WebCore/html/HTMLConstructionSite.cpp @@ -39,7 +39,6 @@ #include "HTMLScriptElement.h" #include "HTMLToken.h" #include "HTMLTokenizer.h" -#include "LegacyHTMLDocumentParser.h" #include "LegacyHTMLTreeBuilder.h" #include "LocalizedStrings.h" #if ENABLE(MATHML) @@ -93,11 +92,17 @@ PassRefPtr<ChildType> HTMLConstructionSite::attach(Node* parent, PassRefPtr<Chil // doesn't. It feels like we're missing a concept somehow. if (shouldFosterParent()) { fosterParent(child.get()); - ASSERT(child->attached()); + ASSERT(child->attached() || !child->parent()->attached()); return child.release(); } parent->parserAddChild(child); + + // An event handler (DOM Mutation, beforeload, et al.) could have removed + // the child, in which case we shouldn't try attaching it. + if (!child->parentNode()) + return child.release(); + // It's slightly unfortunate that we need to hold a reference to child // here to call attach(). We should investigate whether we can rely on // |parent| to hold a ref at this point. In the common case (at least diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index bc9de97..4e26c02 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -68,7 +68,6 @@ #include "HTMLBodyElement.h" #include "HTMLElementFactory.h" #include "HTMLNames.h" -#include "LegacyHTMLDocumentParser.h" #include "InspectorController.h" #include "KURL.h" #include "Page.h" @@ -290,11 +289,7 @@ DocumentParser* HTMLDocument::createParser() if (Page* page = this->page()) reportErrors = page->inspectorController()->windowVisible(); #endif - - if (settings() && settings()->html5ParserEnabled()) - return new HTMLDocumentParser(this, reportErrors); - - return new LegacyHTMLDocumentParser(this, reportErrors); + return new HTMLDocumentParser(this, reportErrors); } // -------------------------------------------------------------------------- @@ -328,9 +323,9 @@ void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicStringImpl*>& map, con { if (name.isEmpty()) return; + map.remove(name.impl()); if (Frame* f = frame()) f->script()->namedItemRemoved(this, name); - map.remove(name.impl()); } void HTMLDocument::addNamedItem(const AtomicString& name) diff --git a/WebCore/html/HTMLDocument.h b/WebCore/html/HTMLDocument.h index 646e100..3b5fdfa 100644 --- a/WebCore/html/HTMLDocument.h +++ b/WebCore/html/HTMLDocument.h @@ -23,10 +23,10 @@ #ifndef HTMLDocument_h #define HTMLDocument_h -#include "AtomicStringHash.h" #include "CachedResourceClient.h" #include "Document.h" #include <wtf/HashCountedSet.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/html/HTMLDocumentParser.h b/WebCore/html/HTMLDocumentParser.h index d055861..d35cfaf 100644 --- a/WebCore/html/HTMLDocumentParser.h +++ b/WebCore/html/HTMLDocumentParser.h @@ -62,12 +62,14 @@ public: static void parseDocumentFragment(const String&, DocumentFragment*, Element* contextElement, FragmentScriptingPermission = FragmentScriptingAllowed); +protected: + virtual void insert(const SegmentedString&); + virtual void finish(); + private: // DocumentParser virtual bool hasInsertionPoint(); - virtual void insert(const SegmentedString&); virtual void append(const SegmentedString&); - virtual void finish(); virtual bool finishWasCalled(); virtual bool processingData() const; virtual void stopParsing(); diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index 6fc53a2..ff25e62 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -275,18 +275,23 @@ String HTMLElement::outerHTML() const return createMarkup(this); } -// FIXME: This method is unecessary with the new HTMLDocumentParser. -PassRefPtr<DocumentFragment> HTMLElement::createContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission) +static bool useLegacyTreeBuilder(Document* document) +{ + return !document || !document->settings() || !document->settings()->html5TreeBuilderEnabled(); +} + +// FIXME: This logic should move into Range::createContextualFragment +PassRefPtr<DocumentFragment> HTMLElement::deprecatedCreateContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission) { // The following is in accordance with the definition as used by IE. if (endTagRequirement() == TagStatusForbidden) return 0; - if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) || - hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag)) + if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) + || hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag)) return 0; - return Element::createContextualFragment(markup, scriptingPermission); + return Element::deprecatedCreateContextualFragment(markup, scriptingPermission); } static inline bool hasOneChild(ContainerNode* node) @@ -339,23 +344,46 @@ static void replaceChildrenWithText(HTMLElement* element, const String& text, Ex element->appendChild(textNode.release(), ec); } +// We may want to move a version of this function into DocumentFragment.h/cpp +static PassRefPtr<DocumentFragment> createFragmentFromSource(const String& markup, Element* contextElement, ExceptionCode& ec) +{ + Document* document = contextElement->document(); + RefPtr<DocumentFragment> fragment; + + if (useLegacyTreeBuilder(document)) { + fragment = contextElement->deprecatedCreateContextualFragment(markup); + if (!fragment) + ec = NO_MODIFICATION_ALLOWED_ERR; + return fragment; + } + + fragment = DocumentFragment::create(document); + if (document->isHTMLDocument()) { + fragment->parseHTML(markup, contextElement); + return fragment; + } + + bool wasValid = fragment->parseXML(markup, contextElement); + if (!wasValid) { + ec = INVALID_STATE_ERR; + return 0; + } + return fragment; +} + void HTMLElement::setInnerHTML(const String& html, ExceptionCode& ec) { // FIXME: This code can be removed, it's handled by the HTMLDocumentParser correctly. - if (hasLocalName(scriptTag) || hasLocalName(styleTag)) { + if (useLegacyTreeBuilder(document()) && (hasLocalName(scriptTag) || hasLocalName(styleTag))) { // Script and CSS source shouldn't be parsed as HTML. removeChildren(); appendChild(document()->createTextNode(html), ec); return; } - RefPtr<DocumentFragment> fragment = createContextualFragment(html); - if (!fragment) { - ec = NO_MODIFICATION_ALLOWED_ERR; - return; - } - - replaceChildrenWithFragment(this, fragment.release(), ec); + RefPtr<DocumentFragment> fragment = createFragmentFromSource(html, this, ec); + if (fragment) + replaceChildrenWithFragment(this, fragment.release(), ec); } void HTMLElement::setOuterHTML(const String& html, ExceptionCode& ec) @@ -365,17 +393,13 @@ void HTMLElement::setOuterHTML(const String& html, ExceptionCode& ec) ec = NO_MODIFICATION_ALLOWED_ERR; return; } - HTMLElement* parent = static_cast<HTMLElement*>(p); - RefPtr<DocumentFragment> fragment = parent->createContextualFragment(html); - if (!fragment) { - ec = NO_MODIFICATION_ALLOWED_ERR; - return; - } - // FIXME: Why doesn't this have code to merge neighboring text nodes the way setOuterText does? - - parent->replaceChild(fragment.release(), this, ec); + RefPtr<DocumentFragment> fragment = createFragmentFromSource(html, parent, ec); + if (fragment) { + // FIXME: Why doesn't this have code to merge neighboring text nodes the way setOuterText does? + parent->replaceChild(fragment.release(), this, ec); + } } void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) @@ -549,13 +573,35 @@ Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi return static_cast<Element*>(returnValue); } +// Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#insertadjacenthtml() +static Element* contextElementForInsertion(const String& where, Element* element, ExceptionCode& ec) +{ + if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) { + Node* parent = element->parentNode(); + if (parent && parent->isDocumentNode()) { + ec = NO_MODIFICATION_ALLOWED_ERR; + return 0; + } + ASSERT(!parent || parent->isElementNode()); + return static_cast<Element*>(parent); + } + if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd")) + return element; + ec = SYNTAX_ERR; + return 0; +} + void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec) { RefPtr<DocumentFragment> fragment = document()->createDocumentFragment(); + Element* contextElement = contextElementForInsertion(where, this, ec); + if (!contextElement) + return; + if (document()->isHTMLDocument()) - fragment->parseHTML(markup, this); + fragment->parseHTML(markup, contextElement); else { - if (!fragment->parseXML(markup, this)) + if (!fragment->parseXML(markup, contextElement)) // FIXME: We should propagate a syntax error exception out here. return; } diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h index 03449c9..8f54d3e 100644 --- a/WebCore/html/HTMLElement.h +++ b/WebCore/html/HTMLElement.h @@ -46,7 +46,8 @@ public: String innerHTML() const; String outerHTML() const; - PassRefPtr<DocumentFragment> createContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed); + // deprecatedCreateContextualFragment logic should be moved into Range::createContextualFragment + PassRefPtr<DocumentFragment> deprecatedCreateContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed); void setInnerHTML(const String&, ExceptionCode&); void setOuterHTML(const String&, ExceptionCode&); void setInnerText(const String&, ExceptionCode&); diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp index 3f700ef..afa56d4 100644 --- a/WebCore/html/HTMLEmbedElement.cpp +++ b/WebCore/html/HTMLEmbedElement.cpp @@ -89,8 +89,8 @@ void HTMLEmbedElement::parseMappedAttribute(Attribute* attr) if (attr->name() == typeAttr) { m_serviceType = value.string().lower(); - int pos = m_serviceType.find(";"); - if (pos != -1) + size_t pos = m_serviceType.find(";"); + if (pos != notFound) m_serviceType = m_serviceType.left(pos); if (!isImageType() && m_imageLoader) m_imageLoader.clear(); diff --git a/WebCore/html/HTMLEntityNames.gperf b/WebCore/html/HTMLEntityNames.gperf deleted file mode 100644 index c665efe..0000000 --- a/WebCore/html/HTMLEntityNames.gperf +++ /dev/null @@ -1,303 +0,0 @@ -%{ -/* - Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) - Copyright (C) 2002, 2003, 2004, 2005 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. - - ---------------------------------------------------------------------------- - - HTMLEntityNames.gperf: input file to generate a hash table for entities - HTMLEntityNames.cpp: DO NOT EDIT! generated by WebCore/make-hash-tools.pl -*/ -%} -%struct-type -struct Entity { - const char *name; - int code; -}; -%language=ANSI-C -%readonly-tables -%global-table -%compare-strncmp -%define lookup-function-name findEntity -%define hash-function-name entity_hash_function -%includes -%enum -%% -AElig, 0x00c6 -AMP, 38 -Aacute, 0x00c1 -Acirc, 0x00c2 -Agrave, 0x00c0 -Alpha, 0x0391 -Aring, 0x00c5 -Atilde, 0x00c3 -Auml, 0x00c4 -Beta, 0x0392 -COPY, 0x00a9 -Ccedil, 0x00c7 -Chi, 0x03a7 -Dagger, 0x2021 -Delta, 0x0394 -ETH, 0x00d0 -Eacute, 0x00c9 -Ecirc, 0x00ca -Egrave, 0x00c8 -Epsilon, 0x0395 -Eta, 0x0397 -Euml, 0x00cb -GT, 62 -Gamma, 0x0393 -Iacute, 0x00cd -Icirc, 0x00ce -Igrave, 0x00cc -Iota, 0x0399 -Iuml, 0x00cf -Kappa, 0x039a -LT, 60 -Lambda, 0x039b -Mu, 0x039c -Ntilde, 0x00d1 -Nu, 0x039d -OElig, 0x0152 -Oacute, 0x00d3 -Ocirc, 0x00d4 -Ograve, 0x00d2 -Omega, 0x03a9 -Omicron, 0x039f -Oslash, 0x00d8 -Otilde, 0x00d5 -Ouml, 0x00d6 -Phi, 0x03a6 -Pi, 0x03a0 -Prime, 0x2033 -Psi, 0x03a8 -QUOT, 34 -REG, 0x00ae -Rho, 0x03a1 -Scaron, 0x0160 -Sigma, 0x03a3 -THORN, 0x00de -Tau, 0x03a4 -Theta, 0x0398 -Uacute, 0x00da -Ucirc, 0x00db -Ugrave, 0x00d9 -Upsilon, 0x03a5 -Uuml, 0x00dc -Xi, 0x039e -Yacute, 0x00dd -Yuml, 0x0178 -Zeta, 0x0396 -aacute, 0x00e1 -acirc, 0x00e2 -acute, 0x00b4 -aelig, 0x00e6 -agrave, 0x00e0 -alefsym, 0x2135 -alpha, 0x03b1 -amp, 38 -and, 0x2227 -ang, 0x2220 -apos, 0x0027 -aring, 0x00e5 -asymp, 0x2248 -atilde, 0x00e3 -auml, 0x00e4 -bdquo, 0x201e -beta, 0x03b2 -brvbar, 0x00a6 -bull, 0x2022 -cap, 0x2229 -ccedil, 0x00e7 -cedil, 0x00b8 -cent, 0x00a2 -chi, 0x03c7 -circ, 0x02c6 -clubs, 0x2663 -cong, 0x2245 -copy, 0x00a9 -crarr, 0x21b5 -cup, 0x222a -curren, 0x00a4 -dArr, 0x21d3 -dagger, 0x2020 -darr, 0x2193 -deg, 0x00b0 -delta, 0x03b4 -diams, 0x2666 -divide, 0x00f7 -eacute, 0x00e9 -ecirc, 0x00ea -egrave, 0x00e8 -empty, 0x2205 -emsp, 0x2003 -ensp, 0x2002 -epsilon, 0x03b5 -equiv, 0x2261 -eta, 0x03b7 -eth, 0x00f0 -euml, 0x00eb -euro, 0x20ac -exist, 0x2203 -fnof, 0x0192 -forall, 0x2200 -frac12, 0x00bd -frac14, 0x00bc -frac34, 0x00be -frasl, 0x2044 -gamma, 0x03b3 -ge, 0x2265 -gt, 62 -hArr, 0x21d4 -harr, 0x2194 -hearts, 0x2665 -hellip, 0x2026 -iacute, 0x00ed -icirc, 0x00ee -iexcl, 0x00a1 -igrave, 0x00ec -image, 0x2111 -infin, 0x221e -int, 0x222b -iota, 0x03b9 -iquest, 0x00bf -isin, 0x2208 -iuml, 0x00ef -kappa, 0x03ba -lArr, 0x21d0 -lambda, 0x03bb -lang, 0x3008 -laquo, 0x00ab -larr, 0x2190 -lceil, 0x2308 -ldquo, 0x201c -le, 0x2264 -lfloor, 0x230a -lowast, 0x2217 -loz, 0x25ca -lrm, 0x200e -lsaquo, 0x2039 -lsquo, 0x2018 -lt, 60 -macr, 0x00af -mdash, 0x2014 -micro, 0x00b5 -middot, 0x00b7 -minus, 0x2212 -mu, 0x03bc -nabla, 0x2207 -nbsp, 0x00a0 -ndash, 0x2013 -ne, 0x2260 -ni, 0x220b -not, 0x00ac -notin, 0x2209 -nsub, 0x2284 -nsup, 0x2285 -ntilde, 0x00f1 -nu, 0x03bd -oacute, 0x00f3 -ocirc, 0x00f4 -oelig, 0x0153 -ograve, 0x00f2 -oline, 0x203e -omega, 0x03c9 -omicron, 0x03bf -oplus, 0x2295 -or, 0x2228 -ordf, 0x00aa -ordm, 0x00ba -oslash, 0x00f8 -otilde, 0x00f5 -otimes, 0x2297 -ouml, 0x00f6 -para, 0x00b6 -part, 0x2202 -percnt, 0x0025 -permil, 0x2030 -perp, 0x22a5 -phi, 0x03c6 -pi, 0x03c0 -piv, 0x03d6 -plusmn, 0x00b1 -pound, 0x00a3 -prime, 0x2032 -prod, 0x220f -prop, 0x221d -psi, 0x03c8 -quot, 34 -rArr, 0x21d2 -radic, 0x221a -rang, 0x3009 -raquo, 0x00bb -rarr, 0x2192 -rceil, 0x2309 -rdquo, 0x201d -real, 0x211c -reg, 0x00ae -rfloor, 0x230b -rho, 0x03c1 -rlm, 0x200f -rsaquo, 0x203a -rsquo, 0x2019 -sbquo, 0x201a -scaron, 0x0161 -sdot, 0x22c5 -sect, 0x00a7 -shy, 0x00ad -sigma, 0x03c3 -sigmaf, 0x03c2 -sim, 0x223c -spades, 0x2660 -sub, 0x2282 -sube, 0x2286 -sum, 0x2211 -sup, 0x2283 -sup1, 0x00b9 -sup2, 0x00b2 -sup3, 0x00b3 -supe, 0x2287 -supl, 0x00b9 -szlig, 0x00df -tau, 0x03c4 -there4, 0x2234 -theta, 0x03b8 -thetasym, 0x03d1 -thinsp, 0x2009 -thorn, 0x00fe -tilde, 0x02dc -times, 0x00d7 -trade, 0x2122 -uArr, 0x21d1 -uacute, 0x00fa -uarr, 0x2191 -ucirc, 0x00fb -ugrave, 0x00f9 -uml, 0x00a8 -upsih, 0x03d2 -upsilon, 0x03c5 -uuml, 0x00fc -weierp, 0x2118 -xi, 0x03be -yacute, 0x00fd -yen, 0x00a5 -yuml, 0x00ff -zeta, 0x03b6 -zwj, 0x200d -zwnj, 0x200c -%% diff --git a/WebCore/html/HTMLEntityParser.cpp b/WebCore/html/HTMLEntityParser.cpp index 84b2006..f675844 100644 --- a/WebCore/html/HTMLEntityParser.cpp +++ b/WebCore/html/HTMLEntityParser.cpp @@ -28,21 +28,10 @@ #include "config.h" #include "HTMLEntityParser.h" +#include "HTMLEntitySearch.h" +#include "HTMLEntityTable.h" #include <wtf/Vector.h> -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file -#ifdef __GNUC__ -// The main parser includes this too so we are getting two copies of the data. However, this way the code gets inlined. -#include "HTMLEntityNames.cpp" -#else -// Not inlined for non-GCC compilers -struct Entity { - const char* name; - int code; -}; -const struct Entity* findEntity(register const char* str, register unsigned int len); -#endif - using namespace WTF; namespace WebCore { @@ -113,7 +102,6 @@ unsigned consumeHTMLEntity(SegmentedString& source, bool& notEnoughCharacters, U EntityState entityState = Initial; unsigned result = 0; Vector<UChar, 10> consumedCharacters; - Vector<char, 10> entityName; while (!source.isEmpty()) { UChar cc = *source; @@ -177,7 +165,7 @@ unsigned consumeHTMLEntity(SegmentedString& source, bool& notEnoughCharacters, U else if (cc == ';') { source.advancePastNonNewline(); return legalEntityFor(result); - } else + } else return legalEntityFor(result); break; } @@ -192,48 +180,48 @@ unsigned consumeHTMLEntity(SegmentedString& source, bool& notEnoughCharacters, U break; } case Named: { - // FIXME: This code is wrong. We need to find the longest matching entity. - // The examples from the spec are: - // I'm ¬it; I tell you - // I'm ∉ I tell you - // In the first case, "¬" is the entity. In the second - // case, "∉" is the entity. - // FIXME: Our list of HTML entities is incomplete. - // FIXME: The number 8 below is bogus. - while (!source.isEmpty() && entityName.size() <= 8) { + HTMLEntitySearch entitySearch; + while (!source.isEmpty()) { cc = *source; - if (cc == ';') { - const Entity* entity = findEntity(entityName.data(), entityName.size()); - if (entity) { - source.advanceAndASSERT(';'); - return entity->code; - } - break; - } - if (!isAlphaNumeric(cc)) { - const Entity* entity = findEntity(entityName.data(), entityName.size()); - if (entity) { - // HTML5 tells us to ignore this entity, for historical reasons, - // if the lookhead character is '='. - if (additionalAllowedCharacter && cc == '=') - break; - // Some entities require a terminating semicolon, whereas other - // entities do not. The HTML5 spec has a giant list: - // - // http://www.whatwg.org/specs/web-apps/current-work/multipage/named-character-references.html#named-character-references - // - // However, the list seems to boil down to this branch: - if (entity->code > 255) - break; - return entity->code; - } + entitySearch.advance(cc); + if (!entitySearch.isEntityPrefix()) break; - } - entityName.append(cc); consumedCharacters.append(cc); source.advanceAndASSERT(cc); } notEnoughCharacters = source.isEmpty(); + if (notEnoughCharacters) { + // We can't an entity because there might be a longer entity + // that we could match if we had more data. + unconsumeCharacters(source, consumedCharacters); + return 0; + } + if (!entitySearch.mostRecentMatch()) { + ASSERT(!entitySearch.currentValue()); + unconsumeCharacters(source, consumedCharacters); + return 0; + } + if (entitySearch.mostRecentMatch()->length != entitySearch.currentLength()) { + // We've consumed too many characters. We need to walk the + // source back to the point at which we had consumed an + // actual entity. + unconsumeCharacters(source, consumedCharacters); + consumedCharacters.clear(); + const int length = entitySearch.mostRecentMatch()->length; + const UChar* reference = entitySearch.mostRecentMatch()->entity; + for (int i = 0; i < length; ++i) { + cc = *source; + ASSERT_UNUSED(reference, cc == *reference++); + consumedCharacters.append(cc); + source.advanceAndASSERT(cc); + ASSERT(!source.isEmpty()); + } + cc = *source; + } + if (entitySearch.mostRecentMatch()->lastCharacter() == ';') + return entitySearch.mostRecentMatch()->value; + if (!additionalAllowedCharacter || !(isAlphaNumeric(cc) || cc == '=')) + return entitySearch.mostRecentMatch()->value; unconsumeCharacters(source, consumedCharacters); return 0; } @@ -247,4 +235,23 @@ unsigned consumeHTMLEntity(SegmentedString& source, bool& notEnoughCharacters, U return 0; } +UChar decodeNamedEntity(const char* name) +{ + HTMLEntitySearch search; + while (*name) { + search.advance(*name++); + if (!search.isEntityPrefix()) + return 0; + } + search.advance(';'); + UChar32 entityValue = search.currentValue(); + if (U16_LENGTH(entityValue) != 1) { + // Callers need to move off this API if the entity table has values + // which do no fit in a 16 bit UChar! + ASSERT_NOT_REACHED(); + return 0; + } + return static_cast<UChar>(entityValue); +} + } // namespace WebCore diff --git a/WebCore/html/HTMLEntityParser.h b/WebCore/html/HTMLEntityParser.h index d37b0c3..1059b24 100644 --- a/WebCore/html/HTMLEntityParser.h +++ b/WebCore/html/HTMLEntityParser.h @@ -33,6 +33,9 @@ namespace WebCore { unsigned consumeHTMLEntity(SegmentedString&, bool& notEnoughCharacters, UChar additionalAllowedCharacter = '\0'); +// Used by the XML parser. Not suitable for use in HTML parsing. Use consumeHTMLEntity instead. +UChar decodeNamedEntity(const char*); + } #endif diff --git a/WebCore/html/HTMLEntitySearch.cpp b/WebCore/html/HTMLEntitySearch.cpp new file mode 100644 index 0000000..580609e --- /dev/null +++ b/WebCore/html/HTMLEntitySearch.cpp @@ -0,0 +1,132 @@ +/* + * 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 "HTMLEntitySearch.h" + +#include "HTMLEntityTable.h" + +namespace WebCore { + +namespace { + +const HTMLEntityTableEntry* halfway(const HTMLEntityTableEntry* left, const HTMLEntityTableEntry* right) +{ + return &left[(right - left) / 2]; +} + +} + +HTMLEntitySearch::HTMLEntitySearch() + : m_currentLength(0) + , m_currentValue(0) + , m_mostRecentMatch(0) + , m_first(HTMLEntityTable::firstEntry()) + , m_last(HTMLEntityTable::lastEntry()) +{ +} + +HTMLEntitySearch::CompareResult HTMLEntitySearch::compare(const HTMLEntityTableEntry* entry, UChar nextCharacter) const +{ + if (entry->length < m_currentLength + 1) + return Before; + UChar entryNextCharacter = entry->entity[m_currentLength]; + if (entryNextCharacter == nextCharacter) + return Prefix; + return entryNextCharacter < nextCharacter ? Before : After; +} + +const HTMLEntityTableEntry* HTMLEntitySearch::findFirst(UChar nextCharacter) const +{ + const HTMLEntityTableEntry* left = m_first; + const HTMLEntityTableEntry* right = m_last; + if (left == right) + return left; + CompareResult result = compare(left, nextCharacter); + if (result == Prefix) + return left; + if (result == After) + return right; + while (left + 1 < right) { + const HTMLEntityTableEntry* probe = halfway(left, right); + result = compare(probe, nextCharacter); + if (result == Before) + left = probe; + else { + ASSERT(result == After || result == Prefix); + right = probe; + } + } + ASSERT(left + 1 == right); + return right; +} + +const HTMLEntityTableEntry* HTMLEntitySearch::findLast(UChar nextCharacter) const +{ + const HTMLEntityTableEntry* left = m_first; + const HTMLEntityTableEntry* right = m_last; + if (left == right) + return right; + CompareResult result = compare(right, nextCharacter); + if (result == Prefix) + return right; + if (result == Before) + return left; + while (left + 1 < right) { + const HTMLEntityTableEntry* probe = halfway(left, right); + result = compare(probe, nextCharacter); + if (result == After) + right = probe; + else { + ASSERT(result == Before || result == Prefix); + left = probe; + } + } + ASSERT(left + 1 == right); + return left; +} + +void HTMLEntitySearch::advance(UChar nextCharacter) +{ + ASSERT(isEntityPrefix()); + if (!m_currentLength) { + m_first = HTMLEntityTable::firstEntryStartingWith(nextCharacter); + m_last = HTMLEntityTable::lastEntryStartingWith(nextCharacter); + } else { + m_first = findFirst(nextCharacter); + m_last = findLast(nextCharacter); + if (m_first == m_last && compare(m_first, nextCharacter) != Prefix) + return fail(); + } + ++m_currentLength; + if (m_first->length != m_currentLength) { + m_currentValue = 0; + return; + } + m_mostRecentMatch = m_first; + m_currentValue = m_mostRecentMatch->value; +} + +} diff --git a/WebCore/html/HTMLEntitySearch.h b/WebCore/html/HTMLEntitySearch.h new file mode 100644 index 0000000..11a23ae --- /dev/null +++ b/WebCore/html/HTMLEntitySearch.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 HTMLEntitySearch_h +#define HTMLEntitySearch_h + +#include "PlatformString.h" + +namespace WebCore { + +struct HTMLEntityTableEntry; + +class HTMLEntitySearch { +public: + HTMLEntitySearch(); + + void advance(UChar); + + bool isEntityPrefix() const { return !!m_first; } + int currentValue() const { return m_currentValue; } + int currentLength() const { return m_currentLength; } + + const HTMLEntityTableEntry* mostRecentMatch() const { return m_mostRecentMatch; } + +private: + enum CompareResult { + Before, + Prefix, + After, + }; + + CompareResult compare(const HTMLEntityTableEntry*, UChar) const; + const HTMLEntityTableEntry* findFirst(UChar) const; + const HTMLEntityTableEntry* findLast(UChar) const; + + void fail() + { + m_currentValue = 0; + m_first = 0; + m_last = 0; + } + + int m_currentLength; + int m_currentValue; + + const HTMLEntityTableEntry* m_mostRecentMatch; + const HTMLEntityTableEntry* m_first; + const HTMLEntityTableEntry* m_last; +}; + +} + +#endif diff --git a/WebCore/html/canvas/CanvasNumberArray.cpp b/WebCore/html/HTMLEntityTable.h index 6cbdfff..3734c34 100644 --- a/WebCore/html/canvas/CanvasNumberArray.cpp +++ b/WebCore/html/HTMLEntityTable.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 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 @@ -10,10 +10,10 @@ * 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 + * 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 COMPUTER, INC. OR + * 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 @@ -23,25 +23,30 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef HTMLEntityTable_h +#define HTMLEntityTable_h -#if ENABLE(3D_CANVAS) - -#include "CanvasNumberArray.h" #include "PlatformString.h" namespace WebCore { - -PassRefPtr<CanvasNumberArray> CanvasNumberArray::create(unsigned length) -{ - return adoptRef(new CanvasNumberArray(length)); -} -CanvasNumberArray::CanvasNumberArray(unsigned length) - : m_data(length) -{ -} +struct HTMLEntityTableEntry { + UChar lastCharacter() const { return entity[length - 1]; } + + const UChar* entity; + int length; + int value; +}; + +class HTMLEntityTable { +public: + static const HTMLEntityTableEntry* firstEntry(); + static const HTMLEntityTableEntry* lastEntry(); + + static const HTMLEntityTableEntry* firstEntryStartingWith(UChar); + static const HTMLEntityTableEntry* lastEntryStartingWith(UChar); +}; } -#endif // ENABLE(3D_CANVAS) +#endif diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index 5103bfa..ae1ac62 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -30,6 +30,7 @@ #include "Chrome.h" #include "ChromeClient.h" #include "Document.h" +#include "DocumentParser.h" #include "ElementRareData.h" #include "Event.h" #include "EventHandler.h" @@ -39,7 +40,6 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "LegacyHTMLTreeBuilder.h" -#include "LegacyHTMLDocumentParser.h" #include "LabelsNodeList.h" #include "Page.h" #include "RenderBox.h" @@ -526,7 +526,7 @@ static bool isNotLineBreak(UChar ch) { return ch != newlineCharacter && ch != ca bool HTMLTextFormControlElement::isPlaceholderEmpty() const { const AtomicString& attributeValue = getAttribute(placeholderAttr); - return attributeValue.string().find(isNotLineBreak) == -1; + return attributeValue.string().find(isNotLineBreak) == notFound; } bool HTMLTextFormControlElement::placeholderShouldBeVisible() const diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index 8c759cb..50b6ed0 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -65,7 +65,6 @@ #include "RenderTheme.h" #include "ScriptEventListener.h" #include "StepRange.h" -#include "StringHash.h" #include "TextEvent.h" #ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS #include "WebViewCore.h" @@ -74,6 +73,7 @@ #include <wtf/HashMap.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> using namespace std; diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h index 72ac589..18cbaa4 100644 --- a/WebCore/html/HTMLInputElement.h +++ b/WebCore/html/HTMLInputElement.h @@ -101,6 +101,7 @@ public: virtual bool isSearchField() const { return m_type == SEARCH; } virtual bool isInputTypeHidden() const { return m_type == HIDDEN; } virtual bool isPasswordField() const { return m_type == PASSWORD; } + virtual bool isCheckbox() const { return m_type == CHECKBOX; } bool isTelephoneField() const { return m_type == TELEPHONE; } bool isNumberField() const { return m_type == NUMBER; } bool isEmailField() const { return m_type == EMAIL; } diff --git a/WebCore/html/HTMLLinkElement.cpp b/WebCore/html/HTMLLinkElement.cpp index a638572..c778b6f 100644 --- a/WebCore/html/HTMLLinkElement.cpp +++ b/WebCore/html/HTMLLinkElement.cpp @@ -51,7 +51,6 @@ inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* , m_disabledState(Unset) , m_loading(false) , m_createdByParser(createdByParser) - , m_shouldProcessAfterAttach(false) { ASSERT(hasTagName(linkTag)); } @@ -260,28 +259,12 @@ 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); - // 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 if there are beforeload listeners. - if (document()->hasListenerType(Document::BEFORELOAD_LISTENER)) { - m_shouldProcessAfterAttach = true; - return; - } - process(); } @@ -294,20 +277,8 @@ 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 057cccc..6d7643a 100644 --- a/WebCore/html/HTMLLinkElement.h +++ b/WebCore/html/HTMLLinkElement.h @@ -77,9 +77,6 @@ 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; } @@ -137,7 +134,6 @@ private: RelAttribute m_relAttribute; bool m_loading; bool m_createdByParser; - bool m_shouldProcessAfterAttach; }; } //namespace diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index 94c0dd2..13b7807 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -112,7 +112,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* doc) , m_processingMediaPlayerCallback(0) , m_playing(false) , m_isWaitingUntilMediaCanStart(false) - , m_processingLoad(false) , m_delayingTheLoadEvent(false) , m_haveFiredLoadedData(false) , m_inActiveDocument(true) @@ -512,7 +511,10 @@ void HTMLMediaElement::prepareForLoad() #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) m_player = MediaPlayer::create(this); #else - createMediaPlayerProxy(); + if (m_player) + m_player->cancelLoad(); + else + createMediaPlayerProxy(); #endif // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps @@ -532,6 +534,16 @@ void HTMLMediaElement::prepareForLoad() m_error = 0; m_autoplaying = true; + // 7 - Invoke the media element's resource selection algorithm. + + // 8 - Note: Playback of any previously playing media resource for this element stops. + + // The resource selection algorithm + // 1 - Set the networkState to NETWORK_NO_SOURCE + m_networkState = NETWORK_NO_SOURCE; + + // 2 - Asynchronously await a stable state. + m_playedTimeRanges = TimeRanges::create(); m_lastSeekTime = 0; m_closedCaptionsVisible = false; @@ -549,11 +561,7 @@ void HTMLMediaElement::loadInternal() return; } - // Steps 1 - 6 were done in prepareForLoad - - // 7 - Invoke the media element's resource selection algorithm. selectMediaResource(); - m_processingLoad = false; } void HTMLMediaElement::selectMediaResource() @@ -561,11 +569,6 @@ void HTMLMediaElement::selectMediaResource() enum Mode { attribute, children }; Mode mode = attribute; - // 1 - Set the networkState to NETWORK_NO_SOURCE - m_networkState = NETWORK_NO_SOURCE; - - // 2 - Asynchronously await a stable state. - // 3 - ... the media element has neither a src attribute ... if (!hasAttribute(srcAttr)) { // ... nor a source element child: ... diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h index aeec188..a73abba 100644 --- a/WebCore/html/HTMLMediaElement.h +++ b/WebCore/html/HTMLMediaElement.h @@ -340,7 +340,6 @@ private: bool m_playing : 1; bool m_isWaitingUntilMediaCanStart : 1; - bool m_processingLoad : 1; bool m_delayingTheLoadEvent : 1; bool m_haveFiredLoadedData : 1; bool m_inActiveDocument : 1; diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp index d4bccc3..5989ec7 100644 --- a/WebCore/html/HTMLObjectElement.cpp +++ b/WebCore/html/HTMLObjectElement.cpp @@ -70,11 +70,11 @@ RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const void HTMLObjectElement::parseMappedAttribute(Attribute* attr) { String val = attr->value(); - int pos; + size_t pos; if (attr->name() == typeAttr) { m_serviceType = val.lower(); pos = m_serviceType.find(";"); - if (pos != -1) + if (pos != notFound) m_serviceType = m_serviceType.left(pos); if (renderer()) m_needWidgetUpdate = true; diff --git a/WebCore/html/HTMLScriptRunner.cpp b/WebCore/html/HTMLScriptRunner.cpp index 4a9058f..0d603ed 100644 --- a/WebCore/html/HTMLScriptRunner.cpp +++ b/WebCore/html/HTMLScriptRunner.cpp @@ -43,23 +43,22 @@ namespace WebCore { using namespace HTMLNames; -class NestScript : public Noncopyable { +// FIXME: Factor out to avoid duplication with HTMLDocumentParser. +class NestingLevelIncrementer : public Noncopyable { public: - NestScript(unsigned& nestingLevel, HTMLInputStream& inputStream) + explicit NestingLevelIncrementer(unsigned& nestingLevel) : m_nestingLevel(&nestingLevel) - , m_savedInsertionPoint(inputStream) { ++(*m_nestingLevel); } - ~NestScript() + ~NestingLevelIncrementer() { --(*m_nestingLevel); } private: unsigned* m_nestingLevel; - InsertionPointRecord m_savedInsertionPoint; }; HTMLScriptRunner::HTMLScriptRunner(Document* document, HTMLScriptRunnerHost* host) @@ -97,7 +96,7 @@ inline PassRefPtr<Event> createScriptErrorEvent() return Event::create(eventNames().errorEvent, true, false); } -ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) +ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) const { if (script.cachedScript()) { errorOccurred = script.cachedScript()->errorOccurred(); @@ -118,22 +117,29 @@ bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script) return true; } -void HTMLScriptRunner::executePendingScript() +void HTMLScriptRunner::executeParsingBlockingScript() { ASSERT(!m_scriptNestingLevel); ASSERT(m_document->haveStylesheetsLoaded()); - bool errorOccurred = false; ASSERT(isPendingScriptReady(m_parsingBlockingScript)); - 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()) stopWatchingForLoad(m_parsingBlockingScript); + InsertionPointRecord insertionPointRecord(m_host->inputStream()); + executePendingScriptAndDispatchEvent(m_parsingBlockingScript); +} + +void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript) +{ + bool errorOccurred = false; + ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOccurred); + // Clear the pending script before possible rentrancy from executeScript() - RefPtr<Element> scriptElement = m_parsingBlockingScript.releaseElementAndClear(); + RefPtr<Element> scriptElement = pendingScript.releaseElementAndClear(); { - NestScript nestingLevel(m_scriptNestingLevel, m_host->inputStream()); + NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); if (errorOccurred) scriptElement->dispatchEvent(createScriptErrorEvent()); else { @@ -144,12 +150,8 @@ void HTMLScriptRunner::executePendingScript() ASSERT(!m_scriptNestingLevel); } -void HTMLScriptRunner::executeScript(Element* element, const ScriptSourceCode& sourceCode) +void HTMLScriptRunner::executeScript(Element* element, const ScriptSourceCode& sourceCode) const { - // FIXME: We do not block inline <script> tags on stylesheets for now. - // When we do, || !element->hasAttribute(srcAttr) should be removed from - // the ASSERT below. See https://bugs.webkit.org/show_bug.cgi?id=40047 - ASSERT(m_document->haveStylesheetsLoaded() || !element->hasAttribute(srcAttr)); ScriptElement* scriptElement = toScriptElement(element); ASSERT(scriptElement); if (!scriptElement->shouldExecuteAsJavaScript()) @@ -204,7 +206,7 @@ bool HTMLScriptRunner::executeParsingBlockingScripts() // We only really need to check once. if (!isPendingScriptReady(m_parsingBlockingScript)) return false; - executePendingScript(); + executeParsingBlockingScript(); } return true; } @@ -228,31 +230,39 @@ bool HTMLScriptRunner::executeScriptsWaitingForStylesheets() return executeParsingBlockingScripts(); } -void HTMLScriptRunner::requestScript(Element* script) +void HTMLScriptRunner::requestParsingBlockingScript(Element* element) { - ASSERT(!m_parsingBlockingScript.element()); - AtomicString srcValue = script->getAttribute(srcAttr); + if (!requestPendingScript(m_parsingBlockingScript, element)) + return; + + ASSERT(m_parsingBlockingScript.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); +} + +bool HTMLScriptRunner::requestPendingScript(PendingScript& pendingScript, Element* script) const +{ + ASSERT(!pendingScript.element()); + const AtomicString& srcValue = script->getAttribute(srcAttr); // Allow the host to disllow script loads (using the XSSAuditor, etc.) if (!m_host->shouldLoadExternalScriptFromSrc(srcValue)) - return; + return false; // FIXME: We need to resolve the url relative to the element. if (!script->dispatchBeforeLoadEvent(srcValue)) - return; - m_parsingBlockingScript.adoptElement(script); + return false; + pendingScript.adoptElement(script); // This should correctly return 0 for empty or invalid srcValues. CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(script)->scriptCharset()); if (!cachedScript) { notImplemented(); // Dispatch error event. - return; + return false; } - - m_parsingBlockingScript.setCachedScript(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); + pendingScript.setCachedScript(cachedScript); + return true; } // This method is meant to match the HTML5 definition of "running a script" @@ -261,17 +271,21 @@ void HTMLScriptRunner::runScript(Element* script, int startingLineNumber) { ASSERT(!haveParsingBlockingScript()); { - NestScript nestingLevel(m_scriptNestingLevel, m_host->inputStream()); + InsertionPointRecord insertionPointRecord(m_host->inputStream()); + NestingLevelIncrementer nestingLevelIncrementer(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); + requestParsingBlockingScript(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 + // old parser for now. When we do, the ASSERT below should be added. + // See https://bugs.webkit.org/show_bug.cgi?id=40047 + // ASSERT(document()->haveStylesheetsLoaded()); + ASSERT(isExecutingScript()); ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), startingLineNumber); executeScript(script, sourceCode); } diff --git a/WebCore/html/HTMLScriptRunner.h b/WebCore/html/HTMLScriptRunner.h index 85801b2..981d433 100644 --- a/WebCore/html/HTMLScriptRunner.h +++ b/WebCore/html/HTMLScriptRunner.h @@ -52,25 +52,27 @@ public: bool hasScriptsWaitingForStylesheets() const { return m_hasScriptsWaitingForStylesheets; } bool executeScriptsWaitingForStylesheets(); - bool isExecutingScript() { return !!m_scriptNestingLevel; } + bool isExecutingScript() const { return !!m_scriptNestingLevel; } private: Frame* frame() const; + void executeParsingBlockingScript(); + void executePendingScriptAndDispatchEvent(PendingScript&); + void executeScript(Element*, const ScriptSourceCode&) const; bool haveParsingBlockingScript() const; bool executeParsingBlockingScripts(); - void executePendingScript(); - void requestScript(Element*); + void requestParsingBlockingScript(Element*); + bool requestPendingScript(PendingScript&, Element*) const; + void runScript(Element*, int startingLineNumber); // Helpers for dealing with HTMLScriptRunnerHost void watchForLoad(PendingScript&); void stopWatchingForLoad(PendingScript&); - void executeScript(Element*, const ScriptSourceCode&); - bool isPendingScriptReady(const PendingScript&); - ScriptSourceCode sourceFromPendingScript(const PendingScript&, bool& errorOccurred); + ScriptSourceCode sourceFromPendingScript(const PendingScript&, bool& errorOccurred) const; Document* m_document; HTMLScriptRunnerHost* m_host; diff --git a/WebCore/html/HTMLSourceElement.cpp b/WebCore/html/HTMLSourceElement.cpp index 6c26610..96c9829 100644 --- a/WebCore/html/HTMLSourceElement.cpp +++ b/WebCore/html/HTMLSourceElement.cpp @@ -52,9 +52,9 @@ PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tag return adoptRef(new HTMLSourceElement(tagName, document)); } -void HTMLSourceElement::insertedIntoDocument() +void HTMLSourceElement::insertedIntoTree(bool deep) { - HTMLElement::insertedIntoDocument(); + HTMLElement::insertedIntoTree(deep); if (parentNode() && (parentNode()->hasTagName(audioTag) || parentNode()->hasTagName(videoTag))) { HTMLMediaElement* media = static_cast<HTMLMediaElement*>(parentNode()); if (media->networkState() == HTMLMediaElement::NETWORK_EMPTY) diff --git a/WebCore/html/HTMLSourceElement.h b/WebCore/html/HTMLSourceElement.h index 20049cc..7d49a3e 100644 --- a/WebCore/html/HTMLSourceElement.h +++ b/WebCore/html/HTMLSourceElement.h @@ -52,7 +52,7 @@ private: virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; } virtual int tagPriority() const { return 0; } - virtual void insertedIntoDocument(); + virtual void insertedIntoTree(bool); virtual bool isURLAttribute(Attribute*) const; void errorEventTimerFired(Timer<HTMLSourceElement>*); diff --git a/WebCore/html/HTMLToken.h b/WebCore/html/HTMLToken.h index 5f2869b..e42a829 100644 --- a/WebCore/html/HTMLToken.h +++ b/WebCore/html/HTMLToken.h @@ -45,8 +45,16 @@ public: EndOfFile, }; + class Range { + public: + int m_start; + int m_end; + }; + class Attribute { public: + Range m_nameRange; + Range m_valueRange; WTF::Vector<UChar, 32> m_name; WTF::Vector<UChar, 32> m_value; }; @@ -56,12 +64,22 @@ public: HTMLToken() { clear(); } - void clear() + void clear(int startIndex = 0) { m_type = Uninitialized; + m_range.m_start = startIndex; + m_range.m_end = startIndex; m_data.clear(); } + int startIndex() const { return m_range.m_start; } + int endIndex() const { return m_range.m_end; } + + void end(int endIndex) + { + m_range.m_end = endIndex; + } + void makeEndOfFile() { ASSERT(m_type == Uninitialized); @@ -146,12 +164,44 @@ public: ASSERT(m_type == StartTag || m_type == EndTag); m_attributes.grow(m_attributes.size() + 1); m_currentAttribute = &m_attributes.last(); +#ifndef NDEBUG + m_currentAttribute->m_nameRange.m_start = 0; + m_currentAttribute->m_nameRange.m_end = 0; + m_currentAttribute->m_valueRange.m_start = 0; + m_currentAttribute->m_valueRange.m_end = 0; +#endif + } + + void beginAttributeName(int index) + { + m_currentAttribute->m_nameRange.m_start = index; + } + + void endAttributeName(int index) + { + m_currentAttribute->m_nameRange.m_end = index; + m_currentAttribute->m_valueRange.m_start = index; + m_currentAttribute->m_valueRange.m_end = index; + } + + void beginAttributeValue(int index) + { + m_currentAttribute->m_valueRange.m_start = index; +#ifndef NDEBUG + m_currentAttribute->m_valueRange.m_end = 0; +#endif + } + + void endAttributeValue(int index) + { + m_currentAttribute->m_valueRange.m_end = index; } void appendToAttributeName(UChar character) { ASSERT(character); ASSERT(m_type == StartTag || m_type == EndTag); + ASSERT(m_currentAttribute->m_nameRange.m_start); m_currentAttribute->m_name.append(character); } @@ -159,6 +209,7 @@ public: { ASSERT(character); ASSERT(m_type == StartTag || m_type == EndTag); + ASSERT(m_currentAttribute->m_valueRange.m_start); m_currentAttribute->m_value.append(character); } @@ -280,6 +331,9 @@ private: Type m_type; + // Which characters from the input stream are represented by this token. + Range m_range; + // "name" for DOCTYPE, StartTag, and EndTag // "characters" for Character // "data" for Comment @@ -323,6 +377,10 @@ public: 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()); + ASSERT(iter->m_nameRange.m_start); + ASSERT(iter->m_nameRange.m_end); + ASSERT(iter->m_valueRange.m_start); + ASSERT(iter->m_valueRange.m_end); RefPtr<Attribute> mappedAttribute = Attribute::createMapped(name, value); if (!m_attributes) { m_attributes = NamedNodeMap::create(); diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp index a52aba6..a18701a 100644 --- a/WebCore/html/HTMLTokenizer.cpp +++ b/WebCore/html/HTMLTokenizer.cpp @@ -28,7 +28,6 @@ #include "config.h" #include "HTMLTokenizer.h" -#include "AtomicString.h" #include "HTMLEntityParser.h" #include "HTMLToken.h" #include "HTMLNames.h" @@ -36,6 +35,7 @@ #include <wtf/ASCIICType.h> #include <wtf/CurrentTime.h> #include <wtf/UnusedParam.h> +#include <wtf/text/AtomicString.h> #include <wtf/text/CString.h> #include <wtf/unicode/Unicode.h> @@ -152,7 +152,7 @@ inline bool HTMLTokenizer::processEntity(SegmentedString& source) do { \ m_state = stateName; \ if (!m_inputStreamPreprocessor.advance(source, m_lineNumber)) \ - return shouldEmitBufferedCharacterToken(source); \ + return haveBufferedCharacterToken(); \ cc = m_inputStreamPreprocessor.nextInputCharacter(); \ goto stateName; \ } while (false) @@ -165,7 +165,7 @@ inline bool HTMLTokenizer::processEntity(SegmentedString& source) do { \ m_state = stateName; \ if (source.isEmpty() || !m_inputStreamPreprocessor.peek(source, m_lineNumber)) \ - return shouldEmitBufferedCharacterToken(source); \ + return haveBufferedCharacterToken(); \ cc = m_inputStreamPreprocessor.nextInputCharacter(); \ goto stateName; \ } while (false) @@ -202,7 +202,7 @@ bool HTMLTokenizer::emitAndReconsumeIn(SegmentedString&, State state) // Check if we have buffered characters to emit first before emitting the EOF. bool HTMLTokenizer::emitEndOfFile(SegmentedString& source) { - if (shouldEmitBufferedCharacterToken(source)) + if (haveBufferedCharacterToken()) return true; m_state = DataState; source.advance(m_lineNumber); @@ -229,7 +229,7 @@ bool HTMLTokenizer::flushBufferedEndTag(SegmentedString& source) return true; \ if (source.isEmpty() \ || !m_inputStreamPreprocessor.peek(source, m_lineNumber)) \ - return shouldEmitBufferedCharacterToken(source); \ + return haveBufferedCharacterToken(); \ cc = m_inputStreamPreprocessor.nextInputCharacter(); \ goto stateName; \ } while (false) @@ -260,7 +260,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) } if (source.isEmpty() || !m_inputStreamPreprocessor.peek(source, m_lineNumber)) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); UChar cc = m_inputStreamPreprocessor.nextInputCharacter(); // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-inbody @@ -308,7 +308,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) BEGIN_STATE(CharacterReferenceInDataState) { if (!processEntity(source)) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); SWITCH_TO(DataState); } END_STATE() @@ -329,7 +329,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) BEGIN_STATE(CharacterReferenceInRCDATAState) { if (!processEntity(source)) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); SWITCH_TO(RCDATAState); } END_STATE() @@ -864,6 +864,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) return emitAndResumeIn(source, DataState); else if (isASCIIUpper(cc)) { m_token->addNewAttribute(); + m_token->beginAttributeName(source.numberOfCharactersConsumed()); m_token->appendToAttributeName(toLowerCase(cc)); ADVANCE_TO(AttributeNameState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { @@ -873,6 +874,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) if (cc == '"' || cc == '\'' || cc == '<' || cc == '=') parseError(); m_token->addNewAttribute(); + m_token->beginAttributeName(source.numberOfCharactersConsumed()); m_token->appendToAttributeName(cc); ADVANCE_TO(AttributeNameState); } @@ -880,19 +882,24 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) END_STATE() BEGIN_STATE(AttributeNameState) { - if (isTokenizerWhitespace(cc)) + if (isTokenizerWhitespace(cc)) { + m_token->endAttributeName(source.numberOfCharactersConsumed()); ADVANCE_TO(AfterAttributeNameState); - else if (cc == '/') + } else if (cc == '/') { + m_token->endAttributeName(source.numberOfCharactersConsumed()); ADVANCE_TO(SelfClosingStartTagState); - else if (cc == '=') + } else if (cc == '=') { + m_token->endAttributeName(source.numberOfCharactersConsumed()); ADVANCE_TO(BeforeAttributeValueState); - else if (cc == '>') + } else if (cc == '>') { + m_token->endAttributeName(source.numberOfCharactersConsumed()); return emitAndResumeIn(source, DataState); - else if (isASCIIUpper(cc)) { + } else if (isASCIIUpper(cc)) { m_token->appendToAttributeName(toLowerCase(cc)); ADVANCE_TO(AttributeNameState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { parseError(); + m_token->endAttributeName(source.numberOfCharactersConsumed()); RECONSUME_IN(DataState); } else { if (cc == '"' || cc == '\'' || cc == '<' || cc == '=') @@ -914,6 +921,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) return emitAndResumeIn(source, DataState); else if (isASCIIUpper(cc)) { m_token->addNewAttribute(); + m_token->beginAttributeName(source.numberOfCharactersConsumed()); m_token->appendToAttributeName(toLowerCase(cc)); ADVANCE_TO(AttributeNameState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { @@ -923,6 +931,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) if (cc == '"' || cc == '\'' || cc == '<') parseError(); m_token->addNewAttribute(); + m_token->beginAttributeName(source.numberOfCharactersConsumed()); m_token->appendToAttributeName(cc); ADVANCE_TO(AttributeNameState); } @@ -932,13 +941,16 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) BEGIN_STATE(BeforeAttributeValueState) { if (isTokenizerWhitespace(cc)) ADVANCE_TO(BeforeAttributeValueState); - else if (cc == '"') + else if (cc == '"') { + m_token->beginAttributeValue(source.numberOfCharactersConsumed() + 1); ADVANCE_TO(AttributeValueDoubleQuotedState); - else if (cc == '&') + } else if (cc == '&') { + m_token->beginAttributeValue(source.numberOfCharactersConsumed()); RECONSUME_IN(AttributeValueUnquotedState); - else if (cc == '\'') + } else if (cc == '\'') { + m_token->beginAttributeValue(source.numberOfCharactersConsumed() + 1); ADVANCE_TO(AttributeValueSingleQuotedState); - else if (cc == '>') { + } else if (cc == '>') { parseError(); return emitAndResumeIn(source, DataState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { @@ -947,6 +959,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) } else { if (cc == '<' || cc == '=' || cc == '`') parseError(); + m_token->beginAttributeValue(source.numberOfCharactersConsumed()); m_token->appendToAttributeValue(cc); ADVANCE_TO(AttributeValueUnquotedState); } @@ -954,13 +967,15 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) END_STATE() BEGIN_STATE(AttributeValueDoubleQuotedState) { - if (cc == '"') + if (cc == '"') { + m_token->endAttributeValue(source.numberOfCharactersConsumed()); ADVANCE_TO(AfterAttributeValueQuotedState); - else if (cc == '&') { + } else if (cc == '&') { m_additionalAllowedCharacter = '"'; ADVANCE_TO(CharacterReferenceInAttributeValueState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { parseError(); + m_token->endAttributeValue(source.numberOfCharactersConsumed()); RECONSUME_IN(DataState); } else { m_token->appendToAttributeValue(cc); @@ -970,13 +985,15 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) END_STATE() BEGIN_STATE(AttributeValueSingleQuotedState) { - if (cc == '\'') + if (cc == '\'') { + m_token->endAttributeValue(source.numberOfCharactersConsumed()); ADVANCE_TO(AfterAttributeValueQuotedState); - else if (cc == '&') { + } else if (cc == '&') { m_additionalAllowedCharacter = '\''; ADVANCE_TO(CharacterReferenceInAttributeValueState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { parseError(); + m_token->endAttributeValue(source.numberOfCharactersConsumed()); RECONSUME_IN(DataState); } else { m_token->appendToAttributeValue(cc); @@ -986,15 +1003,18 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) END_STATE() BEGIN_STATE(AttributeValueUnquotedState) { - if (isTokenizerWhitespace(cc)) + if (isTokenizerWhitespace(cc)) { + m_token->endAttributeValue(source.numberOfCharactersConsumed()); ADVANCE_TO(BeforeAttributeNameState); - else if (cc == '&') { + } else if (cc == '&') { m_additionalAllowedCharacter = '>'; ADVANCE_TO(CharacterReferenceInAttributeValueState); - } else if (cc == '>') + } else if (cc == '>') { + m_token->endAttributeValue(source.numberOfCharactersConsumed()); return emitAndResumeIn(source, DataState); - else if (cc == InputStreamPreprocessor::endOfFileMarker) { + } else if (cc == InputStreamPreprocessor::endOfFileMarker) { parseError(); + m_token->endAttributeValue(source.numberOfCharactersConsumed()); RECONSUME_IN(DataState); } else { if (cc == '"' || cc == '\'' || cc == '<' || cc == '=' || cc == '`') @@ -1009,7 +1029,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) bool notEnoughCharacters = false; unsigned value = consumeHTMLEntity(source, notEnoughCharacters, m_additionalAllowedCharacter); if (notEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); if (!value) m_token->appendToAttributeValue('&'); else if (value < 0xFFFF) @@ -1093,14 +1113,14 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) m_token->beginComment(); SWITCH_TO(CommentStartState); } else if (result == SegmentedString::NotEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); } else if (cc == 'D' || cc == 'd') { SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(doctypeString); if (result == SegmentedString::DidMatch) { advanceStringAndASSERTIgnoringCase(source, "doctype"); SWITCH_TO(DOCTYPEState); } else if (result == SegmentedString::NotEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); } notImplemented(); // FIXME: We're still missing the bits about the insertion mode being in foreign content: @@ -1313,14 +1333,14 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) advanceStringAndASSERTIgnoringCase(source, "public"); SWITCH_TO(AfterDOCTYPEPublicKeywordState); } else if (result == SegmentedString::NotEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); } else if (cc == 'S' || cc == 's') { SegmentedString::LookAheadResult result = source.lookAheadIgnoringCase(systemString); if (result == SegmentedString::DidMatch) { advanceStringAndASSERTIgnoringCase(source, "system"); SWITCH_TO(AfterDOCTYPESystemKeywordState); } else if (result == SegmentedString::NotEnoughCharacters) - return shouldEmitBufferedCharacterToken(source); + return haveBufferedCharacterToken(); } parseError(); m_token->setForceQuirks(); @@ -1629,10 +1649,9 @@ inline void HTMLTokenizer::parseError() notImplemented(); } -inline bool HTMLTokenizer::shouldEmitBufferedCharacterToken(const SegmentedString& source) +inline bool HTMLTokenizer::haveBufferedCharacterToken() { - return source.isClosed() && m_token->type() == HTMLToken::Character; + return m_token->type() == HTMLToken::Character; } } - diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h index 0e9ba3a..6fb3053 100644 --- a/WebCore/html/HTMLTokenizer.h +++ b/WebCore/html/HTMLTokenizer.h @@ -27,10 +27,10 @@ #ifndef HTMLTokenizer_h #define HTMLTokenizer_h -#include "AtomicString.h" #include "SegmentedString.h" #include <wtf/Noncopyable.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> namespace WebCore { @@ -254,7 +254,7 @@ private: inline void saveEndTagNameIfNeeded(); inline bool isAppropriateEndTag(); - inline bool shouldEmitBufferedCharacterToken(const SegmentedString&); + inline bool haveBufferedCharacterToken(); State m_state; diff --git a/WebCore/html/HTMLTreeBuilder.cpp b/WebCore/html/HTMLTreeBuilder.cpp index 2c7d40d..fd0b62e 100644 --- a/WebCore/html/HTMLTreeBuilder.cpp +++ b/WebCore/html/HTMLTreeBuilder.cpp @@ -39,7 +39,6 @@ #include "HTMLScriptElement.h" #include "HTMLToken.h" #include "HTMLTokenizer.h" -#include "LegacyHTMLDocumentParser.h" #include "LegacyHTMLTreeBuilder.h" #include "LocalizedStrings.h" #include "MathMLNames.h" @@ -67,6 +66,11 @@ inline bool isTreeBuilderWhitepace(UChar c) return c == '\t' || c == '\x0A' || c == '\x0C' || c == '\x0D' || c == ' '; } +inline bool isNotTreeBuilderWhitepace(UChar c) +{ + return !isTreeBuilderWhitepace(c); +} + inline bool isTreeBuilderWhitepaceOrReplacementCharacter(UChar c) { return isTreeBuilderWhitepace(c) || c == 0xFFFD; @@ -303,21 +307,17 @@ public: void skipLeadingWhitespace() { - ASSERT(!isEmpty()); - while (isTreeBuilderWhitepace(*m_current)) { - if (++m_current == m_end) - return; - } + skipLeading<isTreeBuilderWhitepace>(); } String takeLeadingWhitespace() { - ASSERT(!isEmpty()); - const UChar* start = m_current; - skipLeadingWhitespace(); - if (start == m_current) - return String(); - return String(start, m_current - start); + return takeLeading<isTreeBuilderWhitepace>(); + } + + String takeLeadingNonWhitespace() + { + return takeLeading<isNotTreeBuilderWhitepace>(); } String takeRemaining() @@ -352,6 +352,27 @@ public: } private: + template<bool characterPredicate(UChar)> + void skipLeading() + { + ASSERT(!isEmpty()); + while (characterPredicate(*m_current)) { + if (++m_current == m_end) + return; + } + } + + template<bool characterPredicate(UChar)> + String takeLeading() + { + ASSERT(!isEmpty()); + const UChar* start = m_current; + skipLeading<characterPredicate>(); + if (start == m_current) + return String(); + return String(start, m_current - start); + } + const UChar* m_current; const UChar* m_end; }; @@ -391,13 +412,14 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fra { if (shouldUseLegacyTreeBuilder(fragment->document())) return; - // This is steps 2-6 of the HTML5 Fragment Case parsing algorithm: - // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case - if (contextElement) + if (contextElement) { + // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case m_document->setParseMode(contextElement->document()->parseMode()); - processFakeStartTag(htmlTag); - resetInsertionModeAppropriately(); - m_tree.setForm(closestFormAncestor(contextElement)); + processFakeStartTag(htmlTag); + resetInsertionModeAppropriately(); + m_tree.setForm(closestFormAncestor(contextElement)); + } } HTMLTreeBuilder::~HTMLTreeBuilder() @@ -1997,7 +2019,9 @@ void HTMLTreeBuilder::processEndTagForInCell(AtomicHTMLToken& token) m_tree.openElements()->popUntilPopped(token.name()); m_tree.activeFormattingElements()->clearToLastMarker(); setInsertionMode(InRowMode); - ASSERT(m_tree.currentElement()->hasTagName(trTag)); + // FIXME: The fragment case of this ASSERT is a spec bug: + // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10338 + ASSERT(m_tree.currentElement()->hasTagName(trTag) || (isParsingFragment() && m_fragmentContext.contextElement()->hasTagName(trTag))); return; } if (token.name() == bodyTag @@ -2628,7 +2652,10 @@ ReprocessBuffer: return; if (!processColgroupEndTagForInColumnGroup()) { ASSERT(isParsingFragment()); - return; + // The spec tells us to drop these characters on the floor. + buffer.takeLeadingNonWhitespace(); + if (buffer.isEmpty()) + return; } goto ReprocessBuffer; } diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp index e1b959b..e0e71ee 100644 --- a/WebCore/html/HTMLViewSourceDocument.cpp +++ b/WebCore/html/HTMLViewSourceDocument.cpp @@ -36,7 +36,9 @@ #include "HTMLTableElement.h" #include "HTMLTableRowElement.h" #include "HTMLTableSectionElement.h" -#include "LegacyHTMLDocumentParser.h" +#include "HTMLToken.h" +#include "HTMLViewSourceParser.h" +#include "SegmentedString.h" #include "Text.h" #include "TextDocument.h" @@ -53,15 +55,13 @@ HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, co DocumentParser* HTMLViewSourceDocument::createParser() { - // Use LegacyHTMLDocumentParser if applicable, otherwise use TextDocumentParser. + // Use HTMLDocumentParser 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 LegacyHTMLDocumentParser(this); - } + ) + return new HTMLViewSourceParser(this); return createTextDocumentParser(this); } @@ -100,107 +100,91 @@ void HTMLViewSourceDocument::addViewSourceText(const String& text) addText(text, ""); } -void HTMLViewSourceDocument::addViewSourceToken(Token* token) +void HTMLViewSourceDocument::addSource(const String& source, HTMLToken& token) { if (!m_current) createContainingTable(); - if (token->tagName == textAtom) - addText(token->text.get(), ""); - else if (token->tagName == commentAtom) { - if (token->beginTag) { - m_current = addSpanWithClassName("webkit-html-comment"); - addText(String("<!--") + token->text.get() + "-->", "webkit-html-comment"); - } - } else { - // Handle the tag. - String classNameStr = "webkit-html-tag"; - m_current = addSpanWithClassName(classNameStr); - - String text = "<"; - if (!token->beginTag) - text += "/"; - text += token->tagName; - Vector<UChar>* guide = token->m_sourceInfo.get(); - if (!guide || !guide->size()) - text += ">"; - - addText(text, classNameStr); - - // Walk our guide string that tells us where attribute names/values should go. - if (guide && guide->size()) { - unsigned size = guide->size(); - unsigned begin = 0; - unsigned currAttr = 0; - RefPtr<Attribute> attr = 0; - for (unsigned i = 0; i < size; i++) { - if (guide->at(i) == 'a' || guide->at(i) == 'x' || guide->at(i) == 'v') { - // Add in the string. - addText(String(static_cast<UChar*>(guide->data()) + begin, i - begin), classNameStr); - - begin = i + 1; - - if (guide->at(i) == 'a') { - if (token->attrs && currAttr < token->attrs->length()) - attr = token->attrs->attributeItem(currAttr++); - else - attr = 0; - } - if (attr) { - if (guide->at(i) == 'a') { - String name = attr->name().toString(); - - m_current = addSpanWithClassName("webkit-html-attribute-name"); - addText(name, "webkit-html-attribute-name"); - if (m_current != m_tbody) - m_current = static_cast<Element*>(m_current->parent()); - } else { - const String& value = attr->value().string(); - - // 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")) { - // Catch the href attribute in the base element. - // It will be used for rendering anchors created - // by addLink() below. - setBaseElementURL(KURL(url(), value)); - } - - // FIXME: XML could use namespace prefixes and confuse us. - if (equalIgnoringCase(attr->name().localName(), "src") || equalIgnoringCase(attr->name().localName(), "href")) - m_current = addLink(value, equalIgnoringCase(token->tagName, "a")); - else - m_current = addSpanWithClassName("webkit-html-attribute-value"); - addText(value, "webkit-html-attribute-value"); - if (m_current != m_tbody) - m_current = static_cast<Element*>(m_current->parent()); - } - } - } - } - - // Add in any string that might be left. - if (begin < size) - addText(String(static_cast<UChar*>(guide->data()) + begin, size - begin), classNameStr); - - // Add in the end tag. - addText(">", classNameStr); - } - - m_current = m_td; + switch (token.type()) { + case HTMLToken::Uninitialized: + ASSERT_NOT_REACHED(); + break; + case HTMLToken::DOCTYPE: + processDoctypeToken(source, token); + break; + case HTMLToken::EndOfFile: + break; + case HTMLToken::StartTag: + case HTMLToken::EndTag: + processTagToken(source, token); + break; + case HTMLToken::Comment: + processCommentToken(source, token); + break; + case HTMLToken::Character: + processCharacterToken(source, token); + break; } } -void HTMLViewSourceDocument::addViewSourceDoctypeToken(DoctypeToken* doctypeToken) +void HTMLViewSourceDocument::processDoctypeToken(const String& source, HTMLToken&) { if (!m_current) createContainingTable(); m_current = addSpanWithClassName("webkit-html-doctype"); - String text = "<"; - text += String::adopt(doctypeToken->m_source); - text += ">"; - addText(text, "webkit-html-doctype"); + addText(source, "webkit-html-doctype"); + m_current = m_td; +} + +void HTMLViewSourceDocument::processTagToken(const String& source, HTMLToken& token) +{ + String classNameStr = "webkit-html-tag"; + m_current = addSpanWithClassName(classNameStr); + + AtomicString tagName(token.name().data(), token.name().size()); + + unsigned index = 0; + HTMLToken::AttributeList::const_iterator iter = token.attributes().begin(); + while (index < source.length()) { + if (iter == token.attributes().end()) { + // We want to show the remaining characters in the token. + index = addRange(source, index, source.length(), ""); + ASSERT(index == source.length()); + break; + } + + AtomicString name(iter->m_name.data(), iter->m_name.size()); + String value(iter->m_value.data(), iter->m_value.size()); + + index = addRange(source, index, iter->m_nameRange.m_start - token.startIndex(), ""); + index = addRange(source, index, iter->m_nameRange.m_end - token.startIndex(), "webkit-html-attribute-name"); + + if (tagName == baseTag && name == hrefAttr) { + // Catch the href attribute in the base element. It will be used + // for rendering anchors created by addLink() below. + setBaseElementURL(KURL(url(), value)); + } + + index = addRange(source, index, iter->m_valueRange.m_start - token.startIndex(), ""); + + bool isLink = name == srcAttr || name == hrefAttr; + index = addRange(source, index, iter->m_valueRange.m_end - token.startIndex(), "webkit-html-attribute-value", isLink, tagName == aTag); + + ++iter; + } + m_current = m_td; +} + +void HTMLViewSourceDocument::processCommentToken(const String& source, HTMLToken&) +{ + m_current = addSpanWithClassName("webkit-html-comment"); + addText(source, "webkit-html-comment"); + m_current = m_td; +} + +void HTMLViewSourceDocument::processCharacterToken(const String& source, HTMLToken&) +{ + addText(source, ""); } PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& className) @@ -287,6 +271,25 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className m_current = m_tbody; } +int HTMLViewSourceDocument::addRange(const String& source, int start, int end, const String& className, bool isLink, bool isAnchor) +{ + ASSERT(start <= end); + if (start == end) + return start; + + String text = source.substring(start, end - start); + if (!className.isEmpty()) { + if (isLink) + m_current = addLink(text, isAnchor); + else + m_current = addSpanWithClassName(className); + } + addText(text, className); + if (!className.isEmpty() && m_current != m_tbody) + m_current = static_cast<Element*>(m_current->parent()); + return end; +} + PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) { if (m_current == m_tbody) diff --git a/WebCore/html/HTMLViewSourceDocument.h b/WebCore/html/HTMLViewSourceDocument.h index cf6cfc1..8805848 100644 --- a/WebCore/html/HTMLViewSourceDocument.h +++ b/WebCore/html/HTMLViewSourceDocument.h @@ -29,11 +29,9 @@ namespace WebCore { -class DoctypeToken; class HTMLTableCellElement; class HTMLTableSectionElement; - -struct Token; +class HTMLToken; class HTMLViewSourceDocument : public HTMLDocument { public: @@ -42,20 +40,27 @@ public: return adoptRef(new HTMLViewSourceDocument(frame, url, mimeType)); } - void addViewSourceToken(Token*); // Used by the LegacyHTMLDocumentParser. + void addSource(const String&, HTMLToken&); + + void addViewSourceToken(HTMLToken&); // Used by the HTMLDocumentParser. void addViewSourceText(const String&); // Used by the TextDocumentParser. - void addViewSourceDoctypeToken(DoctypeToken*); private: HTMLViewSourceDocument(Frame*, const KURL&, const String& mimeType); - // Returns LegacyHTMLDocumentParser or TextDocumentParser based on m_type. + // Returns HTMLViewSourceParser or TextDocumentParser based on m_type. virtual DocumentParser* createParser(); + void processDoctypeToken(const String& source, HTMLToken&); + void processTagToken(const String& source, HTMLToken&); + void processCommentToken(const String& source, HTMLToken&); + void processCharacterToken(const String& source, HTMLToken&); + void createContainingTable(); PassRefPtr<Element> addSpanWithClassName(const String&); void addLine(const String& className); void addText(const String& text, const String& className); + int addRange(const String& source, int start, int end, const String& className, bool isLink = false, bool isAnchor = false); PassRefPtr<Element> addLink(const String& url, bool isAnchor); String m_type; diff --git a/WebCore/html/HTMLViewSourceParser.cpp b/WebCore/html/HTMLViewSourceParser.cpp new file mode 100644 index 0000000..3da4c23 --- /dev/null +++ b/WebCore/html/HTMLViewSourceParser.cpp @@ -0,0 +1,106 @@ +/* + * 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 "HTMLViewSourceParser.h" + +#include "HTMLNames.h" +#include "HTMLTreeBuilder.h" +#include "HTMLViewSourceDocument.h" + +namespace WebCore { + +HTMLViewSourceParser::~HTMLViewSourceParser() +{ +} + +void HTMLViewSourceParser::insert(const SegmentedString&) +{ + ASSERT_NOT_REACHED(); +} + +void HTMLViewSourceParser::pumpTokenizer() +{ + while (m_tokenizer.nextToken(m_input.current(), m_token)) { + m_token.end(m_input.current().numberOfCharactersConsumed()); + document()->addSource(sourceForToken(), m_token); + updateTokenizerState(); + m_token.clear(m_input.current().numberOfCharactersConsumed()); + } +} + +void HTMLViewSourceParser::append(const SegmentedString& input) +{ + m_input.appendToEnd(input); + m_source.append(input); + pumpTokenizer(); +} + +String HTMLViewSourceParser::sourceForToken() +{ + if (m_token.type() == HTMLToken::EndOfFile) + return String(); + + ASSERT(m_source.numberOfCharactersConsumed() == m_token.startIndex()); + UChar* data = 0; + int length = m_token.endIndex() - m_token.startIndex(); + String source = String::createUninitialized(length, data); + for (int i = 0; i < length; ++i) { + data[i] = *m_source; + m_source.advance(); + } + return source; +} + +void HTMLViewSourceParser::updateTokenizerState() +{ + // FIXME: The tokenizer should do this work for us. + if (m_token.type() != HTMLToken::StartTag) + return; + + AtomicString tagName(m_token.name().data(), m_token.name().size()); + m_tokenizer.setState(HTMLTreeBuilder::adjustedLexerState(m_tokenizer.state(), tagName, m_document->frame())); + if (tagName == HTMLNames::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); + } +} + +void HTMLViewSourceParser::finish() +{ + if (!m_input.haveSeenEndOfFile()) + m_input.markEndOfFile(); + pumpTokenizer(); + document()->finishedParsing(); +} + +bool HTMLViewSourceParser::finishWasCalled() +{ + return m_input.haveSeenEndOfFile(); +} + +} diff --git a/WebCore/html/HTMLViewSourceParser.h b/WebCore/html/HTMLViewSourceParser.h new file mode 100644 index 0000000..2571301 --- /dev/null +++ b/WebCore/html/HTMLViewSourceParser.h @@ -0,0 +1,77 @@ +/* + * 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 HTMLViewSourceParser_h +#define HTMLViewSourceParser_h + +#include "DecodedDataDocumentParser.h" +#include "HTMLInputStream.h" +#include "HTMLToken.h" +#include "HTMLTokenizer.h" +#include "HTMLViewSourceDocument.h" +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +class HTMLTokenizer; +class HTMLScriptRunner; +class HTMLTreeBuilder; +class HTMLPreloadScanner; +class LegacyHTMLTreeBuilder; +class ScriptController; +class ScriptSourceCode; + +class HTMLViewSourceParser : public DecodedDataDocumentParser { +public: + // FIXME: Make private with a create method. + HTMLViewSourceParser(HTMLViewSourceDocument* document) + : DecodedDataDocumentParser(document) + { + } + + virtual ~HTMLViewSourceParser(); + +private: + // DocumentParser + virtual void insert(const SegmentedString&); + virtual void append(const SegmentedString&); + virtual void finish(); + virtual bool finishWasCalled(); + + HTMLViewSourceDocument* document() const { return static_cast<HTMLViewSourceDocument*>(m_document); } + + void pumpTokenizer(); + String sourceForToken(); + void updateTokenizerState(); + + HTMLInputStream m_input; + SegmentedString m_source; + HTMLToken m_token; + HTMLTokenizer m_tokenizer; +}; + +} + +#endif diff --git a/WebCore/html/LegacyHTMLDocumentParser.cpp b/WebCore/html/LegacyHTMLDocumentParser.cpp deleted file mode 100644 index 980d6ed..0000000 --- a/WebCore/html/LegacyHTMLDocumentParser.cpp +++ /dev/null @@ -1,2126 +0,0 @@ -/* - 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) - : ScriptableDocumentParser(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) - : ScriptableDocumentParser(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) - : ScriptableDocumentParser(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(String(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(String(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(String(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 (xssAuditor() && !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 (xssAuditor() && !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, but only if we're doing - // document parsing. For document fragments we wait, since they'll likely end up in the document by the time - // the beforeload events fire. - if (!m_fragment) - ImageLoader::dispatchPendingBeforeLoadEvents(); -} - -void LegacyHTMLDocumentParser::insert(const SegmentedString& source) -{ - // 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 = forceSynchronous(); - setForceSynchronous(true); - write(source, false); - setForceSynchronous(wasForcedSynchronous); -} - -void LegacyHTMLDocumentParser::append(const SegmentedString& source) -{ - write(source, true); -} - -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 deleted file mode 100644 index 49e6976..0000000 --- a/WebCore/html/LegacyHTMLDocumentParser.h +++ /dev/null @@ -1,452 +0,0 @@ -/* - 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 "ScriptableDocumentParser.h" -#include "SegmentedString.h" -#include "Timer.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 ScriptableDocumentParser, 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); - - static void parseDocumentFragment(const String&, DocumentFragment*, FragmentScriptingPermission = FragmentScriptingAllowed); - -protected: - // Exposed for FTPDirectoryDocumentParser - virtual void insert(const SegmentedString&); - virtual void finish(); - -private: - // ScriptableDocumentParser - virtual void append(const SegmentedString&); - 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 bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); } - - virtual void executeScriptsWaitingForStylesheets(); - - virtual LegacyHTMLTreeBuilder* htmlTreeBuilder() const { return m_treeBuilder.get(); } - - class State; - - void begin(); - void end(); - void reset(); - - void willWriteHTML(const SegmentedString&); - void write(const SegmentedString&, bool appendData); - 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/LegacyHTMLTreeBuilder.cpp b/WebCore/html/LegacyHTMLTreeBuilder.cpp index ee0bcfc..f39579c 100644 --- a/WebCore/html/LegacyHTMLTreeBuilder.cpp +++ b/WebCore/html/LegacyHTMLTreeBuilder.cpp @@ -52,9 +52,9 @@ #include "HTMLTableCellElement.h" #include "HTMLTableRowElement.h" #include "HTMLTableSectionElement.h" -#include "LegacyHTMLDocumentParser.h" #include "LocalizedStrings.h" #include "Page.h" +#include "ScriptableDocumentParser.h" #include "Settings.h" #include "Text.h" #include "TreeDepthLimit.h" diff --git a/WebCore/html/LegacyHTMLTreeBuilder.h b/WebCore/html/LegacyHTMLTreeBuilder.h index 4ac8413..ed2b857 100644 --- a/WebCore/html/LegacyHTMLTreeBuilder.h +++ b/WebCore/html/LegacyHTMLTreeBuilder.h @@ -26,6 +26,7 @@ #include "FragmentScriptingPermission.h" #include "HTMLParserErrorCodes.h" +#include "NamedNodeMap.h" #include "QualifiedName.h" #include <wtf/Forward.h> #include <wtf/OwnPtr.h> @@ -44,7 +45,97 @@ class HTMLParserQuirks; class Node; struct HTMLStackElem; -struct Token; + +/** + * @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. +}; + +//----------------------------------------------------------------------------- /** * The parser for HTML. It receives a stream of tokens from the LegacyHTMLDocumentParser, and diff --git a/WebCore/html/LegacyPreloadScanner.cpp b/WebCore/html/LegacyPreloadScanner.cpp deleted file mode 100644 index c9fda4f..0000000 --- a/WebCore/html/LegacyPreloadScanner.cpp +++ /dev/null @@ -1,856 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE 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 "LegacyPreloadScanner.h" - -#include "AtomicString.h" -#include "CachedCSSStyleSheet.h" -#include "CachedImage.h" -#include "CachedResource.h" -#include "CachedResourceClient.h" -#include "CachedScript.h" -#include "CSSHelper.h" -#include "DocLoader.h" -#include "Document.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "HTMLLinkElement.h" -#include "HTMLNames.h" -#include <wtf/text/CString.h> -#include <wtf/CurrentTime.h> -#include <wtf/unicode/Unicode.h> - -// Use __GNUC__ instead of PLATFORM(GCC) to stay consistent with the gperf generated c file -#ifdef __GNUC__ -// The main tokenizer includes this too so we are getting two copies of the data. However, this way the code gets inlined. -#include "HTMLEntityNames.cpp" -#else -// Not inlined for non-GCC compilers -struct Entity { - const char* name; - int code; -}; -const struct Entity* findEntity(register const char* str, register unsigned int len); -#endif - -#define PRELOAD_DEBUG 0 - -using namespace WTF; - -namespace WebCore { - -using namespace HTMLNames; - -LegacyPreloadScanner::LegacyPreloadScanner(Document* doc) - : m_inProgress(false) - , m_timeUsed(0) - , m_bodySeen(false) - , m_document(doc) -{ -#if PRELOAD_DEBUG - printf("CREATING PRELOAD SCANNER FOR %s\n", m_document->url().string().latin1().data()); -#endif -} - -LegacyPreloadScanner::~LegacyPreloadScanner() -{ -#if PRELOAD_DEBUG - printf("DELETING PRELOAD SCANNER FOR %s\n", m_document->url().string().latin1().data()); - printf("TOTAL TIME USED %.4fs\n", m_timeUsed); -#endif -} - -void LegacyPreloadScanner::begin() -{ - ASSERT(!m_inProgress); - reset(); - m_inProgress = true; -} - -void LegacyPreloadScanner::end() -{ - ASSERT(m_inProgress); - m_inProgress = false; -} - -void LegacyPreloadScanner::reset() -{ - m_source.clear(); - - m_state = Data; - m_escape = false; - m_contentModel = PCDATA; - m_commentPos = 0; - - m_closeTag = false; - m_tagName.clear(); - m_attributeName.clear(); - m_attributeValue.clear(); - m_lastStartTag = AtomicString(); - - m_urlToLoad = String(); - m_charset = String(); - m_linkIsStyleSheet = false; - m_lastCharacterIndex = 0; - clearLastCharacters(); - - m_cssState = CSSInitial; - m_cssRule.clear(); - m_cssRuleValue.clear(); -} - -bool LegacyPreloadScanner::scanningBody() const -{ - return m_document->body() || m_bodySeen; -} - -void LegacyPreloadScanner::write(const SegmentedString& source) -{ -#if PRELOAD_DEBUG - double startTime = currentTime(); -#endif - tokenize(source); -#if PRELOAD_DEBUG - m_timeUsed += currentTime() - startTime; -#endif -} - -static inline bool isWhitespace(UChar c) -{ - return c == ' ' || c == '\n' || c == '\r' || c == '\t'; -} - -inline void LegacyPreloadScanner::clearLastCharacters() -{ - memset(m_lastCharacters, 0, lastCharactersBufferSize * sizeof(UChar)); -} - -inline void LegacyPreloadScanner::rememberCharacter(UChar c) -{ - m_lastCharacterIndex = (m_lastCharacterIndex + 1) % lastCharactersBufferSize; - m_lastCharacters[m_lastCharacterIndex] = c; -} - -inline bool LegacyPreloadScanner::lastCharactersMatch(const char* chars, unsigned count) const -{ - unsigned pos = m_lastCharacterIndex; - while (count) { - if (chars[count - 1] != m_lastCharacters[pos]) - return false; - --count; - if (!pos) - pos = lastCharactersBufferSize; - --pos; - } - return true; -} - -static inline unsigned legalEntityFor(unsigned value) -{ - // FIXME There is a table for more exceptions in the HTML5 specification. - if (value == 0 || value > 0x10FFFF || (value >= 0xD800 && value <= 0xDFFF)) - return 0xFFFD; - return value; -} - -unsigned LegacyPreloadScanner::consumeEntity(SegmentedString& source, bool& notEnoughCharacters) -{ - enum EntityState { - Initial, - NumberType, - MaybeHex, - Hex, - Decimal, - Named - }; - EntityState entityState = Initial; - unsigned result = 0; - Vector<UChar, 10> seenChars; - Vector<char, 10> entityName; - - while (!source.isEmpty()) { - UChar cc = *source; - seenChars.append(cc); - switch (entityState) { - case Initial: - if (isWhitespace(cc) || cc == '<' || cc == '&') - return 0; - else if (cc == '#') - entityState = NumberType; - else if ((cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z')) { - entityName.append(cc); - entityState = Named; - } else - return 0; - break; - case NumberType: - if (cc == 'x' || cc == 'X') - entityState = MaybeHex; - else if (cc >= '0' && cc <= '9') { - entityState = Decimal; - result = cc - '0'; - } else { - source.push('#'); - return 0; - } - break; - case MaybeHex: - if (cc >= '0' && cc <= '9') - result = cc - '0'; - else if (cc >= 'a' && cc <= 'f') - result = 10 + cc - 'a'; - else if (cc >= 'A' && cc <= 'F') - result = 10 + cc - 'A'; - else { - source.push('#'); - source.push(seenChars[1]); - return 0; - } - entityState = Hex; - break; - case Hex: - if (cc >= '0' && cc <= '9') - result = result * 16 + cc - '0'; - else if (cc >= 'a' && cc <= 'f') - result = result * 16 + 10 + cc - 'a'; - else if (cc >= 'A' && cc <= 'F') - result = result * 16 + 10 + cc - 'A'; - else if (cc == ';') { - source.advance(); - return legalEntityFor(result); - } else - return legalEntityFor(result); - break; - case Decimal: - if (cc >= '0' && cc <= '9') - result = result * 10 + cc - '0'; - else if (cc == ';') { - source.advance(); - return legalEntityFor(result); - } else - return legalEntityFor(result); - break; - case Named: - // This is the attribute only version, generic version matches somewhat differently - while (entityName.size() <= 8) { - if (cc == ';') { - const Entity* entity = findEntity(entityName.data(), entityName.size()); - if (entity) { - source.advance(); - return entity->code; - } - break; - } - if (!(cc >= 'a' && cc <= 'z') && !(cc >= 'A' && cc <= 'Z') && !(cc >= '0' && cc <= '9')) { - const Entity* entity = findEntity(entityName.data(), entityName.size()); - if (entity) - return entity->code; - break; - } - entityName.append(cc); - source.advance(); - if (source.isEmpty()) - goto outOfCharacters; - cc = *source; - seenChars.append(cc); - } - if (seenChars.size() == 2) - source.push(seenChars[0]); - else if (seenChars.size() == 3) { - source.push(seenChars[0]); - source.push(seenChars[1]); - } else - source.prepend(SegmentedString(String(seenChars.data(), seenChars.size() - 1))); - return 0; - } - source.advance(); - } -outOfCharacters: - notEnoughCharacters = true; - source.prepend(SegmentedString(String(seenChars.data(), seenChars.size()))); - return 0; -} - -void LegacyPreloadScanner::tokenize(const SegmentedString& source) -{ - ASSERT(m_inProgress); - - m_source.append(source); - - // This is a simplified HTML5 Tokenizer - // http://www.whatwg.org/specs/web-apps/current-work/#tokenisation0 - while (!m_source.isEmpty()) { - UChar cc = *m_source; - switch (m_state) { - case Data: - while (1) { - rememberCharacter(cc); - if (cc == '&') { - if (m_contentModel == PCDATA || m_contentModel == RCDATA) { - m_state = EntityData; - break; - } - } else if (cc == '-') { - if ((m_contentModel == RCDATA || m_contentModel == CDATA) && !m_escape) { - if (lastCharactersMatch("<!--", 4)) - m_escape = true; - } - } else if (cc == '<') { - if (m_contentModel == PCDATA || ((m_contentModel == RCDATA || m_contentModel == CDATA) && !m_escape)) { - m_state = TagOpen; - break; - } - } else if (cc == '>') { - if ((m_contentModel == RCDATA || m_contentModel == CDATA) && m_escape) { - if (lastCharactersMatch("-->", 3)) - m_escape = false; - } - } - emitCharacter(cc); - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case EntityData: - // should try to consume the entity but we only care about entities in attributes - m_state = Data; - break; - case TagOpen: - if (m_contentModel == RCDATA || m_contentModel == CDATA) { - if (cc == '/') - m_state = CloseTagOpen; - else { - m_state = Data; - continue; - } - } else if (m_contentModel == PCDATA) { - if (cc == '!') - m_state = MarkupDeclarationOpen; - else if (cc == '/') - m_state = CloseTagOpen; - else if (cc >= 'A' && cc <= 'Z') { - m_tagName.clear(); - m_charset = String(); - m_tagName.append(cc + 0x20); - m_closeTag = false; - m_state = TagName; - } else if (cc >= 'a' && cc <= 'z') { - m_tagName.clear(); - m_charset = String(); - m_tagName.append(cc); - m_closeTag = false; - m_state = TagName; - } else if (cc == '>') { - m_state = Data; - } else if (cc == '?') { - m_state = BogusComment; - } else { - m_state = Data; - continue; - } - } - break; - case CloseTagOpen: - if (m_contentModel == RCDATA || m_contentModel == CDATA) { - if (!m_lastStartTag.length()) { - m_state = Data; - continue; - } - if (m_source.length() < m_lastStartTag.length() + 1) - return; - Vector<UChar> tmpString; - UChar tmpChar = 0; - bool match = true; - for (unsigned n = 0; n < m_lastStartTag.length() + 1; n++) { - tmpChar = Unicode::toLower(*m_source); - if (n < m_lastStartTag.length() && tmpChar != m_lastStartTag[n]) - match = false; - tmpString.append(tmpChar); - m_source.advance(); - } - m_source.prepend(SegmentedString(String(tmpString.data(), tmpString.size()))); - if (!match || (!isWhitespace(tmpChar) && tmpChar != '>' && tmpChar != '/')) { - m_state = Data; - continue; - } - } - if (cc >= 'A' && cc <= 'Z') { - m_tagName.clear(); - m_charset = String(); - m_tagName.append(cc + 0x20); - m_closeTag = true; - m_state = TagName; - } else if (cc >= 'a' && cc <= 'z') { - m_tagName.clear(); - m_charset = String(); - m_tagName.append(cc); - m_closeTag = true; - m_state = TagName; - } else if (cc == '>') { - m_state = Data; - } else - m_state = BogusComment; - break; - case TagName: - while (1) { - if (isWhitespace(cc)) { - m_state = BeforeAttributeName; - break; - } - if (cc == '>') { - emitTag(); - m_state = Data; - break; - } - if (cc == '/') { - m_state = BeforeAttributeName; - break; - } - if (cc >= 'A' && cc <= 'Z') - m_tagName.append(cc + 0x20); - else - m_tagName.append(cc); - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case BeforeAttributeName: - if (isWhitespace(cc)) - ; - else if (cc == '>') { - emitTag(); - m_state = Data; - } else if (cc >= 'A' && cc <= 'Z') { - m_attributeName.clear(); - m_attributeValue.clear(); - m_attributeName.append(cc + 0x20); - m_state = AttributeName; - } else if (cc == '/') - ; - else { - m_attributeName.clear(); - m_attributeValue.clear(); - m_attributeName.append(cc); - m_state = AttributeName; - } - break; - case AttributeName: - while (1) { - if (isWhitespace(cc)) { - m_state = AfterAttributeName; - break; - } - if (cc == '=') { - m_state = BeforeAttributeValue; - break; - } - if (cc == '>') { - emitTag(); - m_state = Data; - break; - } - if (cc == '/') { - m_state = BeforeAttributeName; - break; - } - if (cc >= 'A' && cc <= 'Z') - m_attributeName.append(cc + 0x20); - else - m_attributeName.append(cc); - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case AfterAttributeName: - if (isWhitespace(cc)) - ; - else if (cc == '=') - m_state = BeforeAttributeValue; - else if (cc == '>') { - emitTag(); - m_state = Data; - } else if (cc >= 'A' && cc <= 'Z') { - m_attributeName.clear(); - m_attributeValue.clear(); - m_attributeName.append(cc + 0x20); - m_state = AttributeName; - } else if (cc == '/') - m_state = BeforeAttributeName; - else { - m_attributeName.clear(); - m_attributeValue.clear(); - m_attributeName.append(cc); - m_state = AttributeName; - } - break; - case BeforeAttributeValue: - if (isWhitespace(cc)) - ; - else if (cc == '"') - m_state = AttributeValueDoubleQuoted; - else if (cc == '&') { - m_state = AttributeValueUnquoted; - continue; - } else if (cc == '\'') - m_state = AttributeValueSingleQuoted; - else if (cc == '>') { - emitTag(); - m_state = Data; - } else { - m_attributeValue.append(cc); - m_state = AttributeValueUnquoted; - } - break; - case AttributeValueDoubleQuoted: - while (1) { - if (cc == '"') { - processAttribute(); - m_state = BeforeAttributeName; - break; - } - if (cc == '&') { - m_stateBeforeEntityInAttributeValue = m_state; - m_state = EntityInAttributeValue; - break; - } - m_attributeValue.append(cc); - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case AttributeValueSingleQuoted: - while (1) { - if (cc == '\'') { - processAttribute(); - m_state = BeforeAttributeName; - break; - } - if (cc == '&') { - m_stateBeforeEntityInAttributeValue = m_state; - m_state = EntityInAttributeValue; - break; - } - m_attributeValue.append(cc); - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case AttributeValueUnquoted: - while (1) { - if (isWhitespace(cc)) { - processAttribute(); - m_state = BeforeAttributeName; - break; - } - if (cc == '&') { - m_stateBeforeEntityInAttributeValue = m_state; - m_state = EntityInAttributeValue; - break; - } - if (cc == '>') { - processAttribute(); - emitTag(); - m_state = Data; - break; - } - m_attributeValue.append(cc); - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case EntityInAttributeValue: - { - bool notEnoughCharacters = false; - unsigned entity = consumeEntity(m_source, notEnoughCharacters); - if (notEnoughCharacters) - return; - if (entity > 0xFFFF) { - m_attributeValue.append(U16_LEAD(entity)); - m_attributeValue.append(U16_TRAIL(entity)); - } else if (entity) - m_attributeValue.append(entity); - else - m_attributeValue.append('&'); - } - m_state = m_stateBeforeEntityInAttributeValue; - continue; - case BogusComment: - while (1) { - if (cc == '>') { - m_state = Data; - break; - } - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case MarkupDeclarationOpen: { - if (cc == '-') { - if (m_source.length() < 2) - return; - m_source.advance(); - cc = *m_source; - if (cc == '-') - m_state = CommentStart; - else { - m_state = BogusComment; - continue; - } - // If we cared about the DOCTYPE we would test to enter those states here - } else { - m_state = BogusComment; - continue; - } - break; - } - case CommentStart: - if (cc == '-') - m_state = CommentStartDash; - else if (cc == '>') - m_state = Data; - else - m_state = Comment; - break; - case CommentStartDash: - if (cc == '-') - m_state = CommentEnd; - else if (cc == '>') - m_state = Data; - else - m_state = Comment; - break; - case Comment: - while (1) { - if (cc == '-') { - m_state = CommentEndDash; - break; - } - m_source.advance(); - if (m_source.isEmpty()) - return; - cc = *m_source; - } - break; - case CommentEndDash: - if (cc == '-') - m_state = CommentEnd; - else - m_state = Comment; - break; - case CommentEnd: - if (cc == '>') - m_state = Data; - else if (cc == '-') - ; - else - m_state = Comment; - break; - } - m_source.advance(); - } -} - -void LegacyPreloadScanner::processAttribute() -{ - AtomicString tag = AtomicString(m_tagName.data(), m_tagName.size()); - AtomicString attribute = AtomicString(m_attributeName.data(), m_attributeName.size()); - - String value(m_attributeValue.data(), m_attributeValue.size()); - if (tag == scriptTag || tag == imgTag) { - if (attribute == srcAttr && m_urlToLoad.isEmpty()) - m_urlToLoad = deprecatedParseURL(value); - else if (attribute == charsetAttr) - m_charset = value; - } else if (tag == linkTag) { - if (attribute == hrefAttr && m_urlToLoad.isEmpty()) - m_urlToLoad = deprecatedParseURL(value); - else if (attribute == relAttr) { - HTMLLinkElement::RelAttribute rel; - HTMLLinkElement::tokenizeRelAttribute(value, rel); - m_linkIsStyleSheet = rel.m_isStyleSheet && !rel.m_isAlternate && !rel.m_isIcon && !rel.m_isDNSPrefetch; - } else if (attribute == charsetAttr) - m_charset = value; - } -} - -inline void LegacyPreloadScanner::emitCharacter(UChar c) -{ - if (m_contentModel == CDATA && m_lastStartTag == styleTag) - tokenizeCSS(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 - switch (m_cssState) { - case CSSInitial: - if (c == '@') - m_cssState = CSSRuleStart; - else if (c == '/') - m_cssState = CSSMaybeComment; - break; - case CSSMaybeComment: - if (c == '*') - m_cssState = CSSComment; - else - m_cssState = CSSInitial; - break; - case CSSComment: - if (c == '*') - m_cssState = CSSMaybeCommentEnd; - break; - case CSSMaybeCommentEnd: - if (c == '/') - m_cssState = CSSInitial; - else if (c == '*') - ; - else - m_cssState = CSSComment; - break; - case CSSRuleStart: - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - m_cssRule.clear(); - m_cssRuleValue.clear(); - m_cssRule.append(c); - m_cssState = CSSRule; - } else - m_cssState = CSSInitial; - break; - case CSSRule: - if (isWhitespace(c)) - m_cssState = CSSAfterRule; - else if (c == ';') - m_cssState = CSSInitial; - else - m_cssRule.append(c); - break; - case CSSAfterRule: - if (isWhitespace(c)) - ; - else if (c == ';') - m_cssState = CSSInitial; - else { - m_cssState = CSSRuleValue; - m_cssRuleValue.append(c); - } - break; - case CSSRuleValue: - if (isWhitespace(c)) - m_cssState = CSSAfterRuleValue; - else if (c == ';') { - emitCSSRule(); - m_cssState = CSSInitial; - } else - m_cssRuleValue.append(c); - break; - case CSSAfterRuleValue: - if (isWhitespace(c)) - ; - else if (c == ';') { - emitCSSRule(); - m_cssState = CSSInitial; - } else { - // FIXME media rules - m_cssState = CSSInitial; - } - break; - } -} - -void LegacyPreloadScanner::emitTag() -{ - if (m_closeTag) { - m_contentModel = PCDATA; - m_cssState = CSSInitial; - clearLastCharacters(); - return; - } - - AtomicString tag(m_tagName.data(), m_tagName.size()); - m_lastStartTag = tag; - - if (tag == textareaTag || tag == titleTag) - m_contentModel = RCDATA; - else if (tag == styleTag || tag == xmpTag || tag == scriptTag || tag == iframeTag || tag == noembedTag || tag == noframesTag) - m_contentModel = CDATA; - else if (tag == noscriptTag) - // we wouldn't be here if scripts were disabled - m_contentModel = CDATA; - else if (tag == plaintextTag) - m_contentModel = PLAINTEXT; - else - m_contentModel = PCDATA; - - if (tag == bodyTag) - m_bodySeen = true; - - if (m_urlToLoad.isEmpty()) { - m_linkIsStyleSheet = false; - return; - } - - if (tag == scriptTag) - m_document->docLoader()->preload(CachedResource::Script, m_urlToLoad, m_charset, scanningBody()); - else if (tag == imgTag) - m_document->docLoader()->preload(CachedResource::ImageResource, m_urlToLoad, String(), scanningBody()); - else if (tag == linkTag && m_linkIsStyleSheet) - m_document->docLoader()->preload(CachedResource::CSSStyleSheet, m_urlToLoad, m_charset, scanningBody()); - - m_urlToLoad = String(); - m_charset = String(); - m_linkIsStyleSheet = false; -} - -void LegacyPreloadScanner::emitCSSRule() -{ - String rule(m_cssRule.data(), m_cssRule.size()); - if (equalIgnoringCase(rule, "import") && !m_cssRuleValue.isEmpty()) { - String value(m_cssRuleValue.data(), m_cssRuleValue.size()); - String url = deprecatedParseURL(value); - if (!url.isEmpty()) - m_document->docLoader()->preload(CachedResource::CSSStyleSheet, url, String(), scanningBody()); - } - m_cssRule.clear(); - m_cssRuleValue.clear(); -} - -} diff --git a/WebCore/html/LegacyPreloadScanner.h b/WebCore/html/LegacyPreloadScanner.h deleted file mode 100644 index 95710ab..0000000 --- a/WebCore/html/LegacyPreloadScanner.h +++ /dev/null @@ -1,144 +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. - */ - -#ifndef LegacyPreloadScanner_h -#define LegacyPreloadScanner_h - -#include "AtomicString.h" -#include "SegmentedString.h" -#include <wtf/Noncopyable.h> -#include <wtf/Vector.h> - -namespace WebCore { - - class CachedResource; - class CachedResourceClient; - class Document; - - class LegacyPreloadScanner : public Noncopyable { - public: - LegacyPreloadScanner(Document*); - ~LegacyPreloadScanner(); - void begin(); - void write(const SegmentedString&); - void end(); - bool inProgress() const { return m_inProgress; } - - bool scanningBody() const; - - static unsigned consumeEntity(SegmentedString&, bool& notEnoughCharacters); - - private: - void tokenize(const SegmentedString&); - void reset(); - - void emitTag(); - void emitCharacter(UChar); - - void tokenizeCSS(UChar); - void emitCSSRule(); - - void processAttribute(); - - - void clearLastCharacters(); - void rememberCharacter(UChar); - bool lastCharactersMatch(const char*, unsigned count) const; - - bool m_inProgress; - SegmentedString m_source; - - enum State { - Data, - EntityData, - TagOpen, - CloseTagOpen, - TagName, - BeforeAttributeName, - AttributeName, - AfterAttributeName, - BeforeAttributeValue, - AttributeValueDoubleQuoted, - AttributeValueSingleQuoted, - AttributeValueUnquoted, - EntityInAttributeValue, - BogusComment, - MarkupDeclarationOpen, - CommentStart, - CommentStartDash, - Comment, - CommentEndDash, - CommentEnd - }; - State m_state; - bool m_escape; - enum ContentModel { - PCDATA, - RCDATA, - CDATA, - PLAINTEXT - }; - ContentModel m_contentModel; - unsigned m_commentPos; - State m_stateBeforeEntityInAttributeValue; - - static const unsigned lastCharactersBufferSize = 8; - UChar m_lastCharacters[lastCharactersBufferSize]; - unsigned m_lastCharacterIndex; - - bool m_closeTag; - Vector<UChar, 32> m_tagName; - Vector<UChar, 32> m_attributeName; - Vector<UChar> m_attributeValue; - AtomicString m_lastStartTag; - - String m_urlToLoad; - String m_charset; - bool m_linkIsStyleSheet; - - enum CSSState { - CSSInitial, - CSSMaybeComment, - CSSComment, - CSSMaybeCommentEnd, - CSSRuleStart, - CSSRule, - CSSAfterRule, - CSSRuleValue, - CSSAfterRuleValue - }; - CSSState m_cssState; - Vector<UChar, 16> m_cssRule; - Vector<UChar> m_cssRuleValue; - - double m_timeUsed; - - bool m_bodySeen; - Document* m_document; - }; - -} - -#endif diff --git a/WebCore/html/ThreadableBlobRegistry.cpp b/WebCore/html/ThreadableBlobRegistry.cpp new file mode 100644 index 0000000..1df290d --- /dev/null +++ b/WebCore/html/ThreadableBlobRegistry.cpp @@ -0,0 +1,96 @@ +/* + * 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 "ThreadableBlobRegistry.h" + +#include "BlobData.h" +#include "BlobRegistry.h" +#include "CrossThreadTask.h" +#include "NotImplemented.h" +#include "ScriptExecutionContext.h" +#include "WorkerContext.h" +#include "WorkerLoaderProxy.h" +#include "WorkerThread.h" + +namespace WebCore { + +static void postTaskToMainThread(ScriptExecutionContext* scriptExecutionContext, PassOwnPtr<ScriptExecutionContext::Task> task) +{ +#if ENABLE(WORKERS) + ASSERT(scriptExecutionContext->isWorkerContext()); + WorkerLoaderProxy& proxy = static_cast<WorkerContext*>(scriptExecutionContext)->thread()->workerLoaderProxy(); + proxy.postTaskToLoader(task); +#else + notImplemented(); +#endif +} + +static void registerBlobURLTask(ScriptExecutionContext*, const KURL& url, PassOwnPtr<BlobData> blobData) +{ + BlobRegistry::instance().registerBlobURL(url, blobData); +} + +void ThreadableBlobRegistry::registerBlobURL(ScriptExecutionContext* scriptExecutionContext, const KURL& url, PassOwnPtr<BlobData> blobData) +{ + if (scriptExecutionContext->isWorkerContext()) + postTaskToMainThread(scriptExecutionContext, createCallbackTask(®isterBlobURLTask, url, blobData)); + else + registerBlobURLTask(scriptExecutionContext, url, blobData); +} + +static void registerBlobURLFromTask(ScriptExecutionContext*, const KURL& url, const KURL& srcURL) +{ + BlobRegistry::instance().registerBlobURL(url, srcURL); +} + +void ThreadableBlobRegistry::registerBlobURL(ScriptExecutionContext* scriptExecutionContext, const KURL& url, const KURL& srcURL) +{ + if (scriptExecutionContext->isWorkerContext()) + postTaskToMainThread(scriptExecutionContext, createCallbackTask(®isterBlobURLFromTask, url, srcURL)); + else + registerBlobURLFromTask(scriptExecutionContext, url, srcURL); +} + +static void unregisterBlobURLTask(ScriptExecutionContext*, const KURL& url) +{ + BlobRegistry::instance().unregisterBlobURL(url); +} + +void ThreadableBlobRegistry::unregisterBlobURL(ScriptExecutionContext* scriptExecutionContext, const KURL& url) +{ + if (scriptExecutionContext->isWorkerContext()) + postTaskToMainThread(scriptExecutionContext, createCallbackTask(&unregisterBlobURLTask, url)); + else + unregisterBlobURLTask(scriptExecutionContext, url); +} + +} // namespace WebCore diff --git a/WebCore/html/ThreadableBlobRegistry.h b/WebCore/html/ThreadableBlobRegistry.h new file mode 100644 index 0000000..7dce6bb --- /dev/null +++ b/WebCore/html/ThreadableBlobRegistry.h @@ -0,0 +1,51 @@ +/* + * 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 ThreadableBlobRegistry_h +#define ThreadableBlobRegistry_h + +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +class BlobData; +class KURL; +class ScriptExecutionContext; + +class ThreadableBlobRegistry { +public: + static void registerBlobURL(ScriptExecutionContext*, const KURL&, PassOwnPtr<BlobData>); + static void registerBlobURL(ScriptExecutionContext*, const KURL&, const KURL& srcURL); + static void unregisterBlobURL(ScriptExecutionContext*, const KURL&); +}; + +} // namespace WebCore + +#endif // ThreadableBlobRegistry_h diff --git a/WebCore/html/canvas/CanvasPattern.cpp b/WebCore/html/canvas/CanvasPattern.cpp index 62a4620..818d7d3 100644 --- a/WebCore/html/canvas/CanvasPattern.cpp +++ b/WebCore/html/canvas/CanvasPattern.cpp @@ -57,7 +57,7 @@ void CanvasPattern::parseRepetitionType(const String& type, bool& repeatX, bool& ec = SYNTAX_ERR; } -CanvasPattern::CanvasPattern(Image* image, bool repeatX, bool repeatY, bool originClean) +CanvasPattern::CanvasPattern(PassRefPtr<Image> image, bool repeatX, bool repeatY, bool originClean) : m_pattern(Pattern::create(image, repeatX, repeatY)) , m_originClean(originClean) { diff --git a/WebCore/html/canvas/CanvasPattern.h b/WebCore/html/canvas/CanvasPattern.h index 91e0794..58848a9 100644 --- a/WebCore/html/canvas/CanvasPattern.h +++ b/WebCore/html/canvas/CanvasPattern.h @@ -41,7 +41,7 @@ namespace WebCore { public: static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&); - static PassRefPtr<CanvasPattern> create(Image* image, bool repeatX, bool repeatY, bool originClean) + static PassRefPtr<CanvasPattern> create(PassRefPtr<Image> image, bool repeatX, bool repeatY, bool originClean) { return adoptRef(new CanvasPattern(image, repeatX, repeatY, originClean)); } @@ -51,7 +51,7 @@ namespace WebCore { bool originClean() const { return m_originClean; } private: - CanvasPattern(Image*, bool repeatX, bool repeatY, bool originClean); + CanvasPattern(PassRefPtr<Image>, bool repeatX, bool repeatY, bool originClean); RefPtr<Pattern> m_pattern; bool m_originClean; diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 559ddda..58ec1d0 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -126,7 +126,7 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, bo return; if (FrameView* view = canvas->document()->view()) { if (ScrollView* rootView = view->root()) { - if (HostWindow* hostWindow = view->root()->hostWindow()) { + if (HostWindow* hostWindow = rootView->hostWindow()) { // Set up our context GraphicsContext3D::Attributes attr; attr.stencil = true; @@ -167,8 +167,8 @@ void CanvasRenderingContext2D::reset() } CanvasRenderingContext2D::State::State() - : m_strokeStyle(CanvasStyle::create(Color::black)) - , m_fillStyle(CanvasStyle::create(Color::black)) + : m_strokeStyle(CanvasStyle::createFromRGBA(Color::black)) + , m_fillStyle(CanvasStyle::createFromRGBA(Color::black)) , m_lineWidth(1) , m_lineCap(ButtCap) , m_lineJoin(MiterJoin) @@ -550,82 +550,82 @@ void CanvasRenderingContext2D::setStrokeColor(const String& color) { if (color == state().m_unparsedStrokeColor) return; - setStrokeStyle(CanvasStyle::create(color)); + setStrokeStyle(CanvasStyle::createFromString(color)); state().m_unparsedStrokeColor = color; } void CanvasRenderingContext2D::setStrokeColor(float grayLevel) { - if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, 1.0f)) + if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, 1.0f)) return; - setStrokeStyle(CanvasStyle::create(grayLevel, 1)); + setStrokeStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f)); } void CanvasRenderingContext2D::setStrokeColor(const String& color, float alpha) { - setStrokeStyle(CanvasStyle::create(color, alpha)); + setStrokeStyle(CanvasStyle::createFromStringWithOverrideAlpha(color, alpha)); } void CanvasRenderingContext2D::setStrokeColor(float grayLevel, float alpha) { - if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, alpha)) + if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, alpha)) return; - setStrokeStyle(CanvasStyle::create(grayLevel, alpha)); + setStrokeStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, alpha)); } void CanvasRenderingContext2D::setStrokeColor(float r, float g, float b, float a) { - if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(r, g, b, a)) + if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentRGBA(r, g, b, a)) return; - setStrokeStyle(CanvasStyle::create(r, g, b, a)); + setStrokeStyle(CanvasStyle::createFromRGBAChannels(r, g, b, a)); } void CanvasRenderingContext2D::setStrokeColor(float c, float m, float y, float k, float a) { - if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentColor(c, m, y, k, a)) + if (state().m_strokeStyle && state().m_strokeStyle->isEquivalentCMYKA(c, m, y, k, a)) return; - setStrokeStyle(CanvasStyle::create(c, m, y, k, a)); + setStrokeStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a)); } void CanvasRenderingContext2D::setFillColor(const String& color) { if (color == state().m_unparsedFillColor) return; - setFillStyle(CanvasStyle::create(color)); + setFillStyle(CanvasStyle::createFromString(color)); state().m_unparsedFillColor = color; } void CanvasRenderingContext2D::setFillColor(float grayLevel) { - if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, 1.0f)) + if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, 1.0f)) return; - setFillStyle(CanvasStyle::create(grayLevel, 1)); + setFillStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, 1.0f)); } void CanvasRenderingContext2D::setFillColor(const String& color, float alpha) { - setFillStyle(CanvasStyle::create(color, alpha)); + setFillStyle(CanvasStyle::createFromStringWithOverrideAlpha(color, alpha)); } void CanvasRenderingContext2D::setFillColor(float grayLevel, float alpha) { - if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(grayLevel, grayLevel, grayLevel, alpha)) + if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(grayLevel, grayLevel, grayLevel, alpha)) return; - setFillStyle(CanvasStyle::create(grayLevel, alpha)); + setFillStyle(CanvasStyle::createFromGrayLevelWithAlpha(grayLevel, alpha)); } void CanvasRenderingContext2D::setFillColor(float r, float g, float b, float a) { - if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(r, g, b, a)) + if (state().m_fillStyle && state().m_fillStyle->isEquivalentRGBA(r, g, b, a)) return; - setFillStyle(CanvasStyle::create(r, g, b, a)); + setFillStyle(CanvasStyle::createFromRGBAChannels(r, g, b, a)); } void CanvasRenderingContext2D::setFillColor(float c, float m, float y, float k, float a) { - if (state().m_fillStyle && state().m_fillStyle->isEquivalentColor(c, m, y, k, a)) + if (state().m_fillStyle && state().m_fillStyle->isEquivalentCMYKA(c, m, y, k, a)) return; - setFillStyle(CanvasStyle::create(c, m, y, k, a)); + setFillStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a)); } void CanvasRenderingContext2D::beginPath() @@ -825,8 +825,16 @@ void CanvasRenderingContext2D::stroke() c->beginPath(); c->addPath(m_path); +#if PLATFORM(QT) + // Fast approximation of the stroke's bounding rect. + // This yields a slightly oversized rect but is very fast + // compared to Path::strokeBoundingRect(). + FloatRect boundingRect = m_path.platformPath().controlPointRect(); + boundingRect.inflate(state().m_miterLimit + state().m_lineWidth); +#else CanvasStrokeStyleApplier strokeApplier(this); FloatRect boundingRect = m_path.strokeBoundingRect(&strokeApplier); +#endif willDraw(boundingRect); c->strokePath(); @@ -1264,7 +1272,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const sourceCanvas->makeRenderingResultsAvailable(); - c->drawImage(buffer->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); + c->drawImageBuffer(buffer, DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); willDraw(destRect); // This call comes after drawImage, since the buffer we draw into may be our own, and we need to make sure it is dirty. // FIXME: Arguably willDraw should become didDraw and occur after drawing calls and not before them to avoid problems like this. } @@ -1464,7 +1472,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElem CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, ec); if (ec) return 0; - return CanvasPattern::create(canvas->buffer()->image(), repeatX, repeatY, canvas->originClean()); + return CanvasPattern::create(canvas->copiedImage(), repeatX, repeatY, canvas->originClean()); } void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options) @@ -1820,7 +1828,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo maskImageContext->drawBidiText(font, textRun, location); c->save(); - c->clipToImageBuffer(maskRect, maskImage.get()); + c->clipToImageBuffer(maskImage.get(), maskRect); drawStyle->applyFillColor(c); c->fillRect(maskRect); c->restore(); diff --git a/WebCore/html/canvas/CanvasStyle.cpp b/WebCore/html/canvas/CanvasStyle.cpp index 52b31c8..fd3c6e5 100644 --- a/WebCore/html/canvas/CanvasStyle.cpp +++ b/WebCore/html/canvas/CanvasStyle.cpp @@ -55,12 +55,6 @@ CanvasStyle::CanvasStyle(RGBA32 rgba) { } -CanvasStyle::CanvasStyle(float grayLevel) - : m_type(RGBA) - , m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f)) -{ -} - CanvasStyle::CanvasStyle(float grayLevel, float alpha) : m_type(RGBA) , m_rgba(makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha)) @@ -92,7 +86,7 @@ CanvasStyle::CanvasStyle(PassRefPtr<CanvasPattern> pattern) { } -PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color) +PassRefPtr<CanvasStyle> CanvasStyle::createFromString(const String& color) { RGBA32 rgba; if (!CSSParser::parseColor(rgba, color)) @@ -100,7 +94,7 @@ PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color) return adoptRef(new CanvasStyle(rgba)); } -PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color, float alpha) +PassRefPtr<CanvasStyle> CanvasStyle::createFromStringWithOverrideAlpha(const String& color, float alpha) { RGBA32 rgba; if (!CSSParser::parseColor(rgba, color)) @@ -108,13 +102,13 @@ PassRefPtr<CanvasStyle> CanvasStyle::create(const String& color, float alpha) return adoptRef(new CanvasStyle(colorWithOverrideAlpha(rgba, alpha))); } -PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasGradient> gradient) +PassRefPtr<CanvasStyle> CanvasStyle::createFromGradient(PassRefPtr<CanvasGradient> gradient) { if (!gradient) return 0; return adoptRef(new CanvasStyle(gradient)); } -PassRefPtr<CanvasStyle> CanvasStyle::create(PassRefPtr<CanvasPattern> pattern) +PassRefPtr<CanvasStyle> CanvasStyle::createFromPattern(PassRefPtr<CanvasPattern> pattern) { if (!pattern) return 0; @@ -144,7 +138,7 @@ bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const return false; } -bool CanvasStyle::isEquivalentColor(float r, float g, float b, float a) const +bool CanvasStyle::isEquivalentRGBA(float r, float g, float b, float a) const { if (m_type != RGBA) return false; @@ -152,7 +146,7 @@ bool CanvasStyle::isEquivalentColor(float r, float g, float b, float a) const return m_rgba == makeRGBA32FromFloats(r, g, b, a); } -bool CanvasStyle::isEquivalentColor(float c, float m, float y, float k, float a) const +bool CanvasStyle::isEquivalentCMYKA(float c, float m, float y, float k, float a) const { if (m_type != CMYKA) return false; diff --git a/WebCore/html/canvas/CanvasStyle.h b/WebCore/html/canvas/CanvasStyle.h index 8e47e63..3ca760a 100644 --- a/WebCore/html/canvas/CanvasStyle.h +++ b/WebCore/html/canvas/CanvasStyle.h @@ -38,15 +38,14 @@ namespace WebCore { class CanvasStyle : public RefCounted<CanvasStyle> { public: - static PassRefPtr<CanvasStyle> create(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); } - static PassRefPtr<CanvasStyle> create(const String& color); - static PassRefPtr<CanvasStyle> create(const String& color, float alpha); - static PassRefPtr<CanvasStyle> create(float grayLevel) { return adoptRef(new CanvasStyle(grayLevel)); } - static PassRefPtr<CanvasStyle> create(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); } - static PassRefPtr<CanvasStyle> create(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); } - static PassRefPtr<CanvasStyle> create(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); } - static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasGradient> gradient); - static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasPattern> pattern); + static PassRefPtr<CanvasStyle> createFromRGBA(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); } + static PassRefPtr<CanvasStyle> createFromString(const String& color); + static PassRefPtr<CanvasStyle> createFromStringWithOverrideAlpha(const String& color, float alpha); + static PassRefPtr<CanvasStyle> createFromGrayLevelWithAlpha(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); } + static PassRefPtr<CanvasStyle> createFromRGBAChannels(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); } + static PassRefPtr<CanvasStyle> createFromCMYKAChannels(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); } + static PassRefPtr<CanvasStyle> createFromGradient(PassRefPtr<CanvasGradient>); + static PassRefPtr<CanvasStyle> createFromPattern(PassRefPtr<CanvasPattern>); String color() const { return Color(m_rgba).serialized(); } CanvasGradient* canvasGradient() const { return m_gradient.get(); } @@ -56,12 +55,11 @@ namespace WebCore { void applyStrokeColor(GraphicsContext*); bool isEquivalentColor(const CanvasStyle&) const; - bool isEquivalentColor(float r, float g, float b, float a) const; - bool isEquivalentColor(float c, float m, float y, float k, float a) const; + bool isEquivalentRGBA(float r, float g, float b, float a) const; + bool isEquivalentCMYKA(float c, float m, float y, float k, float a) const; private: CanvasStyle(RGBA32 rgba); - CanvasStyle(float grayLevel); CanvasStyle(float grayLevel, float alpha); CanvasStyle(float r, float g, float b, float a); CanvasStyle(float c, float m, float y, float k, float a); diff --git a/WebCore/html/canvas/WebGLObject.cpp b/WebCore/html/canvas/WebGLObject.cpp index 6a34269..5fd5534 100644 --- a/WebCore/html/canvas/WebGLObject.cpp +++ b/WebCore/html/canvas/WebGLObject.cpp @@ -35,8 +35,9 @@ namespace WebCore { WebGLObject::WebGLObject(WebGLRenderingContext* context) : m_object(0) - , m_shouldDeleteObject(true) , m_context(context) + , m_attachmentCount(0) + , m_deleted(false) { } @@ -46,27 +47,26 @@ WebGLObject::~WebGLObject() m_context->removeObject(this); } -void WebGLObject::setObject(Platform3DObject object, bool shouldDeleteObject) +void WebGLObject::setObject(Platform3DObject object) { if (object == m_object) return; deleteObject(); m_object = object; - m_shouldDeleteObject = shouldDeleteObject; } void WebGLObject::deleteObject() { if (m_object) { - if (m_shouldDeleteObject) - if (m_context) { - m_context->graphicsContext3D()->makeContextCurrent(); - deleteObjectImpl(m_object); - } - m_object = 0; + if (m_context) { + m_context->graphicsContext3D()->makeContextCurrent(); + deleteObjectImpl(m_object); + } + if (!m_attachmentCount) + m_object = 0; + m_deleted = true; } - m_shouldDeleteObject = true; } } diff --git a/WebCore/html/canvas/WebGLObject.h b/WebCore/html/canvas/WebGLObject.h index b66311f..18d4cf9 100644 --- a/WebCore/html/canvas/WebGLObject.h +++ b/WebCore/html/canvas/WebGLObject.h @@ -40,7 +40,7 @@ public: virtual ~WebGLObject(); Platform3DObject object() const { return m_object; } - void setObject(Platform3DObject, bool shouldDeleteObject = true); + void setObject(Platform3DObject); void deleteObject(); void detachContext() @@ -58,20 +58,25 @@ public: virtual bool isShader() const { return false; } virtual bool isTexture() const { return false; } + void onAttached() { ++m_attachmentCount; } + void onDetached() + { + if (m_attachmentCount) + --m_attachmentCount; + if (!m_attachmentCount && m_deleted) + m_object = 0; + } + unsigned getAttachmentCount() { return m_attachmentCount; } + protected: WebGLObject(WebGLRenderingContext*); virtual void deleteObjectImpl(Platform3DObject) = 0; private: Platform3DObject m_object; - // The shouldDeleteObject flag indicates whether this wrapper - // owns the underlying resource and should delete it when the - // wrapper is unreferenced for the last time and deleted. It - // is only set to false for certain objects returned from get - // queries. FIXME: should consider canonicalizing all of these - // objects in the future. - bool m_shouldDeleteObject; WebGLRenderingContext* m_context; + unsigned m_attachmentCount; + bool m_deleted; }; } // namespace WebCore diff --git a/WebCore/html/canvas/WebGLProgram.cpp b/WebCore/html/canvas/WebGLProgram.cpp index 846b171..8cf3c42 100644 --- a/WebCore/html/canvas/WebGLProgram.cpp +++ b/WebCore/html/canvas/WebGLProgram.cpp @@ -45,9 +45,15 @@ WebGLProgram::WebGLProgram(WebGLRenderingContext* ctx) setObject(context()->graphicsContext3D()->createProgram()); } -void WebGLProgram::deleteObjectImpl(Platform3DObject object) +void WebGLProgram::deleteObjectImpl(Platform3DObject obj) { - context()->graphicsContext3D()->deleteProgram(object); + context()->graphicsContext3D()->deleteProgram(obj); + if (!object()) { + if (m_vertexShader) + m_vertexShader->onDetached(); + if (m_fragmentShader) + m_fragmentShader->onDetached(); + } } bool WebGLProgram::cacheActiveAttribLocations() @@ -94,6 +100,58 @@ bool WebGLProgram::isUsingVertexAttrib0() const return false; } +WebGLShader* WebGLProgram::getAttachedShader(GraphicsContext3D::WebGLEnumType type) +{ + switch (type) { + case GraphicsContext3D::VERTEX_SHADER: + return m_vertexShader.get(); + case GraphicsContext3D::FRAGMENT_SHADER: + return m_fragmentShader.get(); + default: + return 0; + } +} + +bool WebGLProgram::attachShader(WebGLShader* shader) +{ + if (!shader || !shader->object()) + return false; + switch (shader->getType()) { + case GraphicsContext3D::VERTEX_SHADER: + if (m_vertexShader) + return false; + m_vertexShader = shader; + return true; + case GraphicsContext3D::FRAGMENT_SHADER: + if (m_fragmentShader) + return false; + m_fragmentShader = shader; + return true; + default: + return false; + } +} + +bool WebGLProgram::detachShader(WebGLShader* shader) +{ + if (!shader || !shader->object()) + return false; + switch (shader->getType()) { + case GraphicsContext3D::VERTEX_SHADER: + if (m_vertexShader != shader) + return false; + m_vertexShader = 0; + return true; + case GraphicsContext3D::FRAGMENT_SHADER: + if (m_fragmentShader != shader) + return false; + m_fragmentShader = 0; + return true; + default: + return false; + } +} + } #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/html/canvas/WebGLProgram.h b/WebCore/html/canvas/WebGLProgram.h index 0156938..e5548eb 100644 --- a/WebCore/html/canvas/WebGLProgram.h +++ b/WebCore/html/canvas/WebGLProgram.h @@ -28,6 +28,8 @@ #include "WebGLObject.h" +#include "WebGLShader.h" + #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> @@ -54,6 +56,10 @@ public: bool isLinkFailureFlagSet() const { return m_linkFailure; } void setLinkFailureFlag(bool failed) { m_linkFailure = failed; } + WebGLShader* getAttachedShader(GraphicsContext3D::WebGLEnumType); + bool attachShader(WebGLShader*); + bool detachShader(WebGLShader*); + protected: WebGLProgram(WebGLRenderingContext*); @@ -65,6 +71,9 @@ private: Vector<int> m_activeAttribLocations; bool m_linkFailure; + + RefPtr<WebGLShader> m_vertexShader; + RefPtr<WebGLShader> m_fragmentShader; }; } // namespace WebCore diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp index 0284ec6..4465833 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -158,27 +158,11 @@ void WebGLRenderingContext::markContextChanged() void WebGLRenderingContext::paintRenderingResultsToCanvas() { - if (m_markedCanvasDirty) { - // FIXME: It should not be necessary to clear the image before doing a readback. - // Investigate why this is needed and remove if possible. - canvas()->buffer()->clearImage(); - m_markedCanvasDirty = false; - m_context->paintRenderingResultsToCanvas(this); - } -} - -void WebGLRenderingContext::beginPaint() -{ - if (m_markedCanvasDirty) - m_context->beginPaint(this); -} - -void WebGLRenderingContext::endPaint() -{ - if (m_markedCanvasDirty) { - m_markedCanvasDirty = false; - m_context->endPaint(); - } + if (!m_markedCanvasDirty) + return; + canvas()->clearCopiedImage(); + m_markedCanvasDirty = false; + m_context->paintRenderingResultsToCanvas(this); } void WebGLRenderingContext::reshape(int width, int height) @@ -191,7 +175,9 @@ void WebGLRenderingContext::reshape(int width, int height) #endif m_needsUpdate = false; } - + + // We don't have to mark the canvas as dirty, since the newly created image buffer will also start off + // clear (and this matches what reshape will do). m_context->reshape(width, height); } @@ -217,7 +203,12 @@ void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* sha UNUSED_PARAM(ec); if (!validateWebGLObject(program) || !validateWebGLObject(shader)) return; + if (!program->attachShader(shader)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } m_context->attachShader(objectOrZero(program), objectOrZero(shader)); + shader->onAttached(); cleanupAfterGraphicsCall(false); } @@ -521,6 +512,9 @@ void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, uns { if (!validateTexFuncParameters(target, level, internalformat, width, height, border, internalformat, GraphicsContext3D::UNSIGNED_BYTE)) return; + WebGLTexture* tex = validateTextureBinding(target, true); + if (!tex) + return; if (!isGLES2Compliant()) { if (m_framebufferBinding && m_framebufferBinding->object() && !isTexInternalFormatColorBufferCombinationValid(internalformat, @@ -535,21 +529,20 @@ void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, uns } m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); // FIXME: if the framebuffer is not complete, none of the below should be executed. - WebGLTexture* tex = getTextureBinding(target); - if (!isGLES2Compliant()) { - if (tex) - tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE); - } - if (m_framebufferBinding && tex) + if (!isGLES2Compliant()) + tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE); + if (m_framebufferBinding) m_framebufferBinding->onAttachedObjectChange(tex); cleanupAfterGraphicsCall(false); } void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) { + WebGLTexture* tex = validateTextureBinding(target, true); + if (!tex) + return; if (!isGLES2Compliant()) { - WebGLTexture* tex = getTextureBinding(target); - if (m_framebufferBinding && m_framebufferBinding->object() && tex + if (m_framebufferBinding && m_framebufferBinding->object() && !isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(), m_framebufferBinding->getColorBufferFormat())) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); @@ -648,7 +641,12 @@ void WebGLRenderingContext::deleteProgram(WebGLProgram* program) { if (!program) return; - + if (program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + if (!program->object()) + return; program->deleteObject(); } @@ -703,7 +701,12 @@ void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* sha UNUSED_PARAM(ec); if (!validateWebGLObject(program) || !validateWebGLObject(shader)) return; + if (!program->detachShader(shader)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } m_context->detachShader(objectOrZero(program), objectOrZero(shader)); + shader->onDetached(); cleanupAfterGraphicsCall(false); } @@ -890,7 +893,7 @@ bool WebGLRenderingContext::validateRenderingState(long numElementsRequired) bool WebGLRenderingContext::validateWebGLObject(WebGLObject* object) { - if (!object) { + if (!object || !object->object()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return false; } @@ -1110,22 +1113,18 @@ void WebGLRenderingContext::frontFace(unsigned long mode) void WebGLRenderingContext::generateMipmap(unsigned long target) { - RefPtr<WebGLTexture> tex; + WebGLTexture* tex = validateTextureBinding(target, false); + if (!tex) + return; if (!isGLES2Compliant()) { - if (target == GraphicsContext3D::TEXTURE_2D) - tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; - else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) - tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; - if (tex && !tex->canGenerateMipmaps()) { + if (!tex->canGenerateMipmaps()) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } } m_context->generateMipmap(target); - if (!isGLES2Compliant()) { - if (tex) - tex->generateMipmapLevelInfo(); - } + if (!isGLES2Compliant()) + tex->generateMipmapLevelInfo(); cleanupAfterGraphicsCall(false); } @@ -1574,11 +1573,9 @@ String WebGLRenderingContext::getString(unsigned long name) WebGLGetInfo WebGLRenderingContext::getTexParameter(unsigned long target, unsigned long pname, ExceptionCode& ec) { UNUSED_PARAM(ec); - if (target != GraphicsContext3D::TEXTURE_2D - && target != GraphicsContext3D::TEXTURE_CUBE_MAP) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + WebGLTexture* tex = validateTextureBinding(target, false); + if (!tex) return WebGLGetInfo(); - } WebGLStateRestorer(this, false); int value = 0; switch (pname) { @@ -1886,21 +1883,7 @@ void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec if (!validateWebGLObject(program)) return; if (!isGLES2Compliant()) { - Vector<WebGLShader*> shaders; - bool succeed = getAttachedShaders(program, shaders, ec); - if (succeed) { - bool vShader = false; - bool fShader = false; - for (size_t ii = 0; ii < shaders.size() && (!vShader || !fShader); ++ii) { - if (shaders[ii]->getType() == GraphicsContext3D::VERTEX_SHADER) - vShader = true; - else if (shaders[ii]->getType() == GraphicsContext3D::FRAGMENT_SHADER) - fShader = true; - } - if (!vShader || !fShader) - succeed = false; - } - if (!succeed) { + if (!program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER) || !program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER)) { program->setLinkFailureFlag(true); return; } @@ -2100,6 +2083,9 @@ void WebGLRenderingContext::texImage2DBase(unsigned target, unsigned level, unsi ec = 0; if (!validateTexFuncParameters(target, level, internalformat, width, height, border, format, type)) return; + WebGLTexture* tex = validateTextureBinding(target, true); + if (!tex) + return; if (!isGLES2Compliant()) { if (level && WebGLTexture::isNPOT(width, height)) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); @@ -2108,12 +2094,9 @@ void WebGLRenderingContext::texImage2DBase(unsigned target, unsigned level, unsi } m_context->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); - WebGLTexture* tex = getTextureBinding(target); - if (!isGLES2Compliant()) { - if (tex) - tex->setLevelInfo(target, level, internalformat, width, height, type); - } - if (m_framebufferBinding && tex) + if (!isGLES2Compliant()) + tex->setLevelInfo(target, level, internalformat, width, height, type); + if (m_framebufferBinding) m_framebufferBinding->onAttachedObjectChange(tex); cleanupAfterGraphicsCall(false); } @@ -2200,7 +2183,8 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texImage2DImpl(target, level, internalformat, format, type, canvas->buffer()->image(), + + texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec); } @@ -2219,130 +2203,12 @@ void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned cleanupAfterGraphicsCall(false); } -// Obsolete texImage2D entry points -- to be removed shortly. (FIXME) - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, - ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, ImageData pixels)"); - texImage2D(target, level, pixels, 0, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, - bool flipY, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, ImageData pixels, GLboolean flipY)"); - texImage2D(target, level, pixels, flipY, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - 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, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, premultiplyAlpha, 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); -} - - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, - ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLImageElement image)"); - texImage2D(target, level, image, 0, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, - bool flipY, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLImageElement image, GLboolean flipY)"); - texImage2D(target, level, image, flipY, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLImageElement image, GLboolean flipY, GLboolean premultiplyAlpha)"); - ec = 0; - if (!image || !image->cachedImage()) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); - return; - } - texImage2DImpl(target, level, GraphicsContext3D::RGBA, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, image->cachedImage()->image(), flipY, premultiplyAlpha, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLCanvasElement canvas)"); - texImage2D(target, level, canvas, 0, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - bool flipY, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLCanvasElement canvas, GLboolean flipY)"); - texImage2D(target, level, canvas, flipY, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texImage2D(GLenum target, GLint level, HTMLCanvasElement canvas, GLboolean flipY, GLboolean premultiplyAlpha)"); - ec = 0; - if (!canvas || !canvas->buffer()) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); - return; - } - texImage2DImpl(target, level, GraphicsContext3D::RGBA, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, canvas->buffer()->image(), flipY, premultiplyAlpha, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - ExceptionCode& ec) -{ - texImage2D(target, level, video, 0, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - bool flipY, ExceptionCode& ec) -{ - texImage2D(target, level, video, flipY, 0, ec); -} - -void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: Need implement this call - UNUSED_PARAM(target); - UNUSED_PARAM(level); - UNUSED_PARAM(video); - UNUSED_PARAM(flipY); - UNUSED_PARAM(premultiplyAlpha); - - ec = 0; - cleanupAfterGraphicsCall(false); -} - void WebGLRenderingContext::texParameter(unsigned long target, unsigned long pname, float paramf, int parami, bool isFloat) { + WebGLTexture* tex = validateTextureBinding(target, false); + if (!tex) + return; if (!isGLES2Compliant()) { - RefPtr<WebGLTexture> tex = 0; - switch (target) { - case GraphicsContext3D::TEXTURE_2D: - tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; - break; - case GraphicsContext3D::TEXTURE_CUBE_MAP: - tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; - break; - default: - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); - return; - } switch (pname) { case GraphicsContext3D::TEXTURE_MIN_FILTER: case GraphicsContext3D::TEXTURE_MAG_FILTER: @@ -2359,12 +2225,10 @@ void WebGLRenderingContext::texParameter(unsigned long target, unsigned long pna m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return; } - if (tex) { - if (isFloat) - tex->setParameterf(pname, paramf); - else - tex->setParameteri(pname, parami); - } + if (isFloat) + tex->setParameterf(pname, paramf); + else + tex->setParameteri(pname, parami); } if (isFloat) m_context->texParameterf(target, pname, paramf); @@ -2391,7 +2255,8 @@ void WebGLRenderingContext::texSubImage2DBase(unsigned target, unsigned level, u ec = 0; if (!validateTexFuncFormatAndType(format, type)) return; - + if (!validateTextureBinding(target, true)) + return; m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -2469,7 +2334,8 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); return; } - texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->buffer()->image(), + + texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec); } @@ -2488,117 +2354,6 @@ void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsig cleanupAfterGraphicsCall(false); } -// Obsolete texSubImage2D entry points -- to be removed shortly. (FIXME) - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - ImageData* pixels, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ImageData pixels)"); - texSubImage2D(target, level, xoffset, yoffset, pixels, 0, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - ImageData* pixels, bool flipY, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ImageData pixels, GLboolean flipY)"); - texSubImage2D(target, level, xoffset, yoffset, pixels, flipY, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - 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, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, flipY, premultiplyAlpha, 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); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLImageElement* image, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLImageElement image)"); - texSubImage2D(target, level, xoffset, yoffset, image, 0, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLImageElement* image, bool flipY, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLImageElement image, GLboolean flipY)"); - texSubImage2D(target, level, xoffset, yoffset, image, flipY, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLImageElement image, GLboolean flipY, GLboolean premultiplyAlpha)"); - ec = 0; - if (!image || !image->cachedImage()) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); - return; - } - texSubImage2DImpl(target, level, xoffset, yoffset, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, image->cachedImage()->image(), - flipY, premultiplyAlpha, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLCanvasElement* canvas, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLCanvasElement canvas)"); - texSubImage2D(target, level, xoffset, yoffset, canvas, 0, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLCanvasElement* canvas, bool flipY, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLCanvasElement canvas, GLboolean flipY)"); - texSubImage2D(target, level, xoffset, yoffset, canvas, flipY, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - printWarningToConsole("Calling obsolete texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, HTMLCanvasElement canvas, GLboolean flipY, GLboolean premultiplyAlpha)"); - ec = 0; - if (!canvas || !canvas->buffer()) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); - return; - } - texSubImage2DImpl(target, level, xoffset, yoffset, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, canvas->buffer()->image(), - flipY, premultiplyAlpha, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLVideoElement* video, ExceptionCode& ec) -{ - texSubImage2D(target, level, xoffset, yoffset, video, 0, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLVideoElement* video, bool flipY, ExceptionCode& ec) -{ - texSubImage2D(target, level, xoffset, yoffset, video, flipY, 0, ec); -} - -void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: Need to implement this call - UNUSED_PARAM(target); - UNUSED_PARAM(level); - UNUSED_PARAM(xoffset); - UNUSED_PARAM(yoffset); - UNUSED_PARAM(video); - UNUSED_PARAM(flipY); - UNUSED_PARAM(premultiplyAlpha); - ec = 0; - cleanupAfterGraphicsCall(false); -} - void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode& ec) { UNUSED_PARAM(ec); @@ -2935,13 +2690,23 @@ void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* locatio void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec) { - UNUSED_PARAM(ec); if (program && program->context() != this) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); return; } - m_currentProgram = program; - m_context->useProgram(objectOrZero(program)); + if (program && program->object() && !getProgramParameter(program, GraphicsContext3D::LINK_STATUS, ec).getBool()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + cleanupAfterGraphicsCall(false); + return; + } + if (m_currentProgram != program) { + if (m_currentProgram) + m_currentProgram->onDetached(); + m_currentProgram = program; + m_context->useProgram(objectOrZero(program)); + if (program) + program->onAttached(); + } cleanupAfterGraphicsCall(false); } @@ -3185,7 +2950,8 @@ WebGLGetInfo WebGLRenderingContext::getUnsignedLongParameter(unsigned long pname { int value; m_context->getIntegerv(pname, &value); - return WebGLGetInfo(static_cast<unsigned long>(value)); + unsigned int uValue = static_cast<unsigned int>(value); + return WebGLGetInfo(static_cast<unsigned long>(uValue)); } WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(unsigned long pname) @@ -3309,12 +3075,12 @@ bool WebGLRenderingContext::isTexInternalFormatColorBufferCombinationValid(unsig return false; } -WebGLTexture* WebGLRenderingContext::getTextureBinding(unsigned long target) +WebGLTexture* WebGLRenderingContext::validateTextureBinding(unsigned long target, bool useSixEnumsForCubeMap) { - RefPtr<WebGLTexture> tex = 0; + WebGLTexture* tex = 0; switch (target) { case GraphicsContext3D::TEXTURE_2D: - tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding; + tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get(); break; case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X: case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X: @@ -3322,12 +3088,26 @@ WebGLTexture* WebGLRenderingContext::getTextureBinding(unsigned long target) case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: - tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding; + if (!useSixEnumsForCubeMap) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return 0; + } + tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get(); + break; + case GraphicsContext3D::TEXTURE_CUBE_MAP: + if (useSixEnumsForCubeMap) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return 0; + } + tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get(); break; + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return 0; } - if (tex && tex->object()) - return tex.get(); - return 0; + if (!tex) + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return tex; } bool WebGLRenderingContext::validateTexFuncFormatAndType(unsigned long format, unsigned long type) diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index 608797f..48fa7c8 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -206,19 +206,6 @@ public: unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&); void texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&); - // Obsolete entry points -- to be removed shortly. (FIXME) - void texImage2D(unsigned target, unsigned level, ImageData* pixels, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); void texParameterf(unsigned target, unsigned pname, float param); void texParameteri(unsigned target, unsigned pname, int param); @@ -234,19 +221,6 @@ public: unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&); void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&); - // Obsolete entry points -- to be removed shortly. (FIXME) - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); void uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode&); void uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&); @@ -305,12 +279,10 @@ public: virtual void paintRenderingResultsToCanvas(); - // Helpers for notification about paint events. - void beginPaint(); - void endPaint(); - void removeObject(WebGLObject*); + bool paintsIntoCanvasBuffer() const { return m_context->paintsIntoCanvasBuffer(); } + private: friend class WebGLObject; @@ -460,8 +432,10 @@ public: bool isTexInternalFormatColorBufferCombinationValid(unsigned long texInternalFormat, unsigned long colorBufferFormat); - // Helper function to get the current bound texture. - WebGLTexture* getTextureBinding(unsigned long target); + // Helper function to check target and texture bound to the target. + // Generate GL errors and return 0 if target is invalid or texture bound is + // null. Otherwise, return the texture bound to the target. + WebGLTexture* validateTextureBinding(unsigned long target, bool useSixEnumsForCubeMap); // Helper function to check input format/type for functions {copy}Tex{Sub}Image. // Generates GL error and returns false if parameters are invalid. diff --git a/WebCore/html/canvas/WebGLRenderingContext.idl b/WebCore/html/canvas/WebGLRenderingContext.idl index 711aa42..960dd0b 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/WebCore/html/canvas/WebGLRenderingContext.idl @@ -622,15 +622,6 @@ module html { in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException); void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException); - // Obsolete entry points -- to be removed shortly. (FIXME) - void texImage2D(in unsigned long target, in long level, in ImageData pixels, - in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); - void texImage2D(in unsigned long target, in long level, in HTMLImageElement image, - in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); - void texImage2D(in unsigned long target, in long level, in HTMLCanvasElement canvas, - in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); - void texImage2D(in unsigned long target, in long level, in HTMLVideoElement video, - in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long width, in long height, @@ -643,15 +634,6 @@ module html { in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException); void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException); - // Obsolete entry points -- to be removed shortly. (FIXME) - void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in ImageData pixels, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); - void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in HTMLImageElement image, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); - void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in HTMLCanvasElement canvas, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); - void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in HTMLVideoElement video, in [Optional] boolean flipY, in [Optional] boolean premultiplyAlpha) raises (DOMException); void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException); [Custom] void uniform1fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp index 2c50bf8..e6dfd0a 100644 --- a/WebCore/html/canvas/WebGLTexture.cpp +++ b/WebCore/html/canvas/WebGLTexture.cpp @@ -151,21 +151,22 @@ void WebGLTexture::generateMipmapLevelInfo() return; if (!canGenerateMipmaps()) return; - if (m_isComplete) - return; - for (size_t ii = 0; ii < m_info.size(); ++ii) { - const LevelInfo& info0 = m_info[ii][0]; - int width = info0.width; - int height = info0.height; - int levelCount = computeLevelCount(width, height); - for (int level = 1; level < levelCount; ++level) { - width = std::max(1, width >> 1); - height = std::max(1, height >> 1); - LevelInfo& info = m_info[ii][level]; - info.setInfo(info0.internalFormat, width, height, info0.type); + if (!m_isComplete) { + for (size_t ii = 0; ii < m_info.size(); ++ii) { + const LevelInfo& info0 = m_info[ii][0]; + int width = info0.width; + int height = info0.height; + int levelCount = computeLevelCount(width, height); + for (int level = 1; level < levelCount; ++level) { + width = std::max(1, width >> 1); + height = std::max(1, height >> 1); + LevelInfo& info = m_info[ii][level]; + info.setInfo(info0.internalFormat, width, height, info0.type); + } } + m_isComplete = true; } - m_isComplete = true; + m_needToUseBlackTexture = false; } unsigned long WebGLTexture::getInternalFormat() const diff --git a/WebCore/inspector/CodeGeneratorInspector.pm b/WebCore/inspector/CodeGeneratorInspector.pm index 9d0af53..cd9052a 100644 --- a/WebCore/inspector/CodeGeneratorInspector.pm +++ b/WebCore/inspector/CodeGeneratorInspector.pm @@ -47,30 +47,27 @@ $typeTransform{"PassRefPtr"} = { }; $typeTransform{"Object"} = { "param" => "PassRefPtr<InspectorObject>", - "retVal" => "PassRefPtr<InspectorObject>", "variable" => "RefPtr<InspectorObject>", "defaultValue" => "InspectorObject::create()", "forward" => "InspectorObject", "header" => "InspectorValues.h", - "accessorSuffix" => "" + "accessorSuffix" => "Object" }; $typeTransform{"Array"} = { "param" => "PassRefPtr<InspectorArray>", - "retVal" => "PassRefPtr<InspectorArray>", "variable" => "RefPtr<InspectorArray>", "defaultValue" => "InspectorArray::create()", "forward" => "InspectorArray", "header" => "InspectorValues.h", - "accessorSuffix" => "" + "accessorSuffix" => "Array" }; $typeTransform{"Value"} = { "param" => "PassRefPtr<InspectorValue>", - "retVal" => "PassRefPtr<InspectorValue>", "variable" => "RefPtr<InspectorValue>", "defaultValue" => "InspectorValue::null()", "forward" => "InspectorValue", "header" => "InspectorValues.h", - "accessorSuffix" => "" + "accessorSuffix" => "Value" }; $typeTransform{"String"} = { "param" => "const String&", @@ -120,7 +117,6 @@ $typeTransform{"boolean"} = { "accessorSuffix" => "Bool" }; $typeTransform{"void"} = { - "retVal" => "void", "forward" => "", "header" => "" }; @@ -142,17 +138,23 @@ my $verbose; my $namespace; my $backendClassName; +my $backendJSStubName; my %backendTypes; my %backendMethods; my @backendMethodsImpl; my $backendConstructor; +my @backendConstantDeclarations; +my @backendConstantDefinitions; my $backendFooter; +my @backendStubJS; my $frontendClassName; my %frontendTypes; my %frontendMethods; my @frontendMethodsImpl; my $frontendConstructor; +my @frontendConstantDeclarations; +my @frontendConstantDefinitions; my $frontendFooter; my $callId = new domSignature(); # it is just structure for describing parameters from IDLStructure.pm. @@ -204,11 +206,12 @@ sub GenerateInterface $frontendTypes{"PassRefPtr"} = 1; $backendClassName = $className . "BackendDispatcher"; + $backendJSStubName = $className . "BackendStub"; my @backendHead; push(@backendHead, " ${backendClassName}(InspectorController* inspectorController) : m_inspectorController(inspectorController) { }"); push(@backendHead, " void reportProtocolError(const long callId, const String& method, const String& errorText) const;"); push(@backendHead, " void dispatch(const String& message);"); - push(@backendHead, "private:"); + push(@backendHead, " static bool getCommandName(const String& message, String* result);"); $backendConstructor = join("\n", @backendHead); $backendFooter = " InspectorController* m_inspectorController;"; $backendTypes{"Controller"} = 1; @@ -216,8 +219,13 @@ sub GenerateInterface $backendTypes{"PassRefPtr"} = 1; $backendTypes{"Array"} = 1; - generateBackendPrivateFunctions(); + push(@backendMethodsImpl, generateBackendPrivateFunctions()); + push(@backendMethodsImpl, generateBackendMessageParser()); generateFunctions($interface); + + # Make dispatcher methods private on the backend. + push(@backendConstantDeclarations, ""); + push(@backendConstantDeclarations, "private:"); } sub generateFunctions @@ -225,23 +233,25 @@ sub generateFunctions my $interface = shift; foreach my $function (@{$interface->functions}) { - generateFrontendFunction($function); - generateBackendFunction($function); + if ($function->signature->extendedAttributes->{"notify"}) { + generateFrontendFunction($function); + } else { + generateBackendFunction($function); + } } push(@backendMethodsImpl, generateBackendDispatcher()); push(@backendMethodsImpl, generateBackendReportProtocolError()); + + @backendStubJS = generateBackendStubJS($interface); } sub generateFrontendFunction { my $function = shift; - my $notify = $function->signature->extendedAttributes->{"notify"}; - return if !$notify; - my $functionName = $notify ? $function->signature->name : "did" . ucfirst($function->signature->name); + my $functionName = $function->signature->name; my @argsFiltered = grep($_->direction eq "out", @{$function->parameters}); # just keep only out parameters for frontend interface. - unshift(@argsFiltered, $callId) if !$notify; # Add callId as the first argument for all frontend did* methods. map($frontendTypes{$_->type} = 1, @argsFiltered); # register required types. my $arguments = join(", ", map($typeTransform{$_->type}->{"param"} . " " . $_->name, @argsFiltered)); # prepare arguments for function signature. my @pushArguments = map(" arguments->push" . $typeTransform{$_->type}->{"accessorSuffix"} . "(" . $_->name . ");", @argsFiltered); @@ -254,7 +264,7 @@ sub generateFrontendFunction push(@function, "void ${frontendClassName}::${functionName}(${arguments})"); push(@function, "{"); push(@function, " RefPtr<InspectorArray> arguments = InspectorArray::create();"); - push(@function, " arguments->pushString(\"" . ($notify ? $functionName : "processResponse") . "\");"); + push(@function, " arguments->pushString(\"$functionName\");"); push(@function, @pushArguments); push(@function, " m_inspectorClient->sendMessageToFrontend(arguments->toJSONString());"); @@ -277,16 +287,18 @@ static String formatWrongArgumentTypeMessage(unsigned position, const char* name return String::format("Failed to convert parameter %d (%s) to %s", position, name, expectedType); } EOF - push(@backendMethodsImpl, $privateFunctions); + return split("\n", $privateFunctions); } sub generateBackendFunction { my $function = shift; - return if $function->signature->extendedAttributes->{"notify"}; my $functionName = $function->signature->name; + push(@backendConstantDeclarations, " static const char* ${functionName}Cmd;"); + push(@backendConstantDefinitions, "const char* ${backendClassName}::${functionName}Cmd = \"${functionName}\";"); + map($backendTypes{$_->type} = 1, @{$function->parameters}); # register required types my @inArgs = grep($_->direction eq "in", @{$function->parameters}); my @outArgs = grep($_->direction eq "out", @{$function->parameters}); @@ -298,7 +310,6 @@ sub generateBackendFunction my @function; push(@function, "void ${backendClassName}::${functionName}(PassRefPtr<InspectorArray> args)"); push(@function, "{"); - push(@function, " DEFINE_STATIC_LOCAL(String, backendFunctionName, (\"$functionName\"));"); push(@function, " long callId = 0;"); push(@function, ""); @@ -306,7 +317,7 @@ sub generateBackendFunction my $expectedParametersCountWithMethodName = scalar(@inArgs) + 1; push(@function, " if (args->length() != $expectedParametersCountWithMethodName) {"); push(@function, " ASSERT_NOT_REACHED();"); - push(@function, " reportProtocolError(callId, backendFunctionName, formatWrongArgumentsCountMessage(args->length() - 1, $expectedParametersCount));"); + push(@function, " reportProtocolError(callId, ${functionName}Cmd, formatWrongArgumentsCountMessage(args->length() - 1, $expectedParametersCount));"); push(@function, " return;"); push(@function, " }"); push(@function, ""); @@ -314,11 +325,11 @@ sub generateBackendFunction my $i = 1; # zero element is the method name. foreach my $parameter (@inArgs) { my $type = $parameter->type; - my $argumentType = $typeTransform{$type}->{$typeTransform{$type}->{"retVal"} ? "retVal" : "variable"}; + my $argumentType = $typeTransform{$type}->{"variable"}; push(@function, " $argumentType " . $parameter->name . ";") if !($parameter->name eq "callId"); push(@function, " if (!args->get($i)->as" . $typeTransform{$type}->{"accessorSuffix"} . "(&" . $parameter->name . ")) {"); push(@function, " ASSERT_NOT_REACHED();"); - push(@function, " reportProtocolError(callId, backendFunctionName, formatWrongArgumentTypeMessage($i, \"" . $parameter->name . "\", \"$type\"));"); + push(@function, " reportProtocolError(callId, ${functionName}Cmd, formatWrongArgumentTypeMessage($i, \"" . $parameter->name . "\", \"$type\"));"); push(@function, " return;"); push(@function, " }"); push(@function, ""); @@ -329,7 +340,7 @@ sub generateBackendFunction my $handlerAccessor = $typeTransform{$handler}->{"handlerAccessor"}; $backendTypes{$handler} = 1; push(@function, " if (!$handlerAccessor) {"); - push(@function, " reportProtocolError(callId, backendFunctionName, \"Error: $handler handler is not available.\");"); + push(@function, " reportProtocolError(callId, ${functionName}Cmd, \"Error: $handler handler is not available.\");"); push(@function, " return;"); push(@function, " }"); push(@function, ""); @@ -383,7 +394,7 @@ sub generateBackendDispatcher { my @body; my @methods = map($backendMethods{$_}, keys %backendMethods); - my @mapEntries = map(" dispatchMap.add(\"$_\", &${backendClassName}::$_);", @methods); + my @mapEntries = map(" dispatchMap.add(${_}Cmd, &${backendClassName}::$_);", @methods); my $mapEntries = join("\n", @mapEntries); my $backendDispatcherBody = << "EOF"; @@ -436,16 +447,72 @@ EOF return split("\n", $backendDispatcherBody); } +sub generateBackendMessageParser +{ + my $messageParserBody = << "EOF"; +bool ${backendClassName}::getCommandName(const String& message, String* result) +{ + RefPtr<InspectorValue> value = InspectorValue::parseJSON(message); + if (!value) + return false; + RefPtr<InspectorArray> array = value->asArray(); + if (!array) + return false; + + if (!array->length()) + return false; + return array->get(0)->asString(result); +} +EOF + return split("\n", $messageParserBody); +} + +sub generateBackendStubJS +{ + my $interface = shift; + my @backendFunctions = grep(!$_->signature->extendedAttributes->{"notify"}, @{$interface->functions}); + my @JSStubs = map(" this._registerDelegate(\"" . $_->signature->name . "\");", @backendFunctions); + + my $JSStubs = join("\n", @JSStubs); + my $inspectorBackendStubJS = << "EOF"; +$licenseTemplate + +WebInspector.InspectorBackendStub = function() +{ +$JSStubs +} + +WebInspector.InspectorBackendStub.prototype = { + _registerDelegate: function(methodName) + { + this[methodName] = this.sendMessageToBackend.bind(this, methodName); + }, + + sendMessageToBackend: function() + { + var message = JSON.stringify(Array.prototype.slice.call(arguments)); + InspectorFrontendHost.sendMessageToBackend(message); + } +} + +InspectorBackend = new WebInspector.InspectorBackendStub(); + +EOF + return split("\n", $inspectorBackendStubJS); +} + sub generateHeader { my $className = shift; my $types = shift; my $constructor = shift; + my $constants = shift; my $methods = shift; my $footer = shift; my $forwardHeaders = join("\n", sort(map("#include <" . $typeTransform{$_}->{"forwardHeader"} . ">", grep($typeTransform{$_}->{"forwardHeader"}, keys %{$types})))); my $forwardDeclarations = join("\n", sort(map("class " . $typeTransform{$_}->{"forward"} . ";", grep($typeTransform{$_}->{"forward"}, keys %{$types})))); + my $constantDeclarations = join("\n", @{$constants}); my $methodsDeclarations = join("\n", keys %{$methods}); my $headerBody = << "EOF"; @@ -465,6 +532,7 @@ class $className { public: $constructor +$constantDeclarations $methodsDeclarations private: @@ -482,6 +550,7 @@ sub generateSource { my $className = shift; my $types = shift; + my $constants = shift; my $methods = shift; my @sourceContent = split("\r", $licenseTemplate); @@ -499,6 +568,8 @@ sub generateSource push(@sourceContent, ""); push(@sourceContent, "namespace $namespace {"); push(@sourceContent, ""); + push (@sourceContent, join("\n", @{$constants})); + push(@sourceContent, ""); push(@sourceContent, @{$methods}); push(@sourceContent, ""); push(@sourceContent, "} // namespace $namespace"); @@ -513,24 +584,29 @@ sub finish my $object = shift; open(my $SOURCE, ">$outputDir/$frontendClassName.cpp") || die "Couldn't open file $outputDir/$frontendClassName.cpp"; - print $SOURCE join("\n", generateSource($frontendClassName, \%frontendTypes, \@frontendMethodsImpl)); + print $SOURCE join("\n", generateSource($frontendClassName, \%frontendTypes, \@frontendConstantDefinitions, \@frontendMethodsImpl)); close($SOURCE); undef($SOURCE); open(my $HEADER, ">$outputHeadersDir/$frontendClassName.h") || die "Couldn't open file $outputHeadersDir/$frontendClassName.h"; - print $HEADER generateHeader($frontendClassName, \%frontendTypes, $frontendConstructor, \%frontendMethods, $frontendFooter); + print $HEADER generateHeader($frontendClassName, \%frontendTypes, $frontendConstructor, \@frontendConstantDeclarations, \%frontendMethods, $frontendFooter); close($HEADER); undef($HEADER); open($SOURCE, ">$outputDir/$backendClassName.cpp") || die "Couldn't open file $outputDir/$backendClassName.cpp"; - print $SOURCE join("\n", generateSource($backendClassName, \%backendTypes, \@backendMethodsImpl)); + print $SOURCE join("\n", generateSource($backendClassName, \%backendTypes, \@backendConstantDefinitions, \@backendMethodsImpl)); close($SOURCE); undef($SOURCE); open($HEADER, ">$outputHeadersDir/$backendClassName.h") || die "Couldn't open file $outputHeadersDir/$backendClassName.h"; - print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $backendConstructor, \%backendMethods, $backendFooter)); + print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \%backendMethods, $backendFooter)); close($HEADER); undef($HEADER); + + open(my $JS_STUB, ">$outputDir/$backendJSStubName.js") || die "Couldn't open file $outputDir/$backendJSStubName.js"; + print $JS_STUB join("\n", @backendStubJS); + close($JS_STUB); + undef($JS_STUB); } 1; diff --git a/WebCore/inspector/ConsoleMessage.cpp b/WebCore/inspector/ConsoleMessage.cpp index 059dea4..6f19d2a 100644 --- a/WebCore/inspector/ConsoleMessage.cpp +++ b/WebCore/inspector/ConsoleMessage.cpp @@ -126,23 +126,25 @@ void ConsoleMessage::addToFrontend(RemoteInspectorFrontend* frontend, InjectedSc jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount)); jsonObj->setString("message", m_message); if (!m_arguments.isEmpty()) { - RefPtr<InspectorArray> jsonArgs = InspectorArray::create(); InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_scriptState.get()); - for (unsigned i = 0; i < m_arguments.size(); ++i) { - RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments[i]); - if (!inspectorValue) { - ASSERT_NOT_REACHED(); - return; + if (!injectedScript.hasNoValue()) { + RefPtr<InspectorArray> jsonArgs = InspectorArray::create(); + for (unsigned i = 0; i < m_arguments.size(); ++i) { + RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments[i]); + if (!inspectorValue) { + ASSERT_NOT_REACHED(); + return; + } + jsonArgs->pushValue(inspectorValue); } - jsonArgs->push(inspectorValue); + jsonObj->setArray("parameters", jsonArgs); } - jsonObj->set("parameters", jsonArgs); } if (!m_frames.isEmpty()) { RefPtr<InspectorArray> frames = InspectorArray::create(); for (unsigned i = 0; i < m_frames.size(); i++) - frames->push(m_frames.at(i).buildInspectorObject()); - jsonObj->set("stackTrace", frames); + frames->pushObject(m_frames.at(i).buildInspectorObject()); + jsonObj->setArray("stackTrace", frames); } frontend->addConsoleMessage(jsonObj); } diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl index 9d3d102..1c66b59 100644 --- a/WebCore/inspector/Inspector.idl +++ b/WebCore/inspector/Inspector.idl @@ -67,6 +67,7 @@ module core { [notify] void updateConsoleMessageRepeatCount(out unsigned long count); [notify] void updateFocusedNode(out long nodeId); [notify] void updateResource(out Value resource); + [notify] void consoleMessagesCleared(); #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER [notify] void addProfileHeader(out Object header); @@ -176,10 +177,10 @@ module core { [handler=DOM] void searchCanceled(); [handler=DOM] void pushNodeByPathToFrontend(in long callId, in String path, out long nodeId); - [handler=Backend] void clearConsoleMessages(in long callId); - + [handler=Controller] void clearConsoleMessages(); [handler=Controller] void highlightDOMNode(in long nodeId); [handler=Controller] void hideDOMNodeHighlight(); + [handler=Controller] void openInInspectedWindow(in String url); [handler=DOM] void getStyles(in long callId, in long nodeId, in boolean authOnly, out Value styles); [handler=DOM] void getAllStyles(in long callId, out Array styles); @@ -216,6 +217,5 @@ module core { [handler=Controller] void setDOMStorageItem(in long callId, in long storageId, in String key, in String value, out boolean success); [handler=Controller] void removeDOMStorageItem(in long callId, in long storageId, in String key, out boolean success); #endif - }; } diff --git a/WebCore/inspector/InspectorApplicationCacheAgent.cpp b/WebCore/inspector/InspectorApplicationCacheAgent.cpp index b95c0e1..1206184 100644 --- a/WebCore/inspector/InspectorApplicationCacheAgent.cpp +++ b/WebCore/inspector/InspectorApplicationCacheAgent.cpp @@ -82,7 +82,7 @@ PassRefPtr<InspectorObject> InspectorApplicationCacheAgent::buildObjectForApplic value->setString("lastPathComponent", applicationCacheInfo.m_manifest.lastPathComponent()); value->setNumber("creationTime", applicationCacheInfo.m_creationTime); value->setNumber("updateTime", applicationCacheInfo.m_updateTime); - value->set("resources", buildArrayForApplicationCacheResources(applicationCacheResources)); + value->setArray("resources", buildArrayForApplicationCacheResources(applicationCacheResources)); return value; } @@ -93,7 +93,7 @@ PassRefPtr<InspectorArray> InspectorApplicationCacheAgent::buildArrayForApplicat ApplicationCacheHost::ResourceInfoList::const_iterator end = applicationCacheResources.end(); ApplicationCacheHost::ResourceInfoList::const_iterator it = applicationCacheResources.begin(); for (int i = 0; it != end; ++it, i++) - resources->push(buildObjectForApplicationCacheResource(*it)); + resources->pushObject(buildObjectForApplicationCacheResource(*it)); return resources; } diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 0a18e1c..f0ed94b 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -106,11 +106,6 @@ void InspectorBackend::dispatchOnInjectedScript(long injectedScriptId, const Str injectedScript.dispatch(methodName, arguments, result, hadException); } -void InspectorBackend::clearConsoleMessages() -{ - m_inspectorController->clearConsoleMessages(); -} - void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) { m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup); diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index 63c4a09..27a93eb 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -67,7 +67,6 @@ public: void setInjectedScriptSource(const String& source); void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException); - void clearConsoleMessages(); // Generic code called from custom implementations. void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); diff --git a/WebCore/inspector/InspectorCSSStore.h b/WebCore/inspector/InspectorCSSStore.h index 2a05d71..ee435e5 100644 --- a/WebCore/inspector/InspectorCSSStore.h +++ b/WebCore/inspector/InspectorCSSStore.h @@ -29,10 +29,10 @@ #ifndef InspectorCSSStore_h #define InspectorCSSStore_h -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index 0b59617..ac670cb 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -24,7 +24,7 @@ * 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, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -46,6 +46,7 @@ #include "FloatQuad.h" #include "FloatRect.h" #include "Frame.h" +#include "FrameLoadRequest.h" #include "FrameLoader.h" #include "FrameTree.h" #include "FrameView.h" @@ -86,6 +87,7 @@ #include "SharedBuffer.h" #include "TextEncoding.h" #include "TextIterator.h" +#include "WindowFeatures.h" #include <wtf/text/CString.h> #include <wtf/CurrentTime.h> #include <wtf/ListHashSet.h> @@ -359,6 +361,8 @@ void InspectorController::clearConsoleMessages() m_injectedScriptHost->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console"); if (m_domAgent) m_domAgent->releaseDanglingNodes(); + if (m_remoteFrontend) + m_remoteFrontend->consoleMessagesCleared(); } void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack, bool collapsed) @@ -604,9 +608,12 @@ void InspectorController::releaseFrontendLifetimeAgents() if (m_domAgent) m_domAgent->reset(); m_domAgent.clear(); + +#if ENABLE(DATABASE) if (m_storageAgent) m_storageAgent->clearFrontend(); m_storageAgent.clear(); +#endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) m_applicationCacheAgent.clear(); @@ -1329,7 +1336,7 @@ PassRefPtr<InspectorArray> InspectorController::buildArrayForCookies(ListHashSet ListHashSet<Cookie>::iterator end = cookiesList.end(); ListHashSet<Cookie>::iterator it = cookiesList.begin(); for (int i = 0; it != end; ++it, i++) - cookies->push(buildObjectForCookie(*it)); + cookies->pushObject(buildObjectForCookie(*it)); return cookies; } @@ -1413,7 +1420,7 @@ void InspectorController::getDOMStorageEntries(long storageId, RefPtr<InspectorA RefPtr<InspectorArray> entry = InspectorArray::create(); entry->pushString(name); entry->pushString(value); - (*entries)->push(entry); + (*entries)->pushArray(entry); } } } @@ -1500,7 +1507,7 @@ void InspectorController::getProfileHeaders(RefPtr<InspectorArray>* headers) { ProfilesMap::iterator profilesEnd = m_profiles.end(); for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it) - (*headers)->push(createProfileHeader(*it->second)); + (*headers)->pushObject(createProfileHeader(*it->second)); } void InspectorController::getProfile(unsigned uid, RefPtr<InspectorObject>* profileObject) @@ -1508,7 +1515,7 @@ void InspectorController::getProfile(unsigned uid, RefPtr<InspectorObject>* prof ProfilesMap::iterator it = m_profiles.find(uid); if (it != m_profiles.end()) { *profileObject = createProfileHeader(*it->second); - (*profileObject)->set("head", it->second->buildInspectorObjectForHead()); + (*profileObject)->setObject("head", it->second->buildInspectorObjectForHead()); } } @@ -1865,6 +1872,22 @@ void InspectorController::drawNodeHighlight(GraphicsContext& context) const } } +void InspectorController::openInInspectedWindow(const String& url) +{ + ResourceRequest request; + FrameLoadRequest frameRequest(request, "_blank"); + bool created; + Frame* mainFrame = m_inspectedPage->mainFrame(); + WindowFeatures windowFeatures; + Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, frameRequest, windowFeatures, created); + if (!newFrame) + return; + + newFrame->loader()->setOpener(mainFrame); + newFrame->page()->setOpenedByDOM(); + newFrame->loader()->changeLocation(newFrame->loader()->completeURL(url), "", false, false, true); +} + void InspectorController::count(const String& title, unsigned lineNumber, const String& sourceID) { String identifier = title + String::format("@%s:%d", sourceID.utf8().data(), lineNumber); diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index faddedb..8d96005 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -35,13 +35,13 @@ #include "PlatformString.h" #include "ScriptProfile.h" #include "ScriptState.h" -#include "StringHash.h" #include "Timer.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/ListHashSet.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { @@ -136,7 +136,7 @@ public: void connectFrontend(); void disconnectFrontend(); - void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*, const String& message = String()); + void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*, const String& message); void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID); void clearConsoleMessages(); const Vector<OwnPtr<ConsoleMessage> >& consoleMessages() const { return m_consoleMessages; } @@ -212,6 +212,7 @@ public: bool hasFrontend() const { return m_remoteFrontend; } void drawNodeHighlight(GraphicsContext&) const; + void openInInspectedWindow(const String& url); void count(const String& title, unsigned lineNumber, const String& sourceID); @@ -252,6 +253,7 @@ public: void evaluateForTestInFrontend(long testCallId, const String& script); InjectedScript injectedScriptForNodeId(long id); + void addScriptToEvaluateOnLoad(const String& source); void removeAllScriptsToEvaluateOnLoad(); void setInspectorExtensionAPI(const String& source); diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index 7cf0a82..6243299 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -33,7 +33,6 @@ #if ENABLE(INSPECTOR) -#include "AtomicString.h" #include "CSSComputedStyleDeclaration.h" #include "CSSMutableStyleDeclaration.h" #include "CSSRule.h" @@ -78,6 +77,7 @@ #include <wtf/ListHashSet.h> #include <wtf/OwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> namespace WebCore { @@ -600,7 +600,7 @@ void InspectorDOMAgent::getEventListenersForNode(long nodeId, long* outNodeId, R for (size_t j = 0; j < vector.size(); ++j) { const RegisteredEventListener& listener = vector[j]; if (listener.useCapture) - (*listenersArray)->push(buildObjectForEventListener(listener, info.eventType, info.node)); + (*listenersArray)->pushObject(buildObjectForEventListener(listener, info.eventType, info.node)); } } @@ -611,7 +611,7 @@ void InspectorDOMAgent::getEventListenersForNode(long nodeId, long* outNodeId, R for (size_t j = 0; j < vector.size(); ++j) { const RegisteredEventListener& listener = vector[j]; if (!listener.useCapture) - (*listenersArray)->push(buildObjectForEventListener(listener, info.eventType, info.node)); + (*listenersArray)->pushObject(buildObjectForEventListener(listener, info.eventType, info.node)); } } } @@ -630,7 +630,7 @@ void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool // 2) There is no need to push all search results to the front-end at a time, pushing next / previous result // is sufficient. - int queryLength = whitespaceTrimmedQuery.length(); + unsigned queryLength = whitespaceTrimmedQuery.length(); bool startTagFound = !whitespaceTrimmedQuery.find('<'); bool endTagFound = whitespaceTrimmedQuery.reverseFind('>') + 1 == queryLength; @@ -766,11 +766,11 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForNode(Node* node, in value->setNumber("childNodeCount", nodeCount); RefPtr<InspectorArray> children = buildArrayForContainerChildren(node, depth, nodesMap); if (children->length() > 0) - value->set("children", children.release()); + value->setArray("children", children.release()); if (node->nodeType() == Node::ELEMENT_NODE) { Element* element = static_cast<Element*>(node); - value->set("attributes", buildArrayForElementAttributes(element)); + value->setArray("attributes", buildArrayForElementAttributes(element)); if (node->isFrameOwnerElement()) { HTMLFrameOwnerElement* frameOwner = static_cast<HTMLFrameOwnerElement*>(node); value->setString("documentURL", documentURLString(frameOwner->contentDocument())); @@ -813,7 +813,7 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForContainerChildren(Nod if (innerChildNodeCount(container) == 1) { Node *child = innerFirstChild(container); if (child->nodeType() == Node::TEXT_NODE) - children->push(buildObjectForNode(child, 0, nodesMap)); + children->pushObject(buildObjectForNode(child, 0, nodesMap)); } return children.release(); } else if (depth > 0) { @@ -821,7 +821,7 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForContainerChildren(Nod } for (Node *child = innerFirstChild(container); child; child = innerNextSibling(child)) - children->push(buildObjectForNode(child, depth, nodesMap)); + children->pushObject(buildObjectForNode(child, depth, nodesMap)); return children.release(); } @@ -986,27 +986,27 @@ void InspectorDOMAgent::getStyles(long nodeId, bool authorOnly, RefPtr<Inspector RefPtr<InspectorObject> result = InspectorObject::create(); if (element->style()) - result->set("inlineStyle", buildObjectForStyle(element->style(), true)); - result->set("computedStyle", buildObjectForStyle(computedStyleInfo.get(), false)); + result->setObject("inlineStyle", buildObjectForStyle(element->style(), true)); + result->setObject("computedStyle", buildObjectForStyle(computedStyleInfo.get(), false)); CSSStyleSelector* selector = element->ownerDocument()->styleSelector(); RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, authorOnly); - result->set("matchedCSSRules", buildArrayForCSSRules(node->ownerDocument(), matchedRules.get())); + result->setArray("matchedCSSRules", buildArrayForCSSRules(node->ownerDocument(), matchedRules.get())); - result->set("styleAttributes", buildObjectForAttributeStyles(element)); - result->set("pseudoElements", buildArrayForPseudoElements(element, authorOnly)); + result->setObject("styleAttributes", buildObjectForAttributeStyles(element)); + result->setArray("pseudoElements", buildArrayForPseudoElements(element, authorOnly)); RefPtr<InspectorObject> currentStyle = result; Element* parentElement = element->parentElement(); while (parentElement) { RefPtr<InspectorObject> parentStyle = InspectorObject::create(); - currentStyle->set("parent", parentStyle); + currentStyle->setObject("parent", parentStyle); if (parentElement->style() && parentElement->style()->length()) - parentStyle->set("inlineStyle", buildObjectForStyle(parentElement->style(), true)); + parentStyle->setObject("inlineStyle", buildObjectForStyle(parentElement->style(), true)); CSSStyleSelector* parentSelector = parentElement->ownerDocument()->styleSelector(); RefPtr<CSSRuleList> parentMatchedRules = parentSelector->styleRulesForElement(parentElement, authorOnly); - parentStyle->set("matchedCSSRules", buildArrayForCSSRules(parentElement->ownerDocument(), parentMatchedRules.get())); + parentStyle->setArray("matchedCSSRules", buildArrayForCSSRules(parentElement->ownerDocument(), parentMatchedRules.get())); parentElement = parentElement->parentElement(); currentStyle = parentStyle; @@ -1021,7 +1021,7 @@ void InspectorDOMAgent::getAllStyles(RefPtr<InspectorArray>* styles) for (unsigned i = 0; i < list->length(); ++i) { StyleSheet* styleSheet = list->item(i); if (styleSheet->isCSSStyleSheet()) - (*styles)->push(buildObjectForStyleSheet((*it).get(), static_cast<CSSStyleSheet*>(styleSheet))); + (*styles)->pushObject(buildObjectForStyleSheet((*it).get(), static_cast<CSSStyleSheet*>(styleSheet))); } } } @@ -1044,9 +1044,9 @@ void InspectorDOMAgent::getRuleRanges(long styleSheetId, RefPtr<InspectorValue>* for (HashMap<long, SourceRange>::iterator it = ruleRanges.begin(); it != ruleRanges.end(); ++it) { if (it->second.second) { RefPtr<InspectorObject> ruleRange = InspectorObject::create(); - result->set(String::number(it->first).utf8().data(), ruleRange); + result->setObject(String::number(it->first).utf8().data(), ruleRange); RefPtr<InspectorObject> bodyRange = InspectorObject::create(); - ruleRange->set("bodyRange", bodyRange); + ruleRange->setObject("bodyRange", bodyRange); bodyRange->setNumber("start", it->second.first); bodyRange->setNumber("end", it->second.second); } @@ -1085,7 +1085,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForAttributeStyles(Ele Attribute* attribute = attributes->attributeItem(i); if (attribute->style()) { String attributeName = attribute->localName(); - styleAttributes->set(attributeName.utf8().data(), buildObjectForStyle(attribute->style(), true)); + styleAttributes->setObject(attributeName.utf8().data(), buildObjectForStyle(attribute->style(), true)); } } return styleAttributes; @@ -1097,7 +1097,7 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForCSSRules(Document* ow for (unsigned i = 0; matchedRules && i < matchedRules->length(); ++i) { CSSRule* rule = matchedRules->item(i); if (rule->type() == CSSRule::STYLE_RULE) - matchedCSSRules->push(buildObjectForRule(ownerDocument, static_cast<CSSStyleRule*>(rule))); + matchedCSSRules->pushObject(buildObjectForRule(ownerDocument, static_cast<CSSStyleRule*>(rule))); } return matchedCSSRules.release(); } @@ -1113,8 +1113,8 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForPseudoElements(Elemen if (matchedRules && matchedRules->length()) { RefPtr<InspectorObject> pseudoStyles = InspectorObject::create(); pseudoStyles->setNumber("pseudoId", static_cast<int>(pseudoId)); - pseudoStyles->set("rules", buildArrayForCSSRules(element->ownerDocument(), matchedRules.get())); - result->push(pseudoStyles.release()); + pseudoStyles->setArray("rules", buildArrayForCSSRules(element->ownerDocument(), matchedRules.get())); + result->pushObject(pseudoStyles.release()); } } return result.release(); @@ -1309,7 +1309,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForStyle(CSSStyleDecla DisabledStyleDeclaration* disabledStyle = cssStore()->disabledStyleForId(styleId, false); if (disabledStyle) - result->set("disabled", buildArrayForDisabledStyleProperties(disabledStyle)); + result->setArray("disabled", buildArrayForDisabledStyleProperties(disabledStyle)); } result->setString("width", style->getPropertyValue("width")); result->setString("height", style->getPropertyValue("height")); @@ -1336,10 +1336,10 @@ void InspectorDOMAgent::populateObjectWithStyleProperties(CSSStyleDeclaration* s shorthandValues->setString(shorthand, shorthandValue(style, shorthand)); } property->setString("value", style->getPropertyValue(name)); - properties->push(property.release()); + properties->pushObject(property.release()); } - result->set("properties", properties); - result->set("shorthandValues", shorthandValues); + result->setArray("properties", properties); + result->setObject("shorthandValues", shorthandValues); } PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForDisabledStyleProperties(DisabledStyleDeclaration* declaration) @@ -1350,7 +1350,7 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForDisabledStyleProperti property->setString("name", it->first); property->setString("value", it->second.first); property->setString("priority", it->second.second); - properties->push(property.release()); + properties->pushObject(property.release()); } return properties.release(); } @@ -1370,10 +1370,10 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForStyleSheet(Document for (unsigned i = 0; i < cssRuleList->length(); ++i) { CSSRule* rule = cssRuleList->item(i); if (rule->isStyleRule()) - cssRules->push(buildObjectForRule(ownerDocument, static_cast<CSSStyleRule*>(rule))); + cssRules->pushObject(buildObjectForRule(ownerDocument, static_cast<CSSStyleRule*>(rule))); } } - result->set("cssRules", cssRules.release()); + result->setArray("cssRules", cssRules.release()); return result.release(); } @@ -1390,7 +1390,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForRule(Document* owne RefPtr<InspectorObject> parentStyleSheetValue = InspectorObject::create(); parentStyleSheetValue->setString("href", parentStyleSheet->href()); parentStyleSheetValue->setNumber("id", cssStore()->bindStyleSheet(parentStyleSheet)); - result->set("parentStyleSheet", parentStyleSheetValue.release()); + result->setObject("parentStyleSheet", parentStyleSheetValue.release()); } bool isUserAgent = parentStyleSheet && !parentStyleSheet->ownerNode() && parentStyleSheet->href().isEmpty(); bool isUser = parentStyleSheet && parentStyleSheet->ownerNode() && parentStyleSheet->ownerNode()->nodeName() == "#document"; @@ -1400,7 +1400,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForRule(Document* owne // Bind editable scripts only. bool bind = !isUserAgent && !isUser; - result->set("style", buildObjectForStyle(rule->style(), bind)); + result->setObject("style", buildObjectForStyle(rule->style(), bind)); if (bind) result->setNumber("id", cssStore()->bindRule(rule)); diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index bae65f5..5317a22 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -30,7 +30,6 @@ #ifndef InspectorDOMAgent_h #define InspectorDOMAgent_h -#include "AtomicString.h" #include "Document.h" #include "EventListener.h" #include "EventTarget.h" @@ -46,6 +45,7 @@ #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicString.h> namespace WebCore { class ContainerNode; diff --git a/WebCore/inspector/InspectorDebuggerAgent.cpp b/WebCore/inspector/InspectorDebuggerAgent.cpp index b70ddbf..e1c0dc0 100644 --- a/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -236,7 +236,7 @@ void InspectorDebuggerAgent::saveBreakpoints() if (it->second.isEmpty()) continue; RefPtr<InspectorObject> breakpointsForURL = ScriptBreakpoint::inspectorObjectFromSourceBreakpoints(it->second); - breakpoints->set(it->first, breakpointsForURL); + breakpoints->setObject(it->first, breakpointsForURL); } m_inspectorController->saveBreakpoints(breakpoints); } diff --git a/WebCore/inspector/InspectorDebuggerAgent.h b/WebCore/inspector/InspectorDebuggerAgent.h index 5428eb2..2cfbf55 100644 --- a/WebCore/inspector/InspectorDebuggerAgent.h +++ b/WebCore/inspector/InspectorDebuggerAgent.h @@ -34,10 +34,10 @@ #include "ScriptBreakpoint.h" #include "ScriptDebugListener.h" #include "ScriptState.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { class InjectedScriptHost; diff --git a/WebCore/inspector/InspectorResource.cpp b/WebCore/inspector/InspectorResource.cpp index 9259d79..a2b55b0 100644 --- a/WebCore/inspector/InspectorResource.cpp +++ b/WebCore/inspector/InspectorResource.cpp @@ -189,7 +189,7 @@ void InspectorResource::updateScriptObject(RemoteInspectorFrontend* frontend) jsonObject->setString("path", m_requestURL.path()); jsonObject->setString("lastPathComponent", m_requestURL.lastPathComponent()); RefPtr<InspectorObject> requestHeaders = buildHeadersObject(m_requestHeaderFields); - jsonObject->set("requestHeaders", requestHeaders); + jsonObject->setObject("requestHeaders", requestHeaders); jsonObject->setBool("mainResource", m_isMainResource); jsonObject->setString("requestMethod", m_requestMethod); jsonObject->setString("requestFormData", m_requestFormData); @@ -203,12 +203,12 @@ void InspectorResource::updateScriptObject(RemoteInspectorFrontend* frontend) jsonObject->setNumber("statusCode", m_responseStatusCode); jsonObject->setString("statusText", m_responseStatusText); RefPtr<InspectorObject> responseHeaders = buildHeadersObject(m_responseHeaderFields); - jsonObject->set("responseHeaders", responseHeaders); + jsonObject->setObject("responseHeaders", responseHeaders); jsonObject->setNumber("connectionID", m_connectionID); jsonObject->setBool("connectionReused", m_connectionReused); jsonObject->setBool("cached", m_cached); if (m_loadTiming && !m_cached) - jsonObject->set("timing", buildObjectForTiming(m_loadTiming.get())); + jsonObject->setObject("timing", buildObjectForTiming(m_loadTiming.get())); jsonObject->setBool("didResponseChange", true); } diff --git a/WebCore/inspector/InspectorStorageAgent.cpp b/WebCore/inspector/InspectorStorageAgent.cpp index f95b392..66d3372 100644 --- a/WebCore/inspector/InspectorStorageAgent.cpp +++ b/WebCore/inspector/InspectorStorageAgent.cpp @@ -92,7 +92,7 @@ public: switch (value.type()) { case SQLValue::StringValue: values->pushString(value.string()); break; case SQLValue::NumberValue: values->pushNumber(value.number()); break; - case SQLValue::NullValue: values->push(InspectorValue::null()); break; + case SQLValue::NullValue: values->pushValue(InspectorValue::null()); break; } } m_agent->frontend()->sqlTransactionSucceeded(m_transactionId, columnNames, values); diff --git a/WebCore/inspector/InspectorTimelineAgent.cpp b/WebCore/inspector/InspectorTimelineAgent.cpp index b5cff68..aa42a54 100644 --- a/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/WebCore/inspector/InspectorTimelineAgent.cpp @@ -63,7 +63,7 @@ void InspectorTimelineAgent::pushGCEventRecords() m_gcEvents.clear(); for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) { RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(i->startTime); - record->set("data", TimelineRecordFactory::createGCEventData(i->collectedBytes)); + record->setObject("data", TimelineRecordFactory::createGCEventData(i->collectedBytes)); record->setNumber("endTime", i->endTime); addRecordToTimeline(record.release(), GCEventTimelineRecordType); } @@ -150,7 +150,7 @@ void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool sing { pushGCEventRecords(); RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS()); - record->set("data", TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot)); + record->setObject("data", TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot)); addRecordToTimeline(record.release(), TimerInstallTimelineRecordType); } @@ -158,7 +158,7 @@ void InspectorTimelineAgent::didRemoveTimer(int timerId) { pushGCEventRecords(); RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS()); - record->set("data", TimelineRecordFactory::createGenericTimerData(timerId)); + record->setObject("data", TimelineRecordFactory::createGenericTimerData(timerId)); addRecordToTimeline(record.release(), TimerRemoveTimelineRecordType); } @@ -206,7 +206,7 @@ void InspectorTimelineAgent::didScheduleResourceRequest(const String& url) { pushGCEventRecords(); RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS()); - record->set("data", TimelineRecordFactory::createScheduleResourceRequestData(url)); + record->setObject("data", TimelineRecordFactory::createScheduleResourceRequestData(url)); record->setNumber("type", ScheduleResourceRequestTimelineRecordType); addRecordToTimeline(record.release(), ScheduleResourceRequestTimelineRecordType); } @@ -216,7 +216,7 @@ void InspectorTimelineAgent::willSendResourceRequest(unsigned long identifier, b { pushGCEventRecords(); RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS()); - record->set("data", TimelineRecordFactory::createResourceSendRequestData(identifier, isMainResource, request)); + record->setObject("data", TimelineRecordFactory::createResourceSendRequestData(identifier, isMainResource, request)); record->setNumber("type", ResourceSendRequestTimelineRecordType); setHeapSizeStatistic(record.get()); m_frontend->addRecordToTimeline(record.release()); @@ -246,7 +246,7 @@ void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, { pushGCEventRecords(); RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS()); - record->set("data", TimelineRecordFactory::createResourceFinishData(identifier, didFail)); + record->setObject("data", TimelineRecordFactory::createResourceFinishData(identifier, didFail)); record->setNumber("type", ResourceFinishTimelineRecordType); setHeapSizeStatistic(record.get()); m_frontend->addRecordToTimeline(record.release()); @@ -256,7 +256,7 @@ void InspectorTimelineAgent::didMarkTimeline(const String& message) { pushGCEventRecords(); RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS()); - record->set("data", TimelineRecordFactory::createMarkTimelineData(message)); + record->setObject("data", TimelineRecordFactory::createMarkTimelineData(message)); addRecordToTimeline(record.release(), MarkTimelineRecordType); } @@ -295,7 +295,7 @@ void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> prp m_frontend->addRecordToTimeline(record.release()); else { TimelineRecordEntry parent = m_recordStack.last(); - parent.children->push(record.release()); + parent.children->pushObject(record.release()); } } @@ -317,8 +317,8 @@ void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType type) TimelineRecordEntry entry = m_recordStack.last(); m_recordStack.removeLast(); ASSERT(entry.type == type); - entry.record->set("data", entry.data); - entry.record->set("children", entry.children); + entry.record->setObject("data", entry.data); + entry.record->setArray("children", entry.children); entry.record->setNumber("endTime", WTF::currentTimeMS()); addRecordToTimeline(entry.record, type); } diff --git a/WebCore/inspector/InspectorValues.cpp b/WebCore/inspector/InspectorValues.cpp index dad84ac..a7c43a5 100644 --- a/WebCore/inspector/InspectorValues.cpp +++ b/WebCore/inspector/InspectorValues.cpp @@ -366,7 +366,7 @@ PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, cons RefPtr<InspectorValue> arrayNode = buildValue(start, end, &tokenEnd, depth + 1); if (!arrayNode) return 0; - array->push(arrayNode); + array->pushValue(arrayNode); // After a list value, we expect a comma or the end of the list. start = tokenEnd; @@ -406,7 +406,7 @@ PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, cons RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, depth + 1); if (!value) return 0; - object->set(key, value); + object->setValue(key, value); start = tokenEnd; // After a key/value pair, we expect a comma or the end of the @@ -504,6 +504,22 @@ bool InspectorValue::asString(String*) const return false; } +bool InspectorValue::asValue(RefPtr<InspectorValue>* output) +{ + *output = this; + return true; +} + +bool InspectorValue::asObject(RefPtr<InspectorObject>*) +{ + return false; +} + +bool InspectorValue::asArray(RefPtr<InspectorArray>*) +{ + return false; +} + PassRefPtr<InspectorObject> InspectorValue::asObject() { return 0; @@ -606,6 +622,12 @@ void InspectorString::writeJSON(Vector<UChar>* output) const doubleQuoteString(m_stringValue, output); } +bool InspectorObject::asObject(RefPtr<InspectorObject>* output) +{ + *output = this; + return true; +} + PassRefPtr<InspectorObject> InspectorObject::asObject() { return this; @@ -674,6 +696,12 @@ void InspectorObject::writeJSON(Vector<UChar>* output) const output->append('}'); } +bool InspectorArray::asArray(RefPtr<InspectorArray>* output) +{ + *output = this; + return true; +} + PassRefPtr<InspectorArray> InspectorArray::asArray() { return this; diff --git a/WebCore/inspector/InspectorValues.h b/WebCore/inspector/InspectorValues.h index f6556d7..4bc36f2 100644 --- a/WebCore/inspector/InspectorValues.h +++ b/WebCore/inspector/InspectorValues.h @@ -34,12 +34,12 @@ #if ENABLE(INSPECTOR) #include "PlatformString.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { @@ -73,6 +73,9 @@ public: virtual bool asNumber(unsigned long* output) const; virtual bool asNumber(unsigned int* output) const; virtual bool asString(String* output) const; + virtual bool asValue(RefPtr<InspectorValue>* output); + virtual bool asObject(RefPtr<InspectorObject>* output); + virtual bool asArray(RefPtr<InspectorArray>* output); virtual PassRefPtr<InspectorObject> asObject(); virtual PassRefPtr<InspectorArray> asArray(); @@ -163,12 +166,15 @@ public: } ~InspectorObject() { } + virtual bool asObject(RefPtr<InspectorObject>* output); virtual PassRefPtr<InspectorObject> asObject(); void setBool(const String& name, bool); void setNumber(const String& name, double); void setString(const String& name, const String&); - void set(const String& name, PassRefPtr<InspectorValue>); + void setValue(const String& name, PassRefPtr<InspectorValue>); + void setObject(const String& name, PassRefPtr<InspectorObject>); + void setArray(const String& name, PassRefPtr<InspectorArray>); bool getBool(const String& name, bool* output) const; bool getNumber(const String& name, double* output) const; @@ -198,12 +204,15 @@ public: } ~InspectorArray() { } + virtual bool asArray(RefPtr<InspectorArray>* output); virtual PassRefPtr<InspectorArray> asArray(); void pushBool(bool); void pushNumber(double); void pushString(const String&); - void push(PassRefPtr<InspectorValue>); + void pushValue(PassRefPtr<InspectorValue>); + void pushObject(PassRefPtr<InspectorObject>); + void pushArray(PassRefPtr<InspectorArray>); unsigned length() const { return m_data.size(); } PassRefPtr<InspectorValue> get(size_t index); @@ -217,20 +226,32 @@ private: inline void InspectorObject::setBool(const String& name, bool value) { - set(name, InspectorBasicValue::create(value)); + setValue(name, InspectorBasicValue::create(value)); } inline void InspectorObject::setNumber(const String& name, double value) { - set(name, InspectorBasicValue::create(value)); + setValue(name, InspectorBasicValue::create(value)); } inline void InspectorObject::setString(const String& name, const String& value) { - set(name, InspectorString::create(value)); + setValue(name, InspectorString::create(value)); } -inline void InspectorObject::set(const String& name, PassRefPtr<InspectorValue> value) +inline void InspectorObject::setValue(const String& name, PassRefPtr<InspectorValue> value) +{ + if (m_data.set(name, value).second) + m_order.append(name); +} + +inline void InspectorObject::setObject(const String& name, PassRefPtr<InspectorObject> value) +{ + if (m_data.set(name, value).second) + m_order.append(name); +} + +inline void InspectorObject::setArray(const String& name, PassRefPtr<InspectorArray> value) { if (m_data.set(name, value).second) m_order.append(name); @@ -251,7 +272,17 @@ inline void InspectorArray::pushString(const String& value) m_data.append(InspectorString::create(value)); } -inline void InspectorArray::push(PassRefPtr<InspectorValue> value) +inline void InspectorArray::pushValue(PassRefPtr<InspectorValue> value) +{ + m_data.append(value); +} + +inline void InspectorArray::pushObject(PassRefPtr<InspectorObject> value) +{ + m_data.append(value); +} + +inline void InspectorArray::pushArray(PassRefPtr<InspectorArray> value) { m_data.append(value); } diff --git a/WebCore/inspector/ScriptBreakpoint.cpp b/WebCore/inspector/ScriptBreakpoint.cpp index ce0d18a..24401f1 100644 --- a/WebCore/inspector/ScriptBreakpoint.cpp +++ b/WebCore/inspector/ScriptBreakpoint.cpp @@ -64,7 +64,7 @@ PassRefPtr<InspectorObject> ScriptBreakpoint::inspectorObjectFromSourceBreakpoin RefPtr<InspectorObject> breakpoint = InspectorObject::create(); breakpoint->setBool("enabled", it->second.enabled); breakpoint->setString("condition", it->second.condition); - breakpoints->set(String::number(it->first), breakpoint); + breakpoints->setObject(String::number(it->first), breakpoint); } return breakpoints.release(); } diff --git a/WebCore/inspector/TimelineRecordFactory.cpp b/WebCore/inspector/TimelineRecordFactory.cpp index ad9fdec..e1c2bbb 100644 --- a/WebCore/inspector/TimelineRecordFactory.cpp +++ b/WebCore/inspector/TimelineRecordFactory.cpp @@ -49,7 +49,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double st RefPtr<InspectorArray> stackTrace = InspectorArray::create(); if (ScriptCallStack::stackTrace(5, stackTrace)) - record->set("stackTrace", stackTrace); + record->setArray("stackTrace", stackTrace); return record.release(); } diff --git a/WebCore/inspector/front-end/AuditRules.js b/WebCore/inspector/front-end/AuditRules.js index 8519cf2..e28a364 100644 --- a/WebCore/inspector/front-end/AuditRules.js +++ b/WebCore/inspector/front-end/AuditRules.js @@ -724,9 +724,9 @@ WebInspector.AuditRules.CssInHeadRule = function() WebInspector.AuditRules.CssInHeadRule.prototype = { doRun: function(resources, result, callback) { - function evalCallback(evalResult, isException) + function evalCallback(evalResult) { - if (isException || !evalResult) + if (!evalResult) return callback(null); var summary = result.addChild(""); @@ -800,9 +800,9 @@ WebInspector.AuditRules.StylesScriptsOrderRule = function() WebInspector.AuditRules.StylesScriptsOrderRule.prototype = { doRun: function(resources, result, callback) { - function evalCallback(resultValue, isException) + function evalCallback(resultValue) { - if (isException || !resultValue) + if (!resultValue) return callback(null); var lateCssUrls = resultValue[0]; diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js index 6a4e0d3..474c362 100644 --- a/WebCore/inspector/front-end/ConsoleView.js +++ b/WebCore/inspector/front-end/ConsoleView.js @@ -296,7 +296,7 @@ WebInspector.ConsoleView.prototype = { requestClearMessages: function() { - InspectorBackend.clearConsoleMessages(WebInspector.Callback.wrap(this.clearMessages.bind(this))); + InspectorBackend.clearConsoleMessages(); }, clearMessages: function() @@ -342,7 +342,7 @@ WebInspector.ConsoleView.prototype = { var injectedScriptAccess; if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame; - injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.injectedScriptId); + injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.worldId); } else injectedScriptAccess = InjectedScriptAccess.getDefault(); injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); @@ -511,7 +511,7 @@ WebInspector.ConsoleView.prototype = { function evalCallback(result) { - callback(result.value, result.isException); + callback(WebInspector.RemoteObject.fromPayload(result)); }; InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback); }, @@ -534,7 +534,7 @@ WebInspector.ConsoleView.prototype = { this.addMessage(commandMessage); var self = this; - function printResult(result, exception) + function printResult(result) { self.prompt.history.push(str); self.prompt.historyOffset = 0; @@ -542,7 +542,7 @@ WebInspector.ConsoleView.prototype = { WebInspector.applicationSettings.consoleHistory = self.prompt.history.slice(-30); - self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage)); + self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage)); } this.evalInInspectedWindow(str, "console", printResult); }, @@ -550,7 +550,7 @@ WebInspector.ConsoleView.prototype = { _format: function(output, forceObjectFormat) { var isProxy = (output != null && typeof output === "object"); - var type = (forceObjectFormat ? "object" : Object.proxyType(output)); + var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output)); var formatter = this._customFormatters[type]; if (!formatter || !isProxy) { @@ -589,12 +589,12 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(treeOutline.element); } - InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(object, printNode); + object.pushNodeToFrontend(printNode); }, _formatarray: function(arr, elem) { - InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false, false, this._printArray.bind(this, elem)); + arr.getOwnProperties(false, this._printArray.bind(this, elem)); }, _formatstring: function(output, elem) @@ -637,9 +637,8 @@ WebInspector.ConsoleView.prototype = { _formatAsArrayEntry: function(output) { - var type = Object.proxyType(output); // Prevent infinite expansion of cross-referencing arrays. - return this._format(output, type === "array"); + return this._format(output, WebInspector.RemoteObject.type(output) === "array"); } } @@ -728,12 +727,15 @@ WebInspector.ConsoleMessage.prototype = { // Formatting code below assumes that parameters are all wrappers whereas frontend console // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here. - for (var i = 0; i < parameters.length; ++i) - if (typeof parameters[i] !== "object" && typeof parameters[i] !== "function") - parameters[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(parameters[i]); + for (var i = 0; i < parameters.length; ++i) { + if (typeof parameters[i] === "object") + parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]); + else + parameters[i] = WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]); + } // There can be string log and string eval result. We distinguish between them based on message type. - var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result; + var shouldFormatMessage = WebInspector.RemoteObject.type(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result; // Multiple parameters with the first being a format string. Save unused substitutions. if (shouldFormatMessage) { @@ -1048,21 +1050,11 @@ WebInspector.ConsoleCommand.prototype = { } } -WebInspector.ConsoleCommandResult = function(result, exception, originatingCommand) +WebInspector.ConsoleCommandResult = function(result, originatingCommand) { - var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); - var message = result; - if (exception) { - // Distinguish between strings and errors (no need to quote latter). - message = WebInspector.ObjectProxy.wrapPrimitiveValue(result); - message.type = "error"; - } - var line = (exception ? result.line : -1); - var url = (exception ? result.sourceURL : null); - + var level = (result.isError() ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); this.originatingCommand = originatingCommand; - - WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, null, [message]); + WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, -1, null, null, 1, null, [result]); } WebInspector.ConsoleCommandResult.prototype = { diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js index c41d038..57422f6 100644 --- a/WebCore/inspector/front-end/DOMAgent.js +++ b/WebCore/inspector/front-end/DOMAgent.js @@ -33,10 +33,6 @@ WebInspector.DOMNode = function(doc, payload) { this.ownerDocument = doc; this.id = payload.id; - // injectedScriptId is a node is for DOM nodes which should be converted - // to corresponding InjectedScript by the inspector backend. We indicate - // this by making injectedScriptId negative. - this.injectedScriptId = -payload.id; this.nodeType = payload.nodeType; this.nodeName = payload.nodeName; this.localName = payload.localName; diff --git a/WebCore/inspector/front-end/DatabaseTableView.js b/WebCore/inspector/front-end/DatabaseTableView.js index 9e6d374..5440763 100644 --- a/WebCore/inspector/front-end/DatabaseTableView.js +++ b/WebCore/inspector/front-end/DatabaseTableView.js @@ -46,7 +46,7 @@ WebInspector.DatabaseTableView.prototype = { get statusBarItems() { - return [this.refreshButton]; + return [this.refreshButton.element]; }, update: function() diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index 6713ddc..0296737 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -255,7 +255,7 @@ WebInspector.ElementsPanel.prototype = { this._matchesCountUpdateTimeout = null; this._searchQuery = query; - InspectorBackend.performSearch(whitespaceTrimmedQuery); + InspectorBackend.performSearch(whitespaceTrimmedQuery, false); }, searchingForNodeWasEnabled: function() diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index 87d85c1..c7d39f1 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -413,8 +413,8 @@ WebInspector.ElementsTreeElement.prototype = { else this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); } - var objectProxy = new WebInspector.ObjectProxy(node.injectedScriptId, node.id); - WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this)); + + InjectedScriptAccess.getForNode(node).getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this)); }, updateSelection: function() diff --git a/WebCore/inspector/front-end/EventListenersSidebarPane.js b/WebCore/inspector/front-end/EventListenersSidebarPane.js index 6798845..2800d6e 100644 --- a/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -189,17 +189,21 @@ WebInspector.EventListenerBar = function(eventListener, nodeId) WebInspector.EventListenerBar.prototype = { update: function() { - var properties = []; - for (var propertyName in this.eventListener) { - // Just build properties in place - no need to reach out for injected script. - var value = this.eventListener[propertyName]; - if (value instanceof WebInspector.DOMNode) - value = new WebInspector.ObjectProxy(value.injectedScriptId, value.id, [], appropriateSelectorForNode(value), true); - else - value = WebInspector.ObjectProxy.wrapPrimitiveValue(value); - properties.push(new WebInspector.ObjectPropertyProxy(propertyName, value)); + function updateWithNodeObject(nodeObject) + { + var properties = []; + if (nodeObject) + properties.push(new WebInspector.RemoteObjectProperty("node", nodeObject)); + + for (var propertyName in this.eventListener) { + var value = WebInspector.RemoteObject.fromPrimitiveValue(value); + properties.push(new WebInspector.RemoteObjectProperty(propertyName, value)); + } + this.updateProperties(properties); } - this.updateProperties(properties); + var node = this.eventListener.node; + delete this.eventListener.node; + WebInspector.RemoteObject.resolveNode(node, updateWithNodeObject.bind(this)); }, _setNodeTitle: function() diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js index 2abe1db..95f373f 100644 --- a/WebCore/inspector/front-end/ExtensionServer.js +++ b/WebCore/inspector/front-end/ExtensionServer.js @@ -139,7 +139,8 @@ WebInspector.ExtensionServer.prototype = { var lastToolbarItem = WebInspector.panelOrder[WebInspector.panelOrder.length - 1].toolbarItem; WebInspector.addPanelToolbarIcon(toolbarElement, panel, lastToolbarItem); WebInspector.panels[id] = panel; - this._createClientIframe(panel.element, message.url); + var iframe = this._createClientIframe(panel.element, message.url); + iframe.style.height = "100%"; return this._status.OK(); }, @@ -165,6 +166,7 @@ WebInspector.ExtensionServer.prototype = { iframe.src = url; iframe.style.width = "100%"; parent.appendChild(iframe); + return iframe; }, _onSetSidebarHeight: function(message) @@ -193,7 +195,17 @@ WebInspector.ExtensionServer.prototype = { _onEvaluateOnInspectedPage: function(message, port) { - InjectedScriptAccess.getDefault().evaluateAndStringify(message.expression, this._dispatchCallback.bind(this, message.requestId, port)); + var escapedMessage = escape(message.expression); + function callback(resultPayload) + { + var resultObject = WebInspector.RemoteObject.fromPayload(resultPayload); + var result = {}; + if (resultObject.isError()) + result.isException = true; + result.value = resultObject.description; + this._dispatchCallback(message.requestId, port, result); + } + InjectedScriptAccess.getDefault().evaluate("(function() { var a = window.eval(unescape(\"" + escapedMessage + "\")); return JSON.stringify(a); })();", "", callback.bind(this)); }, _onRevealAndSelect: function(message) diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index b8bf9f2..d4e3d80 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -28,392 +28,517 @@ var injectedScriptConstructor = (function (InjectedScriptHost, inspectedWindow, injectedScriptId, jsEngine) { -var InjectedScript = {}; - -InjectedScript.lastBoundObjectId = 1; -InjectedScript.idToWrappedObject = {}; -InjectedScript.objectGroups = {}; - -InjectedScript.wrapObjectForConsole = function(object, canAccessInspectedWindow) +var InjectedScript = function() { - if (canAccessInspectedWindow) - return InjectedScript.wrapObject(object, "console"); - var result = {}; - result.type = typeof object; - result.description = InjectedScript._toString(object); - return result; + this._lastBoundObjectId = 1; + this._idToWrappedObject = {}; + this._objectGroups = {}; } -InjectedScript.wrapObject = function(object, objectGroupName) -{ - try { - var objectId; - if (typeof object === "object" || typeof object === "function" || InjectedScript._isHTMLAllCollection(object)) { - var id = InjectedScript.lastBoundObjectId++; - objectId = "object#" + id; - InjectedScript.idToWrappedObject[objectId] = object; - - var group = InjectedScript.objectGroups[objectGroupName]; - if (!group) { - group = []; - InjectedScript.objectGroups[objectGroupName] = group; +InjectedScript.prototype = { + wrapObjectForConsole: function(object, canAccessInspectedWindow) + { + if (canAccessInspectedWindow) + return this._wrapObject(object, "console"); + var result = {}; + result.type = typeof object; + result.description = this._toString(object); + return result; + }, + + _wrapObject: function(object, objectGroupName, abbreviate) + { + try { + var objectId; + if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) { + var id = this._lastBoundObjectId++; + objectId = id; + this._idToWrappedObject[id] = object; + + var group = this._objectGroups[objectGroupName]; + if (!group) { + group = []; + this._objectGroups[objectGroupName] = group; + } + group.push(id); + objectId = this._serializeObjectId(id, objectGroupName); } - group.push(objectId); + return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate); + } catch (e) { + return InjectedScript.RemoteObject.fromObject("[ Exception: " + e.toString() + " ]"); } - return InjectedScript.createProxyObject(object, objectId); - } catch (e) { - return InjectedScript.createProxyObject("[ Exception: " + e.toString() + " ]"); - } - return InjectedScript.createProxyObject(object, objectId); -}; - -InjectedScript.unwrapObject = function(objectId) { - return InjectedScript.idToWrappedObject[objectId]; -}; - -InjectedScript.releaseWrapperObjectGroup = function(objectGroupName) { - var group = InjectedScript.objectGroups[objectGroupName]; - if (!group) - return; - for (var i = 0; i < group.length; i++) - delete InjectedScript.idToWrappedObject[group[i]]; - delete InjectedScript.objectGroups[objectGroupName]; -}; - -InjectedScript.dispatch = function(methodName, args, callId) -{ - var argsArray = eval("(" + args + ")"); - if (callId) - argsArray.splice(0, 0, callId); // Methods that run asynchronously have a call back id parameter. - var result = InjectedScript[methodName].apply(InjectedScript, argsArray); - if (typeof result === "undefined") { - inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName); - result = null; - } - return result; -} + }, -InjectedScript.getPrototypes = function(nodeId) -{ - var node = InjectedScript._nodeForId(nodeId); - if (!node) - return false; - - var result = []; - for (var prototype = node; prototype; prototype = prototype.__proto__) { - var title = InjectedScript._describe(prototype, true); - if (title.match(/Prototype$/)) { - title = title.replace(/Prototype$/, ""); + _serializeObjectId: function(id, groupName) + { + return injectedScriptId + ":" + id + ":" + groupName; + }, + + _parseObjectId: function(objectId) + { + var tokens = objectId.split(":"); + var parsedObjectId = {}; + parsedObjectId.id = parseInt(tokens[1]); + parsedObjectId.groupName = tokens[2]; + return parsedObjectId; + }, + + releaseWrapperObjectGroup: function(objectGroupName) + { + var group = this._objectGroups[objectGroupName]; + if (!group) + return; + for (var i = 0; i < group.length; i++) + delete this._idToWrappedObject[group[i]]; + delete this._objectGroups[objectGroupName]; + }, + + dispatch: function(methodName, args) + { + var argsArray = eval("(" + args + ")"); + var result = this[methodName].apply(this, argsArray); + if (typeof result === "undefined") { + inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName); + result = null; } - result.push(title); - } - return result; -} + return result; + }, -InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate) -{ - var object = InjectedScript._resolveObject(objectProxy); - if (!InjectedScript._isDefined(object)) - return false; - var properties = []; + getPrototypes: function(nodeId) + { + this.releaseWrapperObjectGroup("prototypes"); + var node = this._nodeForId(nodeId); + if (!node) + return false; + + var result = []; + var prototype = node; + do { + result.push(this._wrapObject(prototype, "prototypes")); + prototype = prototype.__proto__; + } while (prototype) + return result; + }, + + getProperties: function(objectId, ignoreHasOwnProperty, abbreviate) + { + var parsedObjectId = this._parseObjectId(objectId); + var object = this._objectForId(parsedObjectId); + if (!this._isDefined(object)) + return false; + var properties = []; + + var propertyNames = ignoreHasOwnProperty ? this._getPropertyNames(object) : Object.getOwnPropertyNames(object); + if (!ignoreHasOwnProperty && object.__proto__) + propertyNames.push("__proto__"); - var propertyNames = ignoreHasOwnProperty ? InjectedScript._getPropertyNames(object) : Object.getOwnPropertyNames(object); - if (!ignoreHasOwnProperty && object.__proto__) - propertyNames.push("__proto__"); - - // Go over properties, prepare results. - for (var i = 0; i < propertyNames.length; ++i) { - var propertyName = propertyNames[i]; - - var property = {}; - property.name = propertyName + ""; - property.parentObjectProxy = objectProxy; - var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName); - if (!isGetter) { - try { - var childObject = object[propertyName]; - var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate); - childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : []; - childObjectProxy.path.push(propertyName); - property.value = childObjectProxy; - } catch(e) { - property.value = { description: e.toString() }; - property.isError = true; + // Go over properties, prepare results. + for (var i = 0; i < propertyNames.length; ++i) { + var propertyName = propertyNames[i]; + + var property = {}; + property.name = propertyName + ""; + var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName); + if (!isGetter) { + try { + property.value = this._wrapObject(object[propertyName], parsedObjectId.groupName, abbreviate); + } catch(e) { + property.value = new InjectedScript.RemoteObject.fromException(e); + } + } else { + // FIXME: this should show something like "getter" (bug 16734). + property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); // em dash + property.isGetter = true; } - } else { - // FIXME: this should show something like "getter" (bug 16734). - property.value = { description: "\u2014" }; // em dash - property.isGetter = true; + properties.push(property); } - properties.push(property); - } - return properties; -} - -InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression) -{ - var object = InjectedScript._resolveObject(objectProxy); - if (!InjectedScript._isDefined(object)) - return false; - - var expressionLength = expression.length; - if (!expressionLength) { - delete object[propertyName]; - return !(propertyName in object); - } + return properties; + }, - try { - // Surround the expression in parenthesis so the result of the eval is the result - // of the whole expression not the last potential sub-expression. - - // There is a regression introduced here: eval is now happening against global object, - // not call frame while on a breakpoint. - // TODO: bring evaluation against call frame back. - var result = inspectedWindow.eval("(" + expression + ")"); - // Store the result in the property. - object[propertyName] = result; - return true; - } catch(e) { + setPropertyValue: function(objectId, propertyName, expression) + { + var parsedObjectId = this._parseObjectId(objectId); + var object = this._objectForId(parsedObjectId); + if (!this._isDefined(object)) + return false; + + var expressionLength = expression.length; + if (!expressionLength) { + delete object[propertyName]; + return !(propertyName in object); + } + try { - var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\""); + // Surround the expression in parenthesis so the result of the eval is the result + // of the whole expression not the last potential sub-expression. + + // There is a regression introduced here: eval is now happening against global object, + // not call frame while on a breakpoint. + // TODO: bring evaluation against call frame back. + var result = inspectedWindow.eval("(" + expression + ")"); + // Store the result in the property. object[propertyName] = result; return true; } catch(e) { - return false; + try { + var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\""); + object[propertyName] = result; + return true; + } catch(e) { + return false; + } } - } -} + }, -InjectedScript._populatePropertyNames = function(object, resultSet) -{ - for (var o = object; o; o = o.__proto__) { - try { - var names = Object.getOwnPropertyNames(o); - for (var i = 0; i < names.length; ++i) - resultSet[names[i]] = true; - } catch (e) { + _populatePropertyNames: function(object, resultSet) + { + for (var o = object; o; o = o.__proto__) { + try { + var names = Object.getOwnPropertyNames(o); + for (var i = 0; i < names.length; ++i) + resultSet[names[i]] = true; + } catch (e) { + } } - } -} + }, -InjectedScript._getPropertyNames = function(object, resultSet) -{ - var propertyNameSet = {}; - InjectedScript._populatePropertyNames(object, propertyNameSet); - return Object.keys(propertyNameSet); -} + _getPropertyNames: function(object, resultSet) + { + var propertyNameSet = {}; + this._populatePropertyNames(object, propertyNameSet); + return Object.keys(propertyNameSet); + }, -InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI, callFrameId) -{ - var props = {}; - try { - var expressionResult; - // Evaluate on call frame if call frame id is available. - if (typeof callFrameId === "number") { - var callFrame = InjectedScript._callFrameForId(callFrameId); - if (!callFrame) - return props; - if (expression) - expressionResult = InjectedScript._evaluateOn(callFrame.evaluate, callFrame, expression, true); - else { - // Evaluate into properties in scope of the selected call frame. - var scopeChain = callFrame.scopeChain; - for (var i = 0; i < scopeChain.length; ++i) - InjectedScript._populatePropertyNames(scopeChain[i], props); + getCompletions: function(expression, includeInspectorCommandLineAPI, callFrameId) + { + var props = {}; + try { + var expressionResult; + // Evaluate on call frame if call frame id is available. + if (typeof callFrameId === "number") { + var callFrame = this._callFrameForId(callFrameId); + if (!callFrame) + return props; + if (expression) + expressionResult = this._evaluateOn(callFrame.evaluate, callFrame, expression); + else { + // Evaluate into properties in scope of the selected call frame. + var scopeChain = callFrame.scopeChain; + for (var i = 0; i < scopeChain.length; ++i) + this._populatePropertyNames(scopeChain[i], props); + } + } else { + if (!expression) + expression = "this"; + expressionResult = this._evaluateOn(inspectedWindow.eval, inspectedWindow, expression); } - } else { - if (!expression) - expression = "this"; - expressionResult = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); + if (typeof expressionResult === "object") + this._populatePropertyNames(expressionResult, props); + + if (includeInspectorCommandLineAPI) { + for (var prop in this._commandLineAPI) + props[prop] = true; + } + } catch(e) { } - if (typeof expressionResult === "object") - InjectedScript._populatePropertyNames(expressionResult, props); + return props; + }, - if (includeInspectorCommandLineAPI) { - for (var prop in InjectedScript._commandLineAPI) - props[prop] = true; + evaluate: function(expression, objectGroup) + { + return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup); + }, + + _evaluateAndWrap: function(evalFunction, object, expression, objectGroup) + { + try { + return this._wrapObject(this._evaluateOn(evalFunction, object, expression), objectGroup); + } catch (e) { + return InjectedScript.RemoteObject.fromException(e); } - } catch(e) { - } - return props; -} + }, -InjectedScript.evaluateAndStringify = function(expression) -{ - var result = {}; - try { - var value = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); - result.value = JSON.stringify(value); - } catch (e) { - result.value = e.toString(); - result.isException = true; - } - return result; -} + _evaluateOn: function(evalFunction, object, expression) + { + // 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 = this._commandLineAPI; + + expression = "with (window.console._commandLineAPI) { with (window) {\n" + expression + "\n} }"; + var value = evalFunction.call(object, expression); + + delete inspectedWindow.console._commandLineAPI; + + // When evaluating on call frame error is not thrown, but returned as a value. + if (this._type(value) === "error") + throw value.toString(); + + return value; + }, -InjectedScript.evaluate = function(expression, objectGroup) -{ - return InjectedScript._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup); -} + getNodeId: function(node) + { + return InjectedScriptHost.pushNodePathToFrontend(node, false, false); + }, -InjectedScript._evaluateAndWrap = function(evalFunction, object, expression, objectGroup, dontUseCommandLineAPI) -{ - var result = {}; - try { - result.value = InjectedScript.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression, dontUseCommandLineAPI), objectGroup); + callFrames: function() + { + var callFrame = InjectedScriptHost.currentCallFrame(); + if (!callFrame) + return false; + + injectedScript.releaseWrapperObjectGroup("backtrace"); + var result = []; + var depth = 0; + do { + result.push(new InjectedScript.CallFrameProxy(depth++, callFrame)); + callFrame = callFrame.caller; + } while (callFrame); + return result; + }, - // Handle error that might have happened while describing result. - if (result.value.errorText) { - result.value = result.value.errorText; - result.isException = true; - } - } catch (e) { - result.value = e.toString(); - result.isException = true; - } - return result; -} + evaluateInCallFrame: function(callFrameId, code, objectGroup) + { + var callFrame = this._callFrameForId(callFrameId); + if (!callFrame) + return false; + return this._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup); + }, -InjectedScript._evaluateOn = function(evalFunction, object, expression, dontUseCommandLineAPI) -{ - if (!dontUseCommandLineAPI) { - // Only install command line api object for the time of evaluation. + _callFrameForId: function(id) + { + var callFrame = InjectedScriptHost.currentCallFrame(); + while (--id >= 0 && callFrame) + callFrame = callFrame.caller; + return callFrame; + }, - // 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; + _nodeForId: function(nodeId) + { + if (!nodeId) + return null; + return InjectedScriptHost.nodeForId(nodeId); + }, - expression = "with (window.console._commandLineAPI) { with (window) {\n" + expression + "\n} }"; - } + _objectForId: function(parsedObjectId) + { + return this._idToWrappedObject[parsedObjectId.id]; + }, - var value = evalFunction.call(object, expression); + resolveNode: function(nodeId) + { + var node = this._nodeForId(nodeId); + if (!node) + return false; + // FIXME: receive the object group from client. + return this._wrapObject(node, "prototype"); + }, - if (!dontUseCommandLineAPI) - delete inspectedWindow.console._commandLineAPI; + getNodeProperties: function(nodeId, properties) + { + var node = this._nodeForId(nodeId); + if (!node) + return false; + var result = {}; + for (var i = 0; i < properties.length; ++i) + result[properties[i]] = node[properties[i]]; + return result; + }, - // When evaluating on call frame error is not thrown, but returned as a value. - if (InjectedScript._type(value) === "error") - throw value.toString(); + pushNodeToFrontend: function(objectId) + { + var parsedObjectId = this._parseObjectId(objectId); + var object = this._objectForId(parsedObjectId); + if (!object || this._type(object) !== "node") + return false; + return InjectedScriptHost.pushNodePathToFrontend(object, false, false); + }, - return value; -} + evaluateOnSelf: function(funcBody, args) + { + var func = window.eval("(" + funcBody + ")"); + return func.apply(this, args || []); + }, -InjectedScript.getNodeId = function(node) -{ - return InjectedScriptHost.pushNodePathToFrontend(node, false, false); -} + _isDefined: function(object) + { + return object || this._isHTMLAllCollection(object); + }, -InjectedScript.openInInspectedWindow = function(url) -{ - // Don't call window.open on wrapper - popup blocker mutes it. - // URIs should have no double quotes. - inspectedWindow.eval("window.open(\"" + url + "\")"); - return true; -} + _isHTMLAllCollection: function(object) + { + // document.all is reported as undefined, but we still want to process it. + return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection; + }, -InjectedScript.callFrames = function() -{ - var callFrame = InjectedScriptHost.currentCallFrame(); - if (!callFrame) - return false; - - var result = []; - var depth = 0; - do { - result.push(new InjectedScript.CallFrameProxy(depth++, callFrame)); - callFrame = callFrame.caller; - } while (callFrame); - return result; -} + _type: function(obj) + { + if (obj === null) + return "null"; + + var type = typeof obj; + if (type !== "object" && type !== "function") { + // FIXME(33716): typeof document.all is always 'undefined'. + if (this._isHTMLAllCollection(obj)) + return "array"; + return type; + } -InjectedScript.evaluateInCallFrame = function(callFrameId, code, objectGroup) -{ - var callFrame = InjectedScript._callFrameForId(callFrameId); - if (!callFrame) - return false; - return InjectedScript._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup, true); -} + // If owning frame has navigated to somewhere else window properties will be undefined. + // In this case just return result of the typeof. + if (!inspectedWindow.document) + return type; -InjectedScript._callFrameForId = function(id) -{ - var callFrame = InjectedScriptHost.currentCallFrame(); - while (--id >= 0 && callFrame) - callFrame = callFrame.caller; - return callFrame; -} + if (obj instanceof inspectedWindow.Node) + return (obj.nodeType === undefined ? type : "node"); + if (obj instanceof inspectedWindow.String) + return "string"; + if (obj instanceof inspectedWindow.Array) + return "array"; + if (obj instanceof inspectedWindow.Boolean) + return "boolean"; + if (obj instanceof inspectedWindow.Number) + return "number"; + if (obj instanceof inspectedWindow.Date) + return "date"; + if (obj instanceof inspectedWindow.RegExp) + return "regexp"; + // FireBug's array detection. + if (isFinite(obj.length) && typeof obj.splice === "function") + return "array"; + if (isFinite(obj.length) && typeof obj.callee === "function") // arguments. + return "array"; + if (obj instanceof inspectedWindow.NodeList) + return "array"; + if (obj instanceof inspectedWindow.HTMLCollection) + return "array"; + if (obj instanceof inspectedWindow.Error) + return "error"; + return type; + }, -InjectedScript._resolveObject = function(objectProxy) -{ - var object = InjectedScript._objectForId(objectProxy.objectId); - var path = objectProxy.path; + _describe: function(obj, abbreviated) + { + var type = this._type(obj); + + switch (type) { + case "object": + case "node": + return this._className(obj); + case "array": + var className = this._className(obj); + if (typeof obj.length === "number") + className += "[" + obj.length + "]"; + return className; + case "string": + if (!abbreviated) + return obj; + if (obj.length > 100) + return "\"" + obj.substring(0, 100) + "\u2026\""; + return "\"" + obj + "\""; + case "function": + var objectText = this._toString(obj); + if (abbreviated) + objectText = /.*/.exec(objectText)[0].replace(/ +$/g, ""); + return objectText; + default: + return this._toString(obj); + } + }, - // Follow the property path. - for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i) - object = object[path[i]]; + _toString: function(obj) + { + // We don't use String(obj) because inspectedWindow.String is undefined if owning frame navigated to another page. + return "" + obj; + }, - return object; -} + _className: function(obj) + { + // We can't use the same code for fetching class names of the dom bindings prototype chain. + // Both of the methods below result in "Object" names on the foreign engine bindings. + // I gave up and am using a check below to distinguish between the egine bingings. -InjectedScript._nodeForId = function(nodeId) -{ - if (!nodeId) - return null; - return InjectedScriptHost.nodeForId(nodeId); + if (jsEngine == "JSC") { + var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : this._toString(obj); + return str.replace(/^\[object (.*)\]$/i, "$1"); + } else { + // V8 + return obj.constructor && obj.constructor.name || "Object"; + } + }, + + _logEvent: function(event) + { + console.log(event.type, event); + }, + + _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; + }, + + _inspectedNode: function(num) + { + var nodeId = InjectedScriptHost.inspectedNode(num); + return this._nodeForId(nodeId); + }, + + _bindToScript: function(func) + { + var args = Array.prototype.slice.call(arguments, 1); + function bound() + { + return func.apply(injectedScript, args.concat(Array.prototype.slice.call(arguments))); + } + bound.toString = function() { + return "bound: " + func; + }; + return bound; + } } -InjectedScript._objectForId = function(objectId) +var injectedScript = new InjectedScript(); + +InjectedScript.RemoteObject = function(objectId, type, description, hasChildren) { - // There are three types of object ids used: - // - 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") - return InjectedScript._nodeForId(objectId); - else if (typeof objectId === "string") - return InjectedScript.unwrapObject(objectId); - else if (typeof objectId === "object") { - var callFrame = InjectedScript._callFrameForId(objectId.callFrame); - if (objectId.thisObject) - return callFrame.thisObject; - else - return callFrame.scopeChain[objectId.chainIndex]; - } - return objectId; + this.objectId = objectId; + this.type = type; + this.description = description; + this.hasChildren = hasChildren; } -InjectedScript.pushNodeToFrontend = function(objectProxy) +InjectedScript.RemoteObject.fromException = function(e) { - var object = InjectedScript._resolveObject(objectProxy); - if (!object || InjectedScript._type(object) !== "node") - return false; - return InjectedScriptHost.pushNodePathToFrontend(object, false, false); + return new InjectedScript.RemoteObject(null, "error", e.toString()); } -// Called from within InspectorController on the 'inspected page' side. -InjectedScript.createProxyObject = function(object, objectId, abbreviate) +InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate) { - var result = {}; - result.injectedScriptId = injectedScriptId; - result.objectId = objectId; - result.type = InjectedScript._type(object); - if (result.type === "array") - result.propertyLength = object.length; - - var type = typeof object; - - result.hasChildren = (type === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || type === "function"; + var type = injectedScript._type(object); + var rawType = typeof object; + var hasChildren = (rawType === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function"; + var description = ""; try { - result.description = InjectedScript._describe(object, abbreviate); + var description = injectedScript._describe(object, abbreviate); + return new InjectedScript.RemoteObject(objectId, type, description, hasChildren); } catch (e) { - result.errorText = e.toString(); + return InjectedScript.RemoteObject.fromException(e); } - return result; -} - -InjectedScript.evaluateOnSelf = function(funcBody, args) -{ - var func = window.eval("(" + funcBody + ")"); - return func.apply(this, args || []); } InjectedScript.CallFrameProxy = function(id, callFrame) @@ -424,7 +549,7 @@ InjectedScript.CallFrameProxy = function(id, callFrame) this.sourceID = callFrame.sourceID; this.line = callFrame.line; this.scopeChain = this._wrapScopeChain(callFrame); - this.injectedScriptId = injectedScriptId; + this.worldId = injectedScriptId; } InjectedScript.CallFrameProxy.prototype = { @@ -442,13 +567,13 @@ InjectedScript.CallFrameProxy.prototype = { for (var i = 0; i < scopeChain.length; i++) { var scopeType = callFrame.scopeType(i); var scopeObject = scopeChain[i]; - var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true); + var scopeObjectProxy = injectedScript._wrapObject(scopeObject, "backtrace", true); switch(scopeType) { case LOCAL_SCOPE: { foundLocalScope = true; scopeObjectProxy.isLocal = true; - scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true); + scopeObjectProxy.thisObject = injectedScript._wrapObject(callFrame.thisObject, "backtrace", true); break; } case CLOSURE_SCOPE: { @@ -472,138 +597,10 @@ InjectedScript.CallFrameProxy.prototype = { } } -InjectedScript._isDefined = function(object) -{ - return object || InjectedScript._isHTMLAllCollection(object); -} - -InjectedScript._isHTMLAllCollection = function(object) -{ - // document.all is reported as undefined, but we still want to process it. - return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection; -} - -InjectedScript._type = function(obj) -{ - if (obj === null) - return "null"; - - var type = typeof obj; - if (type !== "object" && type !== "function") { - // FIXME(33716): typeof document.all is always 'undefined'. - if (InjectedScript._isHTMLAllCollection(obj)) - return "array"; - return type; - } - - // If owning frame has navigated to somewhere else window properties will be undefined. - // In this case just return result of the typeof. - if (!inspectedWindow.document) - return type; - - if (obj instanceof inspectedWindow.Node) - return (obj.nodeType === undefined ? type : "node"); - if (obj instanceof inspectedWindow.String) - return "string"; - if (obj instanceof inspectedWindow.Array) - return "array"; - if (obj instanceof inspectedWindow.Boolean) - return "boolean"; - if (obj instanceof inspectedWindow.Number) - return "number"; - if (obj instanceof inspectedWindow.Date) - return "date"; - if (obj instanceof inspectedWindow.RegExp) - return "regexp"; - if (obj instanceof inspectedWindow.NodeList) - return "array"; - if (obj instanceof inspectedWindow.HTMLCollection) - return "array"; - if (typeof inspectedWindow.jQuery === "function" && obj instanceof inspectedWindow.jQuery) - return "array"; - if (obj instanceof inspectedWindow.Error) - return "error"; - return type; -} - -InjectedScript._describe = function(obj, abbreviated) -{ - var type = InjectedScript._type(obj); - - switch (type) { - case "object": - case "node": - case "array": - return InjectedScript._className(obj); - case "string": - if (!abbreviated) - return obj; - if (obj.length > 100) - return "\"" + obj.substring(0, 100) + "\u2026\""; - return "\"" + obj + "\""; - case "function": - var objectText = InjectedScript._toString(obj); - if (abbreviated) - objectText = /.*/.exec(objectText)[0].replace(/ +$/g, ""); - return objectText; - default: - return InjectedScript._toString(obj); - } -} - -InjectedScript._toString = function(obj) -{ - // We don't use String(obj) because inspectedWindow.String is undefined if owning frame navigated to another page. - return "" + obj; -} - -InjectedScript._className = function(obj) -{ - // We can't use the same code for fetching class names of the dom bindings prototype chain. - // Both of the methods below result in "Object" names on the foreign engine bindings. - // I gave up and am using a check below to distinguish between the egine bingings. - - if (jsEngine == "JSC") { - var str = inspectedWindow.Object ? inspectedWindow.Object.prototype.toString.call(obj) : InjectedScript._toString(obj); - return str.replace(/^\[object (.*)\]$/i, "$1"); - } else { - // V8 - 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() { + for (var i = 0; i < 5; ++i) + this.__defineGetter__("$" + i, injectedScript._bindToScript(injectedScript._inspectedNode, i)); } CommandLineAPI.prototype = { @@ -670,10 +667,10 @@ CommandLineAPI.prototype = { { if (!object || !object.addEventListener || !object.removeEventListener) return; - types = InjectedScript._normalizeEventTypes(types); + 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); + object.removeEventListener(types[i], injectedScript._logEvent, false); + object.addEventListener(types[i], injectedScript._logEvent, false); } }, @@ -681,9 +678,9 @@ CommandLineAPI.prototype = { { if (!object || !object.addEventListener || !object.removeEventListener) return; - types = InjectedScript._normalizeEventTypes(types); + types = injectedScript._normalizeEventTypes(types); for (var i = 0; i < types.length; ++i) - object.removeEventListener(types[i], InjectedScript._logEvent, false); + object.removeEventListener(types[i], injectedScript._logEvent, false); }, inspect: function(object) @@ -692,10 +689,10 @@ CommandLineAPI.prototype = { return; inspectedWindow.console.log(object); - if (InjectedScript._type(object) === "node") + if (injectedScript._type(object) === "node") InjectedScriptHost.pushNodePathToFrontend(object, false, true); else { - switch (InjectedScript._describe(object)) { + switch (injectedScript._describe(object)) { case "Database": InjectedScriptHost.selectDatabase(object); break; @@ -708,7 +705,7 @@ CommandLineAPI.prototype = { copy: function(object) { - if (InjectedScript._type(object) === "node") { + if (injectedScript._type(object) === "node") { var nodeId = InjectedScriptHost.pushNodePathToFrontend(object, false, false); InjectedScriptHost.copyNode(nodeId); } else @@ -718,35 +715,9 @@ CommandLineAPI.prototype = { 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; +injectedScript._commandLineAPI = new CommandLineAPI(); +return injectedScript; }); diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js index b5aa9c7..ce264dd 100644 --- a/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -29,17 +29,29 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function InjectedScriptAccess(injectedScriptId) { - this._injectedScriptId = injectedScriptId; +function InjectedScriptAccess(worldId) { + this._worldId = worldId; } -InjectedScriptAccess.get = function(injectedScriptId) +InjectedScriptAccess.get = function(worldId) { - if (typeof injectedScriptId === "number") - return new InjectedScriptAccess(injectedScriptId); + if (typeof worldId === "number") + return new InjectedScriptAccess(worldId); - console.error("Access to injected script with no id"); - console.trace(); + console.assert(false, "Access to injected script with no id"); +} + +InjectedScriptAccess.getForNode = function(node) +{ + // FIXME: do something. + return InjectedScriptAccess.get(-node.id); +} + +InjectedScriptAccess.getForObjectId = function(objectId) +{ + // FIXME: move to native layer. + var tokens = objectId.split(":"); + return InjectedScriptAccess.get(parseInt(tokens[0])); } InjectedScriptAccess.getDefault = function() @@ -66,7 +78,7 @@ InjectedScriptAccess._installHandler = function(methodName, async) } var callId = WebInspector.Callback.wrap(myCallback); - InspectorBackend.dispatchOnInjectedScript(callId, this._injectedScriptId, methodName, argsString); + InspectorBackend.dispatchOnInjectedScript(callId, this._worldId, methodName, argsString); }; } @@ -75,12 +87,12 @@ InjectedScriptAccess._installHandler = function(methodName, async) // - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function. // We keep these sorted. InjectedScriptAccess._installHandler("evaluate"); -InjectedScriptAccess._installHandler("evaluateAndStringify"); InjectedScriptAccess._installHandler("evaluateInCallFrame"); InjectedScriptAccess._installHandler("evaluateOnSelf"); InjectedScriptAccess._installHandler("getCompletions"); InjectedScriptAccess._installHandler("getProperties"); InjectedScriptAccess._installHandler("getPrototypes"); -InjectedScriptAccess._installHandler("openInInspectedWindow"); InjectedScriptAccess._installHandler("pushNodeToFrontend"); +InjectedScriptAccess._installHandler("resolveNode"); +InjectedScriptAccess._installHandler("getNodeProperties"); InjectedScriptAccess._installHandler("setPropertyValue"); diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js deleted file mode 100644 index c87cb81..0000000 --- a/WebCore/inspector/front-end/InspectorBackendStub.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2009, 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. - */ - -WebInspector.InspectorBackendStub = function() -{ - this._registerDelegate("addInspectedNode"); - this._registerDelegate("addScriptToEvaluateOnLoad"); - this._registerDelegate("changeTagName"); - this._registerDelegate("clearConsoleMessages"); - this._registerDelegate("copyNode"); - this._registerDelegate("deleteCookie"); - this._registerDelegate("didEvaluateForTestInFrontend"); - this._registerDelegate("disableMonitoringXHR"); - this._registerDelegate("disableResourceTracking"); - this._registerDelegate("disableSearchingForNode"); - this._registerDelegate("disableTimeline"); - this._registerDelegate("dispatchOnInjectedScript"); - this._registerDelegate("enableMonitoringXHR"); - this._registerDelegate("enableResourceTracking"); - this._registerDelegate("enableSearchingForNode"); - this._registerDelegate("enableTimeline"); - this._registerDelegate("getApplicationCaches"); - this._registerDelegate("getChildNodes"); - this._registerDelegate("getCookies"); - this._registerDelegate("getDatabaseTableNames"); - this._registerDelegate("getDOMStorageEntries"); - this._registerDelegate("getEventListenersForNode"); - this._registerDelegate("getOuterHTML"); - this._registerDelegate("getProfile"); - this._registerDelegate("getProfileHeaders"); - this._registerDelegate("removeProfile"); - this._registerDelegate("clearProfiles"); - this._registerDelegate("getResourceContent"); - this._registerDelegate("highlightDOMNode"); - this._registerDelegate("hideDOMNodeHighlight"); - this._registerDelegate("performSearch"); - this._registerDelegate("pushNodeByPathToFrontend"); - this._registerDelegate("releaseWrapperObjectGroup"); - this._registerDelegate("removeAllScriptsToEvaluateOnLoad"); - this._registerDelegate("reloadPage"); - this._registerDelegate("removeAttribute"); - this._registerDelegate("removeDOMStorageItem"); - this._registerDelegate("removeNode"); - this._registerDelegate("saveApplicationSettings"); - this._registerDelegate("saveSessionSettings"); - this._registerDelegate("searchCanceled"); - this._registerDelegate("setAttribute"); - this._registerDelegate("setDOMStorageItem"); - this._registerDelegate("setInjectedScriptSource"); - this._registerDelegate("setOuterHTML"); - this._registerDelegate("setTextNodeValue"); - this._registerDelegate("startProfiling"); - this._registerDelegate("startTimelineProfiler"); - this._registerDelegate("stopProfiling"); - this._registerDelegate("stopTimelineProfiler"); - this._registerDelegate("storeLastActivePanel"); - this._registerDelegate("takeHeapSnapshot"); - this._registerDelegate("getProfilerLogLines"); - - this._registerDelegate("getAllStyles"); - this._registerDelegate("getStyles"); - this._registerDelegate("getComputedStyle"); - this._registerDelegate("getInlineStyle"); - this._registerDelegate("getStyleSheet"); - this._registerDelegate("getRuleRanges"); - this._registerDelegate("applyStyleText"); - this._registerDelegate("setStyleText"); - this._registerDelegate("setStyleProperty"); - this._registerDelegate("toggleStyleEnabled"); - this._registerDelegate("setRuleSelector"); - this._registerDelegate("addRule"); - - this._registerDelegate("disableDebugger"); - this._registerDelegate("editScriptSource"); - this._registerDelegate("getScriptSource"); - this._registerDelegate("enableDebugger"); - this._registerDelegate("setBreakpoint"); - this._registerDelegate("removeBreakpoint"); - this._registerDelegate("activateBreakpoints"); - this._registerDelegate("deactivateBreakpoints"); - this._registerDelegate("pause"); - this._registerDelegate("resume"); - this._registerDelegate("stepIntoStatement"); - this._registerDelegate("stepOutOfFunction"); - this._registerDelegate("stepOverStatement"); - this._registerDelegate("setPauseOnExceptionsState"); -} - -WebInspector.InspectorBackendStub.prototype = { - _registerDelegate: function(methodName) - { - this[methodName] = this.sendMessageToBackend.bind(this, methodName); - }, - - sendMessageToBackend: function() - { - var message = JSON.stringify(Array.prototype.slice.call(arguments)); - InspectorFrontendHost.sendMessageToBackend(message); - } -} - -InspectorBackend = new WebInspector.InspectorBackendStub(); diff --git a/WebCore/inspector/front-end/InspectorBackendStub.qrc b/WebCore/inspector/front-end/InspectorBackendStub.qrc new file mode 100644 index 0000000..30f6d75 --- /dev/null +++ b/WebCore/inspector/front-end/InspectorBackendStub.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/webkit/inspector"> + <file>InspectorBackendStub.js</file> +</qresource> +</RCC> + diff --git a/WebCore/inspector/front-end/ObjectPropertiesSection.js b/WebCore/inspector/front-end/ObjectPropertiesSection.js index a32e799..aab9546 100644 --- a/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -50,7 +50,7 @@ WebInspector.ObjectPropertiesSection.prototype = { return; self.updateProperties(properties); }; - InjectedScriptAccess.get(this.object.injectedScriptId).getProperties(this.object, this.ignoreHasOwnProperty, true, callback); + this.object.getProperties(this.ignoreHasOwnProperty, true, callback); }, updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer) @@ -69,8 +69,10 @@ WebInspector.ObjectPropertiesSection.prototype = { this.propertiesTreeOutline.removeChildren(); - for (var i = 0; i < properties.length; ++i) + for (var i = 0; i < properties.length; ++i) { + properties[i].parentObject = this.object; this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i])); + } if (!this.propertiesTreeOutline.children.length) { var title = "<div class=\"info\">" + this.emptyPlaceholder + "</div>"; @@ -152,7 +154,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i])); } }; - InjectedScriptAccess.get(this.property.value.injectedScriptId).getProperties(this.property.value, false, true, callback.bind(this)); + this.property.value.getOwnProperties(true, callback.bind(this)); }, ondblclick: function(event) @@ -178,11 +180,9 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.valueElement = document.createElement("span"); this.valueElement.className = "value"; this.valueElement.textContent = this.property.value.description; - if (typeof this.property.value.propertyLength !== "undefined") - this.valueElement.textContent += " (" + this.property.value.propertyLength + ")"; if (this.property.isGetter) this.valueElement.addStyleClass("dimmed"); - if (this.property.isError) + if (this.property.value.isError()) this.valueElement.addStyleClass("error"); this.listItemElement.removeChildren(); @@ -260,7 +260,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { self.updateSiblings(); } }; - InjectedScriptAccess.get(this.property.parentObjectProxy.injectedScriptId).setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback); + this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback); } } diff --git a/WebCore/inspector/front-end/PropertiesSidebarPane.js b/WebCore/inspector/front-end/PropertiesSidebarPane.js index 9df6448..75d6a48 100644 --- a/WebCore/inspector/front-end/PropertiesSidebarPane.js +++ b/WebCore/inspector/front-end/PropertiesSidebarPane.js @@ -48,17 +48,18 @@ WebInspector.PropertiesSidebarPane.prototype = { body.removeChildren(); self.sections = []; - var path = []; // Get array of prototype user-friendly names. for (var i = 0; i < prototypes.length; ++i) { - var prototype = new WebInspector.ObjectProxy(node.injectedScriptId, node.id, path.slice()); - var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype")); + var prototype = WebInspector.RemoteObject.fromPayload(prototypes[i]); + var title = prototype.description; + if (title.match(/Prototype$/)) + title = title.replace(/Prototype$/, ""); + var section = new WebInspector.ObjectPropertiesSection(prototype, title, WebInspector.UIString("Prototype")); self.sections.push(section); body.appendChild(section.element); - path.push("__proto__"); } }; - InjectedScriptAccess.get(node.injectedScriptId).getPrototypes(node.id, callback); + InjectedScriptAccess.getForNode(node).getPrototypes(node.id, callback); } } diff --git a/WebCore/inspector/front-end/RemoteObject.js b/WebCore/inspector/front-end/RemoteObject.js new file mode 100644 index 0000000..003d483 --- /dev/null +++ b/WebCore/inspector/front-end/RemoteObject.js @@ -0,0 +1,138 @@ +/* + * 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. + */ + +WebInspector.RemoteObject = function(objectId, type, description, hasChildren) +{ + this._objectId = objectId; + this._type = type; + this._description = description; + this._hasChildren = hasChildren; +} + +WebInspector.RemoteObject.fromPrimitiveValue = function(value) +{ + return new WebInspector.RemoteObject(null, typeof value, value); +} + +WebInspector.RemoteObject.resolveNode = function(node, callback) +{ + function mycallback(object) + { + callback(object ? WebInspector.RemoteObject.fromPayload(object) : null); + } + InjectedScriptAccess.getForNode(node).resolveNode(node.id, mycallback); +} + +WebInspector.RemoteObject.fromPayload = function(payload) +{ + if (typeof payload === "object") + return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.description, payload.hasChildren); + // FIXME: make sure we only get here with real payloads in the new DebuggerAgent.js. + return payload; +} + +WebInspector.RemoteObject.type = function(remoteObject) +{ + if (remoteObject === null) + return "null"; + + var type = typeof remoteObject; + if (type !== "object" && type !== "function") + return type; + + return remoteObject.type; +} + +WebInspector.RemoteObject.prototype = { + get objectId() + { + return this._objectId; + }, + + get type() + { + return this._type; + }, + + get description() + { + return this._description; + }, + + get hasChildren() + { + return this._hasChildren; + }, + + isError: function() + { + return this._type === "error"; + }, + + getOwnProperties: function(abbreviate, callback) + { + this.getProperties(false, abbreviate, callback); + }, + + getProperties: function(ignoreHasOwnProperty, abbreviate, callback) + { + if (!this._objectId) { + callback([]); + return; + } + function remoteObjectBinder(properties) + { + for (var i = 0; properties && i < properties.length; ++i) + properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value); + callback(properties); + } + InjectedScriptAccess.getForObjectId(this._objectId).getProperties(this._objectId, ignoreHasOwnProperty, abbreviate, remoteObjectBinder); + }, + + setPropertyValue: function(name, value, callback) + { + if (!this._objectId) { + callback(false); + return; + } + InjectedScriptAccess.getForObjectId(this._objectId).setPropertyValue(this._objectId, name, value, callback); + }, + + pushNodeToFrontend: function(callback) + { + InjectedScriptAccess.getForObjectId(this._objectId).pushNodeToFrontend(this._objectId, callback); + } +} + +WebInspector.RemoteObjectProperty = function(name, value) +{ + this.name = name; + this.value = value; +} diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index 9785644..01eefc7 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -1186,7 +1186,7 @@ WebInspector.ResourceSidebarTreeElement.prototype = { ondblclick: function(event) { - InjectedScriptAccess.getDefault().openInInspectedWindow(this.resource.url, function() {}); + InspectorBackend.openInInspectedWindow(this.resource.url); }, ondragstart: function(event) { diff --git a/WebCore/inspector/front-end/ScopeChainSidebarPane.js b/WebCore/inspector/front-end/ScopeChainSidebarPane.js index fdfcd38..d3190a9 100644 --- a/WebCore/inspector/front-end/ScopeChainSidebarPane.js +++ b/WebCore/inspector/front-end/ScopeChainSidebarPane.js @@ -60,7 +60,7 @@ WebInspector.ScopeChainSidebarPane.prototype = { emptyPlaceholder = WebInspector.UIString("No Variables"); subtitle = null; if (scopeObjectProxy.thisObject) - extraProperties = [ new WebInspector.ObjectPropertyProxy("this", scopeObjectProxy.thisObject) ]; + extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scopeObjectProxy.thisObject)) ]; } else if (scopeObjectProxy.isClosure) { title = WebInspector.UIString("Closure"); emptyPlaceholder = WebInspector.UIString("No Variables"); @@ -77,7 +77,7 @@ WebInspector.ScopeChainSidebarPane.prototype = { if (!title || title === subtitle) subtitle = null; - var section = new WebInspector.ObjectPropertiesSection(scopeObjectProxy, title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement); + var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement); section.editInSelectedCallFrameWhenPaused = true; section.pane = this; diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 44c1dba..8675f79 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -387,9 +387,9 @@ WebInspector.ScriptsPanel.prototype = { updateInterface = true; var self = this; - function updatingCallbackWrapper(result, exception) + function updatingCallbackWrapper(result) { - callback(result, exception); + callback(result); if (updateInterface) self.sidebarPanes.scopechain.update(selectedCallFrame); } @@ -401,9 +401,9 @@ WebInspector.ScriptsPanel.prototype = { function evalCallback(result) { if (result) - callback(result.value, result.isException); + callback(WebInspector.RemoteObject.fromPayload(result)); } - InjectedScriptAccess.get(callFrame.injectedScriptId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback); + InjectedScriptAccess.get(callFrame.worldId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback); }, debuggerPaused: function(callFrames) diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 73c3e2a..01a8ec2 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -625,9 +625,9 @@ WebInspector.SourceFrame.prototype = { popupContentElement.addEventListener("mousemove", killHidePopupTimer.bind(this), true); } - function evaluateCallback(result, exception) + function evaluateCallback(result) { - if (exception) + if (result.isError()) return; if (!WebInspector.panels.scripts.paused) return; @@ -699,11 +699,11 @@ WebInspector.SourceFrame.prototype = { return; var expression = selection.getRangeAt(0).toString().trim(); - WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) { + WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result) { WebInspector.showConsole(); var commandMessage = new WebInspector.ConsoleCommand(expression); WebInspector.console.addMessage(commandMessage); - WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage)); + WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage)); }); }, diff --git a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js index b530ab6..28dad23 100644 --- a/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js +++ b/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js @@ -90,24 +90,10 @@ WebInspector.WatchExpressionsSection.NewWatchExpression = "\xA0"; WebInspector.WatchExpressionsSection.prototype = { update: function() { - function appendResult(expression, watchIndex, result, exception) + function appendResult(expression, watchIndex, result) { - if (exception) { - // Exception results are not wrappers, but text messages. - result = WebInspector.ObjectProxy.wrapPrimitiveValue(result); - } else if (result.type === "string") { - // Evaluation result is intentionally not abbreviated. However, we'd like to distinguish between null and "null" - result.description = "\"" + result.description + "\""; - } - - var property = new WebInspector.ObjectPropertyProxy(expression, result); + var property = new WebInspector.RemoteObjectProperty(expression, result); property.watchIndex = watchIndex; - property.isException = exception; - - // For newly added, empty expressions, set description to "", - // since otherwise you get DOMWindow - if (property.name === WebInspector.WatchExpressionsSection.NewWatchExpression) - property.value.description = ""; // To clarify what's going on here: // In the outer function, we calculate the number of properties @@ -222,7 +208,7 @@ WebInspector.WatchExpressionTreeElement.prototype = { { WebInspector.ObjectPropertyTreeElement.prototype.update.call(this); - if (this.property.isException) + if (this.property.value.isError()) this.valueElement.addStyleClass("watch-expressions-error-level"); var deleteButton = document.createElement("input"); diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index a54936c..4901857 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -46,13 +46,11 @@ <file>InjectedScript.js</file> <file>InjectedScriptAccess.js</file> <file>inspector.js</file> - <file>InspectorBackendStub.js</file> <file>InspectorFrontendHostStub.js</file> <file>KeyboardShortcut.js</file> <file>MetricsSidebarPane.js</file> <file>Object.js</file> <file>ObjectPropertiesSection.js</file> - <file>ObjectProxy.js</file> <file>Panel.js</file> <file>PanelEnablerView.js</file> <file>Placard.js</file> @@ -62,6 +60,7 @@ <file>ProfileView.js</file> <file>PropertiesSection.js</file> <file>PropertiesSidebarPane.js</file> + <file>RemoteObject.js</file> <file>Resource.js</file> <file>ResourceCategory.js</file> <file>ResourcesPanel.js</file> diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index 48e95bb..14e2cdc 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -73,7 +73,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="SidebarTreeElement.js"></script> <script type="text/javascript" src="Section.js"></script> <script type="text/javascript" src="PropertiesSection.js"></script> - <script type="text/javascript" src="ObjectProxy.js"></script> + <script type="text/javascript" src="RemoteObject.js"></script> <script type="text/javascript" src="ObjectPropertiesSection.js"></script> <script type="text/javascript" src="BreakpointsSidebarPane.js"></script> <script type="text/javascript" src="CallStackSidebarPane.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index 4e8e633..fa57916 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -28,7 +28,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -function preloadImages() +// Keep this ; so that concatenated version of the script worked. +;(function preloadImages() { (new Image()).src = "Images/clearConsoleButtonGlyph.png"; (new Image()).src = "Images/consoleButtonGlyph.png"; @@ -45,9 +46,7 @@ function preloadImages() (new Image()).src = "Images/recordToggledButtonGlyph.png"; (new Image()).src = "Images/reloadButtonGlyph.png"; (new Image()).src = "Images/undockButtonGlyph.png"; -} - -preloadImages(); +})(); var WebInspector = { resources: {}, @@ -427,10 +426,39 @@ WebInspector.PlatformFlavor = { MacTiger: "mac-tiger", MacLeopard: "mac-leopard", MacSnowLeopard: "mac-snowleopard" -} +}; + +(function parseQueryParameters() +{ + WebInspector.queryParamsObject = {}; + var queryParams = window.location.search; + if (!queryParams) + return; + var params = queryParams.substring(1).split("&"); + for (var i = 0; i < params.length; ++i) { + var pair = params[i].split("="); + WebInspector.queryParamsObject[pair[0]] = pair[1]; + } +})(); WebInspector.loaded = function() { + if ("page" in WebInspector.queryParamsObject) { + WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector.queryParamsObject.page); + WebInspector.socket.onmessage = function(message) { WebInspector_syncDispatch(message.data); } + WebInspector.socket.onerror = function(error) { console.error(error); } + WebInspector.socket.onopen = function() { + InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket); + InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded"); + WebInspector.doLoadedDone(); + } + return; + } + WebInspector.doLoadedDone(); +} + +WebInspector.doLoadedDone = function() +{ InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");"); var platform = WebInspector.platform; @@ -581,6 +609,15 @@ WebInspector.dispatch = function() { setTimeout(delayDispatch, 0); } +// This function is purposely put into the global scope for easy access. +WebInspector_syncDispatch = function(message) +{ + var args = JSON.parse(message); + var methodName = args[0]; + var parameters = args.slice(1); + WebInspector[methodName].apply(WebInspector, parameters); +} + WebInspector.dispatchMessageFromBackend = function(arguments) { WebInspector.dispatch.apply(this, arguments); @@ -1109,6 +1146,11 @@ WebInspector.selectDatabase = function(o) WebInspector.panels.storage.selectDatabase(o); } +WebInspector.consoleMessagesCleared = function() +{ + WebInspector.console.clearMessages(); +} + WebInspector.selectDOMStorage = function(o) { WebInspector.showPanel("storage"); @@ -1470,7 +1512,7 @@ WebInspector.log = function(message, messageLevel) // return indication if we can actually log a message function isLogAvailable() { - return WebInspector.ConsoleMessage && WebInspector.ObjectProxy && self.console; + return WebInspector.ConsoleMessage && WebInspector.RemoteObject && self.console; } // flush the queue of pending messages @@ -1510,7 +1552,7 @@ WebInspector.log = function(message, messageLevel) WebInspector.log.repeatCount = repeatCount; // ConsoleMessage expects a proxy object - message = new WebInspector.ObjectProxy(null, null, [], message, false); + message = new WebInspector.RemoteObject.fromPrimitiveValue(message); // post the message var msg = new WebInspector.ConsoleMessage( diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js index dd3e761..66cf284 100644 --- a/WebCore/inspector/front-end/utilities.js +++ b/WebCore/inspector/front-end/utilities.js @@ -26,18 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -Object.proxyType = function(objectProxy) -{ - if (objectProxy === null) - return "null"; - - var type = typeof objectProxy; - if (type !== "object" && type !== "function") - return type; - - return objectProxy.type; -} - Object.properties = function(obj) { var properties = []; @@ -847,7 +835,7 @@ String.tokenizeFormatString = function(format) String.standardFormatters = { d: function(substitution) { - if (typeof substitution == "object" && Object.proxyType(substitution) === "number") + if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number") substitution = substitution.description; substitution = parseInt(substitution); return !isNaN(substitution) ? substitution : 0; @@ -855,7 +843,7 @@ String.standardFormatters = { f: function(substitution, token) { - if (typeof substitution == "object" && Object.proxyType(substitution) === "number") + if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number") substitution = substitution.description; substitution = parseFloat(substitution); if (substitution && token.precision > -1) @@ -865,7 +853,7 @@ String.standardFormatters = { s: function(substitution) { - if (typeof substitution == "object" && Object.proxyType(substitution) !== "null") + if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) !== "null") substitution = substitution.description; return substitution; }, diff --git a/WebCore/loader/Cache.h b/WebCore/loader/Cache.h index 0a5b74d..23aad1e 100644 --- a/WebCore/loader/Cache.h +++ b/WebCore/loader/Cache.h @@ -28,12 +28,12 @@ #include "CachePolicy.h" #include "CachedResource.h" #include "PlatformString.h" -#include "StringHash.h" #include "loader.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/loader/CrossOriginAccessControl.cpp b/WebCore/loader/CrossOriginAccessControl.cpp index f019f28..630f2b7 100644 --- a/WebCore/loader/CrossOriginAccessControl.cpp +++ b/WebCore/loader/CrossOriginAccessControl.cpp @@ -27,11 +27,11 @@ #include "config.h" #include "CrossOriginAccessControl.h" -#include "AtomicString.h" #include "HTTPParsers.h" #include "ResourceResponse.h" #include "SecurityOrigin.h" #include <wtf/Threading.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/loader/CrossOriginPreflightResultCache.cpp b/WebCore/loader/CrossOriginPreflightResultCache.cpp index 51874d1..18e4be2 100644 --- a/WebCore/loader/CrossOriginPreflightResultCache.cpp +++ b/WebCore/loader/CrossOriginPreflightResultCache.cpp @@ -74,16 +74,16 @@ static void addToAccessControlAllowList(const String& string, unsigned start, un template<class HashType> static bool parseAccessControlAllowList(const String& string, HashSet<String, HashType>& set) { - int start = 0; - int end; - while ((end = string.find(',', start)) != -1) { + unsigned start = 0; + size_t end; + while ((end = string.find(',', start)) != notFound) { if (start == end) return false; addToAccessControlAllowList(string, start, end - 1, set); start = end + 1; } - if (start != static_cast<int>(string.length())) + if (start != string.length()) addToAccessControlAllowList(string, start, string.length() - 1, set); return true; diff --git a/WebCore/loader/CrossOriginPreflightResultCache.h b/WebCore/loader/CrossOriginPreflightResultCache.h index 0f3e356..1016aed 100644 --- a/WebCore/loader/CrossOriginPreflightResultCache.h +++ b/WebCore/loader/CrossOriginPreflightResultCache.h @@ -28,10 +28,10 @@ #define CrossOriginPreflightResultCache_h #include "KURLHash.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/loader/DocLoader.h b/WebCore/loader/DocLoader.h index 2b43bb3..06b02c9 100644 --- a/WebCore/loader/DocLoader.h +++ b/WebCore/loader/DocLoader.h @@ -29,10 +29,10 @@ #include "CachedResource.h" #include "CachedResourceHandle.h" #include "CachePolicy.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/ListHashSet.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/loader/DocumentLoader.cpp b/WebCore/loader/DocumentLoader.cpp index fcc1826..26d66e8 100644 --- a/WebCore/loader/DocumentLoader.cpp +++ b/WebCore/loader/DocumentLoader.cpp @@ -86,6 +86,7 @@ DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& , m_gotFirstByte(false) , m_primaryLoadComplete(false) , m_isClientRedirect(false) + , m_wasOnloadHandled(false) , m_stopRecordingResponses(false) , m_substituteResourceDeliveryTimer(this, &DocumentLoader::substituteResourceDeliveryTimerFired) , m_didCreateGlobalHistoryEntry(false) diff --git a/WebCore/loader/DocumentLoader.h b/WebCore/loader/DocumentLoader.h index d9e7581..bc81350 100644 --- a/WebCore/loader/DocumentLoader.h +++ b/WebCore/loader/DocumentLoader.h @@ -109,6 +109,8 @@ namespace WebCore { void prepareForLoadStart(); bool isClientRedirect() const { return m_isClientRedirect; } void setIsClientRedirect(bool isClientRedirect) { m_isClientRedirect = isClientRedirect; } + void handledOnloadEvents() { m_wasOnloadHandled = true; } + bool wasOnloadHandled() { return m_wasOnloadHandled; } bool isLoadingInAPISense() const; void setPrimaryLoadComplete(bool); void setTitle(const String&); @@ -269,6 +271,7 @@ namespace WebCore { bool m_gotFirstByte; bool m_primaryLoadComplete; bool m_isClientRedirect; + bool m_wasOnloadHandled; String m_pageTitle; String m_pageIconURL; diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index 9315e45..5c7102c 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -27,9 +27,9 @@ #include "FTPDirectoryDocument.h" #include "CharacterNames.h" +#include "HTMLDocumentParser.h" #include "HTMLNames.h" #include "HTMLTableElement.h" -#include "LegacyHTMLDocumentParser.h" #include "LocalizedStrings.h" #include "Logging.h" #include "FTPDirectoryParser.h" @@ -48,13 +48,13 @@ namespace WebCore { using namespace HTMLNames; -class FTPDirectoryDocumentParser : public LegacyHTMLDocumentParser { +class FTPDirectoryDocumentParser : public HTMLDocumentParser { public: FTPDirectoryDocumentParser(HTMLDocument*); virtual void append(const SegmentedString&); virtual void finish(); - + virtual bool isWaitingForScripts() const { return false; } inline void checkBuffer(int len = 10) @@ -79,7 +79,7 @@ private: void parseAndAppendOneLine(const String&); void appendEntry(const String& name, const String& size, const String& date, bool isDirectory); PassRefPtr<Element> createTDForFilename(const String&); - + RefPtr<HTMLTableElement> m_tableElement; bool m_skipLF; @@ -94,14 +94,14 @@ private: }; FTPDirectoryDocumentParser::FTPDirectoryDocumentParser(HTMLDocument* document) - : LegacyHTMLDocumentParser(document, false) + : HTMLDocumentParser(document, false) , m_skipLF(false) , m_parsedTemplate(false) , m_size(254) , m_buffer(static_cast<UChar*>(fastMalloc(sizeof(UChar) * m_size))) , m_dest(m_buffer) { -} +} void FTPDirectoryDocumentParser::appendEntry(const String& filename, const String& size, const String& date, bool isDirectory) { @@ -109,7 +109,7 @@ void FTPDirectoryDocumentParser::appendEntry(const String& filename, const Strin RefPtr<Element> rowElement = m_tableElement->insertRow(-1, ec); rowElement->setAttribute("class", "ftpDirectoryEntryRow", ec); - + RefPtr<Element> element = document()->createElement(tdTag, false); element->appendChild(Text::create(document(), String(&noBreakSpace, 1)), ec); if (isDirectory) @@ -117,16 +117,16 @@ void FTPDirectoryDocumentParser::appendEntry(const String& filename, const Strin else element->setAttribute("class", "ftpDirectoryIcon ftpDirectoryTypeFile", ec); rowElement->appendChild(element, ec); - + element = createTDForFilename(filename); element->setAttribute("class", "ftpDirectoryFileName", ec); rowElement->appendChild(element, ec); - + element = document()->createElement(tdTag, false); element->appendChild(Text::create(document(), date), ec); element->setAttribute("class", "ftpDirectoryFileDate", ec); rowElement->appendChild(element, ec); - + element = document()->createElement(tdTag, false); element->appendChild(Text::create(document(), size), ec); element->setAttribute("class", "ftpDirectoryFileSize", ec); @@ -136,7 +136,7 @@ void FTPDirectoryDocumentParser::appendEntry(const String& filename, const Strin PassRefPtr<Element> FTPDirectoryDocumentParser::createTDForFilename(const String& filename) { ExceptionCode ec; - + String fullURL = document()->baseURL().string(); if (fullURL[fullURL.length() - 1] == '/') fullURL.append(filename); @@ -146,10 +146,10 @@ PassRefPtr<Element> FTPDirectoryDocumentParser::createTDForFilename(const String RefPtr<Element> anchorElement = document()->createElement(aTag, false); anchorElement->setAttribute("href", fullURL, ec); anchorElement->appendChild(Text::create(document(), filename), ec); - + RefPtr<Element> tdElement = document()->createElement(tdTag, false); tdElement->appendChild(anchorElement, ec); - + return tdElement.release(); } @@ -157,18 +157,18 @@ static String processFilesizeString(const String& size, bool isDirectory) { if (isDirectory) return "--"; - + bool valid; int64_t bytes = size.toUInt64(&valid); if (!valid) return unknownFileSizeText(); - + if (bytes < 1000000) return String::format("%.2f KB", static_cast<float>(bytes)/1000); if (bytes < 1000000000) return String::format("%.2f MB", static_cast<float>(bytes)/1000000); - + return String::format("%.2f GB", static_cast<float>(bytes)/1000000000); } @@ -177,19 +177,19 @@ static bool wasLastDayOfMonth(int year, int month, int day) static int lastDays[] = { 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if (month < 0 || month > 11) return false; - + if (month == 2) { if (year % 4 == 0 && (year % 100 || year % 400 == 0)) { if (day == 29) return true; return false; } - + if (day == 28) return true; return false; } - + return lastDays[month] == day; } @@ -198,11 +198,11 @@ static String processFileDateString(const FTPTime& fileTime) // FIXME: Need to localize this string? String timeOfDay; - + if (!(fileTime.tm_hour == 0 && fileTime.tm_min == 0 && fileTime.tm_sec == 0)) { int hour = fileTime.tm_hour; ASSERT(hour >= 0 && hour < 24); - + if (hour < 12) { if (hour == 0) hour = 12; @@ -214,15 +214,15 @@ static String processFileDateString(const FTPTime& fileTime) timeOfDay = String::format(", %i:%02i PM", hour, fileTime.tm_min); } } - + // If it was today or yesterday, lets just do that - but we have to compare to the current time struct tm now; time_t now_t = time(NULL); getLocalTime(&now_t, &now); - + // localtime does "year = current year - 1900", compensate for that for readability and comparison purposes now.tm_year += 1900; - + if (fileTime.tm_year == now.tm_year) { if (fileTime.tm_mon == now.tm_mon) { if (fileTime.tm_mday == now.tm_mday) @@ -235,23 +235,23 @@ static String processFileDateString(const FTPTime& fileTime) wasLastDayOfMonth(fileTime.tm_year, fileTime.tm_mon, fileTime.tm_mday)) return "Yesterday" + timeOfDay; } - + if (fileTime.tm_year == now.tm_year - 1 && fileTime.tm_mon == 12 && fileTime.tm_mday == 31 && now.tm_mon == 1 && now.tm_mday == 1) return "Yesterday" + timeOfDay; static const char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "???" }; - + int month = fileTime.tm_mon; if (month < 0 || month > 11) month = 12; - + String dateString; - + if (fileTime.tm_year > -1) dateString = String::format("%s %i, %i", months[month], fileTime.tm_mday, fileTime.tm_year); else dateString = String::format("%s %i, %i", months[month], fileTime.tm_mday, now.tm_year); - + return dateString + timeOfDay; } @@ -261,22 +261,22 @@ void FTPDirectoryDocumentParser::parseAndAppendOneLine(const String& inputLine) CString latin1Input = inputLine.latin1(); FTPEntryType typeResult = parseOneFTPLine(latin1Input.data(), m_listState, result); - + // FTPMiscEntry is a comment or usage statistic which we don't care about, and junk is invalid data - bail in these 2 cases if (typeResult == FTPMiscEntry || typeResult == FTPJunkEntry) return; - + String filename(result.filename, result.filenameLength); if (result.type == FTPDirectoryEntry) { filename.append("/"); - + // We have no interest in linking to "current directory" if (filename == "./") return; } LOG(FTP, "Appending entry - %s, %s", filename.ascii().data(), result.fileSize.ascii().data()); - + appendEntry(filename, processFilesizeString(result.fileSize, result.type == FTPDirectoryEntry), processFileDateString(result.modifiedTime), result.type == FTPDirectoryEntry); } @@ -302,8 +302,8 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate() return false; } - LegacyHTMLDocumentParser::insert(String(templateDocumentData->data(), templateDocumentData->size())); - + HTMLDocumentParser::insert(String(templateDocumentData->data(), templateDocumentData->size())); + RefPtr<Element> tableElement = document()->getElementById("ftpDirectoryTable"); if (!tableElement) LOG_ERROR("Unable to find element by id \"ftpDirectoryTable\" in the template document."); @@ -329,7 +329,7 @@ bool FTPDirectoryDocumentParser::loadDocumentTemplate() body->appendChild(m_tableElement, ec); else document()->appendChild(m_tableElement, ec); - + return true; } @@ -340,10 +340,10 @@ void FTPDirectoryDocumentParser::createBasicDocument() // FIXME: Make this "basic document" more acceptable RefPtr<Element> bodyElement = document()->createElement(bodyTag, false); - + ExceptionCode ec; document()->appendChild(bodyElement, ec); - + RefPtr<Element> tableElement = document()->createElement(tableTag, false); m_tableElement = static_cast<HTMLTableElement*>(tableElement.get()); m_tableElement->setAttribute("id", "ftpDirectoryTable", ec); @@ -360,14 +360,14 @@ void FTPDirectoryDocumentParser::append(const SegmentedString& source) createBasicDocument(); ASSERT(m_tableElement); } - + bool foundNewLine = false; - + m_dest = m_buffer; SegmentedString str = source; while (!str.isEmpty()) { UChar c = *str; - + if (c == '\r') { *m_dest++ = '\n'; foundNewLine = true; @@ -382,13 +382,13 @@ void FTPDirectoryDocumentParser::append(const SegmentedString& source) *m_dest++ = c; m_skipLF = false; } - + str.advance(); - + // Maybe enlarge the buffer checkBuffer(); } - + if (!foundNewLine) { m_dest = m_buffer; return; @@ -396,7 +396,7 @@ void FTPDirectoryDocumentParser::append(const SegmentedString& source) UChar* start = m_buffer; UChar* cursor = start; - + while (cursor < m_dest) { if (*cursor == '\n') { m_carryOver.append(String(start, cursor - start)); @@ -408,7 +408,7 @@ void FTPDirectoryDocumentParser::append(const SegmentedString& source) } else cursor++; } - + // Copy the partial line we have left to the carryover buffer if (cursor - start > 1) m_carryOver.append(String(start, cursor - start - 1)); @@ -421,11 +421,11 @@ void FTPDirectoryDocumentParser::finish() parseAndAppendOneLine(m_carryOver); m_carryOver = String(); } - + m_tableElement = 0; fastFree(m_buffer); - - LegacyHTMLDocumentParser::finish(); + + HTMLDocumentParser::finish(); } FTPDirectoryDocument::FTPDirectoryDocument(Frame* frame, const KURL& url) diff --git a/WebCore/loader/FTPDirectoryParser.cpp b/WebCore/loader/FTPDirectoryParser.cpp index 142f2a3..f6a74de 100644 --- a/WebCore/loader/FTPDirectoryParser.cpp +++ b/WebCore/loader/FTPDirectoryParser.cpp @@ -188,9 +188,13 @@ FTPEntryType parseOneFTPLine(const char* line, ListState& state, ListResult& res if (pos < linelen && line[pos] == ',') { unsigned long long seconds = 0; +#if OS(WINDOWS) + sscanf(p + 1, "%I64u", &seconds); +#else sscanf(p + 1, "%llu", &seconds); +#endif time_t t = static_cast<time_t>(seconds); - + // FIXME: This code has the year 2038 bug gmtime_r(&t, &result.modifiedTime); result.modifiedTime.tm_year += 1900; diff --git a/WebCore/loader/FormSubmission.cpp b/WebCore/loader/FormSubmission.cpp index f661273..22e89d7 100644 --- a/WebCore/loader/FormSubmission.cpp +++ b/WebCore/loader/FormSubmission.cpp @@ -179,6 +179,16 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A return adoptRef(new FormSubmission(attributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event)); } +KURL FormSubmission::requestURL() const +{ + if (m_method == FormSubmission::PostMethod) + return m_action; + + KURL requestURL(m_action); + requestURL.setQuery(m_formData->flattenToString()); + return requestURL; +} + void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) { if (!m_target.isEmpty()) @@ -187,9 +197,7 @@ void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) if (!m_referrer.isEmpty()) frameRequest.resourceRequest().setHTTPReferrer(m_referrer); - if (m_method == FormSubmission::GetMethod) - m_action.setQuery(m_formData->flattenToString()); - else { + if (m_method == FormSubmission::PostMethod) { frameRequest.resourceRequest().setHTTPMethod("POST"); frameRequest.resourceRequest().setHTTPBody(m_formData); @@ -200,7 +208,7 @@ void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary); } - frameRequest.resourceRequest().setURL(m_action); + frameRequest.resourceRequest().setURL(requestURL()); FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin); } diff --git a/WebCore/loader/FormSubmission.h b/WebCore/loader/FormSubmission.h index bee4e71..b935882 100644 --- a/WebCore/loader/FormSubmission.h +++ b/WebCore/loader/FormSubmission.h @@ -85,6 +85,8 @@ public: static PassRefPtr<FormSubmission> create(HTMLFormElement*, const Attributes&, PassRefPtr<Event> event, bool lockHistory, FormSubmissionTrigger); void populateFrameLoadRequest(FrameLoadRequest&); + + KURL requestURL() const; Method method() const { return m_method; } const KURL& action() const { return m_action; } diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 8307c15..dc2c68c 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -62,9 +62,6 @@ #include "FrameLoaderClient.h" #include "FrameTree.h" #include "FrameView.h" -#if PLATFORM(ANDROID) -#include "Geolocation.h" -#endif // PLATFORM(ANDROID) #include "HTMLAnchorElement.h" #include "HTMLFormElement.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) @@ -80,9 +77,6 @@ #include "Logging.h" #include "MIMETypeRegistry.h" #include "MainResourceLoader.h" -#if PLATFORM(ANDROID) -#include "Navigator.h" -#endif // PLATFORM(ANDROID) #include "Page.h" #include "PageCache.h" #include "PageGroup.h" @@ -271,71 +265,6 @@ void FrameLoader::setDefersLoading(bool defers) } } -Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest& request, const WindowFeatures& features, bool& created) -{ - ASSERT(!features.dialog || request.frameName().isEmpty()); - - if (!request.frameName().isEmpty() && request.frameName() != "_blank") { - Frame* frame = frameLoaderForFrameLookup->frame()->tree()->find(request.frameName()); - if (frame && shouldAllowNavigation(frame)) { - if (!request.resourceRequest().url().isEmpty()) - frame->loader()->loadFrameRequest(request, false, false, 0, 0, SendReferrer); - if (Page* page = frame->page()) - page->chrome()->focus(); - created = false; - return frame; - } - } - - // Sandboxed frames cannot open new auxiliary browsing contexts. - if (isDocumentSandboxed(m_frame, SandboxNavigation)) - return 0; - - // FIXME: Setting the referrer should be the caller's responsibility. - FrameLoadRequest requestWithReferrer = request; - requestWithReferrer.resourceRequest().setHTTPReferrer(m_outgoingReferrer); - addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), outgoingOrigin()); - - Page* oldPage = m_frame->page(); - if (!oldPage) - return 0; - - Page* page = oldPage->chrome()->createWindow(m_frame, requestWithReferrer, features); - if (!page) - return 0; - - Frame* frame = page->mainFrame(); - if (request.frameName() != "_blank") - frame->tree()->setName(request.frameName()); - - page->chrome()->setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); - page->chrome()->setStatusbarVisible(features.statusBarVisible); - page->chrome()->setScrollbarsVisible(features.scrollbarsVisible); - page->chrome()->setMenubarVisible(features.menuBarVisible); - page->chrome()->setResizable(features.resizable); - - // 'x' and 'y' specify the location of the window, while 'width' and 'height' - // specify the size of the page. We can only resize the window, so - // adjust for the difference between the window size and the page size. - - FloatRect windowRect = page->chrome()->windowRect(); - FloatSize pageSize = page->chrome()->pageRect().size(); - if (features.xSet) - windowRect.setX(features.x); - if (features.ySet) - windowRect.setY(features.y); - if (features.widthSet) - windowRect.setWidth(features.width + (windowRect.width() - pageSize.width())); - if (features.heightSet) - windowRect.setHeight(features.height + (windowRect.height() - pageSize.height())); - page->chrome()->setWindowRect(windowRect); - - page->chrome()->show(); - - created = true; - return frame; -} - bool FrameLoader::canHandleRequest(const ResourceRequest& request) { return m_client->canHandleRequest(request); @@ -513,13 +442,6 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic #endif } -#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. - if (m_frame->domWindow()->navigator()->optionalGeolocation()) - m_frame->domWindow()->navigator()->optionalGeolocation()->stop(); -#endif // PLATFORM(ANDROID) - // FIXME: This will cancel redirection timer, which really needs to be restarted when restoring the frame from b/f cache. m_frame->redirectScheduler()->cancel(); } @@ -1160,7 +1082,7 @@ bool FrameLoader::isProcessingUserGesture() Frame* frame = m_frame->tree()->top(); if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) return true; // If JavaScript is disabled, a user gesture must have initiated the navigation. - return frame->script()->processingUserGesture(mainThreadNormalWorld()); // FIXME: Use pageIsProcessingUserGesture. + return ScriptController::processingUserGesture(); // FIXME: Use pageIsProcessingUserGesture. } void FrameLoader::resetMultipleFormSubmissionProtection() @@ -2660,10 +2582,12 @@ void FrameLoader::handledOnloadEvents() { m_client->dispatchDidHandleOnloadEvents(); + if (documentLoader()) { + documentLoader()->handledOnloadEvents(); #if ENABLE(OFFLINE_WEB_APPLICATIONS) - if (documentLoader()) documentLoader()->applicationCacheHost()->stopDeferringEvents(); #endif + } } void FrameLoader::frameDetached() @@ -3553,4 +3477,69 @@ bool FrameLoaderClient::hasHTMLView() const return true; } +Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest& request, const WindowFeatures& features, bool& created) +{ + ASSERT(!features.dialog || request.frameName().isEmpty()); + + if (!request.frameName().isEmpty() && request.frameName() != "_blank") { + Frame* frame = lookupFrame->tree()->find(request.frameName()); + if (frame && openerFrame->loader()->shouldAllowNavigation(frame)) { + if (!request.resourceRequest().url().isEmpty()) + frame->loader()->loadFrameRequest(request, false, false, 0, 0, SendReferrer); + if (Page* page = frame->page()) + page->chrome()->focus(); + created = false; + return frame; + } + } + + // Sandboxed frames cannot open new auxiliary browsing contexts. + if (isDocumentSandboxed(openerFrame, SandboxNavigation)) + return 0; + + // FIXME: Setting the referrer should be the caller's responsibility. + FrameLoadRequest requestWithReferrer = request; + requestWithReferrer.resourceRequest().setHTTPReferrer(openerFrame->loader()->outgoingReferrer()); + FrameLoader::addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), openerFrame->loader()->outgoingOrigin()); + + Page* oldPage = openerFrame->page(); + if (!oldPage) + return 0; + + Page* page = oldPage->chrome()->createWindow(openerFrame, requestWithReferrer, features); + if (!page) + return 0; + + Frame* frame = page->mainFrame(); + if (request.frameName() != "_blank") + frame->tree()->setName(request.frameName()); + + page->chrome()->setToolbarsVisible(features.toolBarVisible || features.locationBarVisible); + page->chrome()->setStatusbarVisible(features.statusBarVisible); + page->chrome()->setScrollbarsVisible(features.scrollbarsVisible); + page->chrome()->setMenubarVisible(features.menuBarVisible); + page->chrome()->setResizable(features.resizable); + + // 'x' and 'y' specify the location of the window, while 'width' and 'height' + // specify the size of the page. We can only resize the window, so + // adjust for the difference between the window size and the page size. + + FloatRect windowRect = page->chrome()->windowRect(); + FloatSize pageSize = page->chrome()->pageRect().size(); + if (features.xSet) + windowRect.setX(features.x); + if (features.ySet) + windowRect.setY(features.y); + if (features.widthSet) + windowRect.setWidth(features.width + (windowRect.width() - pageSize.width())); + if (features.heightSet) + windowRect.setHeight(features.height + (windowRect.height() - pageSize.height())); + page->chrome()->setWindowRect(windowRect); + + page->chrome()->show(); + + created = true; + return frame; +} + } // namespace WebCore diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index de043d2..639b6cc 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -124,10 +124,6 @@ public: static void reportLocalLoadFailed(Frame*, const String& url); - // Called by createWindow in JSDOMWindowBase.cpp, e.g. to fulfill a modal dialog creation - // FIXME: Move this method outside of the FrameLoader class. - Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest&, const WindowFeatures&, bool& created); - unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data); bool canHandleRequest(const ResourceRequest&); @@ -505,6 +501,15 @@ private: #endif }; +// This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for +// modal dialog creation. The lookupFrame is for looking up the frame name in case +// the frame name references a frame different from the openerFrame, e.g. when it is +// "_self" or "_parent". +// +// FIXME: Consider making this function part of an appropriate class (not FrameLoader) +// and moving it to a more appropriate location. +Frame* createWindow(Frame* openerFrame, Frame* lookupFrame, const FrameLoadRequest&, const WindowFeatures&, bool& created); + } // namespace WebCore #endif // FrameLoader_h diff --git a/WebCore/loader/FrameNetworkingContext.h b/WebCore/loader/FrameNetworkingContext.h new file mode 100644 index 0000000..dff1144 --- /dev/null +++ b/WebCore/loader/FrameNetworkingContext.h @@ -0,0 +1,51 @@ +/* + 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. +*/ + +#ifndef FrameNetworkingContext_h +#define FrameNetworkingContext_h + +#include "Frame.h" +#include "NetworkingContext.h" + +namespace WebCore { + +class FrameNetworkingContext : public NetworkingContext { +public: + void invalidate() + { + m_frame = 0; + } + +protected: + FrameNetworkingContext(Frame* frame) + : m_frame(frame) + { + } + + Frame* frame() const { return m_frame; } + +private: + virtual bool isValid() const { return m_frame; } + + Frame* m_frame; +}; + +} + +#endif // FrameNetworkingContext_h diff --git a/WebCore/loader/ImageLoader.h b/WebCore/loader/ImageLoader.h index a585354..02ddce8 100644 --- a/WebCore/loader/ImageLoader.h +++ b/WebCore/loader/ImageLoader.h @@ -23,9 +23,9 @@ #ifndef ImageLoader_h #define ImageLoader_h -#include "AtomicString.h" #include "CachedResourceClient.h" #include "CachedResourceHandle.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp index c03f9ca..a7a5968 100644 --- a/WebCore/loader/MainResourceLoader.cpp +++ b/WebCore/loader/MainResourceLoader.cpp @@ -305,8 +305,8 @@ void MainResourceLoader::substituteMIMETypeFromPluginDatabase(const ResourceResp if (filename.endsWith("/")) return; - int extensionPos = filename.reverseFind('.'); - if (extensionPos == -1) + size_t extensionPos = filename.reverseFind('.'); + if (extensionPos == notFound) return; String extension = filename.substring(extensionPos + 1); diff --git a/WebCore/loader/RedirectScheduler.cpp b/WebCore/loader/RedirectScheduler.cpp index 3cfe61a..d969f30 100644 --- a/WebCore/loader/RedirectScheduler.cpp +++ b/WebCore/loader/RedirectScheduler.cpp @@ -175,15 +175,13 @@ public: ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad) : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true) , m_submission(submission) - , m_wasProcessingUserGesture(UserGestureIndicator::processingUserGesture()) + , m_haveToldClient(false) { ASSERT(m_submission->state()); } virtual void fire(Frame* frame) { - UserGestureIndicator gestureIndicator(m_wasProcessingUserGesture ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture); - // The submitForm function will find a target frame before using the redirection timer. // 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 @@ -194,15 +192,25 @@ public: m_submission->populateFrameLoadRequest(frameRequest); frame->loader()->loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), SendReferrer); } + + virtual void didStartTimer(Frame* frame, Timer<RedirectScheduler>* timer) + { + if (m_haveToldClient) + return; + m_haveToldClient = true; + frame->loader()->clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer->nextFireInterval(), lockBackForwardList()); + } - // FIXME: Implement didStartTimer? It would make sense to report form - // submissions as client redirects too. But we didn't do that in the past - // when form submission used a separate delay mechanism, so doing it will - // be a behavior change. + virtual void didStopTimer(Frame* frame, bool newLoadInProgress) + { + if (!m_haveToldClient) + return; + frame->loader()->clientRedirectCancelledOrFinished(newLoadInProgress); + } private: RefPtr<FormSubmission> m_submission; - bool m_wasProcessingUserGesture; + bool m_haveToldClient; }; RedirectScheduler::RedirectScheduler(Frame* frame) @@ -240,17 +248,21 @@ void RedirectScheduler::scheduleRedirect(double delay, const String& url) if (url.isEmpty()) return; - // We want a new history item if the refresh timeout is > 1 second. + // We want a new back/forward list item if the refresh timeout is > 1 second. if (!m_redirect || delay <= m_redirect->delay()) schedule(new ScheduledRedirect(delay, url, true, delay <= 1, false)); } -bool RedirectScheduler::mustLockBackForwardList(Frame* targetFrame) +bool RedirectScheduler::mustLockBackForwardList(Frame* targetFrame, bool wasUserGesture) { + // Non-user navigation before the page has finished firing onload should not create a new back/forward item. + // See https://webkit.org/b/42861 for the original motivation for this. + if (!wasUserGesture && targetFrame->loader()->documentLoader() && !targetFrame->loader()->documentLoader()->wasOnloadHandled()) + return true; + // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item. // The definition of "during load" is any time before all handlers for the load event have been run. // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this. - for (Frame* ancestor = targetFrame->tree()->parent(); ancestor; ancestor = ancestor->tree()->parent()) { Document* document = ancestor->document(); if (!ancestor->loader()->isComplete() || (document && document->processingLoadEvent())) @@ -266,7 +278,7 @@ void RedirectScheduler::scheduleLocationChange(const String& url, const String& if (url.isEmpty()) return; - lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame); + lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame, wasUserGesture); FrameLoader* loader = m_frame->loader(); @@ -300,7 +312,7 @@ void RedirectScheduler::scheduleFormSubmission(PassRefPtr<FormSubmission> submis // 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) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); + bool lockBackForwardList = mustLockBackForwardList(m_frame, UserGestureIndicator::processingUserGesture()) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); schedule(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad)); } diff --git a/WebCore/loader/RedirectScheduler.h b/WebCore/loader/RedirectScheduler.h index 0203e08..70b0202 100644 --- a/WebCore/loader/RedirectScheduler.h +++ b/WebCore/loader/RedirectScheduler.h @@ -70,7 +70,7 @@ private: void timerFired(Timer<RedirectScheduler>*); void schedule(PassOwnPtr<ScheduledNavigation>); - static bool mustLockBackForwardList(Frame* targetFrame); + static bool mustLockBackForwardList(Frame* targetFrame, bool mustLockIfDuringLoad); Frame* m_frame; Timer<RedirectScheduler> m_timer; @@ -79,4 +79,4 @@ private: } // namespace WebCore -#endif // FrameLoader_h +#endif // RedirectScheduler_h diff --git a/WebCore/loader/appcache/ApplicationCache.cpp b/WebCore/loader/appcache/ApplicationCache.cpp index 2ad4a4b..2a93765 100644 --- a/WebCore/loader/appcache/ApplicationCache.cpp +++ b/WebCore/loader/appcache/ApplicationCache.cpp @@ -32,6 +32,7 @@ #include "ApplicationCacheResource.h" #include "ApplicationCacheStorage.h" #include "ResourceRequest.h" +#include <wtf/text/CString.h> #include <stdio.h> namespace WebCore { diff --git a/WebCore/loader/appcache/ApplicationCache.h b/WebCore/loader/appcache/ApplicationCache.h index d6e15ed..f073499 100644 --- a/WebCore/loader/appcache/ApplicationCache.h +++ b/WebCore/loader/appcache/ApplicationCache.h @@ -29,11 +29,11 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/WebCore/loader/appcache/ApplicationCacheStorage.cpp index 5624809..5a82d6e 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -968,8 +968,8 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) static inline void parseHeader(const UChar* header, size_t headerLength, ResourceResponse& response) { - int pos = find(header, headerLength, ':'); - ASSERT(pos != -1); + size_t pos = find(header, headerLength, ':'); + ASSERT(pos != notFound); AtomicString headerName = AtomicString(header, pos); String headerValue = String(header + pos + 1, headerLength - pos - 1); @@ -979,9 +979,9 @@ static inline void parseHeader(const UChar* header, size_t headerLength, Resourc static inline void parseHeaders(const String& headers, ResourceResponse& response) { - int startPos = 0; - int endPos; - while ((endPos = headers.find('\n', startPos)) != -1) { + unsigned startPos = 0; + size_t endPos; + while ((endPos = headers.find('\n', startPos)) != notFound) { ASSERT(startPos != endPos); parseHeader(headers.characters() + startPos, endPos - startPos, response); @@ -989,7 +989,7 @@ static inline void parseHeaders(const String& headers, ResourceResponse& respons startPos = endPos + 1; } - if (startPos != static_cast<int>(headers.length())) + if (startPos != headers.length()) parseHeader(headers.characters(), headers.length(), response); } diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.h b/WebCore/loader/appcache/ApplicationCacheStorage.h index c990fa7..7db34e6 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -30,9 +30,8 @@ #include "PlatformString.h" #include "SQLiteDatabase.h" -#include "StringHash.h" - #include <wtf/HashCountedSet.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/loader/appcache/DOMApplicationCache.h b/WebCore/loader/appcache/DOMApplicationCache.h index de0614a..2a806fa 100644 --- a/WebCore/loader/appcache/DOMApplicationCache.h +++ b/WebCore/loader/appcache/DOMApplicationCache.h @@ -29,7 +29,6 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "ApplicationCacheHost.h" -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -38,6 +37,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp index b8149d2..63b9c64 100644 --- a/WebCore/loader/icon/IconDatabase.cpp +++ b/WebCore/loader/icon/IconDatabase.cpp @@ -1315,7 +1315,7 @@ void IconDatabase::performURLImport() } } - LOG(IconDatabase, "Notifying %zu interested page URLs that their icon URL is known due to the import", urlsToNotify.size()); + LOG(IconDatabase, "Notifying %lu interested page URLs that their icon URL is known due to the import", static_cast<unsigned long>(urlsToNotify.size())); // Now that we don't hold any locks, perform the actual notifications for (unsigned i = 0; i < urlsToNotify.size(); ++i) { LOG(IconDatabase, "Notifying icon info known for pageURL %s", urlsToNotify[i].ascii().data()); @@ -1639,11 +1639,19 @@ void IconDatabase::pruneUnretainedIcons() SQLiteStatement pageDeleteSQL(m_syncDB, "DELETE FROM PageURL WHERE rowid = (?);"); pageDeleteSQL.prepare(); for (size_t i = 0; i < numToDelete; ++i) { +#if OS(WINDOWS) + LOG(IconDatabase, "Pruning page with rowid %I64i from disk", static_cast<long long>(pageIDsToDelete[i])); +#else LOG(IconDatabase, "Pruning page with rowid %lli from disk", static_cast<long long>(pageIDsToDelete[i])); +#endif pageDeleteSQL.bindInt64(1, pageIDsToDelete[i]); int result = pageDeleteSQL.step(); if (result != SQLResultDone) +#if OS(WINDOWS) + LOG_ERROR("Unabled to delete page with id %I64i from disk", static_cast<long long>(pageIDsToDelete[i])); +#else LOG_ERROR("Unabled to delete page with id %lli from disk", static_cast<long long>(pageIDsToDelete[i])); +#endif pageDeleteSQL.reset(); // If the thread was asked to terminate, we should commit what pruning we've done so far, figuring we can diff --git a/WebCore/loader/icon/IconDatabase.h b/WebCore/loader/icon/IconDatabase.h index 44ef22a..9793d21 100644 --- a/WebCore/loader/icon/IconDatabase.h +++ b/WebCore/loader/icon/IconDatabase.h @@ -27,12 +27,12 @@ #ifndef IconDatabase_h #define IconDatabase_h -#include "StringHash.h" #include "Timer.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> +#include <wtf/text/StringHash.h> #if ENABLE(ICONDATABASE) #include "SQLiteDatabase.h" diff --git a/WebCore/loader/icon/IconFetcher.cpp b/WebCore/loader/icon/IconFetcher.cpp index 3d3df39..1107d7b 100644 --- a/WebCore/loader/icon/IconFetcher.cpp +++ b/WebCore/loader/icon/IconFetcher.cpp @@ -87,8 +87,8 @@ static void parseIconLink(HTMLLinkElement* link, Vector<IconLinkEntry>& entries) // Try to determine the file type. String path = url.path(); - int pos = path.reverseFind('.'); - if (pos >= 0) { + size_t pos = path.reverseFind('.'); + if (pos != notFound) { String extension = path.substring(pos + 1); if (equalIgnoringCase(extension, "icns")) type = IconLinkEntry::ICNS; diff --git a/WebCore/loader/icon/IconRecord.cpp b/WebCore/loader/icon/IconRecord.cpp index ffea318..7e90d8e 100644 --- a/WebCore/loader/icon/IconRecord.cpp +++ b/WebCore/loader/icon/IconRecord.cpp @@ -34,6 +34,7 @@ #include "Logging.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" +#include <wtf/text/CString.h> #include <limits.h> diff --git a/WebCore/loader/icon/IconRecord.h b/WebCore/loader/icon/IconRecord.h index aaea787..f1fe12f 100644 --- a/WebCore/loader/icon/IconRecord.h +++ b/WebCore/loader/icon/IconRecord.h @@ -33,10 +33,10 @@ #include <wtf/RefCounted.h> #include "SharedBuffer.h" +#include "PlatformString.h" #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> -#include "PlatformString.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/loader/loader.h b/WebCore/loader/loader.h index 1fdb9cf..52c61aa 100644 --- a/WebCore/loader/loader.h +++ b/WebCore/loader/loader.h @@ -22,8 +22,6 @@ #ifndef loader_h #define loader_h -#include "AtomicString.h" -#include "AtomicStringImpl.h" #include "FrameLoaderTypes.h" #include "PlatformString.h" #include "SubresourceLoaderClient.h" @@ -31,6 +29,8 @@ #include <wtf/Deque.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/text/AtomicString.h> +#include <wtf/text/AtomicStringImpl.h> namespace WebCore { diff --git a/WebCore/make-hash-tools.pl b/WebCore/make-hash-tools.pl index 42cb6fd..8cc9952 100644 --- a/WebCore/make-hash-tools.pl +++ b/WebCore/make-hash-tools.pl @@ -29,16 +29,6 @@ my $option = basename($ARGV[0],".gperf"); switch ($option) { -case "HTMLEntityNames" { - - my $htmlEntityNamesGenerated = "$outdir/HTMLEntityNames.cpp"; - my $htmlEntityNamesGperf = $ARGV[0]; - shift; - - system("gperf --key-positions=\"*\" -D -s 2 $htmlEntityNamesGperf > $htmlEntityNamesGenerated") == 0 || die "calling gperf failed: $?"; - -} # case "HTMLEntityNames" - case "DocTypeStrings" { my $docTypeStringsGenerated = "$outdir/DocTypeStrings.cpp"; diff --git a/WebCore/manual-tests/back-forward-during-alert-1.html b/WebCore/manual-tests/back-forward-during-alert-1.html new file mode 100644 index 0000000..41a6e6a --- /dev/null +++ b/WebCore/manual-tests/back-forward-during-alert-1.html @@ -0,0 +1,3 @@ +<body> +View this page, then click <a href="back-forward-during-alert-2.html">here.</a> +</body> diff --git a/WebCore/manual-tests/back-forward-during-alert-2.html b/WebCore/manual-tests/back-forward-during-alert-2.html new file mode 100644 index 0000000..931af01 --- /dev/null +++ b/WebCore/manual-tests/back-forward-during-alert-2.html @@ -0,0 +1,10 @@ +<script> +function loaded() +{ + alert("While this alert is showing, two-fingered swipe back using a MacBook trackpad, Magic Trackpad, or Magic Mouse. You should not be able to navigate back. If you can, dismissing this dialog will likely result in a crash."); +} +</script> + +<body onload="loaded();"> +Follow the instructions in the alert that shows up on page load. +</body> diff --git a/WebCore/manual-tests/indexed-database.html b/WebCore/manual-tests/indexed-database.html new file mode 100644 index 0000000..d0fb381 --- /dev/null +++ b/WebCore/manual-tests/indexed-database.html @@ -0,0 +1,67 @@ +<html> +<body> +<p>This is a test that only applies to IndexedDB. <span id=enabled>Our test for whether you have it enabled seems to have failed.</span></p> + +<p>This page opens up a database with the name "name" and a description of "description". Result of open: <span id=result>Pending...</span></p> + +<p>The first time you open this page up, the message should be a success. Now, lets make it fail. Find where the associated .indexeddb file is + for this page, replace it with something that's not a sqlite database, and make it read only to your user. Now close and re-open the browser. + When you re-open it, you should get an internal error from the page.</p> + +<p>Now delete all IndexedDB files (including the one you just made), restart the browser, and come back to this page. It should start up fine again.</p> + +<p>Now click <a href="javascript:updateDescription()">here</a>, close the browser, come back, and click <a href="javascript:readDescription()">here</a>. If everything worked well, this should be a success here: <span id=description>...</span></p> + +<p>That's it!</p> + +<script> + + if (!('indexedDB' in window)) + document.getElementById("enabled").innerHTML = "<font color=red>Your build does NOT seem to have it enabled. So all code on this page is disabled.</font>"; + else { + document.getElementById("enabled").innerHTML = "<font color=green>Your build seems to have it enabled.</font>"; + + request = indexedDB.open("name"); + request.onsuccess = function() { + document.getElementById("result").innerHTML = "<font color=green>Success!</font>"; + window.nameDB = event.result; + }; + request.onerror = function() { + document.getElementById("result").innerHTML = "<font color=red>Error: " + event.message + ".</font>"; + }; + + request = indexedDB.open("another", "test of the description attribute"); + request.onsuccess = function() { + window.anotherDB = event.result; + }; + } + + function updateDescription() + { + indexedDB.open("name", "test of the description attribute"); + indexedDB.open("another", "xyz"); + } + + function readDescription() + { + if (window.nameDB.description != "test of the description attribute") { + // Since we passed in nothing, the description should not be reset. + document.getElementById("description").innerHTML = "<font color=red>Failure: (Database 'name' was this: " + window.nameDB.description + ").</font>"; + } else if (window.anotherDB.description != "test of the description attribute") { + // But in this case we did pass something in, so it should have been reset. + document.getElementById("description").innerHTML = "<font color=red>Failure: (Database 'another' was this: " + window.anotherDB.description + ").</font>"; + } else { + request = indexedDB.open("another", "123"); + request.onsuccess = function() { + // And here it should have been reset again. + if (event.result.description != "123") + document.getElementById("description").innerHTML = "<font color=red>Failure: (Database 'another' was this: " + event.result.description + ").</font>"; + else + document.getElementById("description").innerHTML = "<font color=green>Success!</font>"; + }; + } + } + +</script> +</body> +</html> diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h index 20a319b..e8e29f4 100644 --- a/WebCore/notifications/Notification.h +++ b/WebCore/notifications/Notification.h @@ -33,7 +33,6 @@ #define Notification_h #include "ActiveDOMObject.h" -#include "AtomicStringHash.h" #include "Event.h" #include "EventListener.h" #include "EventNames.h" @@ -51,6 +50,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringHash.h> #if ENABLE(NOTIFICATIONS) namespace WebCore { diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp index 3d8a7de..9cc8d5d 100644 --- a/WebCore/page/Console.cpp +++ b/WebCore/page/Console.cpp @@ -185,7 +185,7 @@ void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL()); #if ENABLE(INSPECTOR) - page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack); + page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack, message); #endif if (!Console::shouldPrintExceptions()) diff --git a/WebCore/page/DOMSelection.cpp b/WebCore/page/DOMSelection.cpp index d62051e..106dd13 100644 --- a/WebCore/page/DOMSelection.cpp +++ b/WebCore/page/DOMSelection.cpp @@ -427,6 +427,8 @@ void DOMSelection::deleteFromDocument() selection->modify(SelectionController::AlterationExtend, SelectionController::DirectionBackward, CharacterGranularity); RefPtr<Range> selectedRange = selection->selection().toNormalizedRange(); + if (!selectedRange) + return; ExceptionCode ec = 0; selectedRange->deleteContents(ec); diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index 71ad7cb..86708de 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -331,20 +331,20 @@ void DOMWindow::parseModalDialogFeatures(const String& featuresArg, HashMap<Stri Vector<String>::const_iterator end = features.end(); for (Vector<String>::const_iterator it = features.begin(); it != end; ++it) { String s = *it; - int pos = s.find('='); - int colonPos = s.find(':'); - if (pos >= 0 && colonPos >= 0) + size_t pos = s.find('='); + size_t colonPos = s.find(':'); + if (pos != notFound && colonPos != notFound) continue; // ignore any strings that have both = and : - if (pos < 0) + if (pos == notFound) pos = colonPos; - if (pos < 0) { + if (pos == notFound) { // null string for value means key without value map.set(s.stripWhiteSpace().lower(), String()); } else { String key = s.left(pos).stripWhiteSpace().lower(); String val = s.substring(pos + 1).stripWhiteSpace().lower(); - int spacePos = val.find(' '); - if (spacePos != -1) + size_t spacePos = val.find(' '); + if (spacePos != notFound) val = val.left(spacePos); map.set(key, val); } diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index a65739b..cabe68a 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -478,17 +478,6 @@ module window { attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint32ArrayConstructor Uint32Array; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Float32ArrayConstructor Float32Array; // Usable with new operator - // Temporary aliases to keep current WebGL content working during transition period to TypedArray spec. - // To be removed before WebGL spec is finalized. (FIXME) - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] ArrayBufferConstructor WebGLArrayBuffer; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int8ArrayConstructor WebGLByteArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint8ArrayConstructor WebGLUnsignedByteArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int16ArrayConstructor WebGLShortArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint16ArrayConstructor WebGLUnsignedShortArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int32ArrayConstructor WebGLIntArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Uint32ArrayConstructor WebGLUnsignedIntArray; // Usable with new operator - attribute [CustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Float32ArrayConstructor WebGLFloatArray; // Usable with new operator - attribute EventConstructor Event; attribute BeforeLoadEventConstructor BeforeLoadEvent; attribute KeyboardEventConstructor KeyboardEvent; diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp index d93a256..bbf4fed 100644 --- a/WebCore/page/DragController.cpp +++ b/WebCore/page/DragController.cpp @@ -63,6 +63,7 @@ #include "SelectionController.h" #include "Settings.h" #include "Text.h" +#include "TextEvent.h" #include "htmlediting.h" #include "markup.h" #include <wtf/CurrentTime.h> @@ -363,6 +364,15 @@ static bool setSelectionToDragCaret(Frame* frame, VisibleSelection& dragCaret, R return !frame->selection()->isNone() && frame->selection()->isContentEditable(); } +bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData* dragData) +{ + VisibleSelection dragCaret(m_page->dragCaretController()->selection()); + String text = dragCaret.isContentRichlyEditable() ? "" : dragData->asPlainText(); + Node* target = innerFrame->editor()->findEventTargetFrom(dragCaret); + ExceptionCode ec = 0; + return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), ec); +} + bool DragController::concludeEditDrag(DragData* dragData) { ASSERT(dragData); @@ -376,12 +386,13 @@ bool DragController::concludeEditDrag(DragData* dragData) Frame* innerFrame = element->ownerDocument()->frame(); ASSERT(innerFrame); + if (!dispatchTextInputEventFor(innerFrame, dragData)) + return true; + if (dragData->containsColor()) { Color color = dragData->asColor(); if (!color.isValid()) return false; - if (!innerFrame) - return false; RefPtr<Range> innerRange = innerFrame->selection()->toNormalizedRange(); RefPtr<CSSStyleDeclaration> style = m_documentUnderMouse->createCSSStyleDeclaration(); ExceptionCode ec; diff --git a/WebCore/page/DragController.h b/WebCore/page/DragController.h index 712f9ab..0e90a52 100644 --- a/WebCore/page/DragController.h +++ b/WebCore/page/DragController.h @@ -90,6 +90,7 @@ namespace WebCore { static const float DragImageAlpha; private: + bool dispatchTextInputEventFor(Frame*, DragData*); bool canProcessDrag(DragData*); bool concludeEditDrag(DragData*); DragOperation dragEnteredOrUpdated(DragData*); diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index adcaadc..6263a4b 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -2656,6 +2656,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve // Platforms should differentiate real commands like selectAll from text input in disguise (like insertNewline), // and avoid dispatching text input events from keydown default handlers. ASSERT(!underlyingEvent || !underlyingEvent->isKeyboardEvent() || static_cast<KeyboardEvent*>(underlyingEvent)->type() == eventNames().keypressEvent); + ASSERT(!(isLineBreak && isBackTab)); if (!m_frame) return false; @@ -2671,10 +2672,9 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve if (FrameView* view = m_frame->view()) view->resetDeferredRepaintDelay(); - RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text); + RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, TextEvent::selectInputType(isLineBreak, isBackTab)); event->setUnderlyingEvent(underlyingEvent); - event->setIsLineBreak(isLineBreak); - event->setIsBackTab(isBackTab); + ExceptionCode ec; target->dispatchEvent(event, ec); return event->defaultHandled(); diff --git a/WebCore/page/FrameTree.h b/WebCore/page/FrameTree.h index 9ab999f..b97aab6 100644 --- a/WebCore/page/FrameTree.h +++ b/WebCore/page/FrameTree.h @@ -20,7 +20,7 @@ #ifndef FrameTree_h #define FrameTree_h -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index 04fef3b..441e543 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -1148,13 +1148,13 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint) void FrameView::scrollPositionChangedViaPlatformWidget() { + repaintFixedElementsAfterScrolling(); scrollPositionChanged(); } void FrameView::scrollPositionChanged() { frame()->eventHandler()->sendScrollEvent(); - repaintFixedElementsAfterScrolling(); #if USE(ACCELERATED_COMPOSITING) if (RenderView* root = m_frame->contentRenderer()) { diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index 523c21d..9a5e40b 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -50,6 +50,9 @@ namespace WebCore { static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service"; +static const char framelessDocumentErrorMessage[] = "Geolocation cannot be used in frameless documents"; + +static const int firstAvailableWatchId = 1; #if ENABLE(CLIENT_BASED_GEOLOCATION) @@ -97,9 +100,15 @@ Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<Posit void Geolocation::GeoNotifier::setFatalError(PassRefPtr<PositionError> error) { - // This method is called at most once on a given GeoNotifier object. - ASSERT(!m_fatalError); + // If a fatal error has already been set, stick with it. This makes sure that + // when permission is denied, this is the error reported, as required by the + // spec. + if (m_fatalError) + return; + m_fatalError = error; + // An existing timer may not have a zero timeout. + m_timer.stop(); m_timer.startOneShot(0); } @@ -133,6 +142,8 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) // could be deleted by a call to clearWatch in a callback. RefPtr<GeoNotifier> protect(this); + // Test for fatal error first. This is required for the case where the Frame is + // disconnected and requests are cancelled. if (m_fatalError) { if (m_errorCallback) m_errorCallback->handleEvent(m_fatalError.get()); @@ -158,6 +169,7 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) void Geolocation::Watchers::set(int id, PassRefPtr<GeoNotifier> prpNotifier) { + ASSERT(id > 0); RefPtr<GeoNotifier> notifier = prpNotifier; m_idToNotifierMap.set(id, notifier.get()); @@ -166,6 +178,7 @@ void Geolocation::Watchers::set(int id, PassRefPtr<GeoNotifier> prpNotifier) void Geolocation::Watchers::remove(int id) { + ASSERT(id > 0); IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id); if (iter == m_idToNotifierMap.end()) return; @@ -221,25 +234,12 @@ Geolocation::~Geolocation() { } -#if PLATFORM(ANDROID) -void Geolocation::stop() -{ - m_oneShots.clear(); - m_watchers.clear(); - stopUpdating(); -} -#endif // PLATFORM(ANDROID) - void Geolocation::disconnectFrame() { if (m_frame && m_frame->page() && m_allowGeolocation == InProgress) m_frame->page()->chrome()->cancelGeolocationPermissionRequestForFrame(m_frame, this); -#if PLATFORM(ANDROID) - // See Geolocation::stop() -#else - stopTimers(); + cancelAllRequests(); stopUpdating(); -#endif // PLATFORM(ANDROID) if (m_frame && m_frame->document()) m_frame->document()->setUsingGeolocation(false); m_frame = 0; @@ -265,6 +265,9 @@ Geoposition* Geolocation::lastPosition() void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { + if (!m_frame) + return; + RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options); ASSERT(notifier); @@ -273,10 +276,13 @@ void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallbac int Geolocation::watchPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { + if (!m_frame) + return 0; + RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options); ASSERT(notifier); - static int nextAvailableWatchId = 1; + static int nextAvailableWatchId = firstAvailableWatchId; // In case of overflow, make sure the ID remains positive, but reuse the ID values. if (nextAvailableWatchId < 1) nextAvailableWatchId = 1; @@ -294,13 +300,18 @@ PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<Positi notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); else if (haveSuitableCachedPosition(notifier->m_options.get())) notifier->setUseCachedPosition(); - else if (notifier->hasZeroTimeout() || startUpdating(notifier.get())) { + else if (notifier->hasZeroTimeout()) + notifier->startTimerIfNeeded(); #if USE(PREEMPT_GEOLOCATION_PERMISSION) - // Only start timer if we're not waiting for user permission. - if (!m_startRequestPermissionNotifier) -#endif - notifier->startTimerIfNeeded(); - } else + else if (!isAllowed()) { + // if we don't yet have permission, request for permission before calling startUpdating() + m_pendingForPermissionNotifiers.add(notifier); + requestPermission(); + } +#endif + else if (startUpdating(notifier.get())) + notifier->startTimerIfNeeded(); + else notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); return notifier.release(); @@ -388,6 +399,9 @@ bool Geolocation::haveSuitableCachedPosition(PositionOptions* options) void Geolocation::clearWatch(int watchId) { + if (watchId < firstAvailableWatchId) + return; + m_watchers.remove(watchId); if (!hasListeners()) @@ -417,28 +431,10 @@ void Geolocation::setIsAllowed(bool allowed) m_allowGeolocation = allowed ? Yes : No; #if USE(PREEMPT_GEOLOCATION_PERMISSION) - if (m_startRequestPermissionNotifier) { - if (isAllowed()) { - // Permission request was made during the startUpdating process - m_startRequestPermissionNotifier->startTimerIfNeeded(); - // The notifier is always ref'ed by m_oneShots or m_watchers. - GeoNotifier* notifier = m_startRequestPermissionNotifier.get(); - m_startRequestPermissionNotifier = 0; -#if ENABLE(CLIENT_BASED_GEOLOCATION) - if (!m_frame) - return; - Page* page = m_frame->page(); - if (!page) - return; - page->geolocationController()->addObserver(this, notifier->m_options->enableHighAccuracy()); -#else - // TODO: Handle startUpdate() for non-client based implementations using pre-emptive policy -#endif - } else { - m_startRequestPermissionNotifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); - m_oneShots.add(m_startRequestPermissionNotifier); - m_startRequestPermissionNotifier = 0; - } + // Permission request was made during the startRequest process + if (!m_pendingForPermissionNotifiers.isEmpty()) { + handlePendingPermissionNotifiers(); + m_pendingForPermissionNotifiers.clear(); return; } #endif @@ -513,6 +509,22 @@ void Geolocation::stopTimers() stopTimersForWatchers(); } +void Geolocation::cancelRequests(Vector<RefPtr<GeoNotifier> >& notifiers) +{ + Vector<RefPtr<GeoNotifier> >::const_iterator end = notifiers.end(); + for (Vector<RefPtr<GeoNotifier> >::const_iterator it = notifiers.begin(); it != end; ++it) + (*it)->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, framelessDocumentErrorMessage)); +} + +void Geolocation::cancelAllRequests() +{ + Vector<RefPtr<GeoNotifier> > copy; + copyToVector(m_oneShots, copy); + cancelRequests(copy); + m_watchers.getNotifiersVector(copy); + cancelRequests(copy); +} + void Geolocation::handleError(PositionError* error) { ASSERT(error); @@ -634,14 +646,6 @@ void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service) bool Geolocation::startUpdating(GeoNotifier* notifier) { -#if USE(PREEMPT_GEOLOCATION_PERMISSION) - if (!isAllowed()) { - m_startRequestPermissionNotifier = notifier; - requestPermission(); - return true; - } -#endif - #if ENABLE(CLIENT_BASED_GEOLOCATION) if (!m_frame) return false; @@ -686,6 +690,38 @@ void Geolocation::stopUpdating() } +#if USE(PREEMPT_GEOLOCATION_PERMISSION) +void Geolocation::handlePendingPermissionNotifiers() +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + if (!m_frame) + return; + Page* page = m_frame->page(); + if (!page) + return; +#endif + + // While we iterate through the list, we need not worry about list being modified as the permission + // is already set to Yes/No and no new listeners will be added to the pending list + GeoNotifierSet::const_iterator end = m_pendingForPermissionNotifiers.end(); + for (GeoNotifierSet::const_iterator iter = m_pendingForPermissionNotifiers.begin(); iter != end; ++iter) { + GeoNotifier* notifier = iter->get(); + + if (isAllowed()) { + // start all pending notification requests as permission granted. + // The notifier is always ref'ed by m_oneShots or m_watchers. +#if ENABLE(CLIENT_BASED_GEOLOCATION) + notifier->startTimerIfNeeded(); + page->geolocationController()->addObserver(this, notifier->m_options->enableHighAccuracy()); +#else + // TODO: Handle startUpdate() for non-client based implementations using pre-emptive policy +#endif + } else + notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); + } +} +#endif + } // namespace WebCore #else diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h index af10632..a4a0c5a 100644 --- a/WebCore/page/Geolocation.h +++ b/WebCore/page/Geolocation.h @@ -139,6 +139,9 @@ private: void stopTimersForWatchers(); void stopTimers(); + void cancelRequests(Vector<RefPtr<GeoNotifier> >&); + void cancelAllRequests(); + void positionChangedInternal(); void makeSuccessCallbacks(); void handleError(PositionError*); @@ -148,6 +151,10 @@ private: bool startUpdating(GeoNotifier*); void stopUpdating(); +#if USE(PREEMPT_GEOLOCATION_PERMISSION) + void handlePendingPermissionNotifiers(); +#endif + #if !ENABLE(CLIENT_BASED_GEOLOCATION) && ENABLE(GEOLOCATION) // GeolocationServiceClient virtual void geolocationServicePositionChanged(GeolocationService*); @@ -171,7 +178,7 @@ private: OwnPtr<GeolocationService> m_service; #endif #if USE(PREEMPT_GEOLOCATION_PERMISSION) - RefPtr<GeoNotifier> m_startRequestPermissionNotifier; + GeoNotifierSet m_pendingForPermissionNotifiers; #endif RefPtr<Geoposition> m_lastPosition; diff --git a/WebCore/page/GroupSettings.cpp b/WebCore/page/GroupSettings.cpp new file mode 100644 index 0000000..58ab74d --- /dev/null +++ b/WebCore/page/GroupSettings.cpp @@ -0,0 +1,46 @@ +/* + * 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 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 "GroupSettings.h" + +namespace WebCore { + +GroupSettings::GroupSettings() + : m_localStorageQuotaBytes(5 * 1024 * 1024) // Suggested by the HTML5 spec. +{ +} + +void GroupSettings::setLocalStorageQuotaBytes(unsigned quota) +{ + m_localStorageQuotaBytes = quota; +} + +void GroupSettings::setIndexedDBDatabasePath(const String& path) +{ + m_indexedDBDatabasePath = path; +} + +} // namespace WebCore diff --git a/WebCore/page/GroupSettings.h b/WebCore/page/GroupSettings.h new file mode 100644 index 0000000..62a5dd2 --- /dev/null +++ b/WebCore/page/GroupSettings.h @@ -0,0 +1,58 @@ +/* + * 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 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 GroupSettings_h +#define GroupSettings_h + +#include "PlatformString.h" +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +class PageGroup; + +class GroupSettings : public Noncopyable { +public: + static PassOwnPtr<GroupSettings> create() + { + return adoptPtr(new GroupSettings()); + } + + void setLocalStorageQuotaBytes(unsigned); + unsigned localStorageQuotaBytes() const { return m_localStorageQuotaBytes; } + + void setIndexedDBDatabasePath(const String&); + const String& indexedDBDatabasePath() const { return m_indexedDBDatabasePath; } + +private: + GroupSettings(); + + unsigned m_localStorageQuotaBytes; + String m_indexedDBDatabasePath; +}; + +} // namespace WebCore + +#endif // GroupSettings_h diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index f808928..63decd7 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -65,12 +65,12 @@ #include "SharedBuffer.h" #include "SpeechInput.h" #include "SpeechInputClient.h" -#include "StringHash.h" #include "TextResourceDecoder.h" #include "Widget.h" #include <wtf/HashMap.h> #include <wtf/RefCountedLeakCounter.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if ENABLE(DOM_STORAGE) #include "StorageArea.h" @@ -359,6 +359,9 @@ void Page::goBackOrForward(int distance) void Page::goToItem(HistoryItem* item, FrameLoadType type) { + if (defersLoading()) + return; + // Abort any current load unless we're navigating the current document to a new state object HistoryItem* currentItem = m_mainFrame->loader()->history()->currentItem(); if (!item->stateObject() || !currentItem || item->documentSequenceNumber() != currentItem->documentSequenceNumber() || item == currentItem) { @@ -445,7 +448,10 @@ void Page::refreshPlugins(bool reload) Page* page = *it; // Clear out the page's plug-in data. - page->m_pluginData = 0; + if (page->m_pluginData) { + page->m_pluginData->disconnectPage(); + page->m_pluginData = 0; + } if (!reload) continue; diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index 12b1a41..aecd550 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -30,6 +30,7 @@ #include "ChromeClient.h" #include "Document.h" #include "Frame.h" +#include "GroupSettings.h" #include "IDBFactoryBackendInterface.h" #include "Page.h" #include "Settings.h" @@ -55,12 +56,14 @@ PageGroup::PageGroup(const String& name) : m_name(name) , m_visitedLinksPopulated(false) , m_identifier(getUniqueIdentifier()) + , m_groupSettings(GroupSettings::create()) { } PageGroup::PageGroup(Page* page) : m_visitedLinksPopulated(false) , m_identifier(getUniqueIdentifier()) + , m_groupSettings(GroupSettings::create()) { ASSERT(page); addPage(page); @@ -200,7 +203,7 @@ StorageNamespace* PageGroup::localStorage() // at this point we're stuck with it. Page* page = *m_pages.begin(); const String& path = page->settings()->localStorageDatabasePath(); - unsigned quota = page->settings()->localStorageQuota(); + unsigned quota = m_groupSettings->localStorageQuotaBytes(); m_localStorage = StorageNamespace::localStorageNamespace(path, quota); } @@ -236,11 +239,12 @@ void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& sourc void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, - UserContentInjectedFrames injectedFrames) + UserContentInjectedFrames injectedFrames, + UserStyleSheet::Level level) { ASSERT_ARG(world, world); - OwnPtr<UserStyleSheet> userStyleSheet(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames)); + OwnPtr<UserStyleSheet> userStyleSheet(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level)); if (!m_userStyleSheets) m_userStyleSheets.set(new UserStyleSheetMap); UserStyleSheetVector*& styleSheetsInWorld = m_userStyleSheets->add(world, 0).first->second; diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h index 08b03d7..6a3518e 100644 --- a/WebCore/page/PageGroup.h +++ b/WebCore/page/PageGroup.h @@ -29,13 +29,14 @@ #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include "LinkHash.h" -#include "StringHash.h" #include "UserScript.h" #include "UserStyleSheet.h" +#include <wtf/text/StringHash.h> namespace WebCore { class KURL; + class GroupSettings; class IDBFactoryBackendInterface; class Page; class StorageNamespace; @@ -80,7 +81,8 @@ namespace WebCore { UserScriptInjectionTime, UserContentInjectedFrames); void addUserStyleSheetToWorld(DOMWrapperWorld*, const String& source, const KURL&, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, - UserContentInjectedFrames); + UserContentInjectedFrames, + UserStyleSheet::Level level = UserStyleSheet::UserLevel); void removeUserScriptFromWorld(DOMWrapperWorld*, const KURL&); void removeUserStyleSheetFromWorld(DOMWrapperWorld*, const KURL&); @@ -93,6 +95,8 @@ namespace WebCore { const UserScriptMap* userScripts() const { return m_userScripts.get(); } const UserStyleSheetMap* userStyleSheets() const { return m_userStyleSheets.get(); } + GroupSettings* groupSettings() const { return m_groupSettings.get(); } + private: void addVisitedLink(LinkHash stringHash); void resetUserStyleCacheInAllFrames(); @@ -114,6 +118,8 @@ namespace WebCore { OwnPtr<UserScriptMap> m_userScripts; OwnPtr<UserStyleSheetMap> m_userStyleSheets; + + OwnPtr<GroupSettings> m_groupSettings; }; } // namespace WebCore diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp index 87b3ed2..f759402 100644 --- a/WebCore/page/SecurityOrigin.cpp +++ b/WebCore/page/SecurityOrigin.cpp @@ -30,6 +30,7 @@ #include "SecurityOrigin.h" #include "Document.h" +#include "FileSystem.h" #include "KURL.h" #include "OriginAccessEntry.h" #include "SchemeRegistry.h" @@ -367,13 +368,13 @@ static const char SeparatorCharacter = '_'; PassRefPtr<SecurityOrigin> SecurityOrigin::createFromDatabaseIdentifier(const String& databaseIdentifier) { // Make sure there's a first separator - int separator1 = databaseIdentifier.find(SeparatorCharacter); - if (separator1 == -1) + size_t separator1 = databaseIdentifier.find(SeparatorCharacter); + if (separator1 == notFound) return create(KURL()); // Make sure there's a second separator - int separator2 = databaseIdentifier.reverseFind(SeparatorCharacter); - if (separator2 == -1) + size_t separator2 = databaseIdentifier.reverseFind(SeparatorCharacter); + if (separator2 == notFound) return create(KURL()); // Ensure there were at least 2 separator characters. Some hostnames on intranets have @@ -384,7 +385,7 @@ PassRefPtr<SecurityOrigin> SecurityOrigin::createFromDatabaseIdentifier(const St // Make sure the port section is a valid port number or doesn't exist bool portOkay; int port = databaseIdentifier.right(databaseIdentifier.length() - separator2 - 1).toInt(&portOkay); - bool portAbsent = (separator2 == static_cast<int>(databaseIdentifier.length()) - 1); + bool portAbsent = (separator2 == databaseIdentifier.length() - 1); if (!(portOkay || portAbsent)) return create(KURL()); @@ -399,85 +400,12 @@ PassRefPtr<SecurityOrigin> SecurityOrigin::createFromDatabaseIdentifier(const St return create(KURL(KURL(), protocol + "://" + host + ":" + String::number(port))); } -// The following lower-ASCII characters need escaping to be used in a filename -// across all systems, including Windows: -// - Unprintable ASCII (00-1F) -// - Space (20) -// - Double quote (22) -// - Percent (25) (escaped because it is our escape character) -// - Asterisk (2A) -// - Slash (2F) -// - Colon (3A) -// - Less-than (3C) -// - Greater-than (3E) -// - Question Mark (3F) -// - Backslash (5C) -// - Pipe (7C) -// - Delete (7F) - -static const bool needsEscaping[128] = { - /* 00-07 */ true, true, true, true, true, true, true, true, - /* 08-0F */ true, true, true, true, true, true, true, true, - - /* 10-17 */ true, true, true, true, true, true, true, true, - /* 18-1F */ true, true, true, true, true, true, true, true, - - /* 20-27 */ true, false, true, false, false, true, false, false, - /* 28-2F */ false, false, true, false, false, false, false, true, - - /* 30-37 */ false, false, false, false, false, false, false, false, - /* 38-3F */ false, false, true, false, true, false, true, true, - - /* 40-47 */ false, false, false, false, false, false, false, false, - /* 48-4F */ false, false, false, false, false, false, false, false, - - /* 50-57 */ false, false, false, false, false, false, false, false, - /* 58-5F */ false, false, false, false, true, false, false, false, - - /* 60-67 */ false, false, false, false, false, false, false, false, - /* 68-6F */ false, false, false, false, false, false, false, false, - - /* 70-77 */ false, false, false, false, false, false, false, false, - /* 78-7F */ false, false, false, false, true, false, false, true, -}; - -static inline bool shouldEscapeUChar(UChar c) -{ - return c > 127 ? false : needsEscaping[c]; -} - -static const char hexDigits[17] = "0123456789ABCDEF"; - -static String encodedHost(const String& host) -{ - unsigned length = host.length(); - Vector<UChar, 512> buffer(length * 3 + 1); - UChar* p = buffer.data(); - - const UChar* str = host.characters(); - const UChar* strEnd = str + length; - - while (str < strEnd) { - UChar c = *str++; - if (shouldEscapeUChar(c)) { - *p++ = '%'; - *p++ = hexDigits[(c >> 4) & 0xF]; - *p++ = hexDigits[c & 0xF]; - } else - *p++ = c; - } - - ASSERT(p - buffer.data() <= static_cast<int>(buffer.size())); - - return String(buffer.data(), p - buffer.data()); -} - String SecurityOrigin::databaseIdentifier() const { String separatorString(&SeparatorCharacter, 1); if (m_encodedHost.isEmpty()) - m_encodedHost = encodedHost(m_host); + m_encodedHost = encodeForFileName(m_host); return m_protocol + separatorString + m_encodedHost + separatorString + String::number(m_port); } diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h index fa5b1e4..266ade0 100644 --- a/WebCore/page/SecurityOrigin.h +++ b/WebCore/page/SecurityOrigin.h @@ -33,10 +33,10 @@ #include <wtf/RefCounted.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> +#include <wtf/text/StringHash.h> #include "FrameLoaderTypes.h" #include "PlatformString.h" -#include "StringHash.h" namespace WebCore { diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index 6ec65c2..24563af 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -76,8 +76,7 @@ Settings::Settings(Page* page) , m_blockNetworkImage(false) #endif , m_maximumDecodedImageSize(numeric_limits<size_t>::max()) -#if ENABLE(DOM_STORAGE) - , m_localStorageQuota(5 * 1024 * 1024) // Suggested by the HTML5 spec. +#if ENABLE(DOM_STORAGE) , m_sessionStorageQuota(StorageMap::noQuota) #endif , m_pluginAllowedRunTime(numeric_limits<unsigned>::max()) @@ -315,12 +314,7 @@ void Settings::setLocalStorageEnabled(bool localStorageEnabled) m_localStorageEnabled = localStorageEnabled; } -#if ENABLE(DOM_STORAGE) -void Settings::setLocalStorageQuota(unsigned localStorageQuota) -{ - m_localStorageQuota = localStorageQuota; -} - +#if ENABLE(DOM_STORAGE) void Settings::setSessionStorageQuota(unsigned sessionStorageQuota) { m_sessionStorageQuota = sessionStorageQuota; diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index c5a13b2..bca23b0 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -27,11 +27,11 @@ #ifndef Settings_h #define Settings_h -#include "AtomicString.h" #include "EditingBehaviorTypes.h" #include "FontRenderingMode.h" #include "KURL.h" #include "ZoomMode.h" +#include <wtf/text/AtomicString.h> namespace WebCore { @@ -157,10 +157,7 @@ namespace WebCore { void setLocalStorageEnabled(bool); bool localStorageEnabled() const { return m_localStorageEnabled; } -#if ENABLE(DOM_STORAGE) - void setLocalStorageQuota(unsigned); - unsigned localStorageQuota() const { return m_localStorageQuota; } - +#if ENABLE(DOM_STORAGE) // Allow clients concerned with memory consumption to set a quota on session storage // since the memory used won't be released until the Page is destroyed. // Default is noQuota. @@ -457,8 +454,7 @@ namespace WebCore { bool m_blockNetworkImage : 1; #endif size_t m_maximumDecodedImageSize; -#if ENABLE(DOM_STORAGE) - unsigned m_localStorageQuota; +#if ENABLE(DOM_STORAGE) unsigned m_sessionStorageQuota; #endif unsigned m_pluginAllowedRunTime; diff --git a/WebCore/page/SpeechInput.cpp b/WebCore/page/SpeechInput.cpp index 4f37988..24b52d2 100644 --- a/WebCore/page/SpeechInput.cpp +++ b/WebCore/page/SpeechInput.cpp @@ -41,46 +41,74 @@ namespace WebCore { SpeechInput::SpeechInput(SpeechInputClient* client) : m_client(client) - , m_listener(0) + , m_nextListenerId(1) { + m_client->setListener(this); } -void SpeechInput::didCompleteRecording() +SpeechInput::~SpeechInput() { - ASSERT(m_listener); - m_listener->didCompleteRecording(); + m_client->setListener(0); } -void SpeechInput::didCompleteRecognition() +int SpeechInput::registerListener(SpeechInputListener* listener) { - ASSERT(m_listener); - m_listener->didCompleteRecognition(); - m_listener = 0; +#if defined(DEBUG) + // Check if already present. + for (HashMap<int, SpeechInputListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) + ASSERT(it->second != listener); +#endif + + m_listeners.add(m_nextListenerId, listener); + return m_nextListenerId++; +} + +void SpeechInput::unregisterListener(int listenerId) +{ + if (m_listeners.contains(listenerId)) + m_listeners.remove(listenerId); +} + +void SpeechInput::didCompleteRecording(int listenerId) +{ + // Don't assert if not present as the element might have been removed by the page while + // this event was on the way. + if (m_listeners.contains(listenerId)) + m_listeners.get(listenerId)->didCompleteRecording(listenerId); +} + +void SpeechInput::didCompleteRecognition(int listenerId) +{ + // Don't assert if not present as the element might have been removed by the page while + // this event was on the way. + if (m_listeners.contains(listenerId)) + m_listeners.get(listenerId)->didCompleteRecognition(listenerId); +} + +void SpeechInput::setRecognitionResult(int listenerId, const String& result) +{ + // Don't assert if not present as the element might have been removed by the page while + // this event was on the way. + if (m_listeners.contains(listenerId)) + m_listeners.get(listenerId)->setRecognitionResult(listenerId, result); } -void SpeechInput::setRecognitionResult(const String& result) +bool SpeechInput::startRecognition(int listenerId) { - ASSERT(m_listener); - m_listener->setRecognitionResult(result); + ASSERT(m_listeners.contains(listenerId)); + return m_client->startRecognition(listenerId); } -bool SpeechInput::startRecognition(SpeechInputListener* listener) +void SpeechInput::stopRecording(int listenerId) { - // Cancel any ongoing recognition first. - if (m_listener) { - m_listener->didCompleteRecognition(); - m_listener = 0; - m_client->cancelRecognition(); - } - - m_listener = listener; - return m_client->startRecognition(this); + ASSERT(m_listeners.contains(listenerId)); + m_client->stopRecording(listenerId); } -void SpeechInput::stopRecording() +void SpeechInput::cancelRecognition(int listenerId) { - ASSERT(m_listener); - m_client->stopRecording(); + ASSERT(m_listeners.contains(listenerId)); + m_client->cancelRecognition(listenerId); } } // namespace WebCore diff --git a/WebCore/page/SpeechInput.h b/WebCore/page/SpeechInput.h index 58f4efe..f36194c 100644 --- a/WebCore/page/SpeechInput.h +++ b/WebCore/page/SpeechInput.h @@ -35,6 +35,7 @@ #include "SpeechInputListener.h" #include <wtf/Forward.h> +#include <wtf/HashMap.h> #include <wtf/Noncopyable.h> namespace WebCore { @@ -48,20 +49,30 @@ class SpeechInputListener; class SpeechInput : public Noncopyable, public SpeechInputListener { public: SpeechInput(SpeechInputClient*); - virtual ~SpeechInput() { } + virtual ~SpeechInput(); + + // Generates a unique ID for the given listener to be used for speech requests. + // This should be the first call made by listeners before anything else. + int registerListener(SpeechInputListener*); + + // Invoked when the listener is done with recording or getting destroyed. + // Failure to unregister may result in crashes if there were any pending speech events. + void unregisterListener(int); // Methods invoked by the input elements. - bool startRecognition(SpeechInputListener* listener); - void stopRecording(); + bool startRecognition(int); + void stopRecording(int); + void cancelRecognition(int); // SpeechInputListener methods. - virtual void didCompleteRecording(); - virtual void didCompleteRecognition(); - virtual void setRecognitionResult(const String&); + virtual void didCompleteRecording(int); + virtual void didCompleteRecognition(int); + virtual void setRecognitionResult(int, const String&); private: SpeechInputClient* m_client; - SpeechInputListener* m_listener; + HashMap<int, SpeechInputListener*> m_listeners; + int m_nextListenerId; }; } // namespace WebCore diff --git a/WebCore/page/SpeechInputClient.h b/WebCore/page/SpeechInputClient.h index f6c61cf..87ff7b9 100644 --- a/WebCore/page/SpeechInputClient.h +++ b/WebCore/page/SpeechInputClient.h @@ -40,15 +40,22 @@ class SpeechInputListener; // Provides an interface for SpeechInput to call into the embedder. class SpeechInputClient { public: - virtual bool startRecognition(SpeechInputListener* listener) = 0; + // This is the first call made by a listener, registering itself for future callbacks. + // When the listener no longer needs speech input (for e.g. when it gets destroyed), + // it should set a null listener to stop receiving callbacks. + // The client does not take ownership of the pointer. + virtual void setListener(SpeechInputListener*) = 0; + + // Starts speech recognition and audio recording. + virtual bool startRecognition(int requestId) = 0; // Stops audio recording and performs recognition with the audio recorded until now // (does not discard audio). - virtual void stopRecording() = 0; + virtual void stopRecording(int requestId) = 0; // Cancels an ongoing recognition and discards any audio recorded so far. No partial // recognition results are returned to the listener. - virtual void cancelRecognition() = 0; + virtual void cancelRecognition(int requestId) = 0; protected: virtual ~SpeechInputClient() { } diff --git a/WebCore/page/SpeechInputListener.h b/WebCore/page/SpeechInputListener.h index 143984d..36060fc 100644 --- a/WebCore/page/SpeechInputListener.h +++ b/WebCore/page/SpeechInputListener.h @@ -41,19 +41,19 @@ namespace WebCore { class SpeechInputListener { public: // Informs that audio recording has completed and recognition is underway. - virtual void didCompleteRecording() = 0; + virtual void didCompleteRecording(int requestId) = 0; // Informs that speech recognition has completed. This gets invoked irrespective of whether // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The // handler typically frees up any temporary resources allocated and waits for the next speech // recognition request. - virtual void didCompleteRecognition() = 0; + virtual void didCompleteRecognition(int requestId) = 0; // Gives results from speech recognition, either partial or the final results. // This method can potentially get called multiple times if there are partial results // available as the user keeps speaking. If the speech could not be recognized properly // or if there was any other errors in the process, this method may never be called. - virtual void setRecognitionResult(const String& result) = 0; + virtual void setRecognitionResult(int requestId, const String& result) = 0; protected: virtual ~SpeechInputListener() { } diff --git a/WebCore/page/UserContentURLPattern.cpp b/WebCore/page/UserContentURLPattern.cpp index 09eb678..272284a 100644 --- a/WebCore/page/UserContentURLPattern.cpp +++ b/WebCore/page/UserContentURLPattern.cpp @@ -63,14 +63,14 @@ bool UserContentURLPattern::parse(const String& pattern) { DEFINE_STATIC_LOCAL(const String, schemeSeparator, ("://")); - int schemeEndPos = pattern.find(schemeSeparator); - if (schemeEndPos == -1) + size_t schemeEndPos = pattern.find(schemeSeparator); + if (schemeEndPos == notFound) return false; m_scheme = pattern.left(schemeEndPos); - int hostStartPos = schemeEndPos + schemeSeparator.length(); - if (hostStartPos >= static_cast<int>(pattern.length())) + unsigned hostStartPos = schemeEndPos + schemeSeparator.length(); + if (hostStartPos >= pattern.length()) return false; int pathStartPos = 0; @@ -78,8 +78,8 @@ bool UserContentURLPattern::parse(const String& pattern) if (equalIgnoringCase(m_scheme, "file")) pathStartPos = hostStartPos; else { - int hostEndPos = pattern.find("/", hostStartPos); - if (hostEndPos == -1) + size_t hostEndPos = pattern.find("/", hostStartPos); + if (hostEndPos == notFound) return false; m_host = pattern.substring(hostStartPos, hostEndPos - hostStartPos); @@ -96,7 +96,7 @@ bool UserContentURLPattern::parse(const String& pattern) } // No other '*' can occur in the host. - if (m_host.find("*") != -1) + if (m_host.find("*") != notFound) return false; pathStartPos = hostEndPos; diff --git a/WebCore/page/UserStyleSheet.h b/WebCore/page/UserStyleSheet.h index 4c6d708..1acd296 100644 --- a/WebCore/page/UserStyleSheet.h +++ b/WebCore/page/UserStyleSheet.h @@ -37,14 +37,20 @@ namespace WebCore { class UserStyleSheet : public Noncopyable { public: + enum Level { + UserLevel, + AuthorLevel + }; + UserStyleSheet(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, - UserContentInjectedFrames injectedFrames) + UserContentInjectedFrames injectedFrames, Level level) : m_source(source) , m_url(url) , m_whitelist(whitelist) , m_blacklist(blacklist) , m_injectedFrames(injectedFrames) + , m_level(level) { } @@ -53,6 +59,7 @@ public: const Vector<String>* whitelist() const { return m_whitelist.get(); } const Vector<String>* blacklist() const { return m_blacklist.get(); } UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; } + Level level() const { return m_level; } private: String m_source; @@ -60,6 +67,7 @@ private: OwnPtr<Vector<String> > m_whitelist; OwnPtr<Vector<String> > m_blacklist; UserContentInjectedFrames m_injectedFrames; + Level m_level; }; } // namespace WebCore diff --git a/WebCore/page/WindowFeatures.cpp b/WebCore/page/WindowFeatures.cpp index 1654ff5..82e36b9 100644 --- a/WebCore/page/WindowFeatures.cpp +++ b/WebCore/page/WindowFeatures.cpp @@ -24,10 +24,10 @@ #include "WindowFeatures.h" #include "PlatformString.h" -#include "StringHash.h" #include <wtf/Assertions.h> #include <wtf/HashMap.h> #include <wtf/MathExtras.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp index 22506b2..fb0e1c0 100644 --- a/WebCore/page/XSSAuditor.cpp +++ b/WebCore/page/XSSAuditor.cpp @@ -34,8 +34,8 @@ #include "DocumentLoader.h" #include "DOMWindow.h" #include "Frame.h" +#include "HTMLEntityParser.h" #include "KURL.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 = LegacyPreloadScanner::consumeEntity(source, notEnoughCharacters); + unsigned entity = consumeHTMLEntity(source, notEnoughCharacters); // We ignore notEnoughCharacters because we might as well use this loop // to copy the remaining characters into |result|. @@ -405,10 +405,10 @@ bool XSSAuditor::findInRequest(Frame* frame, const FindTask& task) const String decodedPageURL = m_pageURLCache.canonicalizeURL(pageURL, frame->document()->decoder()->encoding(), task.decodeEntities, task.decodeURLEscapeSequencesTwice); - if (task.allowRequestIfNoIllegalURICharacters && !hasFormData && decodedPageURL.find(&isIllegalURICharacter, 0) == -1) + if (task.allowRequestIfNoIllegalURICharacters && !hasFormData && decodedPageURL.find(&isIllegalURICharacter, 0) == notFound) return false; // Injection is impossible because the request does not contain any illegal URI characters. - if (decodedPageURL.find(canonicalizedString, 0, false) != -1) + if (decodedPageURL.find(canonicalizedString, 0, false) != notFound) return true; // We've found the string in the GET data. if (hasFormData) { @@ -423,7 +423,7 @@ bool XSSAuditor::findInRequest(Frame* frame, const FindTask& task) const if (m_formDataSuffixTree && !m_formDataSuffixTree->mightContain(canonicalizedString)) return false; - if (decodedFormData.find(canonicalizedString, 0, false) != -1) + if (decodedFormData.find(canonicalizedString, 0, false) != notFound) return true; // We found the string in the POST data. } diff --git a/WebCore/page/XSSAuditor.h b/WebCore/page/XSSAuditor.h index 20e0a53..2b781f1 100644 --- a/WebCore/page/XSSAuditor.h +++ b/WebCore/page/XSSAuditor.h @@ -66,7 +66,7 @@ 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. - // * LegacyHTMLDocumentParser::parseTag - used to load external JavaScript scripts. + // * HTMLDocumentParser::shouldLoadExternalScriptFromSrc - used to load external JavaScript scripts. // * SubframeLoader::requestObject - used to load <object>/<embed> elements. // class XSSAuditor : public Noncopyable { diff --git a/WebCore/page/animation/AnimationBase.h b/WebCore/page/animation/AnimationBase.h index 33a0b1d..182cb3c 100644 --- a/WebCore/page/animation/AnimationBase.h +++ b/WebCore/page/animation/AnimationBase.h @@ -29,8 +29,8 @@ #ifndef AnimationBase_h #define AnimationBase_h -#include "AtomicString.h" #include <wtf/HashMap.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/page/animation/AnimationControllerPrivate.h b/WebCore/page/animation/AnimationControllerPrivate.h index 3ae15a5..3305e24 100644 --- a/WebCore/page/animation/AnimationControllerPrivate.h +++ b/WebCore/page/animation/AnimationControllerPrivate.h @@ -29,7 +29,6 @@ #ifndef AnimationControllerPrivate_h #define AnimationControllerPrivate_h -#include "AtomicString.h" #include "CSSPropertyNames.h" #include "PlatformString.h" #include "Timer.h" @@ -37,6 +36,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/page/animation/CompositeAnimation.h b/WebCore/page/animation/CompositeAnimation.h index 51ba565..a0ac455 100644 --- a/WebCore/page/animation/CompositeAnimation.h +++ b/WebCore/page/animation/CompositeAnimation.h @@ -29,12 +29,11 @@ #ifndef CompositeAnimation_h #define CompositeAnimation_h -#include "AtomicString.h" - #include "ImplicitAnimation.h" #include "KeyframeAnimation.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/platform/ContentType.cpp b/WebCore/platform/ContentType.cpp index 3dce7b5..c094d54 100644 --- a/WebCore/platform/ContentType.cpp +++ b/WebCore/platform/ContentType.cpp @@ -41,14 +41,14 @@ String ContentType::parameter(const String& parameterName) const String strippedType = m_type.stripWhiteSpace(); // a MIME type can have one or more "param=value" after a semi-colon, and separated from each other by semi-colons - int semi = strippedType.find(';'); - if (semi != -1) { - int start = strippedType.find(parameterName, semi + 1, false); - if (start != -1) { + size_t semi = strippedType.find(';'); + if (semi != notFound) { + size_t start = strippedType.find(parameterName, semi + 1, false); + if (start != notFound) { start = strippedType.find('=', start + 6); - if (start != -1) { - int end = strippedType.find(';', start + 6); - if (end == -1) + if (start != notFound) { + size_t end = strippedType.find(';', start + 6); + if (end == notFound) end = strippedType.length(); parameterValue = strippedType.substring(start + 1, end - (start + 1)).stripWhiteSpace(); } @@ -63,8 +63,8 @@ String ContentType::type() const String strippedType = m_type.stripWhiteSpace(); // "type" can have parameters after a semi-colon, strip them - int semi = strippedType.find(';'); - if (semi != -1) + size_t semi = strippedType.find(';'); + if (semi != notFound) strippedType = strippedType.left(semi).stripWhiteSpace(); return strippedType; diff --git a/WebCore/platform/Cookie.h b/WebCore/platform/Cookie.h index 0fe3851..4eea7d2 100644 --- a/WebCore/platform/Cookie.h +++ b/WebCore/platform/Cookie.h @@ -27,7 +27,7 @@ #define Cookie_h #include "PlatformString.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/FileSystem.cpp b/WebCore/platform/FileSystem.cpp new file mode 100644 index 0000000..511f8aa --- /dev/null +++ b/WebCore/platform/FileSystem.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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" + +namespace WebCore { + +// The following lower-ASCII characters need escaping to be used in a filename +// across all systems, including Windows: +// - Unprintable ASCII (00-1F) +// - Space (20) +// - Double quote (22) +// - Percent (25) (escaped because it is our escape character) +// - Asterisk (2A) +// - Slash (2F) +// - Colon (3A) +// - Less-than (3C) +// - Greater-than (3E) +// - Question Mark (3F) +// - Backslash (5C) +// - Pipe (7C) +// - Delete (7F) + +static const bool needsEscaping[128] = { + /* 00-07 */ true, true, true, true, true, true, true, true, + /* 08-0F */ true, true, true, true, true, true, true, true, + + /* 10-17 */ true, true, true, true, true, true, true, true, + /* 18-1F */ true, true, true, true, true, true, true, true, + + /* 20-27 */ true, false, true, false, false, true, false, false, + /* 28-2F */ false, false, true, false, false, false, false, true, + + /* 30-37 */ false, false, false, false, false, false, false, false, + /* 38-3F */ false, false, true, false, true, false, true, true, + + /* 40-47 */ false, false, false, false, false, false, false, false, + /* 48-4F */ false, false, false, false, false, false, false, false, + + /* 50-57 */ false, false, false, false, false, false, false, false, + /* 58-5F */ false, false, false, false, true, false, false, false, + + /* 60-67 */ false, false, false, false, false, false, false, false, + /* 68-6F */ false, false, false, false, false, false, false, false, + + /* 70-77 */ false, false, false, false, false, false, false, false, + /* 78-7F */ false, false, false, false, true, false, false, true, +}; + +static inline bool shouldEscapeUChar(UChar c) +{ + return c > 127 ? false : needsEscaping[c]; +} + +static const char hexDigits[17] = "0123456789ABCDEF"; + +String encodeForFileName(const String& inputStr) +{ + unsigned length = inputStr.length(); + Vector<UChar, 512> buffer(length * 3 + 1); + UChar* p = buffer.data(); + + const UChar* str = inputStr.characters(); + const UChar* strEnd = str + length; + + while (str < strEnd) { + UChar c = *str++; + if (shouldEscapeUChar(c)) { + *p++ = '%'; + *p++ = hexDigits[(c >> 4) & 0xF]; + *p++ = hexDigits[c & 0xF]; + } else + *p++ = c; + } + + ASSERT(p - buffer.data() <= static_cast<int>(buffer.size())); + + return String(buffer.data(), p - buffer.data()); +} + +} // namespace WebCore diff --git a/WebCore/platform/FileSystem.h b/WebCore/platform/FileSystem.h index 617470b..ec75a21 100644 --- a/WebCore/platform/FileSystem.h +++ b/WebCore/platform/FileSystem.h @@ -170,6 +170,9 @@ int readFromFile(PlatformFileHandle, char* data, int length); // Methods for dealing with loadable modules bool unloadModule(PlatformModule); +// Encode a string for use within a file name. +String encodeForFileName(const String&); + #if PLATFORM(WIN) String localUserSpecificStorageDirectory(); String roamingUserSpecificStorageDirectory(); diff --git a/WebCore/platform/KURL.cpp b/WebCore/platform/KURL.cpp index 9ed900f..16b84b5 100644 --- a/WebCore/platform/KURL.cpp +++ b/WebCore/platform/KURL.cpp @@ -29,11 +29,11 @@ #include "KURL.h" -#include "StringHash.h" #include "TextEncoding.h" #include <wtf/text/CString.h> #include <wtf/HashMap.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if USE(ICU_UNICODE) #include <unicode/uidna.h> @@ -551,12 +551,12 @@ String KURL::lastPathComponent() const if (!hasPath()) return String(); - int end = m_pathEnd - 1; + unsigned end = m_pathEnd - 1; if (m_string[end] == '/') --end; - int start = m_string.reverseFind('/', end); - if (start < m_portEnd) + size_t start = m_string.reverseFind('/', end); + if (start < static_cast<unsigned>(m_portEnd)) return String(); ++start; @@ -675,7 +675,7 @@ String KURL::path() const bool KURL::setProtocol(const String& s) { // Firefox and IE remove everything after the first ':'. - int separatorPosition = s.find(':'); + size_t separatorPosition = s.find(':'); String newProtocol = s.substring(0, separatorPosition); if (!isValidProtocol(newProtocol)) @@ -882,13 +882,13 @@ String decodeURLEscapeSequences(const String& str, const TextEncoding& encoding) CharBuffer buffer; - int length = str.length(); - int decodedPosition = 0; - int searchPosition = 0; - int encodedRunPosition; - while ((encodedRunPosition = str.find('%', searchPosition)) >= 0) { + unsigned length = str.length(); + unsigned decodedPosition = 0; + unsigned searchPosition = 0; + size_t encodedRunPosition; + while ((encodedRunPosition = str.find('%', searchPosition)) != notFound) { // Find the sequence of %-escape codes. - int encodedRunEnd = encodedRunPosition; + unsigned encodedRunEnd = encodedRunPosition; while (length - encodedRunEnd >= 3 && str[encodedRunEnd] == '%' && isASCIIHexDigit(str[encodedRunEnd + 1]) @@ -1614,13 +1614,13 @@ static void encodeRelativeString(const String& rel, const TextEncoding& encoding static String substituteBackslashes(const String& string) { - int questionPos = string.find('?'); - int hashPos = string.find('#'); - int pathEnd; + size_t questionPos = string.find('?'); + size_t hashPos = string.find('#'); + unsigned pathEnd; - if (hashPos >= 0 && (questionPos < 0 || questionPos > hashPos)) + if (hashPos != notFound && (questionPos == notFound || questionPos > hashPos)) pathEnd = hashPos; - else if (questionPos >= 0) + else if (questionPos != notFound) pathEnd = questionPos; else pathEnd = string.length(); @@ -1799,13 +1799,12 @@ bool portAllowed(const KURL& url) String mimeTypeFromDataURL(const String& url) { ASSERT(protocolIs(url, "data")); - int index = url.find(';'); - if (index == -1) + size_t index = url.find(';'); + if (index == notFound) index = url.find(','); - if (index != -1) { - int len = index - 5; - if (len > 0) - return url.substring(5, len); + if (index != notFound) { + if (index > 5) + return url.substring(5, index - 5); return "text/plain"; // Data URLs with no MIME type are considered text/plain. } return ""; diff --git a/WebCore/platform/KURLGoogle.cpp b/WebCore/platform/KURLGoogle.cpp index ac02630..3d23fcf 100644 --- a/WebCore/platform/KURLGoogle.cpp +++ b/WebCore/platform/KURLGoogle.cpp @@ -40,13 +40,13 @@ #include <algorithm> -#include "StringHash.h" #include "NotImplemented.h" #include "TextEncoding.h" #include <wtf/HashMap.h> #include <wtf/Vector.h> #include <wtf/StdLibExtras.h> #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> #include <googleurl/src/url_util.h> diff --git a/WebCore/platform/KURLHash.h b/WebCore/platform/KURLHash.h index 283170b..44a4624 100644 --- a/WebCore/platform/KURLHash.h +++ b/WebCore/platform/KURLHash.h @@ -28,7 +28,7 @@ #include "KURL.h" #include "PlatformString.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/Length.cpp b/WebCore/platform/Length.cpp index 3757d92..e2fd9b8 100644 --- a/WebCore/platform/Length.cpp +++ b/WebCore/platform/Length.cpp @@ -26,9 +26,9 @@ #include "Length.h" #include "PlatformString.h" -#include "StringBuffer.h" #include <wtf/ASCIICType.h> #include <wtf/Assertions.h> +#include <wtf/text/StringBuffer.h> using namespace WTF; @@ -103,10 +103,10 @@ Length* newCoordsArray(const String& string, int& len) Length* r = new Length[len]; int i = 0; - int pos = 0; - int pos2; + unsigned pos = 0; + size_t pos2; - while ((pos2 = str->find(' ', pos)) != -1) { + while ((pos2 = str->find(' ', pos)) != notFound) { r[i++] = parseLength(str->characters() + pos, pos2 - pos); pos = pos2+1; } @@ -129,10 +129,10 @@ Length* newLengthArray(const String& string, int& len) Length* r = new Length[len]; int i = 0; - int pos = 0; - int pos2; + unsigned pos = 0; + size_t pos2; - while ((pos2 = str->find(',', pos)) != -1) { + while ((pos2 = str->find(',', pos)) != notFound) { r[i++] = parseLength(str->characters() + pos, pos2 - pos); pos = pos2+1; } diff --git a/WebCore/platform/LinkHash.cpp b/WebCore/platform/LinkHash.cpp index 12437ab..86b4c8a 100644 --- a/WebCore/platform/LinkHash.cpp +++ b/WebCore/platform/LinkHash.cpp @@ -22,49 +22,49 @@ */ #include "config.h" -#include "AtomicString.h" #include "KURL.h" #include "LinkHash.h" #include "PlatformString.h" -#include "StringHash.h" -#include "StringImpl.h" +#include <wtf/text/AtomicString.h> +#include <wtf/text/StringHash.h> +#include <wtf/text/StringImpl.h> namespace WebCore { -static inline int findSlashDotDotSlash(const UChar* characters, size_t length) +static inline size_t findSlashDotDotSlash(const UChar* characters, size_t length) { if (length < 4) - return -1; + return notFound; unsigned loopLimit = length - 3; for (unsigned i = 0; i < loopLimit; ++i) { if (characters[i] == '/' && characters[i + 1] == '.' && characters[i + 2] == '.' && characters[i + 3] == '/') return i; } - return -1; + return notFound; } -static inline int findSlashSlash(const UChar* characters, size_t length, int position) +static inline size_t findSlashSlash(const UChar* characters, size_t length, int position) { if (length < 2) - return -1; + return notFound; unsigned loopLimit = length - 1; for (unsigned i = position; i < loopLimit; ++i) { if (characters[i] == '/' && characters[i + 1] == '/') return i; } - return -1; + return notFound; } -static inline int findSlashDotSlash(const UChar* characters, size_t length) +static inline size_t findSlashDotSlash(const UChar* characters, size_t length) { if (length < 3) - return -1; + return notFound; unsigned loopLimit = length - 2; for (unsigned i = 0; i < loopLimit; ++i) { if (characters[i] == '/' && characters[i + 1] == '.' && characters[i + 2] == '/') return i; } - return -1; + return notFound; } static inline bool containsColonSlashSlash(const UChar* characters, unsigned length) @@ -82,36 +82,32 @@ static inline bool containsColonSlashSlash(const UChar* characters, unsigned len static inline void cleanPath(Vector<UChar, 512>& path) { // FIXME: Should not do this in the query or anchor part. - int pos; - while ((pos = findSlashDotDotSlash(path.data(), path.size())) != -1) { - int prev = reverseFind(path.data(), path.size(), '/', pos - 1); + size_t pos; + while ((pos = findSlashDotDotSlash(path.data(), path.size())) != notFound) { + size_t prev = reverseFind(path.data(), path.size(), '/', pos - 1); // don't remove the host, i.e. http://foo.org/../foo.html - if (prev < 0 || (prev > 3 && path[prev - 2] == ':' && path[prev - 1] == '/')) + if (prev == notFound || (prev > 3 && path[prev - 2] == ':' && path[prev - 1] == '/')) path.remove(pos, 3); else path.remove(prev, pos - prev + 3); } // FIXME: Should not do this in the query part. - // Set refPos to -2 to mean "I haven't looked for the anchor yet". - // We don't want to waste a function call on the search for the the anchor - // in the vast majority of cases where there is no "//" in the path. pos = 0; - int refPos = -2; - while ((pos = findSlashSlash(path.data(), path.size(), pos)) != -1) { - if (refPos == -2) - refPos = find(path.data(), path.size(), '#'); - if (refPos > 0 && pos >= refPos) - break; - - if (pos == 0 || path[pos - 1] != ':') - path.remove(pos); - else - pos += 2; + if ((pos = findSlashSlash(path.data(), path.size(), pos)) != notFound) { + size_t refPos = find(path.data(), path.size(), '#'); + while (refPos == 0 || refPos == notFound || pos < refPos) { + if (pos == 0 || path[pos - 1] != ':') + path.remove(pos); + else + pos += 2; + if ((pos = findSlashSlash(path.data(), path.size(), pos)) == notFound) + break; + } } // FIXME: Should not do this in the query or anchor part. - while ((pos = findSlashDotSlash(path.data(), path.size())) != -1) + while ((pos = findSlashDotSlash(path.data(), path.size())) != notFound) path.remove(pos, 2); } diff --git a/WebCore/platform/LinkHash.h b/WebCore/platform/LinkHash.h index a499a8e..dc494d2 100644 --- a/WebCore/platform/LinkHash.h +++ b/WebCore/platform/LinkHash.h @@ -26,8 +26,8 @@ #ifndef LinkHash_h #define LinkHash_h -#include "StringHash.h" #include <wtf/Forward.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/MIMETypeRegistry.cpp b/WebCore/platform/MIMETypeRegistry.cpp index e9e5dd3..b489d3b 100644 --- a/WebCore/platform/MIMETypeRegistry.cpp +++ b/WebCore/platform/MIMETypeRegistry.cpp @@ -31,10 +31,10 @@ #include "ArchiveFactory.h" #endif #include "MediaPlayer.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if PLATFORM(CG) #include "ImageSourceCG.h" @@ -403,8 +403,8 @@ static void initializeMIMETypeRegistry() String MIMETypeRegistry::getMIMETypeForPath(const String& path) { - int pos = path.reverseFind('.'); - if (pos >= 0) { + size_t pos = path.reverseFind('.'); + if (pos != notFound) { String extension = path.substring(pos + 1); String result = getMIMETypeForExtension(extension); if (result.length()) diff --git a/WebCore/platform/MIMETypeRegistry.h b/WebCore/platform/MIMETypeRegistry.h index f71b478..64abea8 100644 --- a/WebCore/platform/MIMETypeRegistry.h +++ b/WebCore/platform/MIMETypeRegistry.h @@ -27,9 +27,9 @@ #define MIMETypeRegistry_h #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashSet.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/SchemeRegistry.cpp b/WebCore/platform/SchemeRegistry.cpp index 0423236..58df51a 100644 --- a/WebCore/platform/SchemeRegistry.cpp +++ b/WebCore/platform/SchemeRegistry.cpp @@ -113,8 +113,8 @@ bool SchemeRegistry::shouldTreatURLAsLocal(const String& url) return true; } - int loc = url.find(':'); - if (loc == -1) + size_t loc = url.find(':'); + if (loc == notFound) return false; String scheme = url.left(loc); diff --git a/WebCore/platform/SchemeRegistry.h b/WebCore/platform/SchemeRegistry.h index d92ec4e..56e3b33 100644 --- a/WebCore/platform/SchemeRegistry.h +++ b/WebCore/platform/SchemeRegistry.h @@ -27,8 +27,8 @@ #define SchemeRegistry_h #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashSet.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp index ddecf1e..615ae5d 100644 --- a/WebCore/platform/ScrollView.cpp +++ b/WebCore/platform/ScrollView.cpp @@ -322,6 +322,7 @@ void ScrollView::valueChanged(Scrollbar* scrollbar) if (scrollbarsSuppressed()) return; + repaintFixedElementsAfterScrolling(); scrollContents(scrollDelta); } diff --git a/WebCore/platform/ThreadGlobalData.cpp b/WebCore/platform/ThreadGlobalData.cpp index 99cd44a..6d7eb51 100644 --- a/WebCore/platform/ThreadGlobalData.cpp +++ b/WebCore/platform/ThreadGlobalData.cpp @@ -28,10 +28,10 @@ #include "ThreadGlobalData.h" #include "EventNames.h" -#include "StringImpl.h" #include "ThreadTimers.h" #include <wtf/UnusedParam.h> #include <wtf/WTFThreadData.h> +#include <wtf/text/StringImpl.h> #if USE(ICU_UNICODE) #include "TextCodecICU.h" diff --git a/WebCore/platform/ThreadGlobalData.h b/WebCore/platform/ThreadGlobalData.h index c17fbeb..9f57f00 100644 --- a/WebCore/platform/ThreadGlobalData.h +++ b/WebCore/platform/ThreadGlobalData.h @@ -27,10 +27,10 @@ #ifndef ThreadGlobalData_h #define ThreadGlobalData_h -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> +#include <wtf/text/StringHash.h> #if ENABLE(WORKERS) #include <wtf/ThreadSpecific.h> diff --git a/WebCore/platform/android/PackageNotifier.h b/WebCore/platform/android/PackageNotifier.h index d9b4fd4..8191d84 100644 --- a/WebCore/platform/android/PackageNotifier.h +++ b/WebCore/platform/android/PackageNotifier.h @@ -29,10 +29,11 @@ #if ENABLE(APPLICATION_INSTALLED) #include "PlatformString.h" -#include "StringHash.h" #include "Timer.h" + #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/android/PopupMenuAndroid.cpp b/WebCore/platform/android/PopupMenuAndroid.cpp new file mode 100644 index 0000000..8a1ed07 --- /dev/null +++ b/WebCore/platform/android/PopupMenuAndroid.cpp @@ -0,0 +1,57 @@ +/* + * This file is part of the popup menu implementation for <select> elements in WebCore. + * + * Copyright 2009, The Android Open Source Project + * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" +#include "PopupMenu.h" + +namespace WebCore { + +// Now we handle all of this in WebViewCore.cpp. +PopupMenu::PopupMenu(PopupMenuClient* menuList) + : m_popupClient(menuList) +{ +} + +PopupMenu::~PopupMenu() +{ +} + +void PopupMenu::show(const IntRect&, FrameView*, int) +{ +} + +void PopupMenu::hide() +{ +} + +void PopupMenu::updateFromElement() +{ +} + +bool PopupMenu::itemWritingDirectionIsNatural() +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/html/canvas/CanvasNumberArray.idl b/WebCore/platform/android/SearchPopupMenuAndroid.cpp index 036d4ee..0d67fdd 100644 --- a/WebCore/html/canvas/CanvasNumberArray.idl +++ b/WebCore/platform/android/SearchPopupMenuAndroid.cpp @@ -1,16 +1,16 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright 2006, The Android Open Source Project * * 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 + * * 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 + * * 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 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 @@ -20,14 +20,33 @@ * 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. */ -module html { - interface [ - Conditional=3D_CANVAS, - HasCustomIndexGetter - ] CanvasNumberArray { - readonly attribute unsigned long length; - }; +#include "config.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +// Save the past searches stored in 'searchItems' to a database associated with 'name' +void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +{ +} + +// Load past searches associated with 'name' from the database to 'searchItems' +void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +{ } + +// Create a search popup menu - not sure what else we have to do here +SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) + : PopupMenu(client) +{ +} + +bool SearchPopupMenu::enabled() +{ + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/cf/BinaryPropertyList.cpp b/WebCore/platform/cf/BinaryPropertyList.cpp index f0facae..27b44d4 100644 --- a/WebCore/platform/cf/BinaryPropertyList.cpp +++ b/WebCore/platform/cf/BinaryPropertyList.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "BinaryPropertyList.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> +#include <wtf/text/StringHash.h> #include <limits> using namespace std; diff --git a/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm b/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm index e532d57..bafc96e 100644 --- a/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm +++ b/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm @@ -452,9 +452,8 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con HIThemeDrawTrack(&trackInfo, 0, drawingContext->platformContext(), kHIThemeOrientationNormal); } - if (!canDrawDirectly) { - context->drawImage(imageBuffer->image(), DeviceColorSpace, scrollbar->frameRect().location()); - } + if (!canDrawDirectly) + context->drawImageBuffer(imageBuffer.get(), DeviceColorSpace, scrollbar->frameRect().location()); return true; } diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp index d4d4ff5..dc06b5a 100644 --- a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp +++ b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp @@ -32,8 +32,8 @@ #include "config.h" #include "SearchPopupMenuChromium.h" -#include "AtomicString.h" #include "NotImplemented.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/platform/efl/ClipboardEfl.cpp b/WebCore/platform/efl/ClipboardEfl.cpp index 60146b5..caff813 100644 --- a/WebCore/platform/efl/ClipboardEfl.cpp +++ b/WebCore/platform/efl/ClipboardEfl.cpp @@ -24,7 +24,7 @@ #include "Editor.h" #include "FileList.h" #include "NotImplemented.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame*) diff --git a/WebCore/platform/efl/CookieJarEfl.cpp b/WebCore/platform/efl/CookieJarEfl.cpp index 01dcddb..6c78dbd 100644 --- a/WebCore/platform/efl/CookieJarEfl.cpp +++ b/WebCore/platform/efl/CookieJarEfl.cpp @@ -30,9 +30,8 @@ #include "KURL.h" #include "PlatformString.h" -#include "StringHash.h" - #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/efl/LocalizedStringsEfl.cpp b/WebCore/platform/efl/LocalizedStringsEfl.cpp index a58dba2..6023205 100644 --- a/WebCore/platform/efl/LocalizedStringsEfl.cpp +++ b/WebCore/platform/efl/LocalizedStringsEfl.cpp @@ -350,6 +350,26 @@ String imageTitle(const String& filename, const IntSize& size) return String(); } +#if ENABLE(VIDEO) +String localizedMediaControlElementString(const String& name) +{ + notImplemented(); + return String(); +} + +String localizedMediaControlElementHelpText(const String& name) +{ + notImplemented(); + return String(); +} + +String localizedMediaTimeDescription(float time) +{ + notImplemented(); + return String(); +} +#endif + String mediaElementLoadingStateText() { return String::fromUTF8("Loading..."); diff --git a/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp b/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp index 70e317e..fd84b15 100644 --- a/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp +++ b/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp @@ -33,7 +33,6 @@ #include "PlatformKeyboardEvent.h" #include "NotImplemented.h" -#include "StringHash.h" #include "TextEncoding.h" #include "WindowsKeyboardCodes.h" @@ -41,6 +40,7 @@ #include <stdio.h> #include <wtf/HashMap.h> #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/graphics/ANGLEWebKitBridge.cpp b/WebCore/platform/graphics/ANGLEWebKitBridge.cpp new file mode 100644 index 0000000..9a14820 --- /dev/null +++ b/WebCore/platform/graphics/ANGLEWebKitBridge.cpp @@ -0,0 +1,79 @@ +/* + * 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 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 "ANGLEWebKitBridge.h" + +namespace WebCore { + + +ANGLEWebKitBridge::ANGLEWebKitBridge() : + builtCompilers(false) +{ + ShInitialize(); +} + +ANGLEWebKitBridge::~ANGLEWebKitBridge() +{ + if (builtCompilers) { + ShDestruct(m_fragmentCompiler); + ShDestruct(m_vertexCompiler); + } + + ShFinalize(); +} + +bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog) +{ + if (!builtCompilers) { + m_fragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecWebGL, &m_resources); + m_vertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecWebGL, &m_resources); + + builtCompilers = true; + } + + ShHandle compiler; + + if (shaderType == SHADER_TYPE_VERTEX) + compiler = m_vertexCompiler; + else + compiler = m_fragmentCompiler; + + const char* const shaderSourceStrings[] = { shaderSource }; + + bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, EShOptNone, EDebugOpIntermediate); + + translatedShaderSource = ShGetObjectCode(compiler); + shaderValidationLog = ShGetInfoLog(compiler); + + return validateSuccess; +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/js/JSCanvasNumberArrayCustom.cpp b/WebCore/platform/graphics/ANGLEWebKitBridge.h index be10ac0..d01de8f 100644 --- a/WebCore/bindings/js/JSCanvasNumberArrayCustom.cpp +++ b/WebCore/platform/graphics/ANGLEWebKitBridge.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple 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 @@ -23,24 +23,41 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef ANGLEWebKitBridge_h +#define ANGLEWebKitBridge_h -#if ENABLE(3D_CANVAS) +#include "ANGLE/ShaderLang.h" +#include "PlatformString.h" -#include "JSCanvasNumberArray.h" +#include <wtf/text/CString.h> -#include "CanvasNumberArray.h" +namespace WebCore { -using namespace JSC; +enum ANGLEShaderType { + SHADER_TYPE_VERTEX = EShLangVertex, + SHADER_TYPE_FRAGMENT = EShLangFragment +}; -namespace WebCore { +class ANGLEWebKitBridge { +public: + + ANGLEWebKitBridge(); + ~ANGLEWebKitBridge(); + + void setResources(TBuiltInResource resources) { m_resources = resources; } + + bool validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog); + +private: + + ShHandle m_fragmentCompiler; + ShHandle m_vertexCompiler; + + bool builtCompilers; -JSValue JSCanvasNumberArray::getByIndex(JSC::ExecState* exec, unsigned int index) -{ - JSC::JSValue result = jsNumber(exec, impl()->item(index)); - return result; -} + TBuiltInResource m_resources; +}; } // namespace WebCore -#endif // ENABLE(3D_CANVAS) +#endif diff --git a/WebCore/platform/graphics/FontCache.cpp b/WebCore/platform/graphics/FontCache.cpp index cb54cdd..ff865c2 100644 --- a/WebCore/platform/graphics/FontCache.cpp +++ b/WebCore/platform/graphics/FontCache.cpp @@ -34,10 +34,10 @@ #include "FontFallbackList.h" #include "FontPlatformData.h" #include "FontSelector.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/ListHashSet.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> using namespace WTF; diff --git a/WebCore/platform/graphics/FontDescription.h b/WebCore/platform/graphics/FontDescription.h index 86a4349..48fcaad 100644 --- a/WebCore/platform/graphics/FontDescription.h +++ b/WebCore/platform/graphics/FontDescription.h @@ -103,7 +103,11 @@ public: void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } void setWeight(FontWeight w) { m_weight = w; } void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = genericFamily; } +#if PLATFORM(CHROMIUM) && OS(DARWIN) + void setUsePrinterFont(bool) { } +#else void setUsePrinterFont(bool p) { m_usePrinterFont = p; } +#endif void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; } void setKeywordSize(unsigned s) { m_keywordSize = s; } void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; } diff --git a/WebCore/platform/graphics/FontFamily.h b/WebCore/platform/graphics/FontFamily.h index 126bd83..21a6b64 100644 --- a/WebCore/platform/graphics/FontFamily.h +++ b/WebCore/platform/graphics/FontFamily.h @@ -26,9 +26,9 @@ #ifndef FontFamily_h #define FontFamily_h -#include "AtomicString.h" #include <wtf/RefCounted.h> #include <wtf/ListRefPtr.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/platform/graphics/GeneratedImage.cpp b/WebCore/platform/graphics/GeneratedImage.cpp index cd0748e..5df2608 100644 --- a/WebCore/platform/graphics/GeneratedImage.cpp +++ b/WebCore/platform/graphics/GeneratedImage.cpp @@ -63,11 +63,8 @@ void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcR GraphicsContext* graphicsContext = imageBuffer->context(); graphicsContext->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator.get()); - // Grab the final image from the image buffer. - Image* bitmap = imageBuffer->image(); - - // Now just call drawTiled on that image. - bitmap->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect); + // Tile the image buffer into the context. + imageBuffer->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect); } } diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp index bee3ef6..bb4f858 100644 --- a/WebCore/platform/graphics/GraphicsContext.cpp +++ b/WebCore/platform/graphics/GraphicsContext.cpp @@ -30,6 +30,7 @@ #include "Font.h" #include "Generator.h" #include "GraphicsContextPrivate.h" +#include "ImageBuffer.h" using namespace std; @@ -442,6 +443,57 @@ void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, c restore(); } +void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op) +{ + drawImageBuffer(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op); +} + +void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, bool useLowQualityScale) +{ + drawImageBuffer(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, useLowQualityScale); +} + +void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op) +{ + drawImageBuffer(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op); +} + +void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale) +{ + drawImageBuffer(image, styleColorSpace, FloatRect(dest), srcRect, op, useLowQualityScale); +} + +void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale) +{ + if (paintingDisabled() || !image) + return; + + float tsw = src.width(); + float tsh = src.height(); + float tw = dest.width(); + float th = dest.height(); + + if (tsw == -1) + tsw = image->width(); + if (tsh == -1) + tsh = image->height(); + + if (tw == -1) + tw = image->width(); + if (th == -1) + th = image->height(); + + if (useLowQualityScale) { + save(); + setImageInterpolationQuality(InterpolationNone); + } + + image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale); + + if (useLowQualityScale) + restore(); +} + void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight) { @@ -460,6 +512,13 @@ void GraphicsContext::clipOutRoundedRect(const IntRect& rect, const IntSize& top clipOut(Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight)); } +void GraphicsContext::clipToImageBuffer(ImageBuffer* buffer, const FloatRect& rect) +{ + if (paintingDisabled()) + return; + buffer->clip(this, rect); +} + int GraphicsContext::textDrawingMode() { return m_common->state.textDrawingMode; @@ -541,4 +600,14 @@ void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2 } } +#if !PLATFORM(SKIA) +void GraphicsContext::setGraphicsContext3D(GraphicsContext3D*, const IntSize&) +{ +} + +void GraphicsContext::syncSoftwareCanvas() +{ +} +#endif + } diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index 9cae2f1..c48f91a 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -104,6 +104,12 @@ typedef unsigned char UInt8; #endif #endif +#if PLATFORM(CHROMIUM) +#define CanvasInterpolationQuality InterpolationMedium +#else +#define CanvasInterpolationQuality InterpolationDefault +#endif + #if PLATFORM(QT) && defined(Q_WS_WIN) #include <windows.h> #endif @@ -267,6 +273,13 @@ namespace WebCore { Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); + void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const IntPoint&, CompositeOperator = CompositeSourceOver); + void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); + void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver); + void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); + void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), + CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); + void setImageInterpolationQuality(InterpolationQuality); InterpolationQuality imageInterpolationQuality() const; @@ -277,8 +290,8 @@ namespace WebCore { void clipOutEllipseInRect(const IntRect&); void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); void clipPath(WindRule); - void clipToImageBuffer(const FloatRect&, const ImageBuffer*); void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); + void clipToImageBuffer(ImageBuffer*, const FloatRect&); int textDrawingMode(); void setTextDrawingMode(int); @@ -415,6 +428,7 @@ namespace WebCore { #if PLATFORM(QT) bool inTransparencyLayer() const; PlatformPath* currentPath(); + void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask); QPen pen(); static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op); #endif @@ -429,10 +443,8 @@ namespace WebCore { pattern getHaikuStrokeStyle(); #endif -#if PLATFORM(SKIA) void setGraphicsContext3D(GraphicsContext3D*, const IntSize&); void syncSoftwareCanvas(); -#endif private: void savePlatformState(); diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp index 79f6ecf..51c4cd5 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.cpp +++ b/WebCore/platform/graphics/GraphicsContext3D.cpp @@ -816,6 +816,21 @@ bool GraphicsContext3D::packPixels(const uint8_t* sourceData, return true; } +#if !PLATFORM(CHROMIUM) +bool GraphicsContext3D::supportsBGRA() +{ + // For OpenGL ES2.0, this requires checking for + // GL_EXT_texture_format_BGRA8888 and GL_EXT_read_format_bgra. + // For desktop GL, BGRA has been supported since OpenGL 1.2. + + // However, note that the GL ES2 extension requires the internalFormat to + // glTexImage2D() be GL_BGRA, while desktop GL will not accept GL_BGRA + // (must be GL_RGBA), so this must be checked on each platform. + // Returning false for now to be safe. + return false; +} +#endif + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h index d702096..25d1d06 100644 --- a/WebCore/platform/graphics/GraphicsContext3D.h +++ b/WebCore/platform/graphics/GraphicsContext3D.h @@ -26,9 +26,13 @@ #ifndef GraphicsContext3D_h #define GraphicsContext3D_h +#if PLATFORM(MAC) +#include "ANGLEWebKitBridge.h" +#endif #include "GraphicsLayer.h" #include "PlatformString.h" +#include <wtf/HashMap.h> #include <wtf/ListHashSet.h> #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> @@ -403,7 +407,9 @@ public: // WebGL-specific enums UNPACK_FLIP_Y_WEBGL = 0x9240, - UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241 + UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241, + + BGRA_EXT = 0x80E1 }; // Context creation attributes. @@ -716,11 +722,13 @@ public: void paintRenderingResultsToCanvas(CanvasRenderingContext* context); - // Helpers for notification about paint events - void beginPaint(CanvasRenderingContext* context); - void endPaint(); #if PLATFORM(QT) void paint(QPainter* painter, const QRect& rect) const; + bool paintsIntoCanvasBuffer() const { return true; } +#elif PLATFORM(CHROMIUM) + bool paintsIntoCanvasBuffer() const; +#else + bool paintsIntoCanvasBuffer() const { return false; } #endif // Support for buffer creation and deletion @@ -748,6 +756,8 @@ public: // getError in the order they were added. void synthesizeGLError(unsigned long error); + bool supportsBGRA(); + private: GraphicsContext3D(Attributes attrs, HostWindow* hostWindow); @@ -807,7 +817,16 @@ public: int m_currentWidth, m_currentHeight; + typedef struct { + String source; + String log; + bool isValid; + } ShaderSourceEntry; + HashMap<Platform3DObject, ShaderSourceEntry> m_shaderSourceMap; + #if PLATFORM(MAC) + ANGLEWebKitBridge m_compiler; + Attributes m_attrs; Vector<Vector<float> > m_vertexArray; diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h index 7c00b71..3c5e7fd 100644 --- a/WebCore/platform/graphics/Image.h +++ b/WebCore/platform/graphics/Image.h @@ -154,6 +154,9 @@ public: static PassRefPtr<Image> loadPlatformThemeIcon(const char* name, int size); #endif + virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect); + protected: Image(ImageObserver* = 0); @@ -171,9 +174,6 @@ protected: virtual bool mayFillWithSolidColor() { return false; } virtual Color solidColor() const { return Color(); } - virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, - const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect); - private: RefPtr<SharedBuffer> m_data; // The encoded raw data for the image. ImageObserver* m_imageObserver; diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h index a54c721..3c0508e 100644 --- a/WebCore/platform/graphics/ImageBuffer.h +++ b/WebCore/platform/graphics/ImageBuffer.h @@ -29,6 +29,7 @@ #define ImageBuffer_h #include "AffineTransform.h" +#include "FloatRect.h" #include "Image.h" #include "IntSize.h" #include "ImageBufferData.h" @@ -71,16 +72,13 @@ namespace WebCore { ~ImageBuffer(); const IntSize& size() const { return m_size; } + int width() const { return m_size.width(); } + int height() const { return m_size.height(); } + GraphicsContext* context() const; - Image* image() const; -#if PLATFORM(QT) - Image* imageForRendering() const; -#else - Image* imageForRendering() const { return image(); } -#endif - - void clearImage() { m_image.clear(); } + bool drawsUsingCopy() const; // If the image buffer has to render using a copied image, it will return true. + PassRefPtr<Image> copyImage() const; // Return a new image that is a copy of the buffer. PassRefPtr<ImageData> getUnmultipliedImageData(const IntRect&) const; PassRefPtr<ImageData> getPremultipliedImageData(const IntRect&) const; @@ -96,12 +94,23 @@ namespace WebCore { #else AffineTransform baseTransform() const { return AffineTransform(1, 0, 0, -1, 0, m_size.height()); } #endif + + private: + void clip(GraphicsContext*, const FloatRect&) const; + + // The draw method draws the contents of the buffer without copying it. + void draw(GraphicsContext*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), + CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); + void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect); + friend class GraphicsContext; + friend class GeneratedImage; + private: ImageBufferData m_data; IntSize m_size; OwnPtr<GraphicsContext> m_context; - mutable RefPtr<Image> m_image; #if !PLATFORM(CG) Vector<int> m_linearRgbLUT; diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp index b8b742d..e72987a 100644 --- a/WebCore/platform/graphics/MediaPlayer.cpp +++ b/WebCore/platform/graphics/MediaPlayer.cpp @@ -173,7 +173,7 @@ static Vector<MediaPlayerFactory*>& installedMediaEngines() #if PLATFORM(WIN) MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine(addMediaEngine); -#elif !PLATFORM(GTK) +#elif !PLATFORM(GTK) && !PLATFORM(EFL) // FIXME: currently all the MediaEngines are named // MediaPlayerPrivate. This code will need an update when bug // 36663 is adressed. @@ -257,8 +257,8 @@ void MediaPlayer::load(const String& url, const ContentType& contentType) // if we don't know the MIME type, see if the extension can help if (type.isEmpty() || type == "application/octet-stream" || type == "text/plain") { - int pos = url.reverseFind('.'); - if (pos >= 0) { + size_t pos = url.reverseFind('.'); + if (pos != notFound) { String extension = url.substring(pos + 1); String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension); if (!mediaType.isEmpty()) diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h index 4da697a..643f17f 100644 --- a/WebCore/platform/graphics/MediaPlayer.h +++ b/WebCore/platform/graphics/MediaPlayer.h @@ -34,12 +34,12 @@ #include "Document.h" #include "IntRect.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashSet.h> #include <wtf/OwnPtr.h> #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/StringHash.h> #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayer.h" diff --git a/WebCore/platform/graphics/Path.cpp b/WebCore/platform/graphics/Path.cpp index af94be7..333afcb 100644 --- a/WebCore/platform/graphics/Path.cpp +++ b/WebCore/platform/graphics/Path.cpp @@ -266,8 +266,6 @@ Path Path::createCircle(const FloatPoint& center, float r) Path Path::createLine(const FloatPoint& start, const FloatPoint& end) { Path path; - if (start.x() == end.x() && start.y() == end.y()) - return path; path.moveTo(start); path.addLineTo(end); diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h index 43ba889..61ea328 100644 --- a/WebCore/platform/graphics/Path.h +++ b/WebCore/platform/graphics/Path.h @@ -156,6 +156,10 @@ namespace WebCore { private: PlatformPathPtr m_path; + +#if PLATFORM(QT) + int m_lastMoveToIndex; +#endif }; } diff --git a/WebCore/platform/graphics/Pattern.cpp b/WebCore/platform/graphics/Pattern.cpp index bb07307..82d0a24 100644 --- a/WebCore/platform/graphics/Pattern.cpp +++ b/WebCore/platform/graphics/Pattern.cpp @@ -31,7 +31,7 @@ namespace WebCore { -Pattern::Pattern(Image* image, bool repeatX, bool repeatY) +Pattern::Pattern(PassRefPtr<Image> image, bool repeatX, bool repeatY) : m_tileImage(image) , m_repeatX(repeatX) , m_repeatY(repeatY) @@ -39,7 +39,7 @@ Pattern::Pattern(Image* image, bool repeatX, bool repeatY) , m_pattern(0) #endif { - ASSERT(image); + ASSERT(m_tileImage); } Pattern::~Pattern() diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h index 48e8d8b..e215f3d 100644 --- a/WebCore/platform/graphics/Pattern.h +++ b/WebCore/platform/graphics/Pattern.h @@ -29,6 +29,7 @@ #define Pattern_h #include "AffineTransform.h" +#include "Image.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -64,11 +65,10 @@ typedef void* PlatformPatternPtr; namespace WebCore { class AffineTransform; -class Image; class Pattern : public RefCounted<Pattern> { public: - static PassRefPtr<Pattern> create(Image* tileImage, bool repeatX, bool repeatY) + static PassRefPtr<Pattern> create(PassRefPtr<Image> tileImage, bool repeatX, bool repeatY) { return adoptRef(new Pattern(tileImage, repeatX, repeatY)); } @@ -91,7 +91,7 @@ public: bool repeatY() const { return m_repeatY; } private: - Pattern(Image*, bool repeatX, bool repeatY); + Pattern(PassRefPtr<Image>, bool repeatX, bool repeatY); RefPtr<Image> m_tileImage; bool m_repeatX; diff --git a/WebCore/platform/graphics/WOFFFileFormat.cpp b/WebCore/platform/graphics/WOFFFileFormat.cpp index 908e288..25b3b00 100644 --- a/WebCore/platform/graphics/WOFFFileFormat.cpp +++ b/WebCore/platform/graphics/WOFFFileFormat.cpp @@ -31,6 +31,9 @@ #include "SharedBuffer.h" #if !PLATFORM(WIN) +#if OS(UNIX) +#include <netinet/in.h> +#endif #include <zlib.h> #if PLATFORM(BREWMP) #include <AEEStdLib.h> diff --git a/WebCore/platform/graphics/android/FontPlatformData.h b/WebCore/platform/graphics/android/FontPlatformData.h index 19f83f8..7d2176d 100644 --- a/WebCore/platform/graphics/android/FontPlatformData.h +++ b/WebCore/platform/graphics/android/FontPlatformData.h @@ -34,7 +34,7 @@ #include "PlatformString.h" #endif -#include "StringImpl.h" +#include <wtf/text/StringImpl.h> class SkPaint; class SkTypeface; diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index ba10706d..180c97e 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -801,10 +801,6 @@ void GraphicsContext::clipOut(const Path& p) GC2Canvas(this)->clipPath(*p.platformPath(), SkRegion::kDifference_Op); } -void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) { - SkDebugf("xxxxxxxxxxxxxxxxxx clipToImageBuffer not implemented\n"); -} - ////////////////////////////////////////////////////////////////////////////////////////////////// #if SVG_SUPPORT diff --git a/WebCore/platform/graphics/android/ImageBufferAndroid.cpp b/WebCore/platform/graphics/android/ImageBufferAndroid.cpp index 082af3e..3b89777 100644 --- a/WebCore/platform/graphics/android/ImageBufferAndroid.cpp +++ b/WebCore/platform/graphics/android/ImageBufferAndroid.cpp @@ -66,27 +66,42 @@ GraphicsContext* ImageBuffer::context() const return m_context.get(); } -/* This guy needs to make a deep copy of the bitmap, so that the returned - image doesn't reflect any subsequent changes to the canvas' backend. - e.g. this is called when <canvas> wants to make a Pattern, which needs - to snapshot the current pixels when it is created. - */ -Image* ImageBuffer::image() const +bool ImageBuffer::drawsUsingCopy() const { - if (!m_image) { - ASSERT(context()); - SkCanvas* canvas = context()->platformContext()->mCanvas; - SkDevice* device = canvas->getDevice(); - const SkBitmap& orig = device->accessBitmap(false); - - SkBitmap copy; - orig.copyTo(©, orig.config()); - - SkBitmapRef* ref = new SkBitmapRef(copy); - m_image = BitmapImage::create(ref, 0); - ref->unref(); - } - return m_image.get(); + return true; +} + +PassRefPtr<Image> ImageBuffer::copyImage() const +{ + ASSERT(context()); + SkCanvas* canvas = context()->platformContext()->mCanvas; + SkDevice* device = canvas->getDevice(); + const SkBitmap& orig = device->accessBitmap(false); + + SkBitmap copy; + orig.copyTo(©, orig.config()); + + SkBitmapRef* ref = new SkBitmapRef(copy); + RefPtr<Image> image = BitmapImage::create(ref, 0); + ref->unref(); + return image; +} + +void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const +{ + SkDebugf("xxxxxxxxxxxxxxxxxx clip not implemented\n"); +} + +void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, bool useLowQualityScale) +{ + RefPtr<Image> imageCopy = copyImage(); + context->drawImage(imageCopy.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); +} + +void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) +{ + RefPtr<Image> imageCopy = copyImage(); + imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect); } PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const @@ -95,7 +110,7 @@ PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) if (!gc) { return 0; } - + const SkBitmap& src = android_gc2canvas(gc)->getDevice()->accessBitmap(false); SkAutoLockPixels alp(src); if (!src.getPixels()) { @@ -105,10 +120,10 @@ PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) // ! Can't use PassRefPtr<>, otherwise the second access will cause crash. RefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); unsigned char* data = result->data()->data()->data(); - + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > m_size.width() || (rect.y() + rect.height()) > m_size.height()) memset(data, 0, result->data()->length()); - + int originx = rect.x(); int destx = 0; if (originx < 0) { @@ -119,7 +134,7 @@ PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) if (endx > m_size.width()) endx = m_size.width(); int numColumns = endx - originx; - + int originy = rect.y(); int desty = 0; if (originy < 0) { @@ -130,10 +145,10 @@ PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) if (endy > m_size.height()) endy = m_size.height(); int numRows = endy - originy; - + unsigned srcPixelsPerRow = src.rowBytesAsPixels(); unsigned destBytesPerRow = 4 * rect.width(); - + const SkPMColor* srcRows = src.getAddr32(originx, originy); unsigned char* destRows = data + desty * destBytesPerRow + destx * 4; for (int y = 0; y < numRows; ++y) { @@ -158,7 +173,7 @@ void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sou if (!gc) { return; } - + const SkBitmap& dst = android_gc2canvas(gc)->getDevice()->accessBitmap(true); SkAutoLockPixels alp(dst); if (!dst.getPixels()) { @@ -167,33 +182,33 @@ void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sou ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); - + int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); ASSERT(destx < m_size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); - + int endx = destPoint.x() + sourceRect.right(); ASSERT(endx <= m_size.width()); - + int numColumns = endx - destx; - + int originy = sourceRect.y(); int desty = destPoint.y() + sourceRect.y(); ASSERT(desty >= 0); ASSERT(desty < m_size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); - + int endy = destPoint.y() + sourceRect.bottom(); ASSERT(endy <= m_size.height()); int numRows = endy - desty; - + unsigned srcBytesPerRow = 4 * source->width(); unsigned dstPixelsPerRow = dst.rowBytesAsPixels(); - + unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; SkPMColor* dstRows = dst.getAddr32(destx, desty); for (int y = 0; y < numRows; ++y) { @@ -209,9 +224,9 @@ void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sou } } - + String ImageBuffer::toDataURL(const String&, const double*) const -{ +{ // Encode the image into a vector. SkDynamicMemoryWStream pngStream; const SkBitmap& dst = android_gc2canvas(context())->getDevice()->accessBitmap(true); diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 712d699..245d224 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -22,8 +22,9 @@ #include "RefPtr.h" #include "SkColor.h" #include "SkLayer.h" -#include "StringHash.h" + #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> #ifndef BZERO_DEFINED #define BZERO_DEFINED diff --git a/WebCore/platform/graphics/cairo/GRefPtrCairo.cpp b/WebCore/platform/graphics/cairo/GRefPtrCairo.cpp new file mode 100644 index 0000000..d244954 --- /dev/null +++ b/WebCore/platform/graphics/cairo/GRefPtrCairo.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "GRefPtrCairo.h" + +#include <cairo.h> + +namespace WTF { + +template <> cairo_t* refGPtr(cairo_t* ptr) +{ + if (ptr) + cairo_reference(ptr); + return ptr; +} + +template <> void derefGPtr(cairo_t* ptr) +{ + if (ptr) + cairo_destroy(ptr); +} + +template <> cairo_surface_t* refGPtr(cairo_surface_t* ptr) +{ + if (ptr) + cairo_surface_reference(ptr); + return ptr; +} + +template <> void derefGPtr(cairo_surface_t* ptr) +{ + if (ptr) + cairo_surface_destroy(ptr); +} + +} diff --git a/WebCore/platform/graphics/cairo/GRefPtrCairo.h b/WebCore/platform/graphics/cairo/GRefPtrCairo.h new file mode 100644 index 0000000..aef51fe --- /dev/null +++ b/WebCore/platform/graphics/cairo/GRefPtrCairo.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef GRefPtrCairo_h +#define GRefPtrCairo_h + +#include "GRefPtr.h" + +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; + +namespace WTF { + +template <> cairo_t* refGPtr(cairo_t* ptr); +template <> void derefGPtr(cairo_t* ptr); + +template <> cairo_surface_t* refGPtr(cairo_surface_t* ptr); +template <> void derefGPtr(cairo_surface_t* ptr); + +} + +#endif diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index f3fc943..9b3096e 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -908,14 +908,6 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness cairo_set_fill_rule(cr, savedFillRule); } -void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer* imageBuffer) -{ - if (paintingDisabled()) - return; - - notImplemented(); -} - void GraphicsContext::setPlatformShadow(FloatSize const& size, float, Color const&, ColorSpace) { // Cairo doesn't support shadows natively, they are drawn manually in the draw* @@ -936,7 +928,7 @@ void GraphicsContext::createPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const // draw the shadow without blurring, if kernelSize is zero if (!kernelSize) { setColor(cr, shadowColor); - cairo_mask_surface(cr, buffer->image()->nativeImageForCurrentFrame(), shadowRect.x(), shadowRect.y()); + cairo_mask_surface(cr, buffer->m_data.m_surface, shadowRect.x(), shadowRect.y()); return; } @@ -956,7 +948,7 @@ void GraphicsContext::createPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const // Mask the filter with the shadow color and draw it to the context. // Masking makes it possible to just blur the alpha channel. setColor(cr, shadowColor); - cairo_mask_surface(cr, blur->resultImage()->image()->nativeImageForCurrentFrame(), shadowRect.x(), shadowRect.y()); + cairo_mask_surface(cr, blur->resultImage()->m_data.m_surface, shadowRect.x(), shadowRect.y()); #endif } diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index 1a43e54..db66276 100644 --- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -35,6 +35,7 @@ #include "GraphicsContext.h" #include "ImageData.h" #include "MIMETypeRegistry.h" +#include "NotImplemented.h" #include "Pattern.h" #include "PlatformString.h" @@ -97,26 +98,34 @@ GraphicsContext* ImageBuffer::context() const return m_context.get(); } -Image* ImageBuffer::image() const +bool ImageBuffer::drawsUsingCopy() const { - if (!m_image) { - // It's assumed that if image() is called, the actual rendering to the - // GraphicsContext must be done. - ASSERT(context()); - - // This creates a COPY of the image and will cache that copy. This means - // that if subsequent operations take place on the context, neither the - // currently-returned image, nor the results of future image() calls, - // will contain that operation. - // - // This seems silly, but is the way the CG port works: image() is - // intended to be used only when rendering is "complete." - cairo_surface_t* newsurface = copySurface(m_data.m_surface); - - // BitmapImage will release the passed in surface on destruction - m_image = BitmapImage::create(newsurface); - } - return m_image.get(); + return true; +} + +PassRefPtr<Image> ImageBuffer::copyImage() const +{ + // BitmapImage will release the passed in surface on destruction + return BitmapImage::create(copySurface(m_data.m_surface)); +} + +void ImageBuffer::clip(GraphicsContext*, const FloatRect&) const +{ + notImplemented(); +} + +void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, + CompositeOperator op , bool useLowQualityScale) +{ + RefPtr<Image> imageCopy = copyImage(); + context->drawImage(imageCopy.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); +} + +void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) +{ + RefPtr<Image> imageCopy = copyImage(); + imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect); } void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp index 64fbedf..1582671 100644 --- a/WebCore/platform/graphics/cairo/ImageCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp @@ -33,6 +33,7 @@ #include "AffineTransform.h" #include "Color.h" #include "FloatRect.h" +#include "GRefPtrCairo.h" #include "GraphicsContext.h" #include "ImageBuffer.h" #include "ImageObserver.h" @@ -184,17 +185,14 @@ void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, con cairo_t* cr = context->platformContext(); context->save(); - IntRect imageSize = enclosingIntRect(tileRect); - OwnPtr<ImageBuffer> imageSurface = ImageBuffer::create(imageSize.size()); - - if (!imageSurface) - return; - + GRefPtr<cairo_surface_t> clippedImageSurface = 0; if (tileRect.size() != size()) { - cairo_t* clippedImageContext = imageSurface->context()->platformContext(); - cairo_set_source_surface(clippedImageContext, image, -tileRect.x(), -tileRect.y()); - cairo_paint(clippedImageContext); - image = imageSurface->image()->nativeImageForCurrentFrame(); + IntRect imageSize = enclosingIntRect(tileRect); + clippedImageSurface = adoptGRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, imageSize.width(), imageSize.height())); + GRefPtr<cairo_t> clippedImageContext(cairo_create(clippedImageSurface.get())); + cairo_set_source_surface(clippedImageContext.get(), image, -tileRect.x(), -tileRect.y()); + cairo_paint(clippedImageContext.get()); + image = clippedImageSurface.get(); } cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image); diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 2de4d14..e5079dc 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -753,18 +753,6 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness CGContextEOClip(context); } -void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer* imageBuffer) -{ - if (paintingDisabled()) - return; - - CGContextTranslateCTM(platformContext(), rect.x(), rect.y() + rect.height()); - CGContextScaleCTM(platformContext(), 1, -1); - CGContextClipToMask(platformContext(), FloatRect(FloatPoint(), rect.size()), imageBuffer->image()->getCGImageRef()); - CGContextScaleCTM(platformContext(), 1, -1); - CGContextTranslateCTM(platformContext(), -rect.x(), -rect.y() - rect.height()); -} - void GraphicsContext::beginTransparencyLayer(float opacity) { if (paintingDisabled()) @@ -950,9 +938,17 @@ void GraphicsContext::clip(const Path& path) if (paintingDisabled()) return; CGContextRef context = platformContext(); - CGContextBeginPath(context); - CGContextAddPath(context, path.platformPath()); - CGContextClip(context); + + // CGContextClip does nothing if the path is empty, so in this case, we + // instead clip against a zero rect to reduce the clipping region to + // nothing - which is the intended behavior of clip() if the path is empty. + if (path.isEmpty()) + CGContextClipToRect(context, CGRectZero); + else { + CGContextBeginPath(context); + CGContextAddPath(context, path.platformPath()); + CGContextClip(context); + } m_data->clip(path); } diff --git a/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/WebCore/platform/graphics/cg/ImageBufferCG.cpp index feb8cec..ecbcf60 100644 --- a/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -46,6 +46,11 @@ using namespace std; namespace WebCore { +static void releaseImageData(void*, const void* data, size_t) +{ + fastFree(const_cast<void*>(data)); +} + ImageBufferData::ImageBufferData(const IntSize&) : m_data(0) { @@ -56,42 +61,46 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b , m_size(size) { success = false; // Make early return mean failure. - unsigned bytesPerRow; if (size.width() < 0 || size.height() < 0) return; - bytesPerRow = size.width(); + + unsigned bytesPerRow = size.width(); if (imageColorSpace != GrayScale) { // Protect against overflow if (bytesPerRow > 0x3FFFFFFF) return; bytesPerRow *= 4; } + m_data.m_bytesPerRow = bytesPerRow; + size_t dataSize = size.height() * bytesPerRow; if (!tryFastCalloc(size.height(), bytesPerRow).getValue(m_data.m_data)) return; ASSERT((reinterpret_cast<size_t>(m_data.m_data) & 2) == 0); - RetainPtr<CGColorSpaceRef> colorSpace; switch(imageColorSpace) { case DeviceRGB: - colorSpace.adoptCF(CGColorSpaceCreateDeviceRGB()); + m_data.m_colorSpace.adoptCF(CGColorSpaceCreateDeviceRGB()); break; case GrayScale: - colorSpace.adoptCF(CGColorSpaceCreateDeviceGray()); + m_data.m_colorSpace.adoptCF(CGColorSpaceCreateDeviceGray()); break; #if ((PLATFORM(MAC) || PLATFORM(CHROMIUM)) && !defined(BUILDING_ON_TIGER)) case LinearRGB: - colorSpace.adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear)); + m_data.m_colorSpace.adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear)); break; + #endif default: - colorSpace.adoptCF(CGColorSpaceCreateDeviceRGB()); + m_data.m_colorSpace.adoptCF(CGColorSpaceCreateDeviceRGB()); break; } + m_data.m_grayScale = imageColorSpace == GrayScale; + m_data.m_bitmapInfo = m_data.m_grayScale ? kCGImageAlphaNone : kCGImageAlphaPremultipliedLast; RetainPtr<CGContextRef> cgContext(AdoptCF, CGBitmapContextCreate(m_data.m_data, size.width(), size.height(), 8, bytesPerRow, - colorSpace.get(), (imageColorSpace == GrayScale) ? kCGImageAlphaNone : kCGImageAlphaPremultipliedLast)); + m_data.m_colorSpace.get(), m_data.m_bitmapInfo)); if (!cgContext) return; @@ -99,11 +108,13 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b m_context->scale(FloatSize(1, -1)); m_context->translate(0, -size.height()); success = true; + + // Create a live image that wraps the data. + m_data.m_dataProvider.adoptCF(CGDataProviderCreateWithData(0, m_data.m_data, dataSize, releaseImageData)); } ImageBuffer::~ImageBuffer() { - fastFree(m_data.m_data); } GraphicsContext* ImageBuffer::context() const @@ -111,17 +122,59 @@ GraphicsContext* ImageBuffer::context() const return m_context.get(); } -Image* ImageBuffer::image() const +bool ImageBuffer::drawsUsingCopy() const +{ + return false; +} + +PassRefPtr<Image> ImageBuffer::copyImage() const +{ + // BitmapImage will release the passed in CGImage on destruction + return BitmapImage::create(CGBitmapContextCreateImage(context()->platformContext())); +} + +static CGImageRef cgImage(const IntSize& size, const ImageBufferData& data) { - if (!m_image) { - // It's assumed that if image() is called, the actual rendering to the - // GraphicsContext must be done. - ASSERT(context()); - CGImageRef cgImage = CGBitmapContextCreateImage(context()->platformContext()); - // BitmapImage will release the passed in CGImage on destruction - m_image = BitmapImage::create(cgImage); + return CGImageCreate(size.width(), size.height(), 8, data.m_grayScale ? 8 : 32, data.m_bytesPerRow, + data.m_colorSpace.get(), data.m_bitmapInfo, data.m_dataProvider.get(), 0, true, kCGRenderingIntentDefault); +} + +void ImageBuffer::draw(GraphicsContext* destContext, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, + CompositeOperator op, bool useLowQualityScale) +{ + if (destContext == context()) { + // We're drawing into our own buffer. In order for this to work, we need to copy the source buffer first. + RefPtr<Image> copy = copyImage(); + destContext->drawImage(copy.get(), DeviceColorSpace, destRect, srcRect, op, useLowQualityScale); + } else { + RefPtr<Image> imageForRendering = BitmapImage::create(cgImage(m_size, m_data)); + destContext->drawImage(imageForRendering.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); + } +} + +void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) +{ + if (destContext == context()) { + // We're drawing into our own buffer. In order for this to work, we need to copy the source buffer first. + RefPtr<Image> copy = copyImage(); + copy->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect); + } else { + RefPtr<Image> imageForRendering = BitmapImage::create(cgImage(m_size, m_data)); + imageForRendering->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect); } - return m_image.get(); +} + +void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const +{ + RetainPtr<CGImageRef> image(AdoptCF, cgImage(m_size, m_data)); + + CGContextRef platformContext = context->platformContext(); + CGContextTranslateCTM(platformContext, rect.x(), rect.y() + rect.height()); + CGContextScaleCTM(platformContext, 1, -1); + CGContextClipToMask(platformContext, FloatRect(FloatPoint(), rect.size()), image.get()); + CGContextScaleCTM(platformContext, 1, -1); + CGContextTranslateCTM(platformContext, -rect.x(), -rect.y() - rect.height()); } template <Multiply multiplied> diff --git a/WebCore/platform/graphics/cg/ImageBufferData.h b/WebCore/platform/graphics/cg/ImageBufferData.h index 5e6fc4c..2f9d854 100644 --- a/WebCore/platform/graphics/cg/ImageBufferData.h +++ b/WebCore/platform/graphics/cg/ImageBufferData.h @@ -26,6 +26,14 @@ #ifndef ImageBufferData_h #define ImageBufferData_h +#include "Image.h" +#include <wtf/RefPtr.h> +#include <wtf/RetainPtr.h> + +typedef struct CGColorSpace *CGColorSpaceRef; +typedef struct CGDataProvider *CGDataProviderRef; +typedef uint32_t CGBitmapInfo; + namespace WebCore { class IntSize; @@ -35,6 +43,12 @@ public: ImageBufferData(const IntSize&); void* m_data; + + RetainPtr<CGDataProviderRef> m_dataProvider; + CGBitmapInfo m_bitmapInfo; + bool m_grayScale; + unsigned m_bytesPerRow; + RetainPtr<CGColorSpaceRef> m_colorSpace; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/cg/ImageSourceCGWin.cpp b/WebCore/platform/graphics/cg/ImageSourceCGWin.cpp index c7d9a0b..ef69e5e 100644 --- a/WebCore/platform/graphics/cg/ImageSourceCGWin.cpp +++ b/WebCore/platform/graphics/cg/ImageSourceCGWin.cpp @@ -27,8 +27,8 @@ #include "ImageSourceCG.h" #include "StdLibExtras.h" -#include "StringHash.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp index 8ba37c6..7c3e450 100644 --- a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp @@ -38,8 +38,8 @@ #include "HashMap.h" #include "HashSet.h" #include "SimpleFontData.h" -#include "StringHash.h" #include <unicode/uniset.h> +#include <wtf/text/StringHash.h> #include <windows.h> #include <objidl.h> diff --git a/WebCore/platform/graphics/chromium/FontCacheLinux.cpp b/WebCore/platform/graphics/chromium/FontCacheLinux.cpp index 53f4a52..2fda22d 100644 --- a/WebCore/platform/graphics/chromium/FontCacheLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontCacheLinux.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "FontCache.h" -#include "AtomicString.h" #include "ChromiumBridge.h" #include "Font.h" #include "FontDescription.h" @@ -46,6 +45,7 @@ #include <unicode/utf16.h> #include <wtf/Assertions.h> +#include <wtf/text/AtomicString.h> #include <wtf/text/CString.h> namespace WebCore { diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp index 1953dd8..ec79b82 100644 --- a/WebCore/platform/graphics/chromium/FontLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontLinux.cpp @@ -166,6 +166,9 @@ public: , m_offsetX(m_startingX) , m_run(getTextRun(run)) , m_iterateBackwards(m_run.rtl()) + , m_wordSpacingAdjustment(0) + , m_padding(0) + , m_padError(0) { // Do not use |run| inside this constructor. Use |m_run| instead. @@ -207,6 +210,56 @@ public: delete[] m_item.string; } + // setWordSpacingAdjustment sets a delta (in pixels) which is applied at + // each word break in the TextRun. + void setWordSpacingAdjustment(int wordSpacingAdjustment) + { + m_wordSpacingAdjustment = wordSpacingAdjustment; + } + + // setLetterSpacingAdjustment sets an additional number of pixels that is + // added to the advance after each output cluster. This matches the behaviour + // of WidthIterator::advance. + // + // (NOTE: currently does nothing because I don't know how to get the + // cluster information from Harfbuzz.) + void setLetterSpacingAdjustment(int letterSpacingAdjustment) + { + m_letterSpacing = letterSpacingAdjustment; + } + + bool isWordBreak(unsigned i, bool isRTL) + { + if (!isRTL) + return i && isCodepointSpace(m_item.string[i]) && !isCodepointSpace(m_item.string[i - 1]); + return i != m_item.stringLength - 1 && isCodepointSpace(m_item.string[i]) && !isCodepointSpace(m_item.string[i + 1]); + } + + // setPadding sets a number of pixels to be distributed across the TextRun. + // WebKit uses this to justify text. + void setPadding(int padding) + { + m_padding = padding; + if (!m_padding) + return; + + // If we have padding to distribute, then we try to give an equal + // amount to each space. The last space gets the smaller amount, if + // any. + unsigned numWordBreaks = 0; + bool isRTL = m_iterateBackwards; + + for (unsigned i = 0; i < m_item.stringLength; i++) { + if (isWordBreak(i, isRTL)) + numWordBreaks++; + } + + if (numWordBreaks) + m_padPerWordBreak = m_padding / numWordBreaks; + else + m_padPerWordBreak = 0; + } + void reset() { if (m_iterateBackwards) @@ -453,8 +506,15 @@ private: void setGlyphXPositions(bool isRTL) { double position = 0; + // logClustersIndex indexes logClusters for the first (or last when + // RTL) codepoint of the current glyph. Each time we advance a glyph, + // we skip over all the codepoints that contributed to the current + // glyph. + unsigned logClustersIndex = isRTL ? m_item.num_glyphs - 1 : 0; + for (int iter = 0; iter < m_item.num_glyphs; ++iter) { - // Glyphs are stored in logical order, but for layout purposes we always go left to right. + // Glyphs are stored in logical order, but for layout purposes we + // always go left to right. int i = isRTL ? m_item.num_glyphs - iter - 1 : iter; m_glyphs16[i] = m_item.glyphs[i]; @@ -462,12 +522,48 @@ private: m_xPositions[i] = m_offsetX + position + offsetX; double advance = truncateFixedPointToInteger(m_item.advances[i]); + unsigned glyphIndex = m_item.item.pos + logClustersIndex; + if (isWordBreak(glyphIndex, isRTL)) { + advance += m_wordSpacingAdjustment; + + if (m_padding > 0) { + unsigned toPad = roundf(m_padPerWordBreak + m_padError); + m_padError += m_padPerWordBreak - toPad; + + if (m_padding < toPad) + toPad = m_padding; + m_padding -= toPad; + advance += toPad; + } + } + + // We would like to add m_letterSpacing after each cluster, but I + // don't know where the cluster information is. This is typically + // fine for Roman languages, but breaks more complex languages + // terribly. + // advance += m_letterSpacing; + + if (isRTL) { + while (logClustersIndex > 0 && logClusters()[logClustersIndex] == i) + logClustersIndex--; + } else { + while (logClustersIndex < m_item.num_glyphs && logClusters()[logClustersIndex] == i) + logClustersIndex++; + } + position += advance; } + m_pixelWidth = position; m_offsetX += m_pixelWidth; } + static bool isCodepointSpace(HB_UChar16 c) + { + // This matches the logic in RenderBlock::findNextLineBreak + return c == ' ' || c == '\t'; + } + void mirrorCharacters(UChar* destination, const UChar* source, int length) const { int position = 0; @@ -498,6 +594,14 @@ private: OwnArrayPtr<UChar> m_normalizedBuffer; // A buffer for normalized run. const TextRun& m_run; bool m_iterateBackwards; + int m_wordSpacingAdjustment; // delta adjustment (pixels) for each word break. + float m_padding; // pixels to be distributed over the line at word breaks. + float m_padPerWordBreak; // pixels to be added to each word break. + float m_padError; // |m_padPerWordBreak| might have a fractional component. + // Since we only add a whole number of padding pixels at + // each word break we accumulate error. This is the + // number of pixels that we are behind so far. + unsigned m_letterSpacing; // pixels to be added after each glyph. }; static void setupForTextPainting(SkPaint* paint, SkColor color) @@ -534,6 +638,9 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, TextRunWalker walker(run, point.x(), this); bool haveMultipleLayers = isCanvasMultiLayered(canvas); + walker.setWordSpacingAdjustment(wordSpacing()); + walker.setLetterSpacingAdjustment(letterSpacing()); + walker.setPadding(run.padding()); while (walker.nextScriptRun()) { if (fill) { @@ -553,6 +660,8 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const { TextRunWalker walker(run, 0, this); + walker.setWordSpacingAdjustment(wordSpacing()); + walker.setLetterSpacingAdjustment(letterSpacing()); return walker.widthOfFullRun(); } @@ -588,6 +697,8 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float 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); + walker.setWordSpacingAdjustment(wordSpacing()); + walker.setLetterSpacingAdjustment(letterSpacing()); // If this is RTL text, the first glyph from the left is actually the last // code point. So we need to know how many code points there are total in @@ -664,6 +775,8 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, { int fromX = -1, toX = -1, fromAdvance = -1, toAdvance = -1; TextRunWalker walker(run, 0, this); + walker.setWordSpacingAdjustment(wordSpacing()); + walker.setLetterSpacingAdjustment(letterSpacing()); // Base will point to the x offset for the current script run. Note that, in // the LTR case, width will be 0. diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h index 1d6cc8e..beac0bf 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h +++ b/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h @@ -34,10 +34,10 @@ #include "config.h" -#include "StringImpl.h" #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/StringImpl.h> #include <usp10.h> diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp index 9b54732..b51eb8c 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp +++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp @@ -35,11 +35,12 @@ #include "HarfbuzzSkia.h" #include "NotImplemented.h" #include "PlatformString.h" -#include "StringImpl.h" #include "SkPaint.h" #include "SkTypeface.h" +#include <wtf/text/StringImpl.h> + namespace WebCore { static SkPaint::Hinting skiaHinting = SkPaint::kNormal_Hinting; diff --git a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h index de12832..363e55f 100644 --- a/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h +++ b/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h @@ -32,10 +32,10 @@ #define FontPlatformDataLinux_h #include "FontRenderStyle.h" -#include "StringImpl.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> #include <wtf/text/CString.h> +#include <wtf/text/StringImpl.h> #include <SkPaint.h> class SkTypeface; diff --git a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp index 78170a9..e725c50 100644 --- a/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/FontUtilsChromiumWin.cpp @@ -34,11 +34,11 @@ #include <limits> #include "PlatformString.h" -#include "StringHash.h" #include "UniscribeHelper.h" #include <unicode/locid.h> #include <unicode/uchar.h> #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp index 8a9bde1..534de7b 100644 --- a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp +++ b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp @@ -38,14 +38,15 @@ #include "FloatRect.h" #include "GLES2Texture.h" #include "GraphicsContext3D.h" +#include "IntRect.h" #include "PlatformString.h" #include "Uint16Array.h" #define _USE_MATH_DEFINES #include <math.h> -#include <wtf/text/CString.h> #include <wtf/OwnArrayPtr.h> +#include <wtf/text/CString.h> namespace WebCore { @@ -221,7 +222,6 @@ void GLES2Canvas::drawTexturedRect(GLES2Texture* texture, const FloatRect& srcRe checkGLError("glUseProgram"); m_context->activeTexture(GraphicsContext3D::TEXTURE0); - texture->bind(); m_context->uniform1i(m_texSamplerLocation, 0); checkGLError("glUniform1i"); @@ -229,28 +229,52 @@ void GLES2Canvas::drawTexturedRect(GLES2Texture* texture, const FloatRect& srcRe m_context->uniform1f(m_texAlphaLocation, alpha); checkGLError("glUniform1f for alpha"); + m_context->vertexAttribPointer(m_texPositionLocation, 3, GraphicsContext3D::FLOAT, false, 0, 0); + + m_context->enableVertexAttribArray(m_texPositionLocation); + + const TilingData& tiles = texture->tiles(); + IntRect tileIdxRect = tiles.overlappedTileIndices(srcRect); + + for (int y = tileIdxRect.y(); y <= tileIdxRect.bottom(); y++) { + for (int x = tileIdxRect.x(); x <= tileIdxRect.right(); x++) + drawTexturedRectTile(texture, tiles.tileIndex(x, y), srcRect, dstRect, transform); + } +} + +void GLES2Canvas::drawTexturedRectTile(GLES2Texture* texture, int tile, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform) +{ + if (dstRect.isEmpty()) + return; + + const TilingData& tiles = texture->tiles(); + + texture->bindTile(tile); + + FloatRect srcRectClippedInTileSpace; + FloatRect dstRectIntersected; + tiles.intersectDrawQuad(srcRect, dstRect, tile, &srcRectClippedInTileSpace, &dstRectIntersected); + + IntRect tileBoundsWithBorder = tiles.tileBoundsWithBorder(tile); + AffineTransform matrix(m_flipMatrix); matrix.multLeft(transform); - matrix.translate(dstRect.x(), dstRect.y()); - matrix.scale(dstRect.width(), dstRect.height()); + matrix.translate(dstRectIntersected.x(), dstRectIntersected.y()); + matrix.scale(dstRectIntersected.width(), dstRectIntersected.height()); float mat[9]; affineTo3x3(matrix, mat); m_context->uniformMatrix3fv(m_texMatrixLocation, false /*transpose*/, mat, 1 /*count*/); checkGLError("glUniformMatrix3fv"); AffineTransform texMatrix; - texMatrix.scale(1.0f / texture->width(), 1.0f / texture->height()); - texMatrix.translate(srcRect.x(), srcRect.y()); - texMatrix.scale(srcRect.width(), srcRect.height()); + texMatrix.scale(1.0f / tileBoundsWithBorder.width(), 1.0f / tileBoundsWithBorder.height()); + texMatrix.translate(srcRectClippedInTileSpace.x(), srcRectClippedInTileSpace.y()); + texMatrix.scale(srcRectClippedInTileSpace.width(), srcRectClippedInTileSpace.height()); float texMat[9]; affineTo3x3(texMatrix, texMat); m_context->uniformMatrix3fv(m_texTexMatrixLocation, false /*transpose*/, texMat, 1 /*count*/); checkGLError("glUniformMatrix3fv"); - m_context->vertexAttribPointer(m_texPositionLocation, 3, GraphicsContext3D::FLOAT, false, 0, 0); - - m_context->enableVertexAttribArray(m_texPositionLocation); - m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0); checkGLError("glDrawElements"); } diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.h b/WebCore/platform/graphics/chromium/GLES2Canvas.h index cea90ae..0ad07fc 100644 --- a/WebCore/platform/graphics/chromium/GLES2Canvas.h +++ b/WebCore/platform/graphics/chromium/GLES2Canvas.h @@ -81,6 +81,7 @@ public: GLES2Texture* getTexture(NativeImagePtr); private: + void drawTexturedRectTile(GLES2Texture* texture, int tile, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&); void applyCompositeOperator(CompositeOperator); void checkGLError(const char* header); unsigned getQuadVertices(); diff --git a/WebCore/platform/graphics/chromium/GLES2Texture.cpp b/WebCore/platform/graphics/chromium/GLES2Texture.cpp index 5e8a141..ae230db 100644 --- a/WebCore/platform/graphics/chromium/GLES2Texture.cpp +++ b/WebCore/platform/graphics/chromium/GLES2Texture.cpp @@ -35,45 +35,27 @@ #include "GLES2Texture.h" #include "GraphicsContext3D.h" - +#include "IntRect.h" #include <wtf/OwnArrayPtr.h> namespace WebCore { -GLES2Texture::GLES2Texture(GraphicsContext3D* context, unsigned textureId, Format format, int width, int height) + +GLES2Texture::GLES2Texture(GraphicsContext3D* context, PassOwnPtr<Vector<unsigned int> > tileTextureIds, Format format, int width, int height, int maxTextureSize) : m_context(context) - , m_textureId(textureId) , m_format(format) - , m_width(width) - , m_height(height) + , m_tiles(maxTextureSize, width, height, true) + , m_tileTextureIds(tileTextureIds) { } GLES2Texture::~GLES2Texture() { - m_context->deleteTexture(m_textureId); -} - -PassRefPtr<GLES2Texture> GLES2Texture::create(GraphicsContext3D* context, Format format, int width, int height) -{ - int max; - context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &max); - if (width > max || height > max) { - ASSERT(!"texture too big"); - return 0; - } - - unsigned textureId = context->createTexture(); - if (!textureId) - return 0; - - context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId); - context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, width, height, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0); - - return adoptRef(new GLES2Texture(context, textureId, format, width, height)); + for (unsigned int i = 0; i < m_tileTextureIds->size(); i++) + m_context->deleteTexture(m_tileTextureIds->at(i)); } -static void convertFormat(GLES2Texture::Format format, unsigned int* glFormat, unsigned int* glType, bool* swizzle) +static void convertFormat(GraphicsContext3D* context, GLES2Texture::Format format, unsigned int* glFormat, unsigned int* glType, bool* swizzle) { *swizzle = false; switch (format) { @@ -82,43 +64,113 @@ static void convertFormat(GLES2Texture::Format format, unsigned int* glFormat, u *glType = GraphicsContext3D::UNSIGNED_BYTE; break; case GLES2Texture::BGRA8: -// FIXME: Once we have support for extensions, we should check for EXT_texture_format_BGRA8888, -// and use that if present. - *glFormat = GraphicsContext3D::RGBA; - *glType = GraphicsContext3D::UNSIGNED_BYTE; - *swizzle = true; + if (context->supportsBGRA()) { + *glFormat = GraphicsContext3D::BGRA_EXT; + *glType = GraphicsContext3D::UNSIGNED_BYTE; + } else { + *glFormat = GraphicsContext3D::RGBA; + *glType = GraphicsContext3D::UNSIGNED_BYTE; + *swizzle = true; + } break; default: - ASSERT(!"bad format"); + ASSERT_NOT_REACHED(); break; } } +PassRefPtr<GLES2Texture> GLES2Texture::create(GraphicsContext3D* context, Format format, int width, int height) +{ + int maxTextureSize = 0; + context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &maxTextureSize); + + TilingData tiling(maxTextureSize, width, height, true); + int numTiles = tiling.numTiles(); + + OwnPtr<Vector<unsigned int> > textureIds(new Vector<unsigned int>(numTiles)); + textureIds->fill(0, numTiles); + + for (int i = 0; i < numTiles; i++) { + int textureId = context->createTexture(); + if (!textureId) { + for (int i = 0; i < numTiles; i++) + context->deleteTexture(textureIds->at(i)); + return 0; + } + textureIds->at(i) = textureId; + + IntRect tileBoundsWithBorder = tiling.tileBoundsWithBorder(i); + + unsigned int glFormat, glType; + bool swizzle; + convertFormat(context, format, &glFormat, &glType, &swizzle); + context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId); + context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, glFormat, + tileBoundsWithBorder.width(), + tileBoundsWithBorder.height(), + 0, glFormat, glType, 0); + } + return adoptRef(new GLES2Texture(context, textureIds.leakPtr(), format, width, height, maxTextureSize)); +} + +template <bool swizzle> +static uint32_t* copySubRect(uint32_t* src, int srcX, int srcY, uint32_t* dst, int width, int height, int srcStride) +{ + uint32_t* srcOffset = src + srcX + srcY * srcStride; + + if (!swizzle && width == srcStride) + return srcOffset; + + uint32_t* dstPixel = dst; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width ; x++) { + uint32_t pixel = srcOffset[x + y * srcStride]; + if (swizzle) + *dstPixel = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); + else + *dstPixel = pixel; + dstPixel++; + } + } + return dst; +} + void GLES2Texture::load(void* pixels) { + uint32_t* pixels32 = static_cast<uint32_t*>(pixels); unsigned int glFormat, glType; bool swizzle; - convertFormat(m_format, &glFormat, &glType, &swizzle); - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId); + convertFormat(m_context, m_format, &glFormat, &glType, &swizzle); if (swizzle) { ASSERT(glFormat == GraphicsContext3D::RGBA && glType == GraphicsContext3D::UNSIGNED_BYTE); // FIXME: This could use PBO's to save doing an extra copy here. - int size = m_width * m_height; - unsigned* pixels32 = static_cast<unsigned*>(pixels); - OwnArrayPtr<unsigned> buf(new unsigned[size]); - unsigned* bufptr = buf.get(); - for (int i = 0; i < size; ++i) { - unsigned pixel = pixels32[i]; - bufptr[i] = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); + } + OwnArrayPtr<uint32_t> tempBuff(new uint32_t[m_tiles.maxTextureSize() * m_tiles.maxTextureSize()]); + + for (int i = 0; i < m_tiles.numTiles(); i++) { + IntRect tileBoundsWithBorder = m_tiles.tileBoundsWithBorder(i); + + uint32_t* uploadBuff = 0; + if (swizzle) { + uploadBuff = copySubRect<true>( + pixels32, tileBoundsWithBorder.x(), tileBoundsWithBorder.y(), + tempBuff.get(), tileBoundsWithBorder.width(), tileBoundsWithBorder.height(), m_tiles.totalSizeX()); + } else { + uploadBuff = copySubRect<false>( + pixels32, tileBoundsWithBorder.x(), tileBoundsWithBorder.y(), + tempBuff.get(), tileBoundsWithBorder.width(), tileBoundsWithBorder.height(), m_tiles.totalSizeX()); } - m_context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, m_width, m_height, glFormat, glType, buf.get()); - } else - m_context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, m_width, m_height, glFormat, glType, pixels); + + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_tileTextureIds->at(i)); + m_context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, + tileBoundsWithBorder.width(), + tileBoundsWithBorder.height(), glFormat, glType, uploadBuff); + } } -void GLES2Texture::bind() +void GLES2Texture::bindTile(int tile) { - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId); + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_tileTextureIds->at(tile)); m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); diff --git a/WebCore/platform/graphics/chromium/GLES2Texture.h b/WebCore/platform/graphics/chromium/GLES2Texture.h index 4d351cd..43a4955 100644 --- a/WebCore/platform/graphics/chromium/GLES2Texture.h +++ b/WebCore/platform/graphics/chromium/GLES2Texture.h @@ -35,6 +35,10 @@ #include "RefCounted.h" #include "RefPtr.h" +#include "TilingData.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> namespace WebCore { class GraphicsContext3D; @@ -44,18 +48,16 @@ public: ~GLES2Texture(); enum Format { RGBA8, BGRA8 }; static PassRefPtr<GLES2Texture> create(GraphicsContext3D*, Format, int width, int height); - void bind(); + void bindTile(int tile); void load(void* pixels); Format format() const { return m_format; } - int width() const { return m_width; } - int height() const { return m_height; } + const TilingData& tiles() const { return m_tiles; } private: - GLES2Texture(GraphicsContext3D*, unsigned textureId, Format, int width, int height); + GLES2Texture(GraphicsContext3D*, PassOwnPtr<Vector<unsigned int> > tileTextureIds, Format format, int width, int height, int maxTextureSize); GraphicsContext3D* m_context; - unsigned m_textureId; Format m_format; - int m_width; - int m_height; + TilingData m_tiles; + OwnPtr<Vector<unsigned int> > m_tileTextureIds; }; } diff --git a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 9f6ee17..3cc7cad 100644 --- a/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -114,7 +114,7 @@ void ImageLayerChromium::updateTextureContents(unsigned textureId) case kCGColorSpaceModelDeviceN: break; default: - colorSpace.adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear)); + colorSpace.adoptCF(CGColorSpaceCreateDeviceRGB()); break; } RetainPtr<CGContextRef> tempContext(AdoptCF, CGBitmapContextCreate(tempVector.data(), diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp index bba65f4..21d8d12 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -180,8 +180,7 @@ void LayerChromium::updateTextureContents(unsigned textureId) int rowBytes = 4 * dirtyRect.width(); tempVector.resize(rowBytes * dirtyRect.height()); memset(tempVector.data(), 0, tempVector.size()); - // FIXME: unsure whether this is the best color space choice. - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear)); + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); RetainPtr<CGContextRef> contextCG(AdoptCF, CGBitmapContextCreate(tempVector.data(), dirtyRect.width(), dirtyRect.height(), 8, rowBytes, colorSpace.get(), diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h index ebb4504..9fba415 100644 --- a/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/WebCore/platform/graphics/chromium/LayerChromium.h @@ -38,12 +38,12 @@ #include "GraphicsContext.h" #include "GraphicsLayerChromium.h" #include "PlatformString.h" -#include "StringHash.h" #include "TransformationMatrix.h" #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace skia { diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 15acfa5..2f70efa 100644 --- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -255,8 +255,7 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size) int rowBytes = 4 * size.width(); m_rootLayerBackingStore.resize(rowBytes * size.height()); memset(m_rootLayerBackingStore.data(), 0, m_rootLayerBackingStore.size()); - // FIXME: unsure whether this is the best color space choice. - RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear)); + RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); m_rootLayerCGContext.adoptCF(CGBitmapContextCreate(m_rootLayerBackingStore.data(), size.width(), size.height(), 8, rowBytes, colorSpace.get(), diff --git a/WebCore/platform/graphics/chromium/TilingData.cpp b/WebCore/platform/graphics/chromium/TilingData.cpp new file mode 100755 index 0000000..c52288d --- /dev/null +++ b/WebCore/platform/graphics/chromium/TilingData.cpp @@ -0,0 +1,218 @@ +/* + * 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 "TilingData.h" + +#include "FloatRect.h" +#include "IntRect.h" +#include <algorithm> + +using namespace std; + +namespace WebCore { + +static int computeNumTiles(int maxTextureSize, int totalSize, int borderTexels) +{ + return max(1, 1 + (totalSize - 1 - 2 * borderTexels) / (maxTextureSize - 2 * borderTexels)); +} + +TilingData::TilingData(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels) + : m_maxTextureSize(maxTextureSize) + , m_totalSizeX(totalSizeX) + , m_totalSizeY(totalSizeY) + , m_borderTexels(hasBorderTexels ? 1 : 0) +{ + m_numTilesX = computeNumTiles(maxTextureSize, m_totalSizeX, m_borderTexels); + m_numTilesY = computeNumTiles(maxTextureSize, m_totalSizeY, m_borderTexels); +} + +int TilingData::tileXIndexFromSrcCoord(int srcPos) const +{ + int x = (srcPos - m_borderTexels) / (m_maxTextureSize - 2 * m_borderTexels); + return min(max(x, 0), numTilesX() - 1); +} + +int TilingData::tileYIndexFromSrcCoord(int srcPos) const +{ + int y = (srcPos - m_borderTexels) / (m_maxTextureSize - 2 * m_borderTexels); + return min(max(y, 0), numTilesY() - 1); +} + +IntRect TilingData::tileBounds(int tile) const +{ + assertTile(tile); + int ix = tileXIndex(tile); + int iy = tileYIndex(tile); + int x = tilePositionX(ix); + int y = tilePositionY(iy); + int width = tileSizeX(ix); + int height = tileSizeY(iy); + ASSERT(x >= 0 && y >= 0 && width >= 0 && height >= 0); + ASSERT(x <= totalSizeX() && y <= totalSizeY()); + return IntRect(x, y, width, height); +} + +IntRect TilingData::tileBoundsWithBorder(int tile) const +{ + IntRect bounds = tileBounds(tile); + + if (m_borderTexels) { + int x1 = bounds.x(); + int x2 = bounds.right(); + int y1 = bounds.y(); + int y2 = bounds.bottom(); + + if (tileXIndex(tile) > 0) + x1--; + if (tileXIndex(tile) < (numTilesX() - 1)) + x2++; + if (tileYIndex(tile) > 0) + y1--; + if (tileYIndex(tile) < (numTilesY() - 1)) + y2++; + + bounds = IntRect(x1, y1, x2 - x1, y2 - y1); + } + + return bounds; +} + +FloatRect TilingData::tileBoundsNormalized(int tile) const +{ + assertTile(tile); + FloatRect bounds(tileBounds(tile)); + bounds.scale(1.0f / m_totalSizeX, 1.0f / m_totalSizeY); + return bounds; +} + +int TilingData::tilePositionX(int xIndex) const +{ + ASSERT(xIndex >= 0 && xIndex < numTilesX()); + + if (!xIndex) + return 0; + return tilePositionX(xIndex - 1) + tileSizeX(xIndex - 1); +} + +int TilingData::tilePositionY(int yIndex) const +{ + ASSERT(yIndex >= 0 && yIndex < numTilesY()); + + if (!yIndex) + return 0; + return tilePositionX(yIndex - 1) + tileSizeY(yIndex - 1); +} + +int TilingData::tileSizeX(int xIndex) const +{ + ASSERT(xIndex >= 0 && xIndex < numTilesX()); + + int size = maxTextureSize(); + size = min(size, totalSizeX()); + + if (!xIndex && m_numTilesX == 1) + return m_totalSizeX; + if (!xIndex && m_numTilesX > 1) + return m_maxTextureSize - m_borderTexels; + if (xIndex < numTilesX() - 1) + return m_maxTextureSize - 2 * m_borderTexels; + if (xIndex == numTilesX() - 1) + return m_totalSizeX - tilePositionX(xIndex); + + ASSERT_NOT_REACHED(); + return 0; +} + +int TilingData::tileSizeY(int yIndex) const +{ + ASSERT(yIndex >= 0 && yIndex < numTilesY()); + + int size = maxTextureSize(); + size = min(size, totalSizeY()); + + if (!yIndex && m_numTilesY == 1) + return m_totalSizeY; + if (!yIndex && m_numTilesY > 1) + return m_maxTextureSize - m_borderTexels; + if (yIndex < numTilesY() - 1) + return m_maxTextureSize - 2 * m_borderTexels; + if (yIndex == numTilesY() - 1) + return m_totalSizeY - tilePositionY(yIndex); + + ASSERT_NOT_REACHED(); + return 0; +} + +IntRect TilingData::overlappedTileIndices(const WebCore::IntRect &srcRect) const +{ + int x = tileXIndexFromSrcCoord(srcRect.x()); + int y = tileYIndexFromSrcCoord(srcRect.y()); + int r = tileXIndexFromSrcCoord(srcRect.right()); + int b = tileYIndexFromSrcCoord(srcRect.bottom()); + return IntRect(x, y, r - x, b - y); +} + +IntRect TilingData::overlappedTileIndices(const WebCore::FloatRect &srcRect) const +{ + return overlappedTileIndices(enclosingIntRect(srcRect)); +} + +void TilingData::intersectDrawQuad(const FloatRect& srcRect, const FloatRect& dstRect, int tile, + FloatRect* newSrc, FloatRect* newDst) const +{ + // Intersect with tile + FloatRect tileBounds = this->tileBounds(tile); + FloatRect srcRectIntersected = srcRect; + srcRectIntersected.intersect(tileBounds); + + if (srcRectIntersected.isEmpty()) { + *newSrc = *newDst = FloatRect(0, 0, 0, 0); + return; + } + + float srcRectIntersectedNormX = (srcRectIntersected.x() - srcRect.x()) / srcRect.width(); + float srcRectIntersectedNormY = (srcRectIntersected.y() - srcRect.y()) / srcRect.height(); + float srcRectIntersectedNormW = srcRectIntersected.width() / srcRect.width(); + float srcRectIntersectedNormH = srcRectIntersected.height() / srcRect.height(); + + *newSrc = srcRectIntersected; + newSrc->move( + -tileBounds.x() + ((tileXIndex(tile) > 0) ? m_borderTexels : 0), + -tileBounds.y() + ((tileYIndex(tile) > 0) ? m_borderTexels : 0)); + + *newDst = FloatRect( + srcRectIntersectedNormX * dstRect.width() + dstRect.x(), + srcRectIntersectedNormY * dstRect.height() + dstRect.y(), + srcRectIntersectedNormW * dstRect.width(), + srcRectIntersectedNormH * dstRect.height()); +} + +} diff --git a/WebCore/platform/graphics/chromium/TilingData.h b/WebCore/platform/graphics/chromium/TilingData.h new file mode 100755 index 0000000..f12e66e --- /dev/null +++ b/WebCore/platform/graphics/chromium/TilingData.h @@ -0,0 +1,87 @@ +/* + * 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 TilingData_h +#define TilingData_h + +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class FloatRect; +class IntRect; + +class TilingData : public Noncopyable { +public: + TilingData(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels); + int maxTextureSize() const { return m_maxTextureSize; } + int totalSizeX() const { return m_totalSizeX; } + int totalSizeY() const { return m_totalSizeY; } + + int numTiles() const { return numTilesX() * numTilesY(); } + int numTilesX() const { return m_numTilesX; } + int numTilesY() const { return m_numTilesY; } + int tileIndex(int x, int y) const { return x + y * numTilesX(); } + int tileXIndex(int tile) const { assertTile(tile); return tile % numTilesX(); } + int tileYIndex(int tile) const { assertTile(tile); return tile / numTilesX(); } + int tileXIndexFromSrcCoord(int) const; + int tileYIndexFromSrcCoord(int) const; + + IntRect tileBounds(int tile) const; + IntRect tileBoundsWithBorder(int tile) const; + FloatRect tileBoundsNormalized(int tile) const; + int tilePositionX(int xIndex) const; + int tilePositionY(int yIndex) const; + int tileSizeX(int xIndex) const; + int tileSizeY(int yIndex) const; + IntRect overlappedTileIndices(const IntRect& srcRect) const; + IntRect overlappedTileIndices(const FloatRect& srcRect) const; + + // Given a set of source and destination coordinates for a drawing quad + // in texel units, returns adjusted data to render just the one tile. + void intersectDrawQuad(const FloatRect& srcRect, const FloatRect& dstRect, int tile, FloatRect* newSrc, FloatRect* newDst) const; + +private: + TilingData() : m_maxTextureSize(0), m_totalSizeX(0), m_totalSizeY(0) {} + void assertTile(int tile) const { ASSERT(tile >= 0 && tile < numTiles()); } + + int m_maxTextureSize; + int m_totalSizeX; + int m_totalSizeY; + int m_borderTexels; // 0 or 1 + + // computed values: + int m_numTilesX; + int m_numTilesY; +}; + +} + +#endif // TilingData_h diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/WebCore/platform/graphics/filters/FEColorMatrix.cpp index c5ae3b9..7718066 100644 --- a/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -164,7 +164,7 @@ void FEColorMatrix::apply(Filter* filter) if (!filterContext) return; - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); IntRect imageRect(IntPoint(), resultImage()->size()); PassRefPtr<ImageData> imageData(resultImage()->getUnmultipliedImageData(imageRect)); diff --git a/WebCore/platform/graphics/filters/FEComposite.cpp b/WebCore/platform/graphics/filters/FEComposite.cpp index 18df3b2..0bafc48 100644 --- a/WebCore/platform/graphics/filters/FEComposite.cpp +++ b/WebCore/platform/graphics/filters/FEComposite.cpp @@ -131,26 +131,26 @@ void FEComposite::apply(Filter* filter) FloatRect srcRect = FloatRect(0.f, 0.f, -1.f, -1.f); switch (m_type) { case FECOMPOSITE_OPERATOR_OVER: - filterContext->drawImage(m_in2->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion())); - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); + filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion())); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); break; case FECOMPOSITE_OPERATOR_IN: filterContext->save(); - filterContext->clipToImageBuffer(calculateDrawingRect(m_in2->scaledSubRegion()), m_in2->resultImage()); - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); + filterContext->clipToImageBuffer(m_in->resultImage(), calculateDrawingRect(m_in2->scaledSubRegion())); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); filterContext->restore(); break; case FECOMPOSITE_OPERATOR_OUT: - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); - filterContext->drawImage(m_in2->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion()), srcRect, CompositeDestinationOut); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion())); + filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion()), srcRect, CompositeDestinationOut); break; case FECOMPOSITE_OPERATOR_ATOP: - filterContext->drawImage(m_in2->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion())); - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()), srcRect, CompositeSourceAtop); + filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion())); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()), srcRect, CompositeSourceAtop); break; case FECOMPOSITE_OPERATOR_XOR: - filterContext->drawImage(m_in2->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion())); - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()), srcRect, CompositeXOR); + filterContext->drawImageBuffer(m_in2->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in2->scaledSubRegion())); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, calculateDrawingRect(m_in->scaledSubRegion()), srcRect, CompositeXOR); break; case FECOMPOSITE_OPERATOR_ARITHMETIC: { IntRect effectADrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion()); diff --git a/WebCore/platform/graphics/filters/FEGaussianBlur.cpp b/WebCore/platform/graphics/filters/FEGaussianBlur.cpp index 61aea90..70465a0 100644 --- a/WebCore/platform/graphics/filters/FEGaussianBlur.cpp +++ b/WebCore/platform/graphics/filters/FEGaussianBlur.cpp @@ -3,6 +3,7 @@ 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> 2009 Dirk Schulze <krit@webkit.org> + 2010 Igalia, S.L. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -29,18 +30,19 @@ #include "Filter.h" #include "GraphicsContext.h" #include "ImageData.h" -#include <math.h> #include <wtf/MathExtras.h> using std::max; +static const float gGaussianKernelFactor = (3 * sqrtf(2 * piFloat) / 4.f); + namespace WebCore { FEGaussianBlur::FEGaussianBlur(FilterEffect* in, const float& x, const float& y) : FilterEffect() , m_in(in) - , m_x(x) - , m_y(y) + , m_stdX(x) + , m_stdY(y) { } @@ -51,30 +53,27 @@ PassRefPtr<FEGaussianBlur> FEGaussianBlur::create(FilterEffect* in, const float& float FEGaussianBlur::stdDeviationX() const { - return m_x; + return m_stdX; } void FEGaussianBlur::setStdDeviationX(float x) { - m_x = x; + m_stdX = x; } float FEGaussianBlur::stdDeviationY() const { - return m_y; + return m_stdY; } void FEGaussianBlur::setStdDeviationY(float y) { - m_y = y; + m_stdY = y; } static void boxBlur(CanvasPixelArray*& srcPixelArray, CanvasPixelArray*& dstPixelArray, - unsigned dx, int stride, int strideLine, int effectWidth, int effectHeight, bool alphaImage) + unsigned dx, int dxLeft, int dxRight, int stride, int strideLine, int effectWidth, int effectHeight, bool alphaImage) { - int dxLeft = dx / 2; - int dxRight = dx - dxLeft; - for (int y = 0; y < effectHeight; ++y) { int line = y * strideLine; for (int channel = 3; channel >= 0; --channel) { @@ -99,6 +98,34 @@ static void boxBlur(CanvasPixelArray*& srcPixelArray, CanvasPixelArray*& dstPixe } } +void FEGaussianBlur::kernelPosition(int boxBlur, unsigned& std, int& dLeft, int& dRight) +{ + // check http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement for details + switch (boxBlur) { + case 0: + if (!(std % 2)) { + dLeft = std / 2 - 1; + dRight = std - dLeft; + } else { + dLeft = std / 2; + dRight = std - dLeft; + } + break; + case 1: + if (!(std % 2)) { + dLeft++; + dRight--; + } + break; + case 2: + if (!(std % 2)) { + dRight++; + std++; + } + break; + } +} + void FEGaussianBlur::apply(Filter* filter) { m_in->apply(filter); @@ -110,26 +137,50 @@ void FEGaussianBlur::apply(Filter* filter) setIsAlphaImage(m_in->isAlphaImage()); - if (m_x == 0 || m_y == 0) + IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion()); + RefPtr<ImageData> srcImageData(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)); + IntRect imageRect(IntPoint(), resultImage()->size()); + + if (!m_stdX && !m_stdY) { + resultImage()->putPremultipliedImageData(srcImageData.get(), imageRect, IntPoint()); return; + } - unsigned sdx = static_cast<unsigned>(floor(m_x * filter->filterResolution().width() * 3 * sqrt(2 * piDouble) / 4.f + 0.5f)); - unsigned sdy = static_cast<unsigned>(floor(m_y * filter->filterResolution().height() * 3 * sqrt(2 * piDouble) / 4.f + 0.5f)); - sdx = max(sdx, static_cast<unsigned>(1)); - sdy = max(sdy, static_cast<unsigned>(1)); + unsigned kernelSizeX = 0; + if (m_stdX) + kernelSizeX = max(2U, static_cast<unsigned>(floor(m_stdX * filter->filterResolution().width() * gGaussianKernelFactor + 0.5f))); - IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion()); - RefPtr<ImageData> srcImageData(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect)); - CanvasPixelArray* srcPixelArray(srcImageData->data()); + unsigned kernelSizeY = 0; + if (m_stdY) + kernelSizeY = max(2U, static_cast<unsigned>(floor(m_stdY * filter->filterResolution().height() * gGaussianKernelFactor + 0.5f))); - IntRect imageRect(IntPoint(), resultImage()->size()); + CanvasPixelArray* srcPixelArray(srcImageData->data()); RefPtr<ImageData> tmpImageData = ImageData::create(imageRect.width(), imageRect.height()); CanvasPixelArray* tmpPixelArray(tmpImageData->data()); int stride = 4 * imageRect.width(); + int dxLeft = 0; + int dxRight = 0; + int dyLeft = 0; + int dyRight = 0; for (int i = 0; i < 3; ++i) { - boxBlur(srcPixelArray, tmpPixelArray, sdx, 4, stride, imageRect.width(), imageRect.height(), isAlphaImage()); - boxBlur(tmpPixelArray, srcPixelArray, sdy, stride, 4, imageRect.height(), imageRect.width(), isAlphaImage()); + if (kernelSizeX) { + kernelPosition(i, kernelSizeX, dxLeft, dxRight); + boxBlur(srcPixelArray, tmpPixelArray, kernelSizeX, dxLeft, dxRight, 4, stride, imageRect.width(), imageRect.height(), isAlphaImage()); + } else { + CanvasPixelArray* auxPixelArray = tmpPixelArray; + tmpPixelArray = srcPixelArray; + srcPixelArray = auxPixelArray; + } + + if (kernelSizeY) { + kernelPosition(i, kernelSizeY, dyLeft, dyRight); + boxBlur(tmpPixelArray, srcPixelArray, kernelSizeY, dyLeft, dyRight, stride, 4, imageRect.height(), imageRect.width(), isAlphaImage()); + } else { + CanvasPixelArray* auxPixelArray = tmpPixelArray; + tmpPixelArray = srcPixelArray; + srcPixelArray = auxPixelArray; + } } resultImage()->putPremultipliedImageData(srcImageData.get(), imageRect, IntPoint()); @@ -144,7 +195,7 @@ TextStream& FEGaussianBlur::externalRepresentation(TextStream& ts, int indent) c writeIndent(ts, indent); ts << "[feGaussianBlur"; FilterEffect::externalRepresentation(ts); - ts << " stdDeviation=\"" << m_x << ", " << m_y << "\"]\n"; + ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\"]\n"; m_in->externalRepresentation(ts, indent + 1); return ts; } diff --git a/WebCore/platform/graphics/filters/FEGaussianBlur.h b/WebCore/platform/graphics/filters/FEGaussianBlur.h index bcc030e..4c7c43c 100644 --- a/WebCore/platform/graphics/filters/FEGaussianBlur.h +++ b/WebCore/platform/graphics/filters/FEGaussianBlur.h @@ -45,10 +45,11 @@ public: private: FEGaussianBlur(FilterEffect*, const float&, const float&); + static void kernelPosition(int boxBlur, unsigned& std, int& dLeft, int& dRight); RefPtr<FilterEffect> m_in; - float m_x; - float m_y; + float m_stdX; + float m_stdY; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/filters/Filter.h b/WebCore/platform/graphics/filters/Filter.h index 8924b94..16d499f 100644 --- a/WebCore/platform/graphics/filters/Filter.h +++ b/WebCore/platform/graphics/filters/Filter.h @@ -24,11 +24,11 @@ #include "FloatRect.h" #include "FloatSize.h" #include "ImageBuffer.h" -#include "StringHash.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/graphics/filters/SourceAlpha.cpp b/WebCore/platform/graphics/filters/SourceAlpha.cpp index eb23814..37b0023 100644 --- a/WebCore/platform/graphics/filters/SourceAlpha.cpp +++ b/WebCore/platform/graphics/filters/SourceAlpha.cpp @@ -63,9 +63,9 @@ void SourceAlpha::apply(Filter* filter) setIsAlphaImage(true); - FloatRect imageRect(FloatPoint(), filter->sourceImage()->image()->size()); + FloatRect imageRect(FloatPoint(), filter->sourceImage()->size()); filterContext->save(); - filterContext->clipToImageBuffer(imageRect, filter->sourceImage()); + filterContext->clipToImageBuffer(filter->sourceImage(), imageRect); filterContext->fillRect(imageRect, Color::black, DeviceColorSpace); filterContext->restore(); } diff --git a/WebCore/platform/graphics/filters/SourceGraphic.cpp b/WebCore/platform/graphics/filters/SourceGraphic.cpp index a1864d6..5730d34 100644 --- a/WebCore/platform/graphics/filters/SourceGraphic.cpp +++ b/WebCore/platform/graphics/filters/SourceGraphic.cpp @@ -60,7 +60,7 @@ void SourceGraphic::apply(Filter* filter) if (!filterContext) return; - filterContext->drawImage(filter->sourceImage()->image(), DeviceColorSpace, IntPoint()); + filterContext->drawImageBuffer(filter->sourceImage(), DeviceColorSpace, IntPoint()); } void SourceGraphic::dump() diff --git a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp index d3b5f1b..1059b59 100644 --- a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp +++ b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp @@ -780,9 +780,13 @@ void StreamingClient::didFail(ResourceHandle*, const ResourceError& error) void StreamingClient::wasBlocked(ResourceHandle*) { + GST_ERROR_OBJECT(m_src, "Request was blocked"); + GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, ("Access to \"%s\" was blocked", m_src->priv->uri), (0)); } void StreamingClient::cannotShowURL(ResourceHandle*) { + GST_ERROR_OBJECT(m_src, "Cannot show URL"); + GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, ("Can't show \"%s\"", m_src->priv->uri), (0)); } diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp index 30db6d7..5272243 100644 --- a/WebCore/platform/graphics/gtk/ImageGtk.cpp +++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp @@ -27,81 +27,60 @@ #include "BitmapImage.h" #include "CairoUtilities.h" -#include "GOwnPtr.h" +#include "GOwnPtrGtk.h" #include "SharedBuffer.h" #include <wtf/text/CString.h> #include <cairo.h> #include <gtk/gtk.h> -#ifdef _WIN32 -# include <mbstring.h> -# include <shlobj.h> -/* search for data relative to where we are installed */ +#if PLATFORM(WIN) +#include <mbstring.h> +#include <shlobj.h> static HMODULE hmodule; -#ifdef __cplusplus extern "C" { -#endif -BOOL WINAPI -DllMain(HINSTANCE hinstDLL, - DWORD fdwReason, - LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - switch (fdwReason) { - case DLL_PROCESS_ATTACH: + if (fdwReason == DLL_PROCESS_ATTACH) hmodule = hinstDLL; - break; - } - return TRUE; } -#ifdef __cplusplus } -#endif -static char * -get_webkit_datadir(void) +static const char* getWebKitDataDirectory() { - static char retval[1000]; - static int beenhere = 0; - - unsigned char *p; - - if (beenhere) - return retval; + static char* dataDirectory = 0; + if (dataDirectory) + return dataDirectory; - if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10)) + dataDirectory = new char[PATH_MAX]; + if (!GetModuleFileName(hmodule, static_cast<CHAR*>(dataDirectory), sizeof(dataDirectory) - 10)) return DATA_DIR; - p = _mbsrchr((const unsigned char *) retval, '\\'); + // FIXME: This is pretty ugly. Ideally we should be using Windows API + // functions or GLib methods to calculate paths. + unsigned char *p; + p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\'); *p = '\0'; - p = _mbsrchr((const unsigned char *) retval, '\\'); + p = _mbsrchr(static_cast<const unsigned char *>(dataDirectory), '\\'); if (p) { if (!stricmp((const char *) (p+1), "bin")) *p = '\0'; } - strcat(retval, "\\share"); - - beenhere = 1; + strcat(dataDirectory, "\\share"); - return retval; + return dataDirectory; } -#undef DATA_DIR -#define DATA_DIR get_webkit_datadir () -#endif - +#else -namespace WTF { - -template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info) +static const char* getWebKitDataDirectory() { - if (info) - gtk_icon_info_free(info); + return DATA_DIR; } -} +#endif namespace WebCore { @@ -158,11 +137,9 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name) if (!strcmp("missingImage", name)) fileName = getThemeIconFileName(GTK_STOCK_MISSING_IMAGE, 16); if (fileName.isNull()) { - gchar* imagename = g_strdup_printf("%s.png", name); - gchar* glibFileName = g_build_filename(DATA_DIR, "webkit-1.0", "images", imagename, NULL); - fileName = glibFileName; - g_free(imagename); - g_free(glibFileName); + GOwnPtr<gchar> imageName(g_strdup_printf("%s.png", name)); + GOwnPtr<gchar> glibFileName(g_build_filename(getWebKitDataDirectory(), "webkitgtk-"WEBKITGTK_API_VERSION_STRING, "images", imageName.get(), NULL)); + fileName = glibFileName.get(); } return loadImageFromFile(fileName); diff --git a/WebCore/platform/graphics/mac/FontPlatformData.h b/WebCore/platform/graphics/mac/FontPlatformData.h index 07ae4f8..dc876a8 100644 --- a/WebCore/platform/graphics/mac/FontPlatformData.h +++ b/WebCore/platform/graphics/mac/FontPlatformData.h @@ -24,7 +24,7 @@ #ifndef FontPlatformData_h #define FontPlatformData_h -#include "StringImpl.h" +#include <wtf/text/StringImpl.h> #ifdef __OBJC__ @class NSFont; diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm index fd503fc..be1d278 100644 --- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm +++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm @@ -31,6 +31,7 @@ #import "BlockExceptions.h" +#include "ANGLE/ResourceLimits.h" #include "ArrayBuffer.h" #include "ArrayBufferView.h" #include "WebGLObject.h" @@ -181,6 +182,30 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi ::glGenRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer); } + // ANGLE initialization. + + TBuiltInResource ANGLEResources; + + ANGLEResources.maxVertexAttribs = 0; + getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &ANGLEResources.maxVertexAttribs); + ANGLEResources.maxVertexUniformVectors = 0; + getIntegerv(GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS, &ANGLEResources.maxVertexUniformVectors); + ANGLEResources.maxVaryingVectors = 0; + getIntegerv(GraphicsContext3D::MAX_VARYING_VECTORS, &ANGLEResources.maxVaryingVectors); + ANGLEResources.maxVertexTextureImageUnits = 0; + getIntegerv(GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS, &ANGLEResources.maxVertexTextureImageUnits); + ANGLEResources.maxCombinedTextureImageUnits = 0; + getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &ANGLEResources.maxCombinedTextureImageUnits); + ANGLEResources.maxTextureImageUnits = 0; + getIntegerv(GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS, &ANGLEResources.maxTextureImageUnits); + ANGLEResources.maxFragmentUniformVectors = 0; + getIntegerv(GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS, &ANGLEResources.maxFragmentUniformVectors); + + // Always set to 1 for OpenGL ES. + ANGLEResources.maxDrawBuffers = 1; + + m_compiler.setResources(ANGLEResources); + ::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); ::glClearColor(0, 0, 0, 0); } @@ -282,15 +307,6 @@ void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* co canvas->width(), canvas->height(), imageBuffer->context()->platformContext()); } -void GraphicsContext3D::beginPaint(CanvasRenderingContext* context) -{ - UNUSED_PARAM(context); -} - -void GraphicsContext3D::endPaint() -{ -} - bool GraphicsContext3D::isGLES2Compliant() const { return false; @@ -617,7 +633,52 @@ void GraphicsContext3D::compileShader(Platform3DObject shader) { ASSERT(shader); ensureContext(m_contextObj); + + int GLshaderType; + ANGLEShaderType shaderType; + + glGetShaderiv(shader, SHADER_TYPE, &GLshaderType); + + if (GLshaderType == VERTEX_SHADER) + shaderType = SHADER_TYPE_VERTEX; + else if (GLshaderType == FRAGMENT_SHADER) + shaderType = SHADER_TYPE_FRAGMENT; + else + return; // Invalid shader type. + + HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader); + + if (result == m_shaderSourceMap.end()) + return; + + ShaderSourceEntry& entry = result->second; + + String translatedShaderSource; + String shaderInfoLog; + + bool isValid = m_compiler.validateShaderSource(entry.source.utf8().data(), shaderType, translatedShaderSource, shaderInfoLog); + + entry.log = shaderInfoLog; + entry.isValid = isValid; + + if (!isValid) + return; // Shader didn't validate, don't move forward with compiling translated source + + int translatedShaderLength = translatedShaderSource.length(); + + const CString& translatedShaderCString = translatedShaderSource.utf8(); + const char* translatedShaderPtr = translatedShaderCString.data(); + + ::glShaderSource((GLuint) shader, 1, &translatedShaderPtr, &translatedShaderLength); + ::glCompileShader((GLuint) shader); + + int GLCompileSuccess; + + ::glGetShaderiv((GLuint) shader, COMPILE_STATUS, &GLCompileSuccess); + + // ASSERT that ANGLE generated GLSL will be accepted by OpenGL + ASSERT(GLCompileSuccess == GL_TRUE); } void GraphicsContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) @@ -998,11 +1059,12 @@ void GraphicsContext3D::shaderSource(Platform3DObject shader, const String& stri ASSERT(shader); ensureContext(m_contextObj); - const CString& cs = string.utf8(); - const char* s = cs.data(); - - int length = string.length(); - ::glShaderSource((GLuint) shader, 1, &s, &length); + + ShaderSourceEntry entry; + + entry.source = string; + + m_shaderSourceMap.set(shader, entry); } void GraphicsContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask) @@ -1346,26 +1408,77 @@ void GraphicsContext3D::getShaderiv(Platform3DObject shader, unsigned long pname ASSERT(shader); ensureContext(m_contextObj); - ::glGetShaderiv((GLuint) shader, pname, value); + + HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader); + + switch (pname) { + case DELETE_STATUS: + case SHADER_TYPE: + // Let OpenGL handle these. + + ::glGetShaderiv((GLuint) shader, pname, value); + break; + + case COMPILE_STATUS: + if (result == m_shaderSourceMap.end()) { + (*value) = static_cast<int>(false); + return; + } + + (*value) = static_cast<int>(result->second.isValid); + break; + + case INFO_LOG_LENGTH: + if (result == m_shaderSourceMap.end()) { + (*value) = 0; + return; + } + + (*value) = getShaderInfoLog(shader).length(); + break; + + case SHADER_SOURCE_LENGTH: + (*value) = getShaderSource(shader).length(); + break; + + default: + synthesizeGLError(INVALID_ENUM); + } } String GraphicsContext3D::getShaderInfoLog(Platform3DObject shader) { ASSERT(shader); - + ensureContext(m_contextObj); GLint length; ::glGetShaderiv((GLuint) shader, GL_INFO_LOG_LENGTH, &length); - - GLsizei size; - GLchar* info = (GLchar*) fastMalloc(length); - if (!info) - return ""; - - ::glGetShaderInfoLog((GLuint) shader, length, &size, info); - String s(info); - fastFree(info); - return s; + + HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader); + + if (result == m_shaderSourceMap.end()) + return ""; + + ShaderSourceEntry entry = result->second; + + if (entry.isValid) { + GLint length; + ::glGetShaderiv((GLuint) shader, GL_INFO_LOG_LENGTH, &length); + + GLsizei size; + GLchar* info = (GLchar*) fastMalloc(length); + if (!info) + return ""; + + ::glGetShaderInfoLog((GLuint) shader, length, &size, info); + + String s(info); + fastFree(info); + return s; + } + else { + return entry.log; + } } String GraphicsContext3D::getShaderSource(Platform3DObject shader) @@ -1373,18 +1486,13 @@ String GraphicsContext3D::getShaderSource(Platform3DObject shader) ASSERT(shader); ensureContext(m_contextObj); - GLint length; - ::glGetShaderiv((GLuint) shader, GL_SHADER_SOURCE_LENGTH, &length); - - GLsizei size; - GLchar* info = (GLchar*) fastMalloc(length); - if (!info) + + HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader); + + if (result == m_shaderSourceMap.end()) return ""; - - ::glGetShaderSource((GLuint) shader, length, &size, info); - String s(info); - fastFree(info); - return s; + + return result->second.source; } diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h index ee70338..a9f747a 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h @@ -29,11 +29,11 @@ #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayer.h" -#include "StringHash.h" #include "WebLayer.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/RetainPtr.h> +#include <wtf/text/StringHash.h> @class CABasicAnimation; @class CAKeyframeAnimation; diff --git a/WebCore/platform/graphics/qt/ContextShadow.cpp b/WebCore/platform/graphics/qt/ContextShadow.cpp new file mode 100644 index 0000000..0511218 --- /dev/null +++ b/WebCore/platform/graphics/qt/ContextShadow.cpp @@ -0,0 +1,256 @@ +/* + * Copyright (C) 2010 Sencha, 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" +#include "ContextShadow.h" + +namespace WebCore { + +ContextShadow::ContextShadow() + : type(NoShadow) + , blurRadius(0) +{ +} + +ContextShadow::ContextShadow(const QColor& c, float r, qreal dx, qreal dy) + : color(c) + , blurRadius(qRound(r)) + , offset(dx, dy) +{ + // The type of shadow is decided by the blur radius, shadow offset, and shadow color. + if (!color.isValid() || !color.alpha()) { + // Can't paint the shadow with invalid or invisible color. + type = NoShadow; + } else if (r > 0) { + // Shadow is always blurred, even the offset is zero. + type = BlurShadow; + } else if (offset.isNull()) { + // Without blur and zero offset means the shadow is fully hidden. + type = NoShadow; + } else { + if (color.alpha() > 0) + type = AlphaSolidShadow; + else + type = OpaqueSolidShadow; + } +} + +void ContextShadow::clear() +{ + type = NoShadow; + color = QColor(); + blurRadius = 0; + offset = QPointF(0, 0); +} + +// Instead of integer division, we use 18.14 for fixed-point division. +static const int BlurSumShift = 14; + +// Note: image must be RGB32 format +static void blurHorizontal(QImage& image, int radius, bool swap = false) +{ + Q_ASSERT(image.format() == QImage::Format_ARGB32_Premultiplied); + + // See comments in http://webkit.org/b/40793, it seems sensible + // to follow Skia's limit of 128 pixels of blur radius + radius = qMin(128, radius); + + int imgWidth = image.width(); + int imgHeight = image.height(); + + // Check http://www.w3.org/TR/SVG/filters.html#feGaussianBlur + // for the approaches when the box-blur radius is even vs odd. + int dmax = radius >> 1; + int dmin = qMax(0, dmax - 1 + (radius & 1)); + + for (int y = 0; y < imgHeight; ++y) { + + unsigned char* pixels = image.scanLine(y); + + int left; + int right; + int pixelCount; + int prev; + int next; + int firstAlpha; + int lastAlpha; + int totalAlpha; + unsigned char* target; + unsigned char* prevPtr; + unsigned char* nextPtr; + + int invCount; + + static const int alphaChannel = 3; + static const int blueChannel = 0; + static const int greenChannel = 1; + + // For each step, we use sliding window algorithm. This is much more + // efficient than computing the sum of each pixels covered by the box + // kernel size for each x. + + // As noted in the SVG filter specification, running box blur 3x + // approximates a real gaussian blur nicely. + + // Step 1: blur alpha channel and store the result in the blue channel. + left = swap ? dmax : dmin; + right = swap ? dmin : dmax; + pixelCount = left + 1 + right; + invCount = (1 << BlurSumShift) / pixelCount; + prev = -left; + next = 1 + right; + firstAlpha = pixels[alphaChannel]; + lastAlpha = pixels[(imgWidth - 1) * 4 + alphaChannel]; + totalAlpha = 0; + for (int i = 0; i < pixelCount; ++i) + totalAlpha += pixels[qBound(0, i - left, imgWidth - 1) * 4 + alphaChannel]; + target = pixels + blueChannel; + prevPtr = pixels + prev * 4 + alphaChannel; + nextPtr = pixels + next * 4 + alphaChannel; + for (int x = 0; x < imgWidth; ++x, ++prev, ++next, target += 4, prevPtr += 4, nextPtr += 4) { + *target = (totalAlpha * invCount) >> BlurSumShift; + int delta = ((next < imgWidth) ? *nextPtr : lastAlpha) - + ((prev > 0) ? *prevPtr : firstAlpha); + totalAlpha += delta; + } + + // Step 2: blur blue channel and store the result in the green channel. + left = swap ? dmin : dmax; + right = swap ? dmax : dmin; + pixelCount = left + 1 + right; + invCount = (1 << BlurSumShift) / pixelCount; + prev = -left; + next = 1 + right; + firstAlpha = pixels[blueChannel]; + lastAlpha = pixels[(imgWidth - 1) * 4 + blueChannel]; + totalAlpha = 0; + for (int i = 0; i < pixelCount; ++i) + totalAlpha += pixels[qBound(0, i - left, imgWidth - 1) * 4 + blueChannel]; + target = pixels + greenChannel; + prevPtr = pixels + prev * 4 + blueChannel; + nextPtr = pixels + next * 4 + blueChannel; + for (int x = 0; x < imgWidth; ++x, ++prev, ++next, target += 4, prevPtr += 4, nextPtr += 4) { + *target = (totalAlpha * invCount) >> BlurSumShift; + int delta = ((next < imgWidth) ? *nextPtr : lastAlpha) - + ((prev > 0) ? *prevPtr : firstAlpha); + totalAlpha += delta; + } + + // Step 3: blur green channel and store the result in the alpha channel. + left = dmax; + right = dmax; + pixelCount = left + 1 + right; + invCount = (1 << BlurSumShift) / pixelCount; + prev = -left; + next = 1 + right; + firstAlpha = pixels[greenChannel]; + lastAlpha = pixels[(imgWidth - 1) * 4 + greenChannel]; + totalAlpha = 0; + for (int i = 0; i < pixelCount; ++i) + totalAlpha += pixels[qBound(0, i - left, imgWidth - 1) * 4 + greenChannel]; + target = pixels + alphaChannel; + prevPtr = pixels + prev * 4 + greenChannel; + nextPtr = pixels + next * 4 + greenChannel; + for (int x = 0; x < imgWidth; ++x, ++prev, ++next, target += 4, prevPtr += 4, nextPtr += 4) { + *target = (totalAlpha * invCount) >> BlurSumShift; + int delta = ((next < imgWidth) ? *nextPtr : lastAlpha) - + ((prev > 0) ? *prevPtr : firstAlpha); + totalAlpha += delta; + } + } +} + +static void shadowBlur(QImage& image, int radius, const QColor& shadowColor) +{ + blurHorizontal(image, radius); + + QTransform transform; + transform.rotate(90); + image = image.transformed(transform); + blurHorizontal(image, radius, true); + transform.reset(); + transform.rotate(270); + image = image.transformed(transform); + + // "Colorize" with the right shadow color. + QPainter p(&image); + p.setCompositionMode(QPainter::CompositionMode_SourceIn); + p.fillRect(image.rect(), shadowColor.rgb()); + p.end(); +} + +void ContextShadow::drawShadowRect(QPainter* p, const QRectF& rect) +{ + if (type == NoShadow) + return; + + if (type == BlurShadow) { + QRectF shadowRect = rect.translated(offset); + + // We expand the area by the blur radius * 2 to give extra space + // for the blur transition. + int extra = blurRadius * 2; + QRectF bufferRect = shadowRect.adjusted(-extra, -extra, extra, extra); + QRect alignedBufferRect = bufferRect.toAlignedRect(); + + QRect clipRect; + if (p->hasClipping()) + clipRect = p->clipRegion().boundingRect(); + else + clipRect = p->transform().inverted().mapRect(p->window()); + + if (!clipRect.contains(alignedBufferRect)) { + + // No need to have the buffer larger that the clip. + alignedBufferRect = alignedBufferRect.intersected(clipRect); + if (alignedBufferRect.isEmpty()) + return; + + // We adjust again because the pixels at the borders are still + // potentially affected by the pixels outside the buffer. + alignedBufferRect.adjust(-extra, -extra, extra, extra); + } + + QImage shadowImage(alignedBufferRect.size(), QImage::Format_ARGB32_Premultiplied); + shadowImage.fill(Qt::transparent); + QPainter shadowPainter(&shadowImage); + + shadowPainter.fillRect(shadowRect.translated(-alignedBufferRect.topLeft()), color); + shadowPainter.end(); + + shadowBlur(shadowImage, blurRadius, color); + + p->drawImage(alignedBufferRect.topLeft(), shadowImage); + + return; + } + + p->fillRect(rect.translated(offset), color); +} + + +} diff --git a/WebCore/html/canvas/CanvasNumberArray.h b/WebCore/platform/graphics/qt/ContextShadow.h index 09714a0..e114ebc 100644 --- a/WebCore/html/canvas/CanvasNumberArray.h +++ b/WebCore/platform/graphics/qt/ContextShadow.h @@ -1,5 +1,7 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Sencha, Inc. + * + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,35 +22,50 @@ * 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 CanvasNumberArray_h -#define CanvasNumberArray_h +#ifndef ContextShadow_h +#define ContextShadow_h -#include <wtf/Forward.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/Vector.h> -#include <limits> +#include <QPainter> namespace WebCore { - class CanvasNumberArray : public RefCounted<CanvasNumberArray> { - public: - static PassRefPtr<CanvasNumberArray> create(unsigned length); - - Vector<float>& data() { return m_data; } - const Vector<float>& data() const { return m_data; } - - unsigned length() const { return m_data.size(); } - float item(unsigned index) const { return (index >= m_data.size()) ? 0 : m_data[index]; } - - private: - CanvasNumberArray(unsigned length); - Vector<float> m_data; - }; - +// This is to track and keep the shadow state. We use this rather than +// using GraphicsContextState to allow possible optimizations (right now +// only to determine the shadow type, but in future it might covers things +// like cached scratch image, persistent shader, etc). + +// This class should be copyable since GraphicsContextQt keeps a stack of +// the shadow state for savePlatformState and restorePlatformState. + +class ContextShadow { +public: + enum { + NoShadow, + OpaqueSolidShadow, + AlphaSolidShadow, + BlurShadow + } type; + + QColor color; + int blurRadius; + QPointF offset; + + ContextShadow(); + ContextShadow(const QColor& c, float r, qreal dx, qreal dy); + + void clear(); + + // Draws the shadow for colored rectangle (can't be filled with pattern + // or gradient) according to the shadow parameters. + // Note: 'rect' specifies the rectangle which casts the shadow, + // NOT the bounding box of the shadow. + void drawShadowRect(QPainter* p, const QRectF& rect); + +}; + } // namespace WebCore -#endif // CanvasNumberArray_h +#endif // ContextShadow_h diff --git a/WebCore/platform/graphics/qt/FontCacheQt.cpp b/WebCore/platform/graphics/qt/FontCacheQt.cpp index bfcc5c3..c59c523 100644 --- a/WebCore/platform/graphics/qt/FontCacheQt.cpp +++ b/WebCore/platform/graphics/qt/FontCacheQt.cpp @@ -29,10 +29,10 @@ #include "FontPlatformData.h" #include "Font.h" #include "PlatformString.h" -#include "StringHash.h" #include <utility> #include <wtf/ListHashSet.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #include <QFont> diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 273e2dd..d5e7b3f 100644 --- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -512,15 +512,6 @@ void GraphicsContext3D::makeContextCurrent() m_internal->m_glWidget->makeCurrent(); } -void GraphicsContext3D::beginPaint(CanvasRenderingContext* context) -{ - paintRenderingResultsToCanvas(); -} - -void GraphicsContext3D::endPaint() -{ -} - void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context) { m_internal->m_glWidget->makeCurrent(); diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index d4a145f..1632804 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -8,6 +8,7 @@ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> + * Copyright (C) 2010 Sencha, Inc. * * All rights reserved. * @@ -42,6 +43,7 @@ #include "AffineTransform.h" #include "Color.h" +#include "ContextShadow.h" #include "FloatConversion.h" #include "Font.h" #include "GraphicsContextPrivate.h" @@ -50,6 +52,7 @@ #include "Path.h" #include "Pattern.h" #include "Pen.h" +#include "TransparencyLayer.h" #include <QBrush> #include <QDebug> @@ -166,48 +169,6 @@ static inline Qt::FillRule toQtFillRule(WindRule rule) return Qt::OddEvenFill; } -struct TransparencyLayer : FastAllocBase { - TransparencyLayer(const QPainter* p, const QRect &rect, qreal opacity, QPixmap& alphaMask) - : pixmap(rect.width(), rect.height()) - , opacity(opacity) - , alphaMask(alphaMask) - , saveCounter(1) // see the comment for saveCounter - { - offset = rect.topLeft(); - pixmap.fill(Qt::transparent); - painter.begin(&pixmap); - painter.setRenderHint(QPainter::Antialiasing, p->testRenderHint(QPainter::Antialiasing)); - painter.translate(-offset); - painter.setPen(p->pen()); - painter.setBrush(p->brush()); - painter.setTransform(p->transform(), true); - painter.setOpacity(p->opacity()); - painter.setFont(p->font()); - if (painter.paintEngine()->hasFeature(QPaintEngine::PorterDuff)) - painter.setCompositionMode(p->compositionMode()); - // if the path is an empty region, this assignment disables all painting - if (!p->clipPath().isEmpty()) - painter.setClipPath(p->clipPath()); - } - - TransparencyLayer() - { - } - - QPixmap pixmap; - QPoint offset; - QPainter painter; - qreal opacity; - // for clipToImageBuffer - QPixmap alphaMask; - // saveCounter is only used in combination with alphaMask - // otherwise, its value is unspecified - int saveCounter; -private: - TransparencyLayer(const TransparencyLayer &) {} - TransparencyLayer & operator=(const TransparencyLayer &) { return *this; } -}; - class GraphicsContextPlatformPrivate : public Noncopyable { public: GraphicsContextPlatformPrivate(QPainter* painter); @@ -240,6 +201,14 @@ public: // Only used by SVG for now. QPainterPath currentPath; + ContextShadow shadow; + QStack<ContextShadow> shadowStack; + + bool hasShadow() const + { + return shadow.type != ContextShadow::NoShadow; + } + private: QPainter* painter; }; @@ -307,6 +276,7 @@ void GraphicsContext::savePlatformState() if (!m_data->layers.isEmpty() && !m_data->layers.top()->alphaMask.isNull()) ++m_data->layers.top()->saveCounter; m_data->p()->save(); + m_data->shadowStack.push(m_data->shadow); } void GraphicsContext::restorePlatformState() @@ -321,9 +291,16 @@ void GraphicsContext::restorePlatformState() QTransform matrix = m_common->state.pathTransform; m_data->currentPath = m_data->currentPath * matrix; } + + if (m_data->shadowStack.isEmpty()) + m_data->shadow = ContextShadow(); + else + m_data->shadow = m_data->shadowStack.pop(); } // Draws a filled rectangle with a stroked border. +// This is only used to draw borders (real fill is done via fillRect), and +// thus it must not cast any shadow. void GraphicsContext::drawRect(const IntRect& rect) { if (paintingDisabled()) @@ -333,24 +310,13 @@ void GraphicsContext::drawRect(const IntRect& rect) const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); - if (m_common->state.shadowColor.isValid()) { - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - if (getShadow(shadowSize, shadowBlur, shadowColor)) { - IntRect shadowRect = rect; - shadowRect.move(shadowSize.width(), shadowSize.height()); - shadowRect.inflate(static_cast<int>(p->pen().widthF())); - p->fillRect(shadowRect, QColor(shadowColor)); - } - } - p->drawRect(rect); p->setRenderHint(QPainter::Antialiasing, antiAlias); } // This is only used to draw borders. +// Must not cast any shadow. void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) { if (paintingDisabled()) @@ -372,17 +338,6 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); adjustLineToPixelBoundaries(p1, p2, width, style); - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { - p->save(); - p->translate(shadowSize.width(), shadowSize.height()); - p->setPen(shadowColor); - p->drawLine(p1, p2); - p->restore(); - } - int patWidth = 0; switch (style) { case NoStroke: @@ -474,16 +429,14 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, true); - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; startAngle *= 16; angleSpan *= 16; - if (getShadow(shadowSize, shadowBlur, shadowColor)) { + + if (m_data->hasShadow()) { p->save(); - p->translate(shadowSize.width(), shadowSize.height()); + p->translate(m_data->shadow.offset); QPen pen(p->pen()); - pen.setColor(shadowColor); + pen.setColor(m_data->shadow.color); p->setPen(pen); p->drawArc(rect, startAngle, angleSpan); p->restore(); @@ -509,17 +462,14 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points QPainter* p = m_data->p(); p->save(); p->setRenderHint(QPainter::Antialiasing, shouldAntialias); - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - if (getShadow(shadowSize, shadowBlur, shadowColor)) { + if (m_data->hasShadow()) { p->save(); - p->translate(shadowSize.width(), shadowSize.height()); + p->translate(m_data->shadow.offset); if (p->brush().style() != Qt::NoBrush) - p->setBrush(QBrush(shadowColor)); + p->setBrush(QBrush(m_data->shadow.color)); QPen pen(p->pen()); if (pen.style() != Qt::NoPen) { - pen.setColor(shadowColor); + pen.setColor(m_data->shadow.color); p->setPen(pen); } p->drawConvexPolygon(polygon); @@ -553,18 +503,6 @@ QPen GraphicsContext::pen() return p->pen(); } -static void inline drawFilledShadowPath(GraphicsContext* context, QPainter* p, const QPainterPath& path) -{ - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { - p->translate(shadowSize.width(), shadowSize.height()); - p->fillPath(path, QBrush(shadowColor)); - p->translate(-shadowSize.width(), -shadowSize.height()); - } -} - void GraphicsContext::fillPath() { if (paintingDisabled()) @@ -574,7 +512,11 @@ void GraphicsContext::fillPath() QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath path.setFillRule(toQtFillRule(fillRule())); - drawFilledShadowPath(this, p, path); + if (m_data->hasShadow()) { + p->translate(m_data->shadow.offset); + p->fillPath(path, m_data->shadow.color); + p->translate(-m_data->shadow.offset); + } if (m_common->state.fillPattern) { AffineTransform affine; p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine))); @@ -598,16 +540,12 @@ void GraphicsContext::strokePath() QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath path.setFillRule(toQtFillRule(fillRule())); - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - if (getShadow(shadowSize, shadowBlur, shadowColor)) { - QTransform t(p->worldTransform()); - p->translate(shadowSize.width(), shadowSize.height()); + if (m_data->hasShadow()) { + p->translate(m_data->shadow.offset); QPen shadowPen(pen); - shadowPen.setColor(shadowColor); + shadowPen.setColor(m_data->shadow.color); p->strokePath(path, shadowPen); - p->setWorldTransform(t); + p->translate(-m_data->shadow.offset); } if (m_common->state.strokePattern) { AffineTransform affine; @@ -625,18 +563,6 @@ void GraphicsContext::strokePath() m_data->currentPath = QPainterPath(); } -static inline void drawBorderlessRectShadow(GraphicsContext* context, QPainter* p, const FloatRect& rect) -{ - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - if (context->getShadow(shadowSize, shadowBlur, shadowColor)) { - FloatRect shadowRect(rect); - shadowRect.move(shadowSize.width(), shadowSize.height()); - p->fillRect(shadowRect, QColor(shadowColor)); - } -} - 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 @@ -712,22 +638,18 @@ void GraphicsContext::fillRect(const FloatRect& rect) QPainter* p = m_data->p(); FloatRect normalizedRect = rect.normalized(); - FloatSize shadowSize; - float shadowBlur; - Color shadowColor; - bool hasShadow = getShadow(shadowSize, shadowBlur, shadowColor); - FloatRect shadowDestRect; + QRectF shadowDestRect; QImage* shadowImage = 0; QPainter* pShadow = 0; - if (hasShadow) { + if (m_data->hasShadow()) { shadowImage = new QImage(roundedIntSize(normalizedRect.size()), QImage::Format_ARGB32_Premultiplied); pShadow = new QPainter(shadowImage); shadowDestRect = normalizedRect; - shadowDestRect.move(shadowSize.width(), shadowSize.height()); + shadowDestRect.translate(m_data->shadow.offset); pShadow->setCompositionMode(QPainter::CompositionMode_Source); - pShadow->fillRect(shadowImage->rect(), shadowColor); + pShadow->fillRect(shadowImage->rect(), m_data->shadow.color); pShadow->setCompositionMode(QPainter::CompositionMode_DestinationIn); } @@ -737,7 +659,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine)); QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame(); - if (hasShadow) { + if (m_data->hasShadow()) { drawRepeatPattern(pShadow, image, FloatRect(static_cast<QRectF>(shadowImage->rect())), m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY()); pShadow->end(); p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect()); @@ -747,14 +669,14 @@ void GraphicsContext::fillRect(const FloatRect& rect) QBrush brush(*m_common->state.fillGradient->platformGradient()); brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform()); - if (hasShadow) { + if (m_data->hasShadow()) { pShadow->fillRect(shadowImage->rect(), brush); pShadow->end(); p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect()); } p->fillRect(normalizedRect, brush); } else { - if (hasShadow) { + if (m_data->hasShadow()) { pShadow->fillRect(shadowImage->rect(), p->brush()); pShadow->end(); p->drawImage(shadowDestRect, *shadowImage, shadowImage->rect()); @@ -774,8 +696,10 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS m_data->solidColor.setColor(color); QPainter* p = m_data->p(); - if (m_common->state.shadowColor.isValid()) - drawBorderlessRectShadow(this, p, rect); + + if (m_data->hasShadow()) + m_data->shadow.drawShadowRect(p, rect); + p->fillRect(rect, m_data->solidColor); } @@ -786,7 +710,11 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef Path path = Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight); QPainter* p = m_data->p(); - drawFilledShadowPath(this, p, path.platformPath()); + if (m_data->hasShadow()) { + p->translate(m_data->shadow.offset); + p->fillPath(path.platformPath(), m_data->shadow.color); + p->translate(-m_data->shadow.offset); + } p->fillPath(path.platformPath(), QColor(color)); } @@ -928,7 +856,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect) return FloatRect(roundedOrigin, roundedLowerRight - roundedOrigin); } -void GraphicsContext::setPlatformShadow(const FloatSize& size, float, const Color&, ColorSpace) +void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const Color& color, ColorSpace) { // Qt doesn't support shadows natively, they are drawn manually in the draw* // functions @@ -937,13 +865,20 @@ void GraphicsContext::setPlatformShadow(const FloatSize& size, float, const Colo // 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 = FloatSize(size.width(), -size.height()); + m_data->shadow = ContextShadow(color, blur, size.width(), -size.height()); + } else { + m_data->shadow = ContextShadow(color, blur, size.width(), size.height()); } } void GraphicsContext::clearPlatformShadow() { - // Qt doesn't support shadows natively, they are drawn manually in the draw* - // functions + m_data->shadow.clear(); +} + +void GraphicsContext::pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask) +{ + m_data->layers.push(new TransparencyLayer(m_data->p(), m_data->p()->transform().mapRect(rect), 1.0, alphaMask)); } void GraphicsContext::beginTransparencyLayer(float opacity) @@ -1226,23 +1161,6 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) } } -void GraphicsContext::clipToImageBuffer(const FloatRect& floatRect, const ImageBuffer* image) -{ - if (paintingDisabled()) - return; - - QPixmap* nativeImage = image->image()->nativeImageForCurrentFrame(); - if (!nativeImage) - return; - - IntRect rect(floatRect); - QPixmap alphaMask = *nativeImage; - if (alphaMask.width() != rect.width() || alphaMask.height() != rect.height()) - alphaMask = alphaMask.scaled(rect.width(), rect.height()); - - m_data->layers.push(new TransparencyLayer(m_data->p(), m_data->p()->transform().mapRect(rect), 1.0, alphaMask)); -} - void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) { diff --git a/WebCore/platform/graphics/qt/ImageBufferData.h b/WebCore/platform/graphics/qt/ImageBufferData.h index 222dabe..aa32253 100644 --- a/WebCore/platform/graphics/qt/ImageBufferData.h +++ b/WebCore/platform/graphics/qt/ImageBufferData.h @@ -26,6 +26,9 @@ #ifndef ImageBufferData_h #define ImageBufferData_h +#include "Image.h" +#include <wtf/RefPtr.h> + #include <QPainter> #include <QPixmap> @@ -41,6 +44,7 @@ public: QPixmap m_pixmap; OwnPtr<QPainter> m_painter; + RefPtr<Image> m_image; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp index 761a4fe..11ca377 100644 --- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -33,6 +33,7 @@ #include "ImageData.h" #include "MIMETypeRegistry.h" #include "StillImageQt.h" +#include "TransparencyLayer.h" #include <wtf/text/CString.h> #include <QBuffer> @@ -74,6 +75,8 @@ ImageBufferData::ImageBufferData(const IntSize& size) brush.setColor(Qt::black); painter->setBrush(brush); painter->setCompositionMode(QPainter::CompositionMode_SourceOver); + + m_image = StillImage::createForRendering(&m_pixmap); } ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace, bool& success) @@ -98,24 +101,50 @@ GraphicsContext* ImageBuffer::context() const return m_context.get(); } -Image* ImageBuffer::imageForRendering() const +bool ImageBuffer::drawsUsingCopy() const { - if (!m_image) - m_image = StillImage::createForRendering(&m_data.m_pixmap); + return false; +} - return m_image.get(); +PassRefPtr<Image> ImageBuffer::copyImage() const +{ + return StillImage::create(m_data.m_pixmap); } -Image* ImageBuffer::image() const +void ImageBuffer::draw(GraphicsContext* destContext, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, + CompositeOperator op, bool useLowQualityScale) { - if (!m_image) { - // It's assumed that if image() is called, the actual rendering to the - // GraphicsContext must be done. - ASSERT(context()); - m_image = StillImage::create(m_data.m_pixmap); - } + if (destContext == context()) { + // We're drawing into our own buffer. In order for this to work, we need to copy the source buffer first. + RefPtr<Image> copy = copyImage(); + destContext->drawImage(copy.get(), DeviceColorSpace, destRect, srcRect, op, useLowQualityScale); + } else + destContext->drawImage(m_data.m_image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); +} + +void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) +{ + if (destContext == context()) { + // We're drawing into our own buffer. In order for this to work, we need to copy the source buffer first. + RefPtr<Image> copy = copyImage(); + copy->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect); + } else + m_data.m_image->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect); +} + +void ImageBuffer::clip(GraphicsContext* context, const FloatRect& floatRect) const +{ + QPixmap* nativeImage = m_data.m_image->nativeImageForCurrentFrame(); + if (!nativeImage) + return; + + IntRect rect(floatRect); + QPixmap alphaMask = *nativeImage; + if (alphaMask.width() != rect.width() || alphaMask.height() != rect.height()) + alphaMask = alphaMask.scaled(rect.width(), rect.height()); - return m_image.get(); + context->pushTransparencyLayerInternal(rect, 1.0, alphaMask); } void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) diff --git a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index fb3d621..858cc44 100644 --- a/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -78,6 +78,9 @@ 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(); } @@ -186,20 +189,16 @@ void ImageDecoderQt::internalReadImage(size_t frameIndex) bool ImageDecoderQt::internalHandleCurrentImage(size_t frameIndex) { 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) { +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + pixmap = QPixmap::fromImageReader(m_reader.get()); +#else + QImage img; + if (m_reader->read(&img)) + pixmap = QPixmap::fromImage(img); +#endif + + if (pixmap.isNull()) { frameCount(); repetitionCount(); clearPointers(); diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp index 3c6c5aa..08eb816 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp @@ -534,7 +534,11 @@ void MediaPlayerPrivate::aboutToFinish() void MediaPlayerPrivate::totalTimeChanged(qint64 totalTime) { +#if OS(WINDOWS) + LOG(Media, "MediaPlayerPrivatePhonon::totalTimeChanged(%I64d)", totalTime); +#else LOG(Media, "MediaPlayerPrivatePhonon::totalTimeChanged(%lld)", totalTime); +#endif LOG_MEDIAOBJECT(); } diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index 525aaf4..4ad5571 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -25,6 +25,7 @@ #include "GraphicsContext.h" #include "HTMLMediaElement.h" #include "HTMLVideoElement.h" +#include "NotImplemented.h" #include "TimeRanges.h" #include "Widget.h" #include "qwebframe.h" @@ -95,6 +96,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) , m_isSeeking(false) , m_composited(false) , m_queuedSeek(-1) + , m_preload(MediaPlayer::Auto) { m_mediaPlayer->bind(m_videoItem); m_videoScene->addItem(m_videoItem); @@ -106,6 +108,8 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) this, SLOT(stateChanged(QMediaPlayer::State))); connect(m_mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(handleError(QMediaPlayer::Error))); + connect(m_mediaPlayer, SIGNAL(bufferStatusChanged(int)), + this, SLOT(bufferStatusChanged(int))); connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64))); connect(m_mediaPlayer, SIGNAL(positionChanged(qint64)), @@ -145,6 +149,20 @@ bool MediaPlayerPrivate::hasAudio() const void MediaPlayerPrivate::load(const String& url) { + m_mediaUrl = url; + + // QtMultimedia does not have an API to throttle loading + // so we handle this ourselves by delaying the load + if (m_preload == MediaPlayer::None) { + m_delayingLoad = true; + return; + } + + commitLoad(url); +} + +void MediaPlayerPrivate::commitLoad(const String& url) +{ // We are now loading if (m_networkState != MediaPlayer::Loading) { m_networkState = MediaPlayer::Loading; @@ -208,6 +226,21 @@ void MediaPlayerPrivate::load(const String& url) // engine which does. m_mediaPlayer->setMuted(element->muted()); m_mediaPlayer->setVolume(static_cast<int>(element->volume() * 100.0)); + + // Setting a media source will start loading the media, but we need + // to pre-roll as well to get video size-hints and buffer-status + if (element->paused()) + m_mediaPlayer->pause(); + else + m_mediaPlayer->play(); +} + +void MediaPlayerPrivate::resumeLoad() +{ + m_delayingLoad = false; + + if (!m_mediaUrl.isNull()) + commitLoad(m_mediaUrl); } void MediaPlayerPrivate::cancelLoad() @@ -216,6 +249,12 @@ void MediaPlayerPrivate::cancelLoad() updateStates(); } +void MediaPlayerPrivate::prepareToPlay() +{ + if (m_mediaPlayer->media().isNull() || m_delayingLoad) + resumeLoad(); +} + void MediaPlayerPrivate::play() { if (m_mediaPlayer->state() != QMediaPlayer::PlayingState) @@ -322,24 +361,11 @@ float MediaPlayerPrivate::maxTimeSeekable() const unsigned MediaPlayerPrivate::bytesLoaded() const { - unsigned percentage = m_mediaPlayer->bufferStatus(); - - if (percentage == 100) { - if (m_networkState != MediaPlayer::Idle) { - m_networkState = MediaPlayer::Idle; - m_player->networkStateChanged(); - } - if (m_readyState != MediaPlayer::HaveEnoughData) { - m_readyState = MediaPlayer::HaveEnoughData; - m_player->readyStateChanged(); - } - } - QLatin1String bytesLoadedKey("bytes-loaded"); if (m_mediaPlayer->availableExtendedMetaData().contains(bytesLoadedKey)) return m_mediaPlayer->extendedMetaData(bytesLoadedKey).toInt(); - return percentage; + return m_mediaPlayer->bufferStatus(); } unsigned MediaPlayerPrivate::totalBytes() const @@ -350,6 +376,13 @@ unsigned MediaPlayerPrivate::totalBytes() const return 100; } +void MediaPlayerPrivate::setPreload(MediaPlayer::Preload preload) +{ + m_preload = preload; + if (m_delayingLoad && m_preload != MediaPlayer::None) + resumeLoad(); +} + void MediaPlayerPrivate::setRate(float rate) { m_mediaPlayer->setPlaybackRate(rate); @@ -439,6 +472,11 @@ void MediaPlayerPrivate::positionChanged(qint64) } } +void MediaPlayerPrivate::bufferStatusChanged(int) +{ + notImplemented(); +} + void MediaPlayerPrivate::durationChanged(qint64) { m_player->durationChanged(); diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h index d72404c..165efde 100644 --- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h +++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h @@ -50,10 +50,13 @@ public: bool hasAudio() const; void load(const String &url); + void commitLoad(const String& url); + void resumeLoad(); void cancelLoad(); void play(); void pause(); + void prepareToPlay(); bool paused() const; bool seeking() const; @@ -68,6 +71,8 @@ public: bool supportsMuting() const; void setMuted(bool); + void setPreload(MediaPlayer::Preload); + MediaPlayer::NetworkState networkState() const; MediaPlayer::ReadyState readyState() const; @@ -103,6 +108,7 @@ private slots: void seekTimeout(); void positionChanged(qint64); void durationChanged(qint64); + void bufferStatusChanged(int); void volumeChanged(int); void mutedChanged(bool); void repaint(); @@ -127,6 +133,10 @@ private: bool m_isSeeking; bool m_composited; qint64 m_queuedSeek; + MediaPlayer::Preload m_preload; + bool m_delayingLoad; + String m_mediaUrl; + }; } diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp index de9de07..ce5da2e 100644 --- a/WebCore/platform/graphics/qt/PathQt.cpp +++ b/WebCore/platform/graphics/qt/PathQt.cpp @@ -51,6 +51,7 @@ namespace WebCore { Path::Path() + : m_lastMoveToIndex(0) { } @@ -60,12 +61,14 @@ Path::~Path() Path::Path(const Path& other) : m_path(other.m_path) + , m_lastMoveToIndex(other.m_lastMoveToIndex) { } Path& Path::operator=(const Path& other) { m_path = other.m_path; + m_lastMoveToIndex = other.m_lastMoveToIndex; return *this; } @@ -180,6 +183,7 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) void Path::moveTo(const FloatPoint& point) { + m_lastMoveToIndex = m_path.elementCount(); m_path.moveTo(point); } @@ -260,7 +264,26 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) void Path::closeSubpath() { - m_path.closeSubpath(); + const int elementCount = m_path.elementCount(); + + if (!elementCount) + return; + + QPointF lastMoveToPoint = m_path.elementAt(m_lastMoveToIndex); + int elementsInLastSubpath = 0; + + for (int i = m_lastMoveToIndex; i < elementCount; ++i) { + QPainterPath::Element element = m_path.elementAt(i); + if (element.isLineTo() || element.isCurveTo()) { + // All we need to know is if there are 1 or more elements in the last subpath. + if (++elementsInLastSubpath == 2) { + m_path.lineTo(lastMoveToPoint); + return; + } + } + } + + moveTo(lastMoveToPoint); } #define DEGREES(t) ((t) * 180.0 / M_PI) @@ -440,7 +463,7 @@ void Path::transform(const AffineTransform& transform) // QTransform.map doesn't handle the MoveTo element because of the isEmpty issue if (m_path.isEmpty() && m_path.elementCount()) { QPointF point = qTransform.map(m_path.currentPosition()); - m_path.moveTo(point); + moveTo(point); } else #endif m_path = qTransform.map(m_path); diff --git a/WebCore/platform/graphics/qt/TransparencyLayer.h b/WebCore/platform/graphics/qt/TransparencyLayer.h new file mode 100644 index 0000000..0d9c121 --- /dev/null +++ b/WebCore/platform/graphics/qt/TransparencyLayer.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> + * Copyright (C) 2006 Allan Sandfeld Jensen <sandfeld@kde.org> + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> + * + * 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 TransparencyLayer_h +#define TransparencyLayer_h + +#include <QPaintEngine> +#include <QPainter> +#include <QPixmap> + +namespace WebCore { + +struct TransparencyLayer : FastAllocBase { + TransparencyLayer(const QPainter* p, const QRect &rect, qreal opacity, QPixmap& alphaMask) + : pixmap(rect.width(), rect.height()) + , opacity(opacity) + , alphaMask(alphaMask) + , saveCounter(1) // see the comment for saveCounter + { + offset = rect.topLeft(); + pixmap.fill(Qt::transparent); + painter.begin(&pixmap); + painter.setRenderHint(QPainter::Antialiasing, p->testRenderHint(QPainter::Antialiasing)); + painter.translate(-offset); + painter.setPen(p->pen()); + painter.setBrush(p->brush()); + painter.setTransform(p->transform(), true); + painter.setOpacity(p->opacity()); + painter.setFont(p->font()); + if (painter.paintEngine()->hasFeature(QPaintEngine::PorterDuff)) + painter.setCompositionMode(p->compositionMode()); + // if the path is an empty region, this assignment disables all painting + if (!p->clipPath().isEmpty()) + painter.setClipPath(p->clipPath()); + } + + TransparencyLayer() + { + } + + QPixmap pixmap; + QPoint offset; + QPainter painter; + qreal opacity; + // for clipToImageBuffer + QPixmap alphaMask; + // saveCounter is only used in combination with alphaMask + // otherwise, its value is unspecified + int saveCounter; +private: + TransparencyLayer(const TransparencyLayer &) {} + TransparencyLayer & operator=(const TransparencyLayer &) { return *this; } +}; + +} // namespace WebCore + +#endif // TransparencyLayer_h diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 7bcd84b..fe7f6ce 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -53,6 +53,7 @@ #include <math.h> #include <wtf/Assertions.h> #include <wtf/MathExtras.h> +#include <wtf/UnusedParam.h> #if USE(GLES2_RENDERING) #include "GLES2Canvas.h" @@ -455,17 +456,6 @@ void GraphicsContext::clipPath(WindRule clipRule) platformContext()->clipPathAntiAliased(path); } -void GraphicsContext::clipToImageBuffer(const FloatRect& rect, - const ImageBuffer* imageBuffer) -{ - if (paintingDisabled()) - return; - -#if OS(LINUX) || OS(WINDOWS) - platformContext()->beginLayerClippedToImage(rect, imageBuffer); -#endif -} - void GraphicsContext::concatCTM(const AffineTransform& affine) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index eaa91ec..a63eec5 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -87,20 +87,35 @@ GraphicsContext* ImageBuffer::context() const return m_context.get(); } -Image* ImageBuffer::image() const +bool ImageBuffer::drawsUsingCopy() const { - if (!m_image) { - // This creates a COPY of the image and will cache that copy. This means - // that if subsequent operations take place on the context, neither the - // currently-returned image, nor the results of future image() calls, - // will contain that operation. - // - // This seems silly, but is the way the CG port works: image() is - // intended to be used only when rendering is "complete." - m_image = BitmapImageSingleFrameSkia::create( - *m_data.m_platformContext.bitmap()); - } - return m_image.get(); + return true; +} + +PassRefPtr<Image> ImageBuffer::copyImage() const +{ + return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap()); +} + +void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const +{ +#if OS(LINUX) || OS(WINDOWS) + context->platformContext()->beginLayerClippedToImage(rect, this); +#endif +} + +void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, + CompositeOperator op, bool useLowQualityScale) +{ + RefPtr<Image> imageCopy = copyImage(); + context->drawImage(imageCopy.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); +} + +void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) +{ + RefPtr<Image> imageCopy = copyImage(); + imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect); } void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp index 024bf50..b514b1a 100644 --- a/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -465,18 +465,18 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, if (!bm) return; // It's too early and we don't have an image yet. -#if USE(GLES2_RENDERING) - if (ctxt->platformContext()->useGPU()) { - drawBitmapGLES2(ctxt, bm, srcRect, dstRect, colorSpace, compositeOp); - return; - } -#endif FloatRect normDstRect = normalizeRect(dstRect); FloatRect normSrcRect = normalizeRect(srcRect); if (normSrcRect.isEmpty() || normDstRect.isEmpty()) return; // Nothing to draw. +#if USE(GLES2_RENDERING) + if (ctxt->platformContext()->useGPU()) { + drawBitmapGLES2(ctxt, bm, normSrcRect, normDstRect, colorSpace, compositeOp); + return; + } +#endif ctxt->platformContext()->prepareForSoftwareDraw(); paintSkBitmap(ctxt->platformContext(), diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index abf04f9..1161224 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -39,6 +39,7 @@ #include "NativeImageSkia.h" #include "PlatformContextSkia.h" #include "SkiaUtils.h" +#include "TilingData.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" @@ -706,6 +707,7 @@ void PlatformContextSkia::setGraphicsContext3D(GraphicsContext3D* context, const { m_useGPU = true; m_gpuCanvas = new GLES2Canvas(context, size); + m_uploadTexture.clear(); #if USE(ACCELERATED_COMPOSITING) CanvasLayerChromium* layer = static_cast<CanvasLayerChromium*>(context->platformLayer()); layer->setPrepareTextureCallback(PrepareTextureCallbackImpl::create(this)); @@ -791,13 +793,13 @@ void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const { const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); SkAutoLockPixels lock(bitmap); - // FIXME: Keep a texture around for this rather than constantly creating/destroying one. GraphicsContext3D* context = m_gpuCanvas->context(); - RefPtr<GLES2Texture> texture = GLES2Texture::create(context, GLES2Texture::BGRA8, bitmap.width(), bitmap.height()); - texture->load(bitmap.getPixels()); + if (!m_uploadTexture || m_uploadTexture->tiles().totalSizeX() < bitmap.width() || m_uploadTexture->tiles().totalSizeY() < bitmap.height()) + m_uploadTexture = GLES2Texture::create(context, GLES2Texture::BGRA8, bitmap.width(), bitmap.height()); + m_uploadTexture->load(bitmap.getPixels()); IntRect rect(0, 0, bitmap.width(), bitmap.height()); AffineTransform identity; - gpuCanvas()->drawTexturedRect(texture.get(), rect, rect, identity, 1.0, DeviceColorSpace, op); + gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), rect, rect, identity, 1.0, DeviceColorSpace, op); } void PlatformContextSkia::readbackHardwareToSoftware() const @@ -810,11 +812,15 @@ void PlatformContextSkia::readbackHardwareToSoftware() const // Flips the image vertically. for (int y = 0; y < height; ++y) { uint32_t* pixels = bitmap.getAddr32(0, y); - context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels); - for (int i = 0; i < width; ++i) { - uint32_t pixel = pixels[i]; - // Swizzles from RGBA -> BGRA. - pixels[i] = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); + if (context->supportsBGRA()) + context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::BGRA_EXT, GraphicsContext3D::UNSIGNED_BYTE, pixels); + else { + context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels); + for (int i = 0; i < width; ++i) { + uint32_t pixel = pixels[i]; + // Swizzles from RGBA -> BGRA. + pixels[i] = pixel & 0xFF00FF00 | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16); + } } } } diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.h b/WebCore/platform/graphics/skia/PlatformContextSkia.h index ff80d1b..6c84797 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -48,6 +48,7 @@ namespace WebCore { #if USE(GLES2_RENDERING) enum CompositeOperator; class GLES2Canvas; +class GLES2Texture; class GraphicsContext3D; #endif @@ -240,6 +241,7 @@ private: bool m_useGPU; OwnPtr<GLES2Canvas> m_gpuCanvas; mutable enum { None, Software, Mixed, Hardware } m_backingStoreState; + mutable RefPtr<GLES2Texture> m_uploadTexture; #endif }; diff --git a/WebCore/platform/graphics/win/FontCacheWin.cpp b/WebCore/platform/graphics/win/FontCacheWin.cpp index d050243..2240f80 100644 --- a/WebCore/platform/graphics/win/FontCacheWin.cpp +++ b/WebCore/platform/graphics/win/FontCacheWin.cpp @@ -31,11 +31,11 @@ #include "FontCache.h" #include "Font.h" #include "SimpleFontData.h" -#include "StringHash.h" #include "UnicodeRange.h" #include <mlang.h> #include <windows.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if PLATFORM(CG) #include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> diff --git a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp index a804432..9234229 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp @@ -25,12 +25,12 @@ #include "FontPlatformData.h" #include "PlatformString.h" -#include "StringHash.h" #include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/HashMap.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> using std::min; diff --git a/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp index 9b916bd..0f5c365 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp @@ -27,10 +27,10 @@ #include "FontPlatformData.h" #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> #include <cairo-win32.h> diff --git a/WebCore/platform/graphics/win/FontPlatformDataWin.cpp b/WebCore/platform/graphics/win/FontPlatformDataWin.cpp index 99f364c..09ed4a6 100644 --- a/WebCore/platform/graphics/win/FontPlatformDataWin.cpp +++ b/WebCore/platform/graphics/win/FontPlatformDataWin.cpp @@ -26,10 +26,10 @@ #include "FontPlatformData.h" #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> using std::min; diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp index e0ecf78..9bc68d1 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp @@ -43,7 +43,6 @@ #include "Settings.h" #include "SoftLinking.h" #include "StringBuilder.h" -#include "StringHash.h" #include "TimeRanges.h" #include "Timer.h" #include <AssertMacros.h> @@ -54,6 +53,7 @@ #include <wtf/MainThread.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerCACF.h" diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp index 69aaeaf..34f1135 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp @@ -39,7 +39,6 @@ #include "ScrollView.h" #include "SoftLinking.h" #include "StringBuilder.h" -#include "StringHash.h" #include "TimeRanges.h" #include "Timer.h" #include <Wininet.h> @@ -47,6 +46,7 @@ #include <wtf/HashSet.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerCACF.h" diff --git a/WebCore/platform/graphics/win/WKCACFLayer.h b/WebCore/platform/graphics/win/WKCACFLayer.h index ed39297..abc04c8 100644 --- a/WebCore/platform/graphics/win/WKCACFLayer.h +++ b/WebCore/platform/graphics/win/WKCACFLayer.h @@ -28,8 +28,6 @@ #if USE(ACCELERATED_COMPOSITING) -#include "StringHash.h" - #include <wtf/RefCounted.h> #include <QuartzCore/CACFLayer.h> @@ -37,6 +35,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> #include "GraphicsContext.h" #include "PlatformString.h" diff --git a/WebCore/platform/graphics/wince/FontPlatformData.cpp b/WebCore/platform/graphics/wince/FontPlatformData.cpp index 74cadc2..d84a7cc 100644 --- a/WebCore/platform/graphics/wince/FontPlatformData.cpp +++ b/WebCore/platform/graphics/wince/FontPlatformData.cpp @@ -26,10 +26,10 @@ #include "FontData.h" #include "PlatformString.h" #include "SimpleFontData.h" -#include "StringHash.h" #include "UnicodeRange.h" #include "wtf/OwnPtr.h" #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #include <windows.h> #include <mlang.h> diff --git a/WebCore/platform/graphics/wince/PathWince.cpp b/WebCore/platform/graphics/wince/PathWince.cpp index 747e650..6aa2864 100644 --- a/WebCore/platform/graphics/wince/PathWince.cpp +++ b/WebCore/platform/graphics/wince/PathWince.cpp @@ -160,11 +160,9 @@ bool Path::hasCurrentPoint() const return !isEmpty(); } -FloatPoint Path::currentPoint() const +FloatPoint Path::currentPoint() const { - // FIXME: return current point of subpath. - float quietNaN = std::numeric_limits<float>::quiet_NaN(); - return FloatPoint(quietNaN, quietNaN); + return m_path->lastPoint(); } -} +} // namespace WebCore diff --git a/WebCore/platform/graphics/wx/FontPlatformData.h b/WebCore/platform/graphics/wx/FontPlatformData.h index 4f8d740..b328545 100644 --- a/WebCore/platform/graphics/wx/FontPlatformData.h +++ b/WebCore/platform/graphics/wx/FontPlatformData.h @@ -30,10 +30,10 @@ #define FontPlatformData_h #include "FontDescription.h" -#include "AtomicString.h" #include "StringImpl.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicString.h> #include <wtf/text/CString.h> #include <wx/defs.h> diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 4d5afd7..2428e7e 100644 --- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -378,11 +378,6 @@ void GraphicsContext::canvasClip(const Path& path) clip(path); } -void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) -{ - notImplemented(); -} - AffineTransform GraphicsContext::getCTM() const { #if USE(WXGC) diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp index 775e018..2522cbd 100644 --- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -82,12 +82,36 @@ String ImageBuffer::toDataURL(const String&, const double*) const return String(); } -Image* ImageBuffer::image() const +bool ImageBuffer::drawsUsingCopy() const +{ + return true; +} + +PassRefPtr<Image> ImageBuffer::copyImage() const { notImplemented(); return 0; } +void ImageBuffer::clip(GraphicsContext*, const FloatRect&) const +{ + notImplemented(); +} + +void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, + CompositeOperator op, bool useLowQualityScale) +{ + RefPtr<Image> imageCopy = copyImage(); + context->drawImage(imageCopy.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale); +} + +void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, + const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) +{ + RefPtr<Image> imageCopy = copyImage(); + imageCopy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect); +} + void ImageBuffer::platformTransformColorSpace(const Vector<int>&) { notImplemented(); diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index 7003cf0..21ebe4c 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -30,9 +30,9 @@ #include "PasteboardHelper.h" #include "RenderImage.h" #include "ScriptExecutionContext.h" -#include "StringHash.h" #include "markup.h" #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> #include <gtk/gtk.h> namespace WebCore { diff --git a/WebCore/platform/gtk/DataObjectGtk.h b/WebCore/platform/gtk/DataObjectGtk.h index 8fba938..a7d8baf 100644 --- a/WebCore/platform/gtk/DataObjectGtk.h +++ b/WebCore/platform/gtk/DataObjectGtk.h @@ -23,9 +23,9 @@ #include <GRefPtr.h> #include "KURL.h" #include "Range.h" -#include "StringHash.h" #include <wtf/RefCounted.h> #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> typedef struct _GdkPixbuf GdkPixbuf; typedef struct _GdkDragContext GdkDragContext; diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp index 0558f33..9b693f4 100644 --- a/WebCore/platform/gtk/GOwnPtrGtk.cpp +++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp @@ -19,8 +19,7 @@ #include "config.h" #include "GOwnPtrGtk.h" -#include <gdk/gdk.h> -#include <glib.h> +#include <gtk/gtk.h> namespace WTF { @@ -30,4 +29,10 @@ template <> void freeOwnedGPtr<GdkEvent>(GdkEvent* ptr) gdk_event_free(ptr); } +template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo* info) +{ + if (info) + gtk_icon_info_free(info); +} + } diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h index 674ea58..8341661 100644 --- a/WebCore/platform/gtk/GOwnPtrGtk.h +++ b/WebCore/platform/gtk/GOwnPtrGtk.h @@ -23,10 +23,12 @@ #include "GOwnPtr.h" typedef union _GdkEvent GdkEvent; +typedef struct _GtkIconInfo GtkIconInfo; namespace WTF { -template<> void freeOwnedGPtr<GdkEvent>(GdkEvent*); +template <> void freeOwnedGPtr<GdkEvent>(GdkEvent*); +template <> void freeOwnedGPtr<GtkIconInfo>(GtkIconInfo*); } diff --git a/WebCore/platform/gtk/GtkVersioning.cpp b/WebCore/platform/gtk/GtkVersioning.cpp new file mode 100644 index 0000000..e7734a8 --- /dev/null +++ b/WebCore/platform/gtk/GtkVersioning.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Collabora Ltd. + * + * 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 "GtkVersioning.h" + +#include <gtk/gtk.h> + +#if !GTK_CHECK_VERSION(2, 14, 0) +void gtk_adjustment_set_value(GtkAdjustment* adjusment, gdouble value) +{ + m_adjustment->value = m_currentPos; + gtk_adjustment_value_changed(m_adjustment); +} + +void gtk_adjustment_configure(GtkAdjustment* adjustment, gdouble value, gdouble lower, gdouble upper, + gdouble stepIncrement, gdouble pageIncrement, gdouble pageSize) +{ + g_object_freeze_notify(G_OBJECT(adjustment)); + + g_object_set(adjustment, + "lower", lower, + "upper", upper, + "step-increment", stepIncrement, + "page-increment", pageIncrement, + "page-size", pageSize, + NULL); + + g_object_thaw_notify(G_OBJECT(adjustment)); + + gtk_adjustment_changed(adjustment); + gtk_adjustment_value_changed(adjustment); +} +#endif diff --git a/WebCore/platform/gtk/GtkVersioning.h b/WebCore/platform/gtk/GtkVersioning.h index ebb1645..6b45228 100644 --- a/WebCore/platform/gtk/GtkVersioning.h +++ b/WebCore/platform/gtk/GtkVersioning.h @@ -58,6 +58,11 @@ #define gtk_selection_data_get_data(data) (data)->data #define gtk_selection_data_get_target(data) (data)->target #define gtk_adjustment_set_page_size(adj, value) (adj)->page_size = value + +void gtk_adjustment_configure(GtkAdjustment* adjustment, gdouble value, gdouble lower, gdouble upper, + gdouble stepIncrement, gdouble pageIncrement, gdouble pageSize); + +void gtk_adjustment_set_value(GtkAdjustment* adjusment, gdouble value); #endif // GTK_CHECK_VERSION(2, 14, 0) #endif // GtkVersioning_h diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index bc0d147..36fccf0 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -485,7 +485,7 @@ void RenderThemeGtk::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* selec bool RenderThemeGtk::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) { - return paintMozillaGtkWidget(this, MOZ_GTK_DROPDOWN_ARROW, o, i, rect); + return paintSearchFieldResultsDecoration(o, i, rect); } void RenderThemeGtk::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const @@ -501,7 +501,12 @@ void RenderThemeGtk::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* s bool RenderThemeGtk::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& i, const IntRect& rect) { - return paintMozillaGtkWidget(this, MOZ_GTK_CHECKMENUITEM, o, i, rect); + GraphicsContext* context = i.context; + + static Image* searchImage = Image::loadPlatformThemeIcon(GTK_STOCK_FIND, rect.width()).releaseRef(); + context->drawImage(searchImage, DeviceColorSpace, rect); + + return false; } void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const @@ -517,7 +522,13 @@ void RenderThemeGtk::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* select bool RenderThemeGtk::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) { - return paintMozillaGtkWidget(this, MOZ_GTK_CHECKMENUITEM, o, i, rect); + GraphicsContext* context = i.context; + + // TODO: Brightening up the image on hover is desirable here, I believe. + static Image* cancelImage = Image::loadPlatformThemeIcon(GTK_STOCK_CLEAR, rect.width()).releaseRef(); + context->drawImage(cancelImage, DeviceColorSpace, rect); + + return false; } void RenderThemeGtk::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp index e705fe0..871a0bf 100644 --- a/WebCore/platform/gtk/ScrollViewGtk.cpp +++ b/WebCore/platform/gtk/ScrollViewGtk.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "GtkVersioning.h" #include "HostWindow.h" #include "IntRect.h" #include "Page.h" @@ -72,29 +73,6 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati return Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar); } -#if !GTK_CHECK_VERSION(2, 14, 0) -#define gtk_adjustment_configure AdjustmentConfigure - -static void AdjustmentConfigure(GtkAdjustment* adjustment, gdouble value, gdouble lower, gdouble upper, - gdouble stepIncrement, gdouble pageIncrement, gdouble pageSize) -{ - g_object_freeze_notify(G_OBJECT(adjustment)); - - g_object_set(adjustment, - "lower", lower, - "upper", upper, - "step-increment", stepIncrement, - "page-increment", pageIncrement, - "page-size", pageSize, - NULL); - - g_object_thaw_notify(G_OBJECT(adjustment)); - - gtk_adjustment_changed(adjustment); - gtk_adjustment_value_changed(adjustment); -} -#endif - /* * The following is assumed: * (hadj && vadj) || (!hadj && !vadj) diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp index 8081fb8..3b86ec9 100644 --- a/WebCore/platform/gtk/ScrollbarGtk.cpp +++ b/WebCore/platform/gtk/ScrollbarGtk.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2007, 2009 Holger Hans Peter Freyther zecke@selfish.org * Copyright (C) 2010 Gustavo Noronha Silva <gns@gnome.org> + * Copyright (C) 2010 Collabora Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +21,10 @@ #include "config.h" #include "ScrollbarGtk.h" +#include "FrameView.h" +#include "GraphicsContext.h" #include "GtkVersioning.h" #include "IntRect.h" -#include "GraphicsContext.h" -#include "FrameView.h" #include "ScrollbarTheme.h" #include <gtk/gtk.h> @@ -120,15 +121,8 @@ 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; } @@ -162,19 +156,12 @@ void ScrollbarGtk::frameRectsChanged() void ScrollbarGtk::updateThumbPosition() { - if (gtk_adjustment_get_value(m_adjustment) != m_currentPos) { -#if GTK_CHECK_VERSION(2, 14, 0) + if (gtk_adjustment_get_value(m_adjustment) != m_currentPos) 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), @@ -182,13 +169,6 @@ void ScrollbarGtk::updateThumbProportion() 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/gtk/SharedTimerGtk.cpp b/WebCore/platform/gtk/SharedTimerGtk.cpp index 092df95..ee4d75b 100644 --- a/WebCore/platform/gtk/SharedTimerGtk.cpp +++ b/WebCore/platform/gtk/SharedTimerGtk.cpp @@ -30,6 +30,7 @@ #include <wtf/Assertions.h> #include <wtf/CurrentTime.h> +#include <gdk/gdk.h> #include <glib.h> namespace WebCore { @@ -63,7 +64,7 @@ void setSharedTimerFireTime(double fireTime) } stopSharedTimer(); - sharedTimer = g_timeout_add(intervalInMS, timeout_cb, NULL); + sharedTimer = g_timeout_add_full(GDK_PRIORITY_REDRAW, intervalInMS, timeout_cb, 0, 0); } void stopSharedTimer() diff --git a/WebCore/platform/haiku/ClipboardHaiku.cpp b/WebCore/platform/haiku/ClipboardHaiku.cpp index 9931131..da242c1 100644 --- a/WebCore/platform/haiku/ClipboardHaiku.cpp +++ b/WebCore/platform/haiku/ClipboardHaiku.cpp @@ -31,13 +31,13 @@ #include "IntPoint.h" #include "NotImplemented.h" #include "PlatformString.h" -#include "StringHash.h" #include <support/Locker.h> #include <app/Clipboard.h> #include <Message.h> #include <String.h> #include <wtf/HashTable.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/haiku/CookieJarHaiku.cpp b/WebCore/platform/haiku/CookieJarHaiku.cpp index f619f00..471ac59 100644 --- a/WebCore/platform/haiku/CookieJarHaiku.cpp +++ b/WebCore/platform/haiku/CookieJarHaiku.cpp @@ -32,9 +32,8 @@ #include "Cookie.h" #include "KURL.h" #include "PlatformString.h" -#include "StringHash.h" - #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp index 109409a..ea73c61 100644 --- a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp +++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp @@ -21,8 +21,8 @@ #include "config.h" #include "SearchPopupMenuHaiku.h" -#include "AtomicString.h" #include "NotImplemented.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/platform/mac/DragImageMac.mm b/WebCore/platform/mac/DragImageMac.mm index 7b51018..f444b6e 100644 --- a/WebCore/platform/mac/DragImageMac.mm +++ b/WebCore/platform/mac/DragImageMac.mm @@ -87,9 +87,9 @@ RetainPtr<NSImage> createDragImageIconForCachedImage(CachedImage* image) { const String& filename = image->response().suggestedFilename(); NSString *extension = nil; - int dotIndex = filename.reverseFind('.'); + size_t dotIndex = filename.reverseFind('.'); - if (dotIndex > 0 && dotIndex < (int)(filename.length() - 1)) // require that a . exists after the first character and before the last + if (dotIndex != notFound && dotIndex < (filename.length() - 1)) // require that a . exists after the first character and before the last extension = filename.substring(dotIndex + 1); else { // It might be worth doing a further lookup to pull the extension from the MIME type. diff --git a/WebCore/platform/mac/ScrollbarThemeMac.mm b/WebCore/platform/mac/ScrollbarThemeMac.mm index 067f28f..bfa584a 100644 --- a/WebCore/platform/mac/ScrollbarThemeMac.mm +++ b/WebCore/platform/mac/ScrollbarThemeMac.mm @@ -396,7 +396,7 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co return true; HIThemeDrawTrack(&trackInfo, 0, imageBuffer->context()->platformContext(), kHIThemeOrientationNormal); - context->drawImage(imageBuffer->image(), DeviceColorSpace, scrollbar->frameRect().location()); + context->drawImageBuffer(imageBuffer.get(), DeviceColorSpace, scrollbar->frameRect().location()); } return true; diff --git a/WebCore/platform/mac/SearchPopupMenuMac.mm b/WebCore/platform/mac/SearchPopupMenuMac.mm index 69018ee..47d6e57 100644 --- a/WebCore/platform/mac/SearchPopupMenuMac.mm +++ b/WebCore/platform/mac/SearchPopupMenuMac.mm @@ -21,7 +21,7 @@ #import "config.h" #import "SearchPopupMenuMac.h" -#import "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/platform/mac/ThreadCheck.mm b/WebCore/platform/mac/ThreadCheck.mm index ddee05c..4792191 100644 --- a/WebCore/platform/mac/ThreadCheck.mm +++ b/WebCore/platform/mac/ThreadCheck.mm @@ -26,9 +26,9 @@ #import "config.h" #import "ThreadCheck.h" -#import "StringHash.h" #import <wtf/HashSet.h> #import <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/mock/SpeechInputClientMock.cpp b/WebCore/platform/mock/SpeechInputClientMock.cpp index 74a3151..c3d74d1 100644 --- a/WebCore/platform/mock/SpeechInputClientMock.cpp +++ b/WebCore/platform/mock/SpeechInputClientMock.cpp @@ -41,34 +41,42 @@ SpeechInputClientMock::SpeechInputClientMock() : m_recording(false) , m_timer(this, &SpeechInputClientMock::timerFired) , m_listener(0) + , m_requestId(0) { } -bool SpeechInputClientMock::startRecognition(SpeechInputListener* listener) +void SpeechInputClientMock::setListener(SpeechInputListener* listener) +{ + m_listener = listener; +} + +bool SpeechInputClientMock::startRecognition(int requestId) { if (m_timer.isActive()) return false; - m_listener = listener; + m_requestId = requestId; m_recording = true; m_timer.startOneShot(0); return true; } -void SpeechInputClientMock::stopRecording() +void SpeechInputClientMock::stopRecording(int requestId) { + ASSERT(requestId == m_requestId); if (m_timer.isActive() && m_recording) { m_timer.stop(); timerFired(&m_timer); } } -void SpeechInputClientMock::cancelRecognition() +void SpeechInputClientMock::cancelRecognition(int requestId) { + ASSERT(requestId == m_requestId); if (m_timer.isActive()) { m_timer.stop(); m_recording = false; - m_listener->didCompleteRecognition(); - m_listener = 0; + m_listener->didCompleteRecognition(m_requestId); + m_requestId = 0; } } @@ -81,12 +89,12 @@ void SpeechInputClientMock::timerFired(WebCore::Timer<SpeechInputClientMock>*) { if (m_recording) { m_recording = false; - m_listener->didCompleteRecording(); + m_listener->didCompleteRecording(m_requestId); m_timer.startOneShot(0); } else { - m_listener->setRecognitionResult(m_recognitionResult); - m_listener->didCompleteRecognition(); - m_listener = 0; + m_listener->setRecognitionResult(m_requestId, m_recognitionResult); + m_listener->didCompleteRecognition(m_requestId); + m_requestId = 0; } } diff --git a/WebCore/platform/mock/SpeechInputClientMock.h b/WebCore/platform/mock/SpeechInputClientMock.h index faca444..7d5fda2 100644 --- a/WebCore/platform/mock/SpeechInputClientMock.h +++ b/WebCore/platform/mock/SpeechInputClientMock.h @@ -49,9 +49,10 @@ public: void setRecognitionResult(const String& result); // SpeechInputClient methods. - bool startRecognition(SpeechInputListener*); - void stopRecording(); - void cancelRecognition(); + void setListener(SpeechInputListener*); + bool startRecognition(int); + void stopRecording(int); + void cancelRecognition(int); private: void timerFired(Timer<SpeechInputClientMock>*); @@ -59,6 +60,7 @@ private: bool m_recording; Timer<SpeechInputClientMock> m_timer; SpeechInputListener* m_listener; + int m_requestId; String m_recognitionResult; }; diff --git a/WebCore/platform/network/BlobData.cpp b/WebCore/platform/network/BlobData.cpp new file mode 100644 index 0000000..bb256d0 --- /dev/null +++ b/WebCore/platform/network/BlobData.cpp @@ -0,0 +1,87 @@ +/* + * 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 "BlobData.h" + +namespace WebCore { + +const long long BlobDataItem::toEndOfFile = -1; +const double BlobDataItem::doNotCheckFileChange = 0; + +void BlobDataItem::copy(const BlobDataItem& item) +{ + type = item.type; + data = item.data; // This is OK because the underlying storage is Vector<char>. + path = item.path.crossThreadString(); + url = item.url.copy(); + offset = item.offset; + length = item.length; + expectedModificationTime = item.expectedModificationTime; +} + +PassOwnPtr<BlobData> BlobData::copy() const +{ + OwnPtr<BlobData> blobData = adoptPtr(new BlobData()); + blobData->m_contentType = m_contentType.crossThreadString(); + blobData->m_contentDisposition = m_contentDisposition.crossThreadString(); + blobData->m_items.resize(m_items.size()); + for (size_t i = 0; i < m_items.size(); ++i) + blobData->m_items.at(i).copy(m_items.at(i)); + + return blobData.release(); +} + +void BlobData::appendData(const CString& data) +{ + m_items.append(BlobDataItem(data)); +} + +void BlobData::appendFile(const String& path) +{ + m_items.append(BlobDataItem(path)); +} + +void BlobData::appendFile(const String& path, long long offset, long long length, double expectedModificationTime) +{ + m_items.append(BlobDataItem(path, offset, length, expectedModificationTime)); +} + +void BlobData::appendBlob(const KURL& url, long long offset, long long length) +{ + m_items.append(BlobDataItem(url, offset, length)); +} + +void BlobData::swapItems(BlobDataItemList& items) +{ + m_items.swap(items); +} + +} // namespace WebCore diff --git a/WebCore/platform/network/BlobData.h b/WebCore/platform/network/BlobData.h new file mode 100644 index 0000000..17cdfdd --- /dev/null +++ b/WebCore/platform/network/BlobData.h @@ -0,0 +1,152 @@ +/* + * 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 BlobData_h +#define BlobData_h + +#include "KURL.h" +#include "PlatformString.h" +#include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +struct BlobDataItem { + static const long long toEndOfFile; + static const double doNotCheckFileChange; + + // Default constructor. + BlobDataItem() + : offset(0) + , length(toEndOfFile) + , expectedModificationTime(doNotCheckFileChange) + { + } + + // Constructor for String type. + BlobDataItem(const CString& data) + : type(Data) + , data(data) + , offset(0) + , length(toEndOfFile) + , expectedModificationTime(doNotCheckFileChange) + { + } + + // Constructor for File type (complete file). + BlobDataItem(const String& path) + : type(File) + , path(path) + , offset(0) + , length(toEndOfFile) + , expectedModificationTime(doNotCheckFileChange) + { + } + + // Constructor for File type (partial file). + BlobDataItem(const String& path, long long offset, long long length, double expectedModificationTime) + : type(File) + , path(path) + , offset(offset) + , length(length) + , expectedModificationTime(expectedModificationTime) + { + } + + // Constructor for Blob type. + BlobDataItem(const KURL& url, long long offset, long long length) + : type(Blob) + , url(url) + , offset(offset) + , length(length) + , expectedModificationTime(doNotCheckFileChange) + { + } + + // Gets a copy of the data suitable for passing to another thread. + void copy(const BlobDataItem&); + + enum { Data, File, Blob } type; + + // For Data type. + CString data; + + // For File type. + String path; + + // For Blob type. + KURL url; + + // For File and Blob type. + long long offset; + long long length; + + // For File type only. + double expectedModificationTime; +}; + +typedef Vector<BlobDataItem> BlobDataItemList; + +class BlobData { +public: + static PassOwnPtr<BlobData> create() + { + return adoptPtr(new BlobData()); + } + + // Gets a copy of the data suitable for passing to another thread. + PassOwnPtr<BlobData> copy() const; + + const String& contentType() const { return m_contentType; } + void setContentType(const String& contentType) { m_contentType = contentType; } + + const String& contentDisposition() const { return m_contentDisposition; } + void setContentDisposition(const String& contentDisposition) { m_contentDisposition = contentDisposition; } + + const BlobDataItemList& items() const { return m_items; } + void swapItems(BlobDataItemList&); + + void appendData(const CString&); + void appendFile(const String& path); + void appendFile(const String& path, long long offset, long long length, double expectedModificationTime); + void appendBlob(const KURL&, long long offset, long long length); + +private: + BlobData() { } + + String m_contentType; + String m_contentDisposition; + BlobDataItemList m_items; +}; + +} // namespace WebCore + +#endif // BlobData_h diff --git a/WebCore/platform/network/BlobRegistry.h b/WebCore/platform/network/BlobRegistry.h new file mode 100644 index 0000000..fcd7b1c --- /dev/null +++ b/WebCore/platform/network/BlobRegistry.h @@ -0,0 +1,64 @@ +/* + * 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 BlobRegistry_h +#define BlobRegistry_h + +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + +class BlobData; +class KURL; +class ResourceError; +class ResourceHandle; +class ResourceHandleClient; +class ResourceRequest; +class ResourceResponse; + +// BlobRegistry is not thread-safe. It should only be called from main thread. +class BlobRegistry { +public: + static BlobRegistry& instance(); + + virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>) = 0; + virtual void registerBlobURL(const KURL&, const KURL& srcURL) = 0; + virtual void unregisterBlobURL(const KURL&) = 0; + virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*) = 0; + virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) = 0; + + virtual ~BlobRegistry() { } +}; + +} // namespace WebCore + +#endif // BlobRegistry_h diff --git a/WebCore/platform/network/BlobRegistryImpl.cpp b/WebCore/platform/network/BlobRegistryImpl.cpp new file mode 100644 index 0000000..bbbb8f0 --- /dev/null +++ b/WebCore/platform/network/BlobRegistryImpl.cpp @@ -0,0 +1,177 @@ +/* + * 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 "BlobRegistryImpl.h" + +#include "FileStream.h" +#include "FileStreamProxy.h" +#include "FileSystem.h" +#include "ResourceError.h" +#include "ResourceHandle.h" +#include "ResourceLoader.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include <wtf/MainThread.h> +#include <wtf/StdLibExtras.h> + +namespace WebCore { + +bool BlobRegistryImpl::shouldLoadResource(const ResourceRequest& request) const +{ + // If the resource is not fetched using the GET method, bail out. + if (!equalIgnoringCase(request.httpMethod(), "GET")) + return false; + + return true; +} + +PassRefPtr<ResourceHandle> BlobRegistryImpl::createResourceHandle(const ResourceRequest& request, ResourceHandleClient*) +{ + if (!shouldLoadResource(request)) + return 0; + + // FIXME: To be implemented. + return 0; +} + +bool BlobRegistryImpl::loadResourceSynchronously(const ResourceRequest& request, ResourceError&, ResourceResponse&, Vector<char>&) +{ + if (!shouldLoadResource(request)) + return false; + + // FIXME: To be implemented. + return false; +} + +BlobRegistry& BlobRegistry::instance() +{ + ASSERT(isMainThread()); + DEFINE_STATIC_LOCAL(BlobRegistryImpl, instance, ()); + return instance; +} + +void BlobRegistryImpl::appendStorageItems(BlobStorageData* blobStorageData, const BlobStorageDataItemList& items) +{ + for (BlobStorageDataItemList::const_iterator iter = items.begin(); iter != items.end(); ++iter) { + if (iter->type == BlobStorageDataItem::Data) + blobStorageData->appendData(iter->data, iter->offset, iter->length); + else { + ASSERT(iter->type == BlobStorageDataItem::File); + blobStorageData->appendFile(iter->path, iter->offset, iter->length, iter->expectedModificationTime); + } + } +} + +void BlobRegistryImpl::appendStorageItems(BlobStorageData* blobStorageData, const BlobStorageDataItemList& items, long long offset, long long length) +{ + ASSERT(length != BlobDataItem::toEndOfFile); + + BlobStorageDataItemList::const_iterator iter = items.begin(); + if (offset) { + for (; iter != items.end(); ++iter) { + if (offset >= iter->length) + offset -= iter->length; + else + break; + } + } + + for (; iter != items.end() && length > 0; ++iter) { + long long currentLength = iter->length - offset; + long long newLength = currentLength > length ? length : currentLength; + if (iter->type == BlobStorageDataItem::Data) + blobStorageData->appendData(iter->data, iter->offset + offset, newLength); + else { + ASSERT(iter->type == BlobStorageDataItem::File); + blobStorageData->appendFile(iter->path, iter->offset + offset, newLength, iter->expectedModificationTime); + } + offset = 0; + } +} + +void BlobRegistryImpl::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData) +{ + ASSERT(isMainThread()); + + RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create(); + blobStorageData->setContentType(blobData->contentType()); + blobStorageData->setContentDisposition(blobData->contentDisposition()); + + for (BlobDataItemList::const_iterator iter = blobData->items().begin(); iter != blobData->items().end(); ++iter) { + switch (iter->type) { + case BlobDataItem::Data: + blobStorageData->appendData(iter->data, 0, iter->data.length()); + break; + case BlobDataItem::File: + blobStorageData->appendFile(iter->path, iter->offset, iter->length, iter->expectedModificationTime); + break; + case BlobDataItem::Blob: + if (m_blobs.contains(iter->url.string())) + appendStorageItems(blobStorageData.get(), m_blobs.get(iter->url.string())->items(), iter->offset, iter->length); + break; + } + } + + + m_blobs.set(url.string(), blobStorageData); +} + +void BlobRegistryImpl::registerBlobURL(const KURL& url, const KURL& srcURL) +{ + ASSERT(isMainThread()); + + RefPtr<BlobStorageData> src = m_blobs.get(srcURL.string()); + ASSERT(src); + if (!src) + return; + + RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create(); + blobStorageData->setContentType(src->contentType()); + blobStorageData->setContentDisposition(src->contentDisposition()); + appendStorageItems(blobStorageData.get(), src->items()); + + m_blobs.set(url.string(), blobStorageData); +} + +void BlobRegistryImpl::unregisterBlobURL(const KURL& url) +{ + ASSERT(isMainThread()); + m_blobs.remove(url.string()); +} + +PassRefPtr<BlobStorageData> BlobRegistryImpl::getBlobDataFromURL(const KURL& url) const +{ + ASSERT(isMainThread()); + return m_blobs.get(url.string()); +} + +} // namespace WebCore diff --git a/WebCore/platform/network/BlobRegistryImpl.h b/WebCore/platform/network/BlobRegistryImpl.h new file mode 100644 index 0000000..42693bc --- /dev/null +++ b/WebCore/platform/network/BlobRegistryImpl.h @@ -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: + * + * * 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 BlobRegistryImpl_h +#define BlobRegistryImpl_h + +#include "BlobData.h" +#include "BlobRegistry.h" +#include "BlobStorageData.h" +#include "PlatformString.h" +#include <wtf/HashMap.h> +#include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> + +namespace WebCore { + +class KURL; +class ResourceError; +class ResourceHandle; +class ResourceHandleClient; +class ResourceRequest; +class ResourceResponse; + +// BlobRegistryImpl is not thread-safe. It should only be called from main thread. +class BlobRegistryImpl : public BlobRegistry { +public: + virtual ~BlobRegistryImpl() { } + + virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>); + virtual void registerBlobURL(const KURL&, const KURL& srcURL); + virtual void unregisterBlobURL(const KURL&); + virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*); + virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data); + + PassRefPtr<BlobStorageData> getBlobDataFromURL(const KURL&) const; + +private: + bool shouldLoadResource(const ResourceRequest& request) const; + void appendStorageItems(BlobStorageData*, const BlobStorageDataItemList&); + void appendStorageItems(BlobStorageData*, const BlobStorageDataItemList&, long long offset, long long length); + + HashMap<String, RefPtr<BlobStorageData> > m_blobs; +}; + +} // namespace WebCore + +#endif // BlobRegistryImpl_h diff --git a/WebCore/platform/network/BlobStorageData.h b/WebCore/platform/network/BlobStorageData.h new file mode 100644 index 0000000..f4125a4 --- /dev/null +++ b/WebCore/platform/network/BlobStorageData.h @@ -0,0 +1,108 @@ +/* + * 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 BlobStorageData_h +#define BlobStorageData_h + +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +struct BlobStorageDataItem { + enum BlobStoreDataItemType { Data, File }; + BlobStoreDataItemType type; + long long offset; + long long length; + + // For string data. + CString data; + + // For file data. + String path; + double expectedModificationTime; + + BlobStorageDataItem(const CString& data, long long offset, long long length) + : type(Data) + , offset(offset) + , length(length) + , data(data) + , expectedModificationTime(0) + { + } + + BlobStorageDataItem(const String& path, long long offset, long long length, double expectedModificationTime) + : type(File) + , offset(offset) + , length(length) + , path(path) + , expectedModificationTime(expectedModificationTime) + { + } +}; + +typedef Vector<BlobStorageDataItem> BlobStorageDataItemList; + +class BlobStorageData : public RefCounted<BlobStorageData> { +public: + static PassRefPtr<BlobStorageData> create() + { + return adoptRef(new BlobStorageData()); + } + + const String& contentType() const { return m_contentType; } + void setContentType(const String& contentType) { m_contentType = contentType; } + + const String& contentDisposition() const { return m_contentDisposition; } + void setContentDisposition(const String& contentDisposition) { m_contentDisposition = contentDisposition; } + + const BlobStorageDataItemList& items() const { return m_items; } + + void appendData(const CString& data, long long offset, long long length) + { + m_items.append(BlobStorageDataItem(data, offset, length)); + } + + void appendFile(const String& path, long long offset, long long length, double expectedModificationTime) + { + m_items.append(BlobStorageDataItem(path, offset, length, expectedModificationTime)); + } + +private: + String m_contentType; + String m_contentDisposition; + BlobStorageDataItemList m_items; +}; + +} // namespace WebCore + +#endif // BlobStorageData_h diff --git a/WebCore/platform/network/CredentialStorage.cpp b/WebCore/platform/network/CredentialStorage.cpp index 14f4086..4fb7799 100644 --- a/WebCore/platform/network/CredentialStorage.cpp +++ b/WebCore/platform/network/CredentialStorage.cpp @@ -29,8 +29,8 @@ #include "Credential.h" #include "KURL.h" #include "ProtectionSpaceHash.h" -#include "StringHash.h" #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> @@ -75,9 +75,9 @@ static String protectionSpaceMapKeyFromURL(const KURL& url) unsigned directoryURLPathStart = url.pathStart(); ASSERT(directoryURL[directoryURLPathStart] == '/'); if (directoryURL.length() > directoryURLPathStart + 1) { - int index = directoryURL.reverseFind('/'); - ASSERT(index > 0); - directoryURL = directoryURL.substring(0, (static_cast<unsigned>(index) != directoryURLPathStart) ? static_cast<unsigned>(index) : directoryURLPathStart + 1); + size_t index = directoryURL.reverseFind('/'); + ASSERT(index != notFound); + directoryURL = directoryURL.substring(0, (index != directoryURLPathStart) ? index : directoryURLPathStart + 1); } ASSERT(directoryURL.length() == directoryURLPathStart + 1 || directoryURL[directoryURL.length() - 1] != '/'); @@ -132,9 +132,9 @@ static PathToDefaultProtectionSpaceMap::iterator findDefaultProtectionSpaceForUR if (directoryURL.length() == directoryURLPathStart + 1) // path is "/" already, cannot shorten it any more return map.end(); - int index = directoryURL.reverseFind('/', -2); - ASSERT(index > 0); - directoryURL = directoryURL.substring(0, (static_cast<unsigned>(index) == directoryURLPathStart) ? index + 1 : index); + size_t index = directoryURL.reverseFind('/', directoryURL.length() - 2); + ASSERT(index != notFound); + directoryURL = directoryURL.substring(0, (index == directoryURLPathStart) ? index + 1 : index); ASSERT(directoryURL.length() > directoryURLPathStart); ASSERT(directoryURL.length() == directoryURLPathStart + 1 || directoryURL[directoryURL.length() - 1] != '/'); } diff --git a/WebCore/platform/network/HTTPHeaderMap.h b/WebCore/platform/network/HTTPHeaderMap.h index 557ddb3..c6145bd 100644 --- a/WebCore/platform/network/HTTPHeaderMap.h +++ b/WebCore/platform/network/HTTPHeaderMap.h @@ -27,13 +27,13 @@ #ifndef HTTPHeaderMap_h #define HTTPHeaderMap_h -#include "AtomicString.h" -#include "AtomicStringHash.h" -#include "StringHash.h" #include <utility> #include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> +#include <wtf/text/AtomicStringHash.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/network/HTTPParsers.cpp b/WebCore/platform/network/HTTPParsers.cpp index 6252bfc..b3f3d45 100644 --- a/WebCore/platform/network/HTTPParsers.cpp +++ b/WebCore/platform/network/HTTPParsers.cpp @@ -42,9 +42,9 @@ using namespace WTF; namespace WebCore { // true if there is more to parse -static inline bool skipWhiteSpace(const String& str, int& pos, bool fromHttpEquivMeta) +static inline bool skipWhiteSpace(const String& str, unsigned& pos, bool fromHttpEquivMeta) { - int len = str.length(); + unsigned len = str.length(); if (fromHttpEquivMeta) { while (pos != len && str[pos] <= ' ') @@ -59,9 +59,9 @@ static inline bool skipWhiteSpace(const String& str, int& pos, bool fromHttpEqui // Returns true if the function can match the whole token (case insensitive). // Note: Might return pos == str.length() -static inline bool skipToken(const String& str, int& pos, const char* token) +static inline bool skipToken(const String& str, unsigned& pos, const char* token) { - int len = str.length(); + unsigned len = str.length(); while (pos != len && *token) { if (toASCIILower(str[pos]) != *token++) @@ -104,8 +104,8 @@ ContentDispositionType contentDispositionType(const String& contentDisposition) bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url) { - int len = refresh.length(); - int pos = 0; + unsigned len = refresh.length(); + unsigned pos = 0; if (!skipWhiteSpace(refresh, pos, fromHttpEquivMeta)) return false; @@ -126,7 +126,7 @@ bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& del ++pos; skipWhiteSpace(refresh, pos, fromHttpEquivMeta); - int urlStartPos = pos; + unsigned urlStartPos = pos; if (refresh.find("url", urlStartPos, false) == urlStartPos) { urlStartPos += 3; skipWhiteSpace(refresh, urlStartPos, fromHttpEquivMeta); @@ -137,7 +137,7 @@ bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& del urlStartPos = pos; // e.g. "Refresh: 0; url.html" } - int urlEndPos = len; + unsigned urlEndPos = len; if (refresh[urlStartPos] == '"' || refresh[urlStartPos] == '\'') { UChar quotationMark = refresh[urlStartPos]; @@ -173,8 +173,8 @@ String filenameFromHTTPContentDisposition(const String& value) unsigned length = keyValuePairs.size(); for (unsigned i = 0; i < length; i++) { - int valueStartPos = keyValuePairs[i].find('='); - if (valueStartPos < 0) + size_t valueStartPos = keyValuePairs[i].find('='); + if (valueStartPos == notFound) continue; String key = keyValuePairs[i].left(valueStartPos).stripWhiteSpace(); @@ -241,12 +241,12 @@ void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, u charsetPos = start; charsetLen = 0; - int pos = start; - int length = (int)mediaType.length(); + size_t pos = start; + unsigned length = mediaType.length(); while (pos < length) { pos = mediaType.find("charset", pos, false); - if (pos <= 0) { + if (pos == notFound || pos == 0) { charsetLen = 0; return; } @@ -270,7 +270,7 @@ void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, u ++pos; // we don't handle spaces within quoted parameter values, because charset names cannot have any - int endpos = pos; + unsigned endpos = pos; while (pos != length && mediaType[endpos] > ' ' && mediaType[endpos] != '"' && mediaType[endpos] != '\'' && mediaType[endpos] != ';') ++endpos; @@ -290,8 +290,8 @@ XSSProtectionDisposition parseXSSProtectionHeader(const String& header) if (stippedHeader[0] == '0') return XSSProtectionDisabled; - int length = (int)header.length(); - int pos = 0; + unsigned length = header.length(); + unsigned pos = 0; if (stippedHeader[pos++] == '1' && skipWhiteSpace(stippedHeader, pos, false) && stippedHeader[pos++] == ';' @@ -309,7 +309,7 @@ XSSProtectionDisposition parseXSSProtectionHeader(const String& header) String extractReasonPhraseFromHTTPStatusLine(const String& statusLine) { - int spacePos = statusLine.find(' '); + size_t spacePos = statusLine.find(' '); // Remove status code from the status line. spacePos = statusLine.find(' ', spacePos + 1); return statusLine.substring(spacePos + 1); diff --git a/WebCore/platform/network/NetworkingContext.h b/WebCore/platform/network/NetworkingContext.h new file mode 100644 index 0000000..31f3025 --- /dev/null +++ b/WebCore/platform/network/NetworkingContext.h @@ -0,0 +1,68 @@ +/* + 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. +*/ + +#ifndef NetworkingContext_h +#define NetworkingContext_h + +#include <wtf/RefCounted.h> + +#if PLATFORM(MAC) +#include "SchedulePair.h" +#endif + +#if PLATFORM(QT) +class QObject; +class QNetworkAccessManager; +#endif + +namespace WebCore { + +class ResourceError; +class ResourceRequest; + +class NetworkingContext : public RefCounted<NetworkingContext> { +public: + virtual ~NetworkingContext() { } + + virtual bool isValid() const { return true; } + +#if PLATFORM(MAC) + virtual bool needsSiteSpecificQuirks() const = 0; + virtual bool localFileContentSniffingEnabled() const = 0; + virtual SchedulePairHashSet* scheduledRunLoopPairs() const = 0; + virtual ResourceError blockedError(const ResourceRequest&) const = 0; +#endif + +#if PLATFORM(QT) + virtual QObject* originatingObject() const = 0; + virtual QNetworkAccessManager* networkAccessManager() const = 0; +#endif + +#if PLATFORM(WIN) + virtual String userAgent() const = 0; + virtual String referrer() const = 0; +#endif + +protected: + NetworkingContext() { } +}; + +} + +#endif // NetworkingContext_h diff --git a/WebCore/platform/network/ResourceResponseBase.cpp b/WebCore/platform/network/ResourceResponseBase.cpp index f30344e..e231652 100644 --- a/WebCore/platform/network/ResourceResponseBase.cpp +++ b/WebCore/platform/network/ResourceResponseBase.cpp @@ -439,8 +439,8 @@ bool ResourceResponseBase::isAttachment() const DEFINE_STATIC_LOCAL(const AtomicString, headerName, ("content-disposition")); String value = m_httpHeaderFields.get(headerName); - int loc = value.find(';'); - if (loc != -1) + size_t loc = value.find(';'); + if (loc != notFound) value = value.left(loc); value = value.stripWhiteSpace(); DEFINE_STATIC_LOCAL(const AtomicString, attachmentString, ("attachment")); @@ -591,9 +591,9 @@ static void parseCacheHeader(const String& header, Vector<pair<String, String> > const String safeHeader = header.removeCharacters(isControlCharacter); unsigned max = safeHeader.length(); for (unsigned pos = 0; pos < max; /* pos incremented in loop */) { - int nextCommaPosition = safeHeader.find(',', pos); - int nextEqualSignPosition = safeHeader.find('=', pos); - if (nextEqualSignPosition >= 0 && (nextEqualSignPosition < nextCommaPosition || nextCommaPosition < 0)) { + size_t nextCommaPosition = safeHeader.find(',', pos); + size_t nextEqualSignPosition = safeHeader.find('=', pos); + if (nextEqualSignPosition != notFound && (nextEqualSignPosition < nextCommaPosition || nextCommaPosition == notFound)) { // Get directive name, parse right hand side of equal sign, then add to map String directive = trimToNextSeparator(safeHeader.substring(pos, nextEqualSignPosition - pos).stripWhiteSpace()); pos += nextEqualSignPosition - pos + 1; @@ -601,14 +601,14 @@ static void parseCacheHeader(const String& header, Vector<pair<String, String> > String value = safeHeader.substring(pos, max - pos).stripWhiteSpace(); if (value[0] == '"') { // The value is a quoted string - int nextDoubleQuotePosition = value.find('"', 1); - if (nextDoubleQuotePosition >= 0) { + size_t nextDoubleQuotePosition = value.find('"', 1); + if (nextDoubleQuotePosition != notFound) { // Store the value as a quoted string without quotes result.append(pair<String, String>(directive, value.substring(1, nextDoubleQuotePosition - 1).stripWhiteSpace())); pos += (safeHeader.find('"', pos) - pos) + nextDoubleQuotePosition + 1; // Move past next comma, if there is one - int nextCommaPosition2 = safeHeader.find(',', pos); - if (nextCommaPosition2 >= 0) + size_t nextCommaPosition2 = safeHeader.find(',', pos); + if (nextCommaPosition2 != notFound) pos += nextCommaPosition2 - pos + 1; else return; // Parse error if there is anything left with no comma @@ -619,8 +619,8 @@ static void parseCacheHeader(const String& header, Vector<pair<String, String> > } } else { // The value is a token until the next comma - int nextCommaPosition2 = value.find(',', 0); - if (nextCommaPosition2 >= 0) { + size_t nextCommaPosition2 = value.find(',', 0); + if (nextCommaPosition2 != notFound) { // The value is delimited by the next comma result.append(pair<String, String>(directive, trimToNextSeparator(value.substring(0, nextCommaPosition2).stripWhiteSpace()))); pos += (safeHeader.find(',', pos) - pos) + 1; @@ -630,7 +630,7 @@ static void parseCacheHeader(const String& header, Vector<pair<String, String> > return; } } - } else if (nextCommaPosition >= 0 && (nextCommaPosition < nextEqualSignPosition || nextEqualSignPosition < 0)) { + } else if (nextCommaPosition != notFound && (nextCommaPosition < nextEqualSignPosition || nextEqualSignPosition == notFound)) { // Add directive to map with empty string as value result.append(pair<String, String>(trimToNextSeparator(safeHeader.substring(pos, nextCommaPosition - pos).stripWhiteSpace()), "")); pos += nextCommaPosition - pos + 1; diff --git a/WebCore/platform/network/cf/DNSCFNet.cpp b/WebCore/platform/network/cf/DNSCFNet.cpp index bda9e41..fbceb7d 100644 --- a/WebCore/platform/network/cf/DNSCFNet.cpp +++ b/WebCore/platform/network/cf/DNSCFNet.cpp @@ -27,11 +27,11 @@ #include "config.h" #include "DNS.h" -#include "StringHash.h" #include "Timer.h" #include <wtf/HashSet.h> #include <wtf/RetainPtr.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> #if PLATFORM(WIN) #include "LoaderRunLoopCF.h" diff --git a/WebCore/platform/network/curl/CookieJarCurl.cpp b/WebCore/platform/network/curl/CookieJarCurl.cpp index 7c906a0..e05947c 100644 --- a/WebCore/platform/network/curl/CookieJarCurl.cpp +++ b/WebCore/platform/network/curl/CookieJarCurl.cpp @@ -21,9 +21,8 @@ #include "Document.h" #include "KURL.h" #include "PlatformString.h" -#include "StringHash.h" - #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp index 6ca4830..f677d28 100644 --- a/WebCore/platform/qt/ClipboardQt.cpp +++ b/WebCore/platform/qt/ClipboardQt.cpp @@ -43,8 +43,8 @@ #include "PlatformString.h" #include "Range.h" #include "RenderImage.h" -#include "StringHash.h" #include "markup.h" +#include <wtf/text/StringHash.h> #include <QApplication> #include <QClipboard> diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp index 05a2a22..80d3946 100644 --- a/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/WebCore/platform/sql/SQLiteDatabase.cpp @@ -33,6 +33,7 @@ #include "SQLiteStatement.h" #include <sqlite3.h> #include <wtf/Threading.h> +#include <wtf/text/CString.h> namespace WebCore { @@ -156,7 +157,11 @@ void SQLiteDatabase::setMaximumSize(int64_t size) SQLiteStatement statement(*this, "PRAGMA max_page_count = " + String::number(newMaxPageCount)); statement.prepare(); if (statement.step() != SQLResultRow) +#if OS(WINDOWS) + LOG_ERROR("Failed to set maximum size of database to %I64i bytes", static_cast<long long>(size)); +#else LOG_ERROR("Failed to set maximum size of database to %lli bytes", static_cast<long long>(size)); +#endif enableAuthorizer(true); diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp index ac467a6..4dc80fb 100644 --- a/WebCore/platform/sql/SQLiteStatement.cpp +++ b/WebCore/platform/sql/SQLiteStatement.cpp @@ -30,6 +30,7 @@ #include "SQLValue.h" #include <sqlite3.h> #include <wtf/Assertions.h> +#include <wtf/text/CString.h> namespace WebCore { diff --git a/WebCore/platform/text/AtomicString.h b/WebCore/platform/text/AtomicString.h deleted file mode 100644 index 6ce63b5..0000000 --- a/WebCore/platform/text/AtomicString.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2008 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 WebCoreAtomicString_h -#define WebCoreAtomicString_h - -// FIXME: remove this header, use the forward from wtf directly. -#include <wtf/text/AtomicString.h> - -#endif // AtomicString_h diff --git a/WebCore/platform/text/AtomicStringImpl.h b/WebCore/platform/text/AtomicStringImpl.h deleted file mode 100644 index 64bce77..0000000 --- a/WebCore/platform/text/AtomicStringImpl.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef WebCoreAtomicStringImpl_h -#define WebCoreAtomicStringImpl_h - -// FIXME: remove this header, use the forward from wtf directly. -#include <wtf/text/AtomicStringImpl.h> - -#endif diff --git a/WebCore/platform/text/AtomicStringKeyedMRUCache.h b/WebCore/platform/text/AtomicStringKeyedMRUCache.h index a47585a..b3004f7 100644 --- a/WebCore/platform/text/AtomicStringKeyedMRUCache.h +++ b/WebCore/platform/text/AtomicStringKeyedMRUCache.h @@ -26,6 +26,8 @@ #ifndef AtomicStringKeyedMRUCache_h #define AtomicStringKeyedMRUCache_h +#include <wtf/text/AtomicString.h> + namespace WebCore { template<typename T, size_t capacity = 4> diff --git a/WebCore/platform/text/SegmentedString.cpp b/WebCore/platform/text/SegmentedString.cpp index 04d6c77..b9ff503 100644 --- a/WebCore/platform/text/SegmentedString.cpp +++ b/WebCore/platform/text/SegmentedString.cpp @@ -52,6 +52,7 @@ const SegmentedString& SegmentedString::operator=(const SegmentedString &other) else m_currentChar = other.m_currentChar; m_closed = other.m_closed; + m_numberOfCharactersConsumedPriorToCurrentString = other.m_numberOfCharactersConsumedPriorToCurrentString; return *this; } @@ -99,6 +100,7 @@ void SegmentedString::append(const SegmentedSubstring &s) ASSERT(!m_closed); if (s.m_length) { if (!m_currentString.m_length) { + m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed(); m_currentString = s; } else { m_substrings.append(s); @@ -110,7 +112,15 @@ void SegmentedString::append(const SegmentedSubstring &s) void SegmentedString::prepend(const SegmentedSubstring &s) { ASSERT(!escaped()); + ASSERT(!s.numberOfCharactersConsumed()); if (s.m_length) { + // FIXME: We're assuming that the prepend were originally consumed by + // this SegmentedString. We're also ASSERTing that s is a fresh + // SegmentedSubstring. These assumptions are sufficient for our + // current use, but we might need to handle the more elaborate + // cases in the future. + m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed(); + m_numberOfCharactersConsumedPriorToCurrentString -= s.m_length; if (!m_currentString.m_length) m_currentString = s; else { @@ -160,7 +170,12 @@ void SegmentedString::prepend(const SegmentedString &s) void SegmentedString::advanceSubstring() { if (m_composite) { + m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed(); m_currentString = m_substrings.takeFirst(); + // If we've previously consumed some characters of the non-current + // string, we now account for those characters as part of the current + // string, not as part of "prior to current string." + m_numberOfCharactersConsumedPriorToCurrentString -= m_currentString.numberOfCharactersConsumed(); if (m_substrings.isEmpty()) m_composite = false; } else { diff --git a/WebCore/platform/text/SegmentedString.h b/WebCore/platform/text/SegmentedString.h index 1d3098d..91c2cbe 100644 --- a/WebCore/platform/text/SegmentedString.h +++ b/WebCore/platform/text/SegmentedString.h @@ -45,6 +45,8 @@ public: void setExcludeLineNumbers() { m_doNotExcludeLineNumbers = false; } + int numberOfCharactersConsumed() const { return m_string.length() - m_length; } + void appendTo(String& str) const { if (m_string.characters() == m_current) { @@ -69,10 +71,26 @@ private: class SegmentedString { public: SegmentedString() - : m_pushedChar1(0), m_pushedChar2(0), m_currentChar(0), m_composite(false), m_closed(false) {} + : m_pushedChar1(0) + , m_pushedChar2(0) + , m_currentChar(0) + , m_numberOfCharactersConsumedPriorToCurrentString(0) + , m_composite(false) + , m_closed(false) + { + } + SegmentedString(const String& str) - : m_pushedChar1(0), m_pushedChar2(0), m_currentString(str) - , m_currentChar(m_currentString.m_current), m_composite(false), m_closed(false) {} + : m_pushedChar1(0) + , m_pushedChar2(0) + , m_currentString(str) + , m_currentChar(m_currentString.m_current) + , m_numberOfCharactersConsumedPriorToCurrentString(0) + , m_composite(false) + , m_closed(false) + { + } + SegmentedString(const SegmentedString&); const SegmentedString& operator=(const SegmentedString&); @@ -173,6 +191,13 @@ public: bool escaped() const { return m_pushedChar1; } + int numberOfCharactersConsumed() + { + // We don't currently handle the case when there are pushed character. + ASSERT(!m_pushedChar1); + return m_numberOfCharactersConsumedPriorToCurrentString + m_currentString.numberOfCharactersConsumed(); + } + String toString() const; const UChar& operator*() const { return *current(); } @@ -221,6 +246,7 @@ private: UChar m_pushedChar2; SegmentedSubstring m_currentString; const UChar* m_currentChar; + int m_numberOfCharactersConsumedPriorToCurrentString; Deque<SegmentedSubstring> m_substrings; bool m_composite; bool m_closed; diff --git a/WebCore/platform/text/StringBuilder.cpp b/WebCore/platform/text/StringBuilder.cpp index 213daab..1c47129 100644 --- a/WebCore/platform/text/StringBuilder.cpp +++ b/WebCore/platform/text/StringBuilder.cpp @@ -30,7 +30,7 @@ #include "config.h" #include "StringBuilder.h" -#include "StringBuffer.h" +#include <wtf/text/StringBuffer.h> namespace WebCore { diff --git a/WebCore/platform/text/StringHash.h b/WebCore/platform/text/StringHash.h deleted file mode 100644 index 35de30d..0000000 --- a/WebCore/platform/text/StringHash.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved - * Copyright (C) Research In Motion Limited 2009. 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 WebCoreStringHash_h -#define WebCoreStringHash_h - -// FIXME: remove this header, use the forward from wtf directly. -#include <wtf/text/StringHash.h> - -#endif diff --git a/WebCore/platform/text/StringImpl.h b/WebCore/platform/text/StringImpl.h deleted file mode 100644 index fa79b61..0000000 --- a/WebCore/platform/text/StringImpl.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2009 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 - * 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 WebCoreStringImpl_h -#define WebCoreStringImpl_h - -// FIXME: remove this header, use the forward from wtf directly. -#include <wtf/text/StringImpl.h> - -#endif diff --git a/WebCore/platform/text/TextBoundaries.cpp b/WebCore/platform/text/TextBoundaries.cpp index 2455f6d..8eaffca 100644 --- a/WebCore/platform/text/TextBoundaries.cpp +++ b/WebCore/platform/text/TextBoundaries.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "TextBoundaries.h" -#include "StringImpl.h" #include "TextBreakIterator.h" +#include <wtf/text/StringImpl.h> #include <wtf/unicode/Unicode.h> using namespace WTF; diff --git a/WebCore/platform/text/TextCodecLatin1.cpp b/WebCore/platform/text/TextCodecLatin1.cpp index 1e9385d..4f9cbe0 100644 --- a/WebCore/platform/text/TextCodecLatin1.cpp +++ b/WebCore/platform/text/TextCodecLatin1.cpp @@ -27,9 +27,9 @@ #include "TextCodecLatin1.h" #include "PlatformString.h" -#include "StringBuffer.h" #include <stdio.h> #include <wtf/text/CString.h> +#include <wtf/text/StringBuffer.h> #include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/WebCore/platform/text/TextCodecUTF16.cpp b/WebCore/platform/text/TextCodecUTF16.cpp index 16f8431..5c23732 100644 --- a/WebCore/platform/text/TextCodecUTF16.cpp +++ b/WebCore/platform/text/TextCodecUTF16.cpp @@ -27,8 +27,8 @@ #include "TextCodecUTF16.h" #include "PlatformString.h" -#include "StringBuffer.h" #include <wtf/text/CString.h> +#include <wtf/text/StringBuffer.h> #include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/WebCore/platform/text/TextCodecUserDefined.cpp b/WebCore/platform/text/TextCodecUserDefined.cpp index 851d693..70d8673 100644 --- a/WebCore/platform/text/TextCodecUserDefined.cpp +++ b/WebCore/platform/text/TextCodecUserDefined.cpp @@ -27,9 +27,9 @@ #include "TextCodecUserDefined.h" #include "PlatformString.h" -#include "StringBuffer.h" #include <stdio.h> #include <wtf/text/CString.h> +#include <wtf/text/StringBuffer.h> #include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/WebCore/platform/text/cf/HyphenationCF.cpp b/WebCore/platform/text/cf/HyphenationCF.cpp index b983979..8be537d 100644 --- a/WebCore/platform/text/cf/HyphenationCF.cpp +++ b/WebCore/platform/text/cf/HyphenationCF.cpp @@ -28,7 +28,6 @@ #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) -#include "AtomicString.h" #include "AtomicStringKeyedMRUCache.h" #include "TextBreakIteratorInternalICU.h" #include <wtf/ListHashSet.h> diff --git a/WebCore/platform/text/cf/StringImplCF.cpp b/WebCore/platform/text/cf/StringImplCF.cpp index 18e137f..0157918 100644 --- a/WebCore/platform/text/cf/StringImplCF.cpp +++ b/WebCore/platform/text/cf/StringImplCF.cpp @@ -19,7 +19,7 @@ */ #include "config.h" -#include "StringImpl.h" +#include <wtf/text/StringImpl.h> #if PLATFORM(CF) diff --git a/WebCore/platform/text/mac/HyphenationMac.mm b/WebCore/platform/text/mac/HyphenationMac.mm index 56122df..d5c9283 100644 --- a/WebCore/platform/text/mac/HyphenationMac.mm +++ b/WebCore/platform/text/mac/HyphenationMac.mm @@ -28,7 +28,6 @@ #if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) -#import "AtomicString.h" #import "AtomicStringKeyedMRUCache.h" #import "TextBreakIteratorInternalICU.h" #import "WebCoreSystemInterface.h" diff --git a/WebCore/platform/text/mac/StringImplMac.mm b/WebCore/platform/text/mac/StringImplMac.mm index 843f396..6f5e953 100644 --- a/WebCore/platform/text/mac/StringImplMac.mm +++ b/WebCore/platform/text/mac/StringImplMac.mm @@ -19,7 +19,7 @@ */ #include "config.h" -#include "StringImpl.h" +#include <wtf/text/StringImpl.h> #include "FoundationExtras.h" diff --git a/WebCore/platform/text/transcoder/FontTranscoder.h b/WebCore/platform/text/transcoder/FontTranscoder.h index 1fdc936..67db977 100644 --- a/WebCore/platform/text/transcoder/FontTranscoder.h +++ b/WebCore/platform/text/transcoder/FontTranscoder.h @@ -31,9 +31,9 @@ #ifndef FontTranscoder_h #define FontTranscoder_h -#include "AtomicStringHash.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/platform/text/wince/TextCodecWinCE.cpp b/WebCore/platform/text/wince/TextCodecWinCE.cpp index 644b12f..578f789 100644 --- a/WebCore/platform/text/wince/TextCodecWinCE.cpp +++ b/WebCore/platform/text/wince/TextCodecWinCE.cpp @@ -27,13 +27,13 @@ #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/text/StringHash.h> #include <wtf/unicode/UTF8.h> namespace WebCore { diff --git a/WebCore/platform/win/BString.cpp b/WebCore/platform/win/BString.cpp index 618ecf3..4d6d11e 100644 --- a/WebCore/platform/win/BString.cpp +++ b/WebCore/platform/win/BString.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "BString.h" -#include "AtomicString.h" #include "KURL.h" #include "PlatformString.h" +#include <wtf/text/AtomicString.h> #include <tchar.h> #include <windows.h> @@ -90,7 +90,7 @@ BString::BString(const UString& s) if (s.isNull()) m_bstr = 0; else - m_bstr = SysAllocStringLen(s.data(), s.size()); + m_bstr = SysAllocStringLen(s.characters(), s.length()); } #if PLATFORM(CF) diff --git a/WebCore/platform/win/COMPtr.h b/WebCore/platform/win/COMPtr.h index 692706f..6b84256 100644 --- a/WebCore/platform/win/COMPtr.h +++ b/WebCore/platform/win/COMPtr.h @@ -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 @@ -44,7 +44,7 @@ enum AdoptCOMTag { AdoptCOM }; enum QueryTag { Query }; enum CreateTag { Create }; -template <typename T> class COMPtr { +template<typename T> class COMPtr { public: COMPtr() : m_ptr(0) { } COMPtr(T* ptr) : m_ptr(ptr) { if (m_ptr) m_ptr->AddRef(); } @@ -52,7 +52,7 @@ public: COMPtr(const COMPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) ptr->AddRef(); } COMPtr(QueryTag, IUnknown* ptr) : m_ptr(copyQueryInterfaceRef(ptr)) { } - template <typename U> COMPtr(QueryTag, const COMPtr<U>& ptr) : m_ptr(copyQueryInterfaceRef(ptr.get())) { } + template<typename U> COMPtr(QueryTag, const COMPtr<U>& ptr) : m_ptr(copyQueryInterfaceRef(ptr.get())) { } COMPtr(CreateTag, const IID& clsid) : m_ptr(createInstance(clsid)) { } @@ -63,7 +63,9 @@ public: ~COMPtr() { if (m_ptr) m_ptr->Release(); } T* get() const { return m_ptr; } - T* releaseRef() { T* tmp = m_ptr; m_ptr = 0; return tmp; } + + void clear(); + T* leakRef(); T& operator*() const { return *m_ptr; } T* operator->() const { return m_ptr; } @@ -78,16 +80,19 @@ public: COMPtr& operator=(const COMPtr&); COMPtr& operator=(T*); - template <typename U> COMPtr& operator=(const COMPtr<U>&); + template<typename U> COMPtr& operator=(const COMPtr<U>&); void query(IUnknown* ptr) { adoptRef(copyQueryInterfaceRef(ptr)); } - template <typename U> void query(const COMPtr<U>& ptr) { query(ptr.get()); } + template<typename U> void query(const COMPtr<U>& ptr) { query(ptr.get()); } void create(const IID& clsid) { adoptRef(createInstance(clsid)); } - template <typename U> HRESULT copyRefTo(U**); + template<typename U> HRESULT copyRefTo(U**); void adoptRef(T*); + // FIXME: Remove releaseRef once we change all callers to call leakRef instead. + T* releaseRef() { return leakRef(); } + private: static T* copyQueryInterfaceRef(IUnknown*); static T* createInstance(const IID& clsid); @@ -96,7 +101,22 @@ private: T* m_ptr; }; -template <typename T> inline T* COMPtr<T>::createInstance(const IID& clsid) +template<typename T> inline void COMPtr<T>::clear() +{ + if (T* ptr = m_ptr) { + m_ptr = 0; + ptr->Release(); + } +} + +template<typename T> inline T* COMPtr<T>::leakRef() +{ + T* ptr = m_ptr; + m_ptr = 0; + return ptr; +} + +template<typename T> inline T* COMPtr<T>::createInstance(const IID& clsid) { T* result; if (FAILED(CoCreateInstance(clsid, 0, CLSCTX_ALL, __uuidof(result), reinterpret_cast<void**>(&result)))) @@ -104,7 +124,7 @@ template <typename T> inline T* COMPtr<T>::createInstance(const IID& clsid) return result; } -template <typename T> inline T* COMPtr<T>::copyQueryInterfaceRef(IUnknown* ptr) +template<typename T> inline T* COMPtr<T>::copyQueryInterfaceRef(IUnknown* ptr) { if (!ptr) return 0; @@ -114,7 +134,7 @@ template <typename T> inline T* COMPtr<T>::copyQueryInterfaceRef(IUnknown* ptr) return result; } -template <typename T> template <typename U> inline HRESULT COMPtr<T>::copyRefTo(U** ptr) +template<typename T> template<typename U> inline HRESULT COMPtr<T>::copyRefTo(U** ptr) { if (!ptr) return E_POINTER; @@ -124,14 +144,14 @@ template <typename T> template <typename U> inline HRESULT COMPtr<T>::copyRefTo( return S_OK; } -template <typename T> inline void COMPtr<T>::adoptRef(T *ptr) +template<typename T> inline void COMPtr<T>::adoptRef(T *ptr) { if (m_ptr) m_ptr->Release(); m_ptr = ptr; } -template <typename T> inline COMPtr<T>& COMPtr<T>::operator=(const COMPtr<T>& o) +template<typename T> inline COMPtr<T>& COMPtr<T>::operator=(const COMPtr<T>& o) { T* optr = o.get(); if (optr) @@ -143,7 +163,7 @@ template <typename T> inline COMPtr<T>& COMPtr<T>::operator=(const COMPtr<T>& o) return *this; } -template <typename T> template <typename U> inline COMPtr<T>& COMPtr<T>::operator=(const COMPtr<U>& o) +template<typename T> template<typename U> inline COMPtr<T>& COMPtr<T>::operator=(const COMPtr<U>& o) { T* optr = o.get(); if (optr) @@ -155,7 +175,7 @@ template <typename T> template <typename U> inline COMPtr<T>& COMPtr<T>::operato return *this; } -template <typename T> inline COMPtr<T>& COMPtr<T>::operator=(T* optr) +template<typename T> inline COMPtr<T>& COMPtr<T>::operator=(T* optr) { if (optr) optr->AddRef(); @@ -166,32 +186,32 @@ template <typename T> inline COMPtr<T>& COMPtr<T>::operator=(T* optr) return *this; } -template <typename T, typename U> inline bool operator==(const COMPtr<T>& a, const COMPtr<U>& b) +template<typename T, typename U> inline bool operator==(const COMPtr<T>& a, const COMPtr<U>& b) { return a.get() == b.get(); } -template <typename T, typename U> inline bool operator==(const COMPtr<T>& a, U* b) +template<typename T, typename U> inline bool operator==(const COMPtr<T>& a, U* b) { return a.get() == b; } -template <typename T, typename U> inline bool operator==(T* a, const COMPtr<U>& b) +template<typename T, typename U> inline bool operator==(T* a, const COMPtr<U>& b) { return a == b.get(); } -template <typename T, typename U> inline bool operator!=(const COMPtr<T>& a, const COMPtr<U>& b) +template<typename T, typename U> inline bool operator!=(const COMPtr<T>& a, const COMPtr<U>& b) { return a.get() != b.get(); } -template <typename T, typename U> inline bool operator!=(const COMPtr<T>& a, U* b) +template<typename T, typename U> inline bool operator!=(const COMPtr<T>& a, U* b) { return a.get() != b; } -template <typename T, typename U> inline bool operator!=(T* a, const COMPtr<U>& b) +template<typename T, typename U> inline bool operator!=(T* a, const COMPtr<U>& b) { return a != b.get(); } @@ -200,8 +220,8 @@ namespace WTF { template<typename P> struct HashTraits<COMPtr<P> > : GenericHashTraits<COMPtr<P> > { static const bool emptyValueIsZero = true; - static void constructDeletedValue(COMPtr<P>& slot) { slot.releaseRef(); *&slot = reinterpret_cast<P*>(-1); } - static bool isDeletedValue(const COMPtr<P>& value) { return value == reinterpret_cast<P*>(-1); } + static void constructDeletedValue(COMPtr<P>& slot) { new (&slot) COMPtr<P>(HashTableDeletedValue); } + static bool isDeletedValue(const COMPtr<P>& value) { return value.isHashTableDeletedValue(); } }; template<typename P> struct PtrHash<COMPtr<P> > : PtrHash<P*> { diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp index 6e026d6..2915f9d 100644 --- a/WebCore/platform/win/ClipboardWin.cpp +++ b/WebCore/platform/win/ClipboardWin.cpp @@ -49,7 +49,6 @@ #include "RenderImage.h" #include "ResourceResponse.h" #include "SharedBuffer.h" -#include "StringHash.h" #include "WCDataObject.h" #include "csshelper.h" #include "markup.h" @@ -57,6 +56,7 @@ #include <wininet.h> #include <wtf/RefPtr.h> #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> using namespace std; diff --git a/WebCore/platform/win/SearchPopupMenuWin.cpp b/WebCore/platform/win/SearchPopupMenuWin.cpp index 6655b1b..7ae800b 100644 --- a/WebCore/platform/win/SearchPopupMenuWin.cpp +++ b/WebCore/platform/win/SearchPopupMenuWin.cpp @@ -21,7 +21,7 @@ #include "config.h" #include "SearchPopupMenuWin.h" -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> #if PLATFORM(CF) #include <wtf/RetainPtr.h> diff --git a/WebCore/platform/win/SharedBufferWin.cpp b/WebCore/platform/win/SharedBufferWin.cpp index bbecb86..59a5a76 100644 --- a/WebCore/platform/win/SharedBufferWin.cpp +++ b/WebCore/platform/win/SharedBufferWin.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "SharedBuffer.h" +#include <wtf/text/CString.h> // INVALID_FILE_SIZE is not defined on WinCE. #ifndef INVALID_FILE_SIZE diff --git a/WebCore/platform/wince/SearchPopupMenuWince.cpp b/WebCore/platform/wince/SearchPopupMenuWince.cpp index 756b7cf..f9d65a6 100644 --- a/WebCore/platform/wince/SearchPopupMenuWince.cpp +++ b/WebCore/platform/wince/SearchPopupMenuWince.cpp @@ -20,8 +20,8 @@ #include "config.h" #include "SearchPopupMenu.h" -#include "AtomicString.h" #include "NotImplemented.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/platform/wx/ClipboardWx.cpp b/WebCore/platform/wx/ClipboardWx.cpp index 336881d..2ef943f 100644 --- a/WebCore/platform/wx/ClipboardWx.cpp +++ b/WebCore/platform/wx/ClipboardWx.cpp @@ -32,7 +32,7 @@ #include "NotImplemented.h" #include "Pasteboard.h" #include "PlatformString.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/plugins/DOMMimeTypeArray.cpp b/WebCore/plugins/DOMMimeTypeArray.cpp index f36f2a2..8c81bb7 100644 --- a/WebCore/plugins/DOMMimeTypeArray.cpp +++ b/WebCore/plugins/DOMMimeTypeArray.cpp @@ -20,11 +20,11 @@ #include "config.h" #include "DOMMimeTypeArray.h" -#include "AtomicString.h" #include "DOMPlugin.h" #include "Frame.h" #include "Page.h" #include "PluginData.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/plugins/DOMPlugin.cpp b/WebCore/plugins/DOMPlugin.cpp index 11ec929..ac4fd03 100644 --- a/WebCore/plugins/DOMPlugin.cpp +++ b/WebCore/plugins/DOMPlugin.cpp @@ -19,9 +19,9 @@ #include "config.h" #include "DOMPlugin.h" -#include "AtomicString.h" #include "PluginData.h" #include "Frame.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/plugins/DOMPluginArray.cpp b/WebCore/plugins/DOMPluginArray.cpp index fb11da8..3717f32 100644 --- a/WebCore/plugins/DOMPluginArray.cpp +++ b/WebCore/plugins/DOMPluginArray.cpp @@ -20,11 +20,11 @@ #include "config.h" #include "DOMPluginArray.h" -#include "AtomicString.h" #include "DOMPlugin.h" #include "Frame.h" #include "Page.h" #include "PluginData.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/plugins/PluginDatabase.h b/WebCore/plugins/PluginDatabase.h index ea3559d..287857e 100644 --- a/WebCore/plugins/PluginDatabase.h +++ b/WebCore/plugins/PluginDatabase.h @@ -30,10 +30,9 @@ #include "PlatformString.h" #include "PluginPackage.h" -#include "StringHash.h" - #include <wtf/HashSet.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> #if defined(ANDROID_PLUGINS) namespace android { diff --git a/WebCore/plugins/PluginPackage.cpp b/WebCore/plugins/PluginPackage.cpp index c7d8b22..48c44f0 100644 --- a/WebCore/plugins/PluginPackage.cpp +++ b/WebCore/plugins/PluginPackage.cpp @@ -191,7 +191,6 @@ void PluginPackage::determineQuirks(const String& mimeType) #if PLATFORM(QT) m_quirks.add(PluginQuirkRequiresGtkToolKit); #endif - m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); } else { // Flash 9 and older requests windowless plugins if we return a mozilla user agent m_quirks.add(PluginQuirkWantsMozillaUserAgent); @@ -201,6 +200,7 @@ void PluginPackage::determineQuirks(const String& mimeType) #endif } + m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); m_quirks.add(PluginQuirkThrottleInvalidate); m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages); m_quirks.add(PluginQuirkFlashURLNotifyBug); diff --git a/WebCore/plugins/PluginPackage.h b/WebCore/plugins/PluginPackage.h index 659f5ff..92a9c52 100644 --- a/WebCore/plugins/PluginPackage.h +++ b/WebCore/plugins/PluginPackage.h @@ -30,11 +30,11 @@ #include "FileSystem.h" #include "PlatformString.h" #include "PluginQuirkSet.h" -#include "StringHash.h" #include "Timer.h" #include "npruntime_internal.h" #include <wtf/HashMap.h> #include <wtf/RefCounted.h> +#include <wtf/text/StringHash.h> #if OS(SYMBIAN) class QPluginLoader; diff --git a/WebCore/plugins/PluginStream.h b/WebCore/plugins/PluginStream.h index f9f927e..ae69539 100644 --- a/WebCore/plugins/PluginStream.h +++ b/WebCore/plugins/PluginStream.h @@ -34,7 +34,6 @@ #include "PluginQuirkSet.h" #include "ResourceRequest.h" #include "ResourceResponse.h" -#include "StringHash.h" #include "Timer.h" #include "npruntime_internal.h" #include <wtf/HashMap.h> @@ -42,6 +41,7 @@ #include <wtf/RefCounted.h> #include <wtf/Vector.h> #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> namespace WebCore { class Frame; diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index 2f5f342..5a33b78 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2010 Girish Ramakrishnan <girish@forwardbias.in> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -708,6 +709,12 @@ NPError PluginView::setValue(NPPVariable variable, void* value) } #endif // defined(XP_MACOSX) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + case NPPVpluginWindowlessLocalBool: + m_renderToImage = true; + return NPERR_NO_ERROR; +#endif + default: #ifdef PLUGIN_PLATFORM_SETVALUE return platformSetValue(variable, value); @@ -919,6 +926,9 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p , m_colormap(0) , m_pluginDisplay(0) #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , m_renderToImage(false) +#endif , m_loadManually(loadManually) , m_manualStream(0) , m_isJavaScriptPaused(false) diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index cc36665..2b272ec 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -62,6 +62,10 @@ typedef PlatformWidget PlatformPluginWidget; #include <QPixmap> #endif #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#include <QImage> +class QPainter; +#endif #if USE(JSC) namespace JSC { @@ -420,6 +424,12 @@ private: void initXEvent(XEvent* event); #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + QImage m_image; + bool m_renderToImage; + void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect); +#endif + IntRect m_clipRect; // The clip rect to apply to a windowed plug-in IntRect m_windowRect; // Our window rect. #ifdef ANDROID_PLUGINS diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp index 0ca356b..3b41072 100644 --- a/WebCore/plugins/qt/PluginViewQt.cpp +++ b/WebCore/plugins/qt/PluginViewQt.cpp @@ -111,12 +111,20 @@ void PluginView::updatePluginWidget() return; if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) { - if (m_drawable) - XFreePixmap(QX11Info::display(), m_drawable); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + // On Maemo5, Flash always renders to 16-bit buffer + if (m_renderToImage) + m_image = QImage(m_windowRect.width(), m_windowRect.height(), QImage::Format_RGB16); + else +#endif + { + if (m_drawable) + XFreePixmap(QX11Info::display(), m_drawable); - m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), - ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); - QApplication::syncX(); // make sure that the server knows about the Drawable + m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), + ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); + QApplication::syncX(); // make sure that the server knows about the Drawable + } } // do not call setNPWindowIfNeeded immediately, will be called on paint() @@ -160,6 +168,48 @@ void PluginView::hide() Widget::hide(); } +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect) +{ + if (m_isTransparent) { + // On Maemo5, Flash expects the buffer to contain the contents that are below it. + // We don't support transparency, so clean the image before giving to Flash. + QPainter imagePainter(&m_image); + imagePainter.fillRect(exposedRect, Qt::white); + } + + NPImageExpose imageExpose; + imageExpose.data = reinterpret_cast<char*>(m_image.bits()); + imageExpose.stride = m_image.bytesPerLine(); + imageExpose.depth = m_image.depth(); + imageExpose.x = exposedRect.x(); + imageExpose.y = exposedRect.y(); + imageExpose.width = exposedRect.width(); + imageExpose.height = exposedRect.height(); + imageExpose.dataSize.width = m_image.width(); + imageExpose.dataSize.height = m_image.height(); + imageExpose.translateX = 0; + imageExpose.translateY = 0; + imageExpose.scaleX = 1; + imageExpose.scaleY = 1; + + XEvent xevent; + memset(&xevent, 0, sizeof(XEvent)); + XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; + exposeEvent.type = GraphicsExpose; + exposeEvent.display = 0; + exposeEvent.drawable = reinterpret_cast<XID>(&imageExpose); + exposeEvent.x = exposedRect.x(); + exposeEvent.y = exposedRect.y(); + exposeEvent.width = exposedRect.width(); + exposeEvent.height = exposedRect.height(); + + dispatchNPEvent(xevent); + + painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect); +} +#endif + void PluginView::paint(GraphicsContext* context, const IntRect& rect) { if (!m_isStarted) { @@ -172,19 +222,32 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) setNPWindowIfNeeded(); - if (m_isWindowed || !m_drawable) + if (m_isWindowed) return; - const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); + if (!m_drawable +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + && m_image.isNull() +#endif + ) + return; QPainter* painter = context->platformContext(); IntRect exposedRect(rect); exposedRect.intersect(frameRect()); exposedRect.move(-frameRect().x(), -frameRect().y()); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + if (!m_image.isNull()) { + paintUsingImageSurfaceExtension(painter, exposedRect); + return; + } +#endif + QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; ASSERT(drawableDepth == qtDrawable.depth()); + const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); // When printing, Qt uses a QPicture to capture the output in preview mode. The // QPicture holds a reference to the X Pixmap. As a result, the print preview would @@ -587,6 +650,13 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr *result = NPERR_NO_ERROR; return true; +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + case NPNVSupportsWindowlessLocal: + *static_cast<NPBool*>(value) = true; + *result = NPERR_NO_ERROR; + return true; +#endif + default: return false; } @@ -662,7 +732,7 @@ static Display *getPluginDisplay() // support gdk based plugins (like flash) that use a different X connection. // The code below has the same effect as this one: // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default()); - QLibrary library("libgdk-x11-2.0"); + QLibrary library("libgdk-x11-2.0.so.0"); if (!library.load()) return 0; diff --git a/WebCore/plugins/symbian/PluginViewSymbian.cpp b/WebCore/plugins/symbian/PluginViewSymbian.cpp index baa9839..b9f82ad 100644 --- a/WebCore/plugins/symbian/PluginViewSymbian.cpp +++ b/WebCore/plugins/symbian/PluginViewSymbian.cpp @@ -242,8 +242,11 @@ void PluginView::setParent(ScrollView* parent) { Widget::setParent(parent); - if (parent) + if (parent) { init(); + if (m_status == PluginStatusLoadedSuccessfully) + updatePluginWidget(); + } } void PluginView::setNPWindowRect(const IntRect&) diff --git a/WebCore/plugins/win/PluginPackageWin.cpp b/WebCore/plugins/win/PluginPackageWin.cpp index 80dea93..f3dd781 100644 --- a/WebCore/plugins/win/PluginPackageWin.cpp +++ b/WebCore/plugins/win/PluginPackageWin.cpp @@ -181,7 +181,7 @@ bool PluginPackage::fetchInfo() VS_FIXEDFILEINFO* info; UINT infoSize; - if (!VerQueryValue(versionInfoData.get(), TEXT("\\"), (LPVOID*) &info, &infoSize) || infoSize < sizeof(VS_FIXEDFILEINFO)) + if (!VerQueryValueW(versionInfoData.get(), L"\\", (LPVOID*) &info, &infoSize) || infoSize < sizeof(VS_FIXEDFILEINFO)) return false; m_moduleVersion.leastSig = info->dwFileVersionLS; m_moduleVersion.mostSig = info->dwFileVersionMS; diff --git a/WebCore/rendering/InlineTextBox.h b/WebCore/rendering/InlineTextBox.h index fcbf23a..7d828f3 100644 --- a/WebCore/rendering/InlineTextBox.h +++ b/WebCore/rendering/InlineTextBox.h @@ -67,6 +67,7 @@ public: bool hasHyphen() const { return m_hasEllipsisBoxOrHyphen; } void setHasHyphen(bool hasHyphen) { m_hasEllipsisBoxOrHyphen = hasHyphen; } + static inline bool compareByStart(const InlineTextBox* first, const InlineTextBox* second) { return first->start() < second->start(); } private: virtual int selectionTop(); diff --git a/WebCore/rendering/RenderApplet.h b/WebCore/rendering/RenderApplet.h index 343421e..62f46cd 100644 --- a/WebCore/rendering/RenderApplet.h +++ b/WebCore/rendering/RenderApplet.h @@ -23,7 +23,7 @@ #define RenderApplet_h #include "RenderWidget.h" -#include "StringHash.h" +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index c982d26..574d389 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -1021,8 +1021,8 @@ void RenderBlock::removeChild(RenderObject* oldChild) // If this was our last child be sure to clear out our line boxes. if (childrenInline()) lineBoxes()->deleteLineBoxes(renderArena()); - // If we're now an empty anonymous block then go ahead and delete ourselves. - else if (isAnonymousBlock() && parent() && parent()->isRenderBlock() && !continuation()) + // If we're now an empty anonymous columns or column span block, then go ahead and delete ourselves. + else if ((isAnonymousColumnsBlock() || isAnonymousColumnSpanBlock()) && parent() && parent()->isRenderBlock() && !continuation()) destroy(); } } @@ -2120,7 +2120,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) PaintInfo info(paintInfo); info.phase = newPhase; info.updatePaintingRootForChildren(this); - bool checkPageBreaks = document()->printing() && !document()->settings()->paginateDuringLayoutEnabled(); + bool checkPageBreaks = document()->paginated() && !document()->settings()->paginateDuringLayoutEnabled(); bool checkColumnBreaks = !checkPageBreaks && !view()->printRect().isEmpty() && !document()->settings()->paginateDuringLayoutEnabled(); for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { @@ -4109,7 +4109,7 @@ void RenderBlock::calcColumnWidth() int desiredColumnWidth = contentWidth(); // For now, we don't support multi-column layouts when printing, since we have to do a lot of work for proper pagination. - if (document()->printing() || (style()->hasAutoColumnCount() && style()->hasAutoColumnWidth())) { + if (document()->paginated() || (style()->hasAutoColumnCount() && style()->hasAutoColumnWidth())) { setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); return; } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index e11c7ad..8a3ea8e 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -1476,6 +1476,12 @@ bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const && (parent()->style()->boxOrient() == HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) return true; + // Button, input, select, textarea, legend and datagrid treat + // width value of 'auto' as 'intrinsic' unless it's in a + // stretching vertical flexbox. + if (width.type() == Auto && !(parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL && parent()->style()->boxAlign() == BSTRETCH) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag) || node()->hasTagName(datagridTag))) + return true; + return false; } @@ -1579,9 +1585,9 @@ void RenderBox::calcHeight() // is specified. When we're printing, we also need this quirk if the body or root has a percentage // height since we don't set a height in RenderView when we're printing. So without this quirk, the // height has nothing to be a percentage of, and it ends up being 0. That is bad. - bool printingNeedsBaseHeight = document()->printing() && h.isPercent() + bool paginatedContentNeedsBaseHeight = document()->paginated() && h.isPercent() && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->height().isPercent())); - if (stretchesToViewHeight() || printingNeedsBaseHeight) { + if (stretchesToViewHeight() || paginatedContentNeedsBaseHeight) { int margins = collapsedMarginTop() + collapsedMarginBottom(); int visHeight = document()->printing() ? view()->frameView()->pageHeight() : view()->viewHeight(); if (isRoot()) diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp index 9117ed8..78618d1 100644 --- a/WebCore/rendering/RenderBoxModelObject.cpp +++ b/WebCore/rendering/RenderBoxModelObject.cpp @@ -531,7 +531,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co // The mask has been created. Now we just need to clip to it. context->save(); - context->clipToImageBuffer(maskRect, maskImage.get()); + context->clipToImageBuffer(maskImage.get(), maskRect); } StyleImage* bg = bgLayer->image(); diff --git a/WebCore/rendering/RenderEmbeddedObject.cpp b/WebCore/rendering/RenderEmbeddedObject.cpp index e72825e..55b230b 100644 --- a/WebCore/rendering/RenderEmbeddedObject.cpp +++ b/WebCore/rendering/RenderEmbeddedObject.cpp @@ -231,8 +231,8 @@ void RenderEmbeddedObject::updateWidget(bool onlyCreateNonNetscapePlugins) url = p->value(); if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { serviceType = p->value(); - int pos = serviceType.find(";"); - if (pos != -1) + size_t pos = serviceType.find(";"); + if (pos != notFound) serviceType = serviceType.left(pos); } if (!embed && !name.isEmpty()) { diff --git a/WebCore/rendering/RenderInputSpeech.cpp b/WebCore/rendering/RenderInputSpeech.cpp index df17944..5472025 100644 --- a/WebCore/rendering/RenderInputSpeech.cpp +++ b/WebCore/rendering/RenderInputSpeech.cpp @@ -36,6 +36,7 @@ #include "GraphicsContext.h" #include "HTMLNames.h" #include "RenderBox.h" +#include "TextControlInnerElements.h" namespace WebCore { @@ -79,7 +80,16 @@ bool RenderInputSpeech::paintInputFieldSpeechButton(RenderObject* object, const buttonRect.move(rect.x(), rect.y()); DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateNormal, (Image::loadPlatformResource("inputSpeech"))); - paintInfo.context->drawImage(imageStateNormal.get(), object->style()->colorSpace(), buttonRect); + DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateRecording, (Image::loadPlatformResource("inputSpeechRecording"))); + DEFINE_STATIC_LOCAL(RefPtr<Image>, imageStateWaiting, (Image::loadPlatformResource("inputSpeechWaiting"))); + + InputFieldSpeechButtonElement* speechButton = reinterpret_cast<InputFieldSpeechButtonElement*>(object->node()); + Image* image = imageStateNormal.get(); + if (speechButton->state() == InputFieldSpeechButtonElement::Recording) + image = imageStateRecording.get(); + else if (speechButton->state() == InputFieldSpeechButtonElement::Recognizing) + image = imageStateWaiting.get(); + paintInfo.context->drawImage(image, object->style()->colorSpace(), buttonRect); return false; } diff --git a/WebCore/rendering/RenderRubyRun.cpp b/WebCore/rendering/RenderRubyRun.cpp index d6b724b..d48646b 100644 --- a/WebCore/rendering/RenderRubyRun.cpp +++ b/WebCore/rendering/RenderRubyRun.cpp @@ -143,14 +143,15 @@ void RenderRubyRun::addChild(RenderObject* child, RenderObject* beforeChild) RenderBlock::removeChild(beforeChild); newRun->addChild(beforeChild); } else { - ASSERT(hasRubyBase()); // Otherwise beforeChild would be borked. - // Insertion before a ruby base object. - // In this case we need insert a new run before the current one and split the base. - RenderObject* ruby = parent(); - RenderRubyRun* newRun = staticCreateRubyRun(ruby); - ruby->addChild(newRun, this); - newRun->addChild(child); - rubyBaseSafe()->moveChildren(newRun->rubyBaseSafe(), beforeChild); + if (hasRubyBase()) { + // Insertion before a ruby base object. + // In this case we need insert a new run before the current one and split the base. + RenderObject* ruby = parent(); + RenderRubyRun* newRun = staticCreateRubyRun(ruby); + ruby->addChild(newRun, this); + newRun->addChild(child); + rubyBaseSafe()->moveChildren(newRun->rubyBaseSafe(), beforeChild); + } } } else { // child is not a text -> insert it into the base @@ -171,13 +172,14 @@ void RenderRubyRun::removeChild(RenderObject* child) if (base && rightNeighbour && rightNeighbour->isRubyRun()) { // Ruby run without a base can happen only at the first run. RenderRubyRun* rightRun = static_cast<RenderRubyRun*>(rightNeighbour); - ASSERT(rightRun->hasRubyBase()); - RenderRubyBase* rightBase = rightRun->rubyBaseSafe(); - // Collect all children in a single base, then swap the bases. - rightBase->moveChildren(base); - moveChildTo(rightRun, base); - rightRun->moveChildTo(this, rightBase); - // The now empty ruby base will be removed below. + if (rightRun->hasRubyBase()) { + RenderRubyBase* rightBase = rightRun->rubyBaseSafe(); + // Collect all children in a single base, then swap the bases. + rightBase->moveChildren(base); + moveChildTo(rightRun, base); + rightRun->moveChildTo(this, rightBase); + // The now empty ruby base will be removed below. + } } } diff --git a/WebCore/rendering/RenderSVGAllInOne.cpp b/WebCore/rendering/RenderSVGAllInOne.cpp index fa5709e..2d44ca2 100644 --- a/WebCore/rendering/RenderSVGAllInOne.cpp +++ b/WebCore/rendering/RenderSVGAllInOne.cpp @@ -53,6 +53,7 @@ #include "RenderSVGViewportContainer.cpp" #include "SVGCharacterData.cpp" #include "SVGCharacterLayoutInfo.cpp" +#include "SVGImageBufferTools.cpp" #include "SVGInlineFlowBox.cpp" #include "SVGInlineTextBox.cpp" #include "SVGMarkerLayoutInfo.cpp" diff --git a/WebCore/rendering/RenderSVGGradientStop.cpp b/WebCore/rendering/RenderSVGGradientStop.cpp index 3494aa7..ebf7385 100644 --- a/WebCore/rendering/RenderSVGGradientStop.cpp +++ b/WebCore/rendering/RenderSVGGradientStop.cpp @@ -47,6 +47,8 @@ RenderSVGGradientStop::~RenderSVGGradientStop() void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderObject::styleDidChange(diff, oldStyle); + if (diff == StyleDifferenceEqual) + return; // <stop> elements should only be allowed to make renderers under gradient elements // but I can imagine a few cases we might not be catching, so let's not crash if our parent isn't a gradient. @@ -60,7 +62,7 @@ void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderSty ASSERT(renderer->isSVGResourceContainer()); RenderSVGResourceContainer* container = renderer->toRenderSVGResourceContainer(); - container->invalidateClients(); + container->removeAllClientsFromCache(); } void RenderSVGGradientStop::layout() diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index 993278c..893a4ea 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -177,7 +177,7 @@ void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect) // The image resource defaults to nullImage until the resource arrives. // This empty image may be cached by SVG resources which must be invalidated. if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this)) - resources->invalidateClient(this); + resources->removeClientFromCache(this); // Eventually notify parent resources, that we've changed. RenderSVGResource::markForLayoutAndParentResourceInvalidation(this, false); diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h index 6ee0179..38e3a13 100644 --- a/WebCore/rendering/RenderSVGImage.h +++ b/WebCore/rendering/RenderSVGImage.h @@ -81,6 +81,21 @@ private: mutable FloatRect m_cachedLocalRepaintRect; }; +inline RenderSVGImage* toRenderSVGImage(RenderObject* object) +{ + ASSERT(!object || object->isSVGImage()); + return static_cast<RenderSVGImage*>(object); +} + +inline const RenderSVGImage* toRenderSVGImage(const RenderObject* object) +{ + ASSERT(!object || object->isSVGImage()); + return static_cast<const RenderSVGImage*>(object); +} + +// This will catch anyone doing an unnecessary cast. +void toRenderSVGImage(const RenderSVGImage*); + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp index 9c89d3c..0c943e5 100644 --- a/WebCore/rendering/RenderSVGResource.cpp +++ b/WebCore/rendering/RenderSVGResource.cpp @@ -171,7 +171,7 @@ void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject* RenderObject* current = object->parent(); while (current) { if (current->isSVGResourceContainer()) { - current->toRenderSVGResourceContainer()->invalidateClients(); + current->toRenderSVGResourceContainer()->removeAllClientsFromCache(); break; } diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h index e2d8216..a70ce52 100644 --- a/WebCore/rendering/RenderSVGResource.h +++ b/WebCore/rendering/RenderSVGResource.h @@ -57,8 +57,8 @@ public: RenderSVGResource() { } virtual ~RenderSVGResource() { } - virtual void invalidateClients() = 0; - virtual void invalidateClient(RenderObject*) = 0; + virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0; + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0; virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0; virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short) { } diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp index a201d1f..626a880 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.cpp +++ b/WebCore/rendering/RenderSVGResourceClipper.cpp @@ -64,7 +64,7 @@ RenderSVGResourceClipper::~RenderSVGResourceClipper() m_clipper.clear(); } -void RenderSVGResourceClipper::invalidateClients() +void RenderSVGResourceClipper::removeAllClientsFromCache(bool markForInvalidation) { if (m_invalidationBlocked) return; @@ -75,20 +75,19 @@ void RenderSVGResourceClipper::invalidateClients() m_clipper.clear(); } - markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); + markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation); } -void RenderSVGResourceClipper::invalidateClient(RenderObject* client) +void RenderSVGResourceClipper::removeClientFromCache(RenderObject* client, bool markForInvalidation) { ASSERT(client); if (m_invalidationBlocked) return; - ASSERT(client->selfNeedsLayout()); if (m_clipper.contains(client)) delete m_clipper.take(client); - markClientForInvalidation(client, BoundariesInvalidation); + markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation); } bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) @@ -174,7 +173,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons if (!clipperData->clipMaskImage) return false; - context->clipToImageBuffer(repaintRect, clipperData->clipMaskImage.get()); + context->clipToImageBuffer(clipperData->clipMaskImage.get(), repaintRect); return true; } diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h index d334c7d..0f68c67 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.h +++ b/WebCore/rendering/RenderSVGResourceClipper.h @@ -47,8 +47,8 @@ public: virtual const char* renderName() const { return "RenderSVGResourceClipper"; } - virtual void invalidateClients(); - virtual void invalidateClient(RenderObject*); + virtual void removeAllClientsFromCache(bool markForInvalidation = true); + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual FloatRect resourceBoundingBox(RenderObject*); diff --git a/WebCore/rendering/RenderSVGResourceContainer.cpp b/WebCore/rendering/RenderSVGResourceContainer.cpp index 7e43300..5652dcc 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.cpp +++ b/WebCore/rendering/RenderSVGResourceContainer.cpp @@ -52,7 +52,7 @@ void RenderSVGResourceContainer::layout() { // Invalidate all resources if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - invalidateClients(); + removeAllClientsFromCache(); RenderSVGHiddenContainer::layout(); } @@ -76,7 +76,7 @@ void RenderSVGResourceContainer::styleDidChange(StyleDifference diff, const Rend void RenderSVGResourceContainer::idChanged() { // Invalidate all our current clients. - invalidateClients(); + removeAllClientsFromCache(); // Remove old id, that is guaranteed to be present in cache. SVGDocumentExtensions* extensions = svgExtensionsFromNode(node()); @@ -92,17 +92,32 @@ void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode return; bool needsLayout = mode == LayoutAndBoundariesInvalidation; + bool markForInvalidation = mode != ParentOnlyInvalidation; HashSet<RenderObject*>::iterator end = m_clients.end(); for (HashSet<RenderObject*>::iterator it = m_clients.begin(); it != end; ++it) { RenderObject* client = *it; if (client->isSVGResourceContainer()) { - client->toRenderSVGResourceContainer()->invalidateClients(); + client->toRenderSVGResourceContainer()->removeAllClientsFromCache(markForInvalidation); continue; } - markClientForInvalidation(client, mode); - RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, needsLayout); + if (markForInvalidation) + markClientForInvalidation(client, mode); + + if (needsLayout) + client->setNeedsLayout(true); + + // Invalidate resources in ancestor chain, if needed. + RenderObject* current = client->parent(); + while (current) { + if (current->isSVGResourceContainer()) { + current->toRenderSVGResourceContainer()->removeAllClientsFromCache(markForInvalidation); + break; + } + + current = current->parent(); + } } } @@ -120,6 +135,8 @@ void RenderSVGResourceContainer::markClientForInvalidation(RenderObject* client, if (client->view()) client->repaint(); break; + case ParentOnlyInvalidation: + break; } } diff --git a/WebCore/rendering/RenderSVGResourceContainer.h b/WebCore/rendering/RenderSVGResourceContainer.h index 4271a5f..08e18d4 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.h +++ b/WebCore/rendering/RenderSVGResourceContainer.h @@ -49,7 +49,8 @@ protected: enum InvalidationMode { LayoutAndBoundariesInvalidation, BoundariesInvalidation, - RepaintInvalidation + RepaintInvalidation, + ParentOnlyInvalidation }; // Used from the invalidateClient/invalidateClients methods from classes, inheriting from us. diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index bc5feaf..09e83f4 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -67,25 +67,24 @@ RenderSVGResourceFilter::~RenderSVGResourceFilter() m_filter.clear(); } -void RenderSVGResourceFilter::invalidateClients() +void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation) { if (!m_filter.isEmpty()) { deleteAllValues(m_filter); m_filter.clear(); } - markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); + markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation); } -void RenderSVGResourceFilter::invalidateClient(RenderObject* client) +void RenderSVGResourceFilter::removeClientFromCache(RenderObject* client, bool markForInvalidation) { ASSERT(client); - ASSERT(client->selfNeedsLayout()); if (m_filter.contains(client)) delete m_filter.take(client); - markClientForInvalidation(client, BoundariesInvalidation); + markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation); } PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() @@ -243,7 +242,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo FilterData* filterData = m_filter.get(object); if (!filterData->builded) { if (!filterData->savedContext) { - invalidateClient(object); + removeClientFromCache(object); return; } @@ -271,7 +270,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo #if !PLATFORM(CG) resultImage->transformColorSpace(LinearRGB, DeviceRGB); #endif - context->drawImage(resultImage->image(), object->style()->colorSpace(), lastEffect->subRegion()); + context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->subRegion()); } } diff --git a/WebCore/rendering/RenderSVGResourceFilter.h b/WebCore/rendering/RenderSVGResourceFilter.h index 7b5ab09..314c94d 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.h +++ b/WebCore/rendering/RenderSVGResourceFilter.h @@ -64,8 +64,8 @@ public: virtual const char* renderName() const { return "RenderSVGResourceFilter"; } - virtual void invalidateClients(); - virtual void invalidateClient(RenderObject*); + virtual void removeAllClientsFromCache(bool markForInvalidation = true); + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp index 73b2ab6..d29192a 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.cpp +++ b/WebCore/rendering/RenderSVGResourceGradient.cpp @@ -28,6 +28,7 @@ #include "GradientAttributes.h" #include "GraphicsContext.h" +#include "SVGImageBufferTools.h" #include "SVGRenderSupport.h" #include <wtf/UnusedParam.h> @@ -50,81 +51,64 @@ RenderSVGResourceGradient::~RenderSVGResourceGradient() m_gradient.clear(); } -void RenderSVGResourceGradient::invalidateClients() +void RenderSVGResourceGradient::removeAllClientsFromCache(bool markForInvalidation) { if (!m_gradient.isEmpty()) { deleteAllValues(m_gradient); m_gradient.clear(); } - markAllClientsForInvalidation(RepaintInvalidation); + markAllClientsForInvalidation(markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation); } -void RenderSVGResourceGradient::invalidateClient(RenderObject* client) +void RenderSVGResourceGradient::removeClientFromCache(RenderObject* client, bool markForInvalidation) { ASSERT(client); - ASSERT(client->selfNeedsLayout()); if (m_gradient.contains(client)) delete m_gradient.take(client); - markClientForInvalidation(client, RepaintInvalidation); + markClientForInvalidation(client, markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation); } #if PLATFORM(CG) -static inline AffineTransform absoluteTransformFromContext(GraphicsContext* context) -{ - // Extract current transformation matrix used in the original context. Note that this coordinate - // system is flipped compared to SVGs internal coordinate system, done in WebKit level. Fix - // this transformation by flipping the y component. - return context->getCTM() * AffineTransform().flipY(); -} - static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& context, GraphicsContext*& savedContext, OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object) { const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object); + ASSERT(textRootBlock); - AffineTransform transform(absoluteTransformFromContext(context)); - FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates()); + AffineTransform absoluteTransform(SVGImageBufferTools::absoluteTransformFromContext(context)); + FloatRect absoluteTargetRect = absoluteTransform.mapRect(textRootBlock->repaintRectInLocalCoordinates()); - IntRect maskImageRect = enclosingIntRect(maskAbsoluteBoundingBox); - if (maskImageRect.isEmpty()) + OwnPtr<ImageBuffer> maskImage; + if (!SVGImageBufferTools::createImageBuffer(absoluteTransform, absoluteTargetRect, maskImage, DeviceRGB)) return false; - // Allocate an image buffer as big as the absolute unclipped size of the object - OwnPtr<ImageBuffer> maskImage = ImageBuffer::create(maskImageRect.size()); - if (!maskImage) - return false; - - GraphicsContext* maskImageContext = maskImage->context(); - - // Transform the mask image coordinate system to absolute screen coordinates - maskImageContext->translate(-maskAbsoluteBoundingBox.x(), -maskAbsoluteBoundingBox.y()); - maskImageContext->concatCTM(transform); - - imageBuffer = maskImage.release(); + ASSERT(maskImage); savedContext = context; - context = maskImageContext; - + context = maskImage->context(); + imageBuffer = maskImage.release(); return true; } static inline AffineTransform clipToTextMask(GraphicsContext* context, OwnPtr<ImageBuffer>& imageBuffer, + FloatRect& repaintRect, const RenderObject* object, GradientData* gradientData) { const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object); + ASSERT(textRootBlock); - // The mask image has been created in the device coordinate space, as the image should not be scaled. - // So the actual masking process has to be done in the device coordinate space as well. - AffineTransform transform(absoluteTransformFromContext(context)); - context->concatCTM(transform.inverse()); - context->clipToImageBuffer(transform.mapRect(textRootBlock->repaintRectInLocalCoordinates()), imageBuffer.get()); - context->concatCTM(transform); + repaintRect = textRootBlock->repaintRectInLocalCoordinates(); + + AffineTransform absoluteTransform(SVGImageBufferTools::absoluteTransformFromContext(context)); + FloatRect absoluteTargetRect = absoluteTransform.mapRect(repaintRect); + + SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, absoluteTargetRect, imageBuffer.get()); AffineTransform matrix; if (gradientData->boundingBoxMode) { @@ -146,7 +130,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* // Be sure to synchronize all SVG properties on the gradientElement _before_ processing any further. // Otherwhise the call to collectGradientAttributes() in createTileImage(), may cause the SVG DOM property - // synchronization to kick in, which causes invalidateClients() to be called, which in turn deletes our + // synchronization to kick in, which causes removeAllClientsFromCache() to be called, which in turn deletes our // GradientData object! Leaving out the line below will cause svg/dynamic-updates/SVG*GradientElement-svgdom* to crash. SVGGradientElement* gradientElement = static_cast<SVGGradientElement*>(node()); if (!gradientElement) @@ -232,12 +216,11 @@ void RenderSVGResourceGradient::postApplyResource(RenderObject* object, Graphics context = m_savedContext; m_savedContext = 0; - gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, object, gradientData)); + FloatRect repaintRect; + gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, repaintRect, object, gradientData)); context->setFillGradient(gradientData->gradient); - const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object); - context->fillRect(textRootBlock->repaintRectInLocalCoordinates()); - + context->fillRect(repaintRect); m_imageBuffer.clear(); } #else diff --git a/WebCore/rendering/RenderSVGResourceGradient.h b/WebCore/rendering/RenderSVGResourceGradient.h index b01af6d..4de4272 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.h +++ b/WebCore/rendering/RenderSVGResourceGradient.h @@ -50,8 +50,8 @@ public: RenderSVGResourceGradient(SVGGradientElement*); virtual ~RenderSVGResourceGradient(); - virtual void invalidateClients(); - virtual void invalidateClient(RenderObject*); + virtual void removeAllClientsFromCache(bool markForInvalidation = true); + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); diff --git a/WebCore/rendering/RenderSVGResourceMarker.cpp b/WebCore/rendering/RenderSVGResourceMarker.cpp index fa00fa3..1d5663b 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.cpp +++ b/WebCore/rendering/RenderSVGResourceMarker.cpp @@ -50,7 +50,7 @@ void RenderSVGResourceMarker::layout() { // Invalidate all resources if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - invalidateClients(); + removeAllClientsFromCache(); // RenderSVGHiddenContainer overwrites layout(). We need the // layouting of RenderSVGContainer for calculating local @@ -58,16 +58,15 @@ void RenderSVGResourceMarker::layout() RenderSVGContainer::layout(); } -void RenderSVGResourceMarker::invalidateClients() +void RenderSVGResourceMarker::removeAllClientsFromCache(bool markForInvalidation) { - markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); + markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation); } -void RenderSVGResourceMarker::invalidateClient(RenderObject* client) +void RenderSVGResourceMarker::removeClientFromCache(RenderObject* client, bool markForInvalidation) { ASSERT(client); - ASSERT(client->selfNeedsLayout()); - markClientForInvalidation(client, BoundariesInvalidation); + markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation); } void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo) diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h index 8509aca..e41096e 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.h +++ b/WebCore/rendering/RenderSVGResourceMarker.h @@ -41,8 +41,8 @@ public: virtual const char* renderName() const { return "RenderSVGResourceMarker"; } - virtual void invalidateClients(); - virtual void invalidateClient(RenderObject*); + virtual void removeAllClientsFromCache(bool markForInvalidation = true); + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); void draw(PaintInfo&, const AffineTransform&); diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp index 2c36c96..9713dd6 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.cpp +++ b/WebCore/rendering/RenderSVGResourceMasker.cpp @@ -35,6 +35,7 @@ #include "IntRect.h" #include "RenderSVGResource.h" #include "SVGElement.h" +#include "SVGImageBufferTools.h" #include "SVGMaskElement.h" #include "SVGStyledElement.h" #include "SVGUnitTypes.h" @@ -59,26 +60,25 @@ RenderSVGResourceMasker::~RenderSVGResourceMasker() m_masker.clear(); } -void RenderSVGResourceMasker::invalidateClients() +void RenderSVGResourceMasker::removeAllClientsFromCache(bool markForInvalidation) { - m_maskBoundaries = FloatRect(); + m_maskContentBoundaries = FloatRect(); if (!m_masker.isEmpty()) { deleteAllValues(m_masker); m_masker.clear(); } - markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); + markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation); } -void RenderSVGResourceMasker::invalidateClient(RenderObject* client) +void RenderSVGResourceMasker::removeClientFromCache(RenderObject* client, bool markForInvalidation) { ASSERT(client); - ASSERT(client->selfNeedsLayout()); if (m_masker.contains(client)) delete m_masker.take(client); - markClientForInvalidation(client, BoundariesInvalidation); + markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation); } bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) @@ -95,73 +95,47 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, m_masker.set(object, new MaskerData); MaskerData* maskerData = m_masker.get(object); - if (!maskerData->maskImage && !maskerData->emptyMask) { + + AffineTransform absoluteTransform(SVGImageBufferTools::absoluteTransformFromContext(context)); + FloatRect maskRect = absoluteTransform.mapRect(object->repaintRectInLocalCoordinates()); + + if (!maskerData->maskImage && !maskRect.isEmpty()) { SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); if (!maskElement) return false; - createMaskImage(maskerData, maskElement, object); + + if (!SVGImageBufferTools::createImageBuffer(absoluteTransform, maskRect, maskerData->maskImage, LinearRGB)) + return false; + + ASSERT(maskerData->maskImage); + drawContentIntoMaskImage(maskRect, maskerData, maskElement, object); } if (!maskerData->maskImage) return false; - context->clipToImageBuffer(maskerData->maskRect, maskerData->maskImage.get()); + SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, maskRect, maskerData->maskImage.get()); return true; } -void RenderSVGResourceMasker::createMaskImage(MaskerData* maskerData, const SVGMaskElement* maskElement, RenderObject* object) +void RenderSVGResourceMasker::drawContentIntoMaskImage(const FloatRect& maskRect, MaskerData* maskerData, const SVGMaskElement* maskElement, RenderObject* object) { - FloatRect objectBoundingBox = object->objectBoundingBox(); - - // Mask rect clipped with clippingBoundingBox and filterBoundingBox as long as they are present. - maskerData->maskRect = object->repaintRectInLocalCoordinates(); - if (maskerData->maskRect.isEmpty()) { - maskerData->emptyMask = true; - return; - } - - if (m_maskBoundaries.isEmpty()) - calculateMaskContentRepaintRect(); + IntRect maskImageRect = enclosingIntRect(maskRect); + maskImageRect.setLocation(IntPoint()); - FloatRect repaintRect = m_maskBoundaries; - AffineTransform contextTransform; - // We need to scale repaintRect for objectBoundingBox to get the drawing area. + // Eventually adjust the mask image context according to the target objectBoundingBox. if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { - contextTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); - FloatPoint contextAdjustment = repaintRect.location(); - repaintRect = contextTransform.mapRect(repaintRect); - repaintRect.move(objectBoundingBox.x(), objectBoundingBox.y()); - contextTransform.translate(-contextAdjustment.x(), -contextAdjustment.y()); - } - repaintRect.intersect(maskerData->maskRect); - maskerData->maskRect = repaintRect; - IntRect maskImageRect = enclosingIntRect(maskerData->maskRect); - - maskImageRect.setLocation(IntPoint()); + GraphicsContext* maskImageContext = maskerData->maskImage->context(); + ASSERT(maskImageContext); - // Don't create ImageBuffers with image size of 0 - if (maskImageRect.isEmpty()) { - maskerData->emptyMask = true; - return; + FloatRect objectBoundingBox = object->objectBoundingBox(); + AffineTransform contextTransform; + contextTransform.translate(objectBoundingBox.x(), objectBoundingBox.y()); + contextTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); + maskImageContext->concatCTM(contextTransform); } - // FIXME: This changes color space to linearRGB, the default color space - // for masking operations in SVG. We need a switch for the other color-space - // attribute values sRGB, inherit and auto. - maskerData->maskImage = ImageBuffer::create(maskImageRect.size(), LinearRGB); - if (!maskerData->maskImage) - return; - - GraphicsContext* maskImageContext = maskerData->maskImage->context(); - ASSERT(maskImageContext); - - maskImageContext->save(); - - if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) - maskImageContext->translate(-maskerData->maskRect.x(), -maskerData->maskRect.y()); - maskImageContext->concatCTM(contextTransform); - - // draw the content into the ImageBuffer + // Draw the content into the ImageBuffer. for (Node* node = maskElement->firstChild(); node; node = node->nextSibling()) { RenderObject* renderer = node->renderer(); if (!node->isSVGElement() || !static_cast<SVGElement*>(node)->isStyled() || !renderer) @@ -172,8 +146,6 @@ void RenderSVGResourceMasker::createMaskImage(MaskerData* maskerData, const SVGM SVGRenderSupport::renderSubtreeToImage(maskerData->maskImage.get(), renderer); } - maskImageContext->restore(); - #if !PLATFORM(CG) maskerData->maskImage->transformColorSpace(DeviceRGB, LinearRGB); #endif @@ -206,31 +178,31 @@ void RenderSVGResourceMasker::calculateMaskContentRepaintRect() RenderStyle* style = renderer->style(); if (!style || style->display() == NONE || style->visibility() != VISIBLE) continue; - m_maskBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates())); + m_maskContentBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates())); } } FloatRect RenderSVGResourceMasker::resourceBoundingBox(RenderObject* object) { - // Resource was not layouted yet. Give back clipping rect of the mask. SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); + ASSERT(maskElement); + FloatRect objectBoundingBox = object->objectBoundingBox(); FloatRect maskBoundaries = maskElement->maskBoundingBox(objectBoundingBox); + + // Resource was not layouted yet. Give back clipping rect of the mask. if (selfNeedsLayout()) return maskBoundaries; - if (m_maskBoundaries.isEmpty()) + if (m_maskContentBoundaries.isEmpty()) calculateMaskContentRepaintRect(); - if (!maskElement) - return FloatRect(); - - FloatRect maskRect = m_maskBoundaries; + FloatRect maskRect = m_maskContentBoundaries; if (maskElement->maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); - maskRect = transform.mapRect(maskRect); + maskRect = transform.mapRect(maskRect); } maskRect.intersect(maskBoundaries); diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h index f6301cb..f2d8cb2 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.h +++ b/WebCore/rendering/RenderSVGResourceMasker.h @@ -36,14 +36,7 @@ namespace WebCore { struct MaskerData { - MaskerData() - : emptyMask(false) - { - } - OwnPtr<ImageBuffer> maskImage; - FloatRect maskRect; - bool emptyMask; }; class RenderSVGResourceMasker : public RenderSVGResourceContainer { @@ -53,9 +46,8 @@ public: virtual const char* renderName() const { return "RenderSVGResourceMasker"; } - virtual void invalidateClients(); - virtual void invalidateClient(RenderObject*); - + virtual void removeAllClientsFromCache(bool markForInvalidation = true); + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual FloatRect resourceBoundingBox(RenderObject*); @@ -66,10 +58,10 @@ public: static RenderSVGResourceType s_resourceType; private: - void createMaskImage(MaskerData*, const SVGMaskElement*, RenderObject*); + void drawContentIntoMaskImage(const FloatRect& maskRect, MaskerData*, const SVGMaskElement*, RenderObject*); void calculateMaskContentRepaintRect(); - FloatRect m_maskBoundaries; + FloatRect m_maskContentBoundaries; HashMap<RenderObject*, MaskerData*> m_masker; }; diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp index 902ff02..f4f5cf4 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.cpp +++ b/WebCore/rendering/RenderSVGResourcePattern.cpp @@ -47,25 +47,24 @@ RenderSVGResourcePattern::~RenderSVGResourcePattern() m_pattern.clear(); } -void RenderSVGResourcePattern::invalidateClients() +void RenderSVGResourcePattern::removeAllClientsFromCache(bool markForInvalidation) { if (!m_pattern.isEmpty()) { deleteAllValues(m_pattern); m_pattern.clear(); } - markAllClientsForInvalidation(RepaintInvalidation); + markAllClientsForInvalidation(markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation); } -void RenderSVGResourcePattern::invalidateClient(RenderObject* client) +void RenderSVGResourcePattern::removeClientFromCache(RenderObject* client, bool markForInvalidation) { ASSERT(client); - ASSERT(client->selfNeedsLayout()); if (m_pattern.contains(client)) delete m_pattern.take(client); - markClientForInvalidation(client, RepaintInvalidation); + markClientForInvalidation(client, markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation); } bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) @@ -77,7 +76,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* // Be sure to synchronize all SVG properties on the patternElement _before_ processing any further. // Otherwhise the call to collectPatternAttributes() in createTileImage(), may cause the SVG DOM property - // synchronization to kick in, which causes invalidateClients() to be called, which in turn deletes our + // synchronization to kick in, which causes removeAllClientsFromCache() to be called, which in turn deletes our // PatternData object! Leaving out the line below will cause svg/dynamic-updates/SVGPatternElement-svgdom* to crash. SVGPatternElement* patternElement = static_cast<SVGPatternElement*>(node()); if (!patternElement) @@ -298,14 +297,15 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* p void RenderSVGResourcePattern::buildPattern(PatternData* patternData, PassOwnPtr<ImageBuffer> tileImage) const { - if (!tileImage->image()) { + RefPtr<Image> copiedImage = tileImage->copyImage(); + if (!copiedImage) { patternData->pattern = 0; return; } - - IntRect tileRect = tileImage->image()->rect(); + + IntRect tileRect = copiedImage->rect(); if (tileRect.width() <= patternData->boundaries.width() && tileRect.height() <= patternData->boundaries.height()) { - patternData->pattern = Pattern::create(tileImage->image(), true, true); + patternData->pattern = Pattern::create(copiedImage, true, true); return; } @@ -331,13 +331,13 @@ void RenderSVGResourcePattern::buildPattern(PatternData* patternData, PassOwnPtr newTileImageContext->translate(0, patternData->boundaries.height()); for (int j = numX; j > 0; --j) { newTileImageContext->translate(patternData->boundaries.width(), 0); - newTileImageContext->drawImage(tileImage->image(), style()->colorSpace(), tileRect, tileRect); + newTileImageContext->drawImage(copiedImage.get(), style()->colorSpace(), tileRect, tileRect); } newTileImageContext->translate(-patternData->boundaries.width() * numX, 0); } newTileImageContext->restore(); - patternData->pattern = Pattern::create(newTileImage->image(), true, true); + patternData->pattern = Pattern::create(newTileImage->copyImage(), true, true); } } diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h index 690b0de..52bf09d 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.h +++ b/WebCore/rendering/RenderSVGResourcePattern.h @@ -51,8 +51,8 @@ public: virtual const char* renderName() const { return "RenderSVGResourcePattern"; } - virtual void invalidateClients(); - virtual void invalidateClient(RenderObject*); + virtual void removeAllClientsFromCache(bool markForInvalidation = true); + virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.h b/WebCore/rendering/RenderSVGResourceSolidColor.h index ad7fd27..44109db 100644 --- a/WebCore/rendering/RenderSVGResourceSolidColor.h +++ b/WebCore/rendering/RenderSVGResourceSolidColor.h @@ -33,8 +33,8 @@ public: RenderSVGResourceSolidColor(); virtual ~RenderSVGResourceSolidColor(); - virtual void invalidateClients() { } - virtual void invalidateClient(RenderObject*) { } + virtual void removeAllClientsFromCache(bool = true) { } + virtual void removeClientFromCache(RenderObject*, bool = true) { } virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode); diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index e192e29..8cb54c0 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -25,7 +25,6 @@ #include "config.h" #include "RenderTableSection.h" - #include "CachedImage.h" #include "Document.h" #include "HitTestResult.h" @@ -1116,38 +1115,43 @@ void RenderTableSection::paintObject(PaintInfo& paintInfo, int tx, int ty) // If some cell overflows, just paint all of them. if (!m_hasOverflowingCell) { - for (; startrow < totalRows; startrow++) { - if (ty + m_rowPos[startrow + 1] >= y - os) - break; - } - if (startrow == totalRows && ty + m_rowPos[totalRows] + table()->outerBorderBottom() >= y - os) - startrow--; + int relativeY = y - ty; + int top = relativeY - os; + // binary search to find a row + startrow = std::lower_bound(m_rowPos.begin(), m_rowPos.end(), top) - m_rowPos.begin(); + + // The binary search above gives us the first row with + // a y position >= the top of the paint rect. Thus, the previous + // may need to be repainted as well. + if (startrow == m_rowPos.size() || (startrow > 0 && (m_rowPos[startrow] > top))) + --startrow; + + int bottom = relativeY + h + os - 1; + endrow = std::lower_bound(m_rowPos.begin(), m_rowPos.end(), bottom) - m_rowPos.begin(); + if ((endrow == m_rowPos.size()) || (endrow > 0 && m_rowPos[endrow - 1] == bottom)) + --endrow; - for (; endrow > 0; endrow--) { - if (ty + m_rowPos[endrow - 1] <= y + h + os) - break; - } if (!endrow && ty + m_rowPos[0] - table()->outerBorderTop() <= y + h + os) - endrow++; + ++endrow; } - unsigned startcol = 0; unsigned endcol = totalCols; // FIXME: Implement RTL. if (!m_hasOverflowingCell && style()->direction() == LTR) { - for (; startcol < totalCols; startcol++) { - if (tx + table()->columnPositions()[startcol + 1] >= x - os) - break; - } - if (startcol == totalCols && tx + table()->columnPositions()[totalCols] + table()->outerBorderRight() >= x - os) - startcol--; + int relativeX = x - tx; + int left = relativeX - os; + Vector<int>& columnPos = table()->columnPositions(); + startcol = std::lower_bound(columnPos.begin(), columnPos.end(), left) - columnPos.begin(); + if ((startcol == columnPos.size()) || (startcol > 0 && (columnPos[startcol] > left))) + --startcol; + + int right = relativeX + w + os - 1; + endcol = std::lower_bound(columnPos.begin(), columnPos.end(), right) - columnPos.begin(); + if (endcol == columnPos.size() || (endcol > 0 && (columnPos[endcol - 1] == right))) + --endcol; - for (; endcol > 0; endcol--) { - if (tx + table()->columnPositions()[endcol - 1] <= x + w + os) - break; - } if (!endcol && tx + table()->columnPositions()[0] - table()->outerBorderLeft() <= y + w + os) - endcol++; + ++endcol; } #ifdef ANDROID_LAYOUT @@ -1282,6 +1286,10 @@ void RenderTableSection::splitColumn(int pos, int first) // Hit Testing bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int xPos, int yPos, int tx, int ty, HitTestAction action) { + // If we have no children then we have nothing to do. + if (!firstChild()) + return false; + // Table sections cannot ever be hit tested. Effectively they do not exist. // Just forward to our children always. tx += x(); @@ -1290,17 +1298,56 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) return false; - for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { - // FIXME: We have to skip over inline flows, since they can show up inside table rows - // at the moment (a demoted inline <form> for example). If we ever implement a - // table-specific hit-test method (which we should do for performance reasons anyway), - // then we can remove this check. - if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { + if (m_hasOverflowingCell) { + for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { + // FIXME: We have to skip over inline flows, since they can show up inside table rows + // at the moment (a demoted inline <form> for example). If we ever implement a + // table-specific hit-test method (which we should do for performance reasons anyway), + // then we can remove this check. + if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { + updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); + return true; + } + } + return false; + } + + int relativeY = yPos - ty; + // leftrow corresponds to the first row that starts after the y mouse position + unsigned leftrow = std::upper_bound(m_rowPos.begin(), m_rowPos.end(), relativeY) - m_rowPos.begin(); + if (leftrow == m_rowPos.size()) + return false; + // Grab the last row that starts before the y mouse position. + if (leftrow > 0) + --leftrow; + + Vector<int>& columnPos = table()->columnPositions(); + bool rtl = style()->direction() == RTL; + int relativeX = xPos - tx; + if (rtl) + relativeX = columnPos[columnPos.size() - 1] - relativeX; + + unsigned leftcol = std::lower_bound(columnPos.begin(), columnPos.end(), relativeX) - columnPos.begin(); + if (leftcol == columnPos.size()) + return false; + if (leftcol > 0) + --leftcol; + + CellStruct& current = cellAt(leftrow, leftcol); + + // If the cell is empty, there's nothing to do + if (!current.hasCells()) + return false; + + for (int i = current.cells.size() - 1; i >= 0; --i) { + RenderTableCell* cell = current.cells[i]; + if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); return true; } } return false; + } } // namespace WebCore diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index bd050d8..da152b0 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -37,13 +37,13 @@ #include "RenderBlock.h" #include "RenderLayer.h" #include "RenderView.h" -#include "StringBuffer.h" #include "Text.h" #include "TextBreakIterator.h" #include "TextResourceDecoder.h" #include "VisiblePosition.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> +#include <wtf/text/StringBuffer.h> using namespace std; using namespace WTF; diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp index d1c8039..5f8c788 100644 --- a/WebCore/rendering/RenderTextControl.cpp +++ b/WebCore/rendering/RenderTextControl.cpp @@ -29,6 +29,7 @@ #include "EventNames.h" #include "Frame.h" #include "HTMLBRElement.h" +#include "HTMLFormControlElement.h" #include "HTMLNames.h" #include "HitTestResult.h" #include "RenderLayer.h" @@ -217,12 +218,14 @@ int RenderTextControl::selectionEnd() void RenderTextControl::setSelectionStart(int start) { - setSelectionRange(start, max(start, selectionEnd())); + HTMLTextFormControlElement* element = static_cast<HTMLTextFormControlElement*>(node()); + setSelectionRange(start, max(start, element->selectionEnd())); } void RenderTextControl::setSelectionEnd(int end) { - setSelectionRange(min(end, selectionStart()), end); + HTMLTextFormControlElement* element = static_cast<HTMLTextFormControlElement*>(node()); + setSelectionRange(min(end, element->selectionStart()), end); } void RenderTextControl::select() diff --git a/WebCore/rendering/RenderTheme.h b/WebCore/rendering/RenderTheme.h index 1e0b54c..aedb8eb 100644 --- a/WebCore/rendering/RenderTheme.h +++ b/WebCore/rendering/RenderTheme.h @@ -29,7 +29,6 @@ #include "ThemeTypes.h" #endif #include "RenderObject.h" -#include "RenderTheme.h" #include "ScrollTypes.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h index 2309081..d1875fc 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.h +++ b/WebCore/rendering/RenderThemeChromiumMac.h @@ -41,8 +41,11 @@ protected: virtual bool shouldRenderMediaControlPart(ControlPart, Element*); virtual String extraMediaControlsStyleSheet(); + virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&); virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual IntPoint volumeSliderOffsetFromMuteButton(Node*, const IntSize&) const; #endif diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index a43da1e..e8ffe6c 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -134,6 +134,11 @@ String RenderThemeChromiumMac::extraMediaControlsStyleSheet() return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet)); } +bool RenderThemeChromiumMac::paintMediaVolumeSliderContainer(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) +{ + return true; +} + bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) { return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect); @@ -144,6 +149,15 @@ bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, c return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect); } +bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect) +{ + return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect); +} + +IntPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(Node* muteButton, const IntSize& size) const +{ + return RenderTheme::volumeSliderOffsetFromMuteButton(muteButton, size); +} #endif } // namespace WebCore diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm index cc2ff1f..7982834 100644 --- a/WebCore/rendering/RenderThemeMac.mm +++ b/WebCore/rendering/RenderThemeMac.mm @@ -963,7 +963,8 @@ bool RenderThemeMac::paintProgressBar(RenderObject* renderObject, const PaintInf paintInfo.context->translate(2 * rect.x() + rect.width(), 0); paintInfo.context->scale(FloatSize(-1, 1)); } - paintInfo.context->drawImage(imageBuffer->image(), DeviceColorSpace, rect.location()); + + paintInfo.context->drawImageBuffer(imageBuffer.get(), DeviceColorSpace, rect.location()); paintInfo.context->restore(); return false; diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp index 408015c..e10c2f1 100644 --- a/WebCore/rendering/RenderTreeAsText.cpp +++ b/WebCore/rendering/RenderTreeAsText.cpp @@ -442,7 +442,7 @@ void write(TextStream& ts, const RenderObject& o, int indent, RenderAsTextBehavi return; } if (o.isSVGImage()) { - writeSVGImage(ts, *toRenderImage(&o), indent); + writeSVGImage(ts, *toRenderSVGImage(&o), indent); return; } #endif diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp index ab969cc..0f444b2 100644 --- a/WebCore/rendering/RenderVideo.cpp +++ b/WebCore/rendering/RenderVideo.cpp @@ -134,13 +134,14 @@ void RenderVideo::imageChanged(WrappedImagePtr newImage, const IntRect* rect) RenderMedia::imageChanged(newImage, rect); // Cache the image intrinsic size so we can continue to use it to draw the image correctly - // even after we know the video intrisic size but aren't able to draw video frames yet - // (we don't want to scale the poster to the video size). - if (videoElement()->shouldDisplayPosterImage()) { - if (errorOccurred()) - updateIntrinsicSize(); + // even if we know the video intrinsic size but aren't able to draw video frames yet + // (we don't want to scale the poster to the video size without keeping aspect ratio). + if (videoElement()->shouldDisplayPosterImage()) m_cachedImageSize = intrinsicSize(); - } + + // The intrinsic size is now that of the image, but in case we already had the + // intrinsic size of the video we call this here to restore the video size. + updateIntrinsicSize(); } IntRect RenderVideo::videoBox() const diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp index 449c15c..acb8487 100644 --- a/WebCore/rendering/RenderView.cpp +++ b/WebCore/rendering/RenderView.cpp @@ -186,7 +186,7 @@ void RenderView::paint(PaintInfo& paintInfo, int tx, int ty) ASSERT(!needsLayout()); // Cache the print rect because the dirty rect could get changed during painting. - if (printing()) + if (document()->paginated()) setPrintRect(paintInfo.rect); else setPrintRect(IntRect()); diff --git a/WebCore/rendering/SVGImageBufferTools.cpp b/WebCore/rendering/SVGImageBufferTools.cpp new file mode 100644 index 0000000..5b45ccc --- /dev/null +++ b/WebCore/rendering/SVGImageBufferTools.cpp @@ -0,0 +1,73 @@ +/* + 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" + +#if ENABLE(SVG) +#include "SVGImageBufferTools.h" + +#include "GraphicsContext.h" +#include "RenderObject.h" + +namespace WebCore { + +AffineTransform SVGImageBufferTools::absoluteTransformFromContext(GraphicsContext* context) +{ + // Extract current transformation matrix used in the original context. Note that this coordinate + // system is flipped compared to SVGs internal coordinate system, done in WebKit level. Fix + // this transformation by flipping the y component. + return context->getCTM() * AffineTransform().flipY(); +} + +bool SVGImageBufferTools::createImageBuffer(const AffineTransform& absoluteTransform, const FloatRect& absoluteTargetRect, OwnPtr<ImageBuffer>& imageBuffer, ImageColorSpace colorSpace) +{ + IntRect imageRect = enclosingIntRect(absoluteTargetRect); + if (imageRect.isEmpty()) + return false; + + // Allocate an image buffer as big as the absolute unclipped size of the object + OwnPtr<ImageBuffer> image = ImageBuffer::create(imageRect.size(), colorSpace); + if (!image) + return false; + + GraphicsContext* imageContext = image->context(); + + // Transform the mask image coordinate system to absolute screen coordinates + imageContext->translate(-absoluteTargetRect.x(), -absoluteTargetRect.y()); + imageContext->concatCTM(absoluteTransform); + + imageBuffer = image.release(); + return true; +} + +void SVGImageBufferTools::clipToImageBuffer(GraphicsContext* context, const AffineTransform& absoluteTransform, const FloatRect& absoluteTargetRect, ImageBuffer* imageBuffer) +{ + ASSERT(context); + ASSERT(imageBuffer); + + // The mask image has been created in the device coordinate space, as the image should not be scaled. + // So the actual masking process has to be done in the device coordinate space as well. + context->concatCTM(absoluteTransform.inverse()); + context->clipToImageBuffer(imageBuffer, absoluteTargetRect); + context->concatCTM(absoluteTransform); +} + +} + +#endif // ENABLE(SVG) diff --git a/WebCore/rendering/SVGImageBufferTools.h b/WebCore/rendering/SVGImageBufferTools.h new file mode 100644 index 0000000..bdbcb1c --- /dev/null +++ b/WebCore/rendering/SVGImageBufferTools.h @@ -0,0 +1,49 @@ +/* + 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 + aint 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 SVGImageBufferTools_h +#define SVGImageBufferTools_h + +#if ENABLE(SVG) +#include "ImageBuffer.h" +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class AffineTransform; +class FloatRect; +class GraphicsContext; +class RenderObject; + +class SVGImageBufferTools : public Noncopyable { +public: + static bool createImageBuffer(const AffineTransform& absoluteTransform, const FloatRect& absoluteTargetRect, OwnPtr<ImageBuffer>&, ImageColorSpace); + static void clipToImageBuffer(GraphicsContext*, const AffineTransform& absoluteTransform, const FloatRect& absoluteTargetRect, ImageBuffer*); + + static AffineTransform absoluteTransformFromContext(GraphicsContext*); + +private: + SVGImageBufferTools() { } + ~SVGImageBufferTools() { } +}; + +} + +#endif +#endif diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index 67e19f2..e265b2b 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -229,9 +229,20 @@ static inline RenderSVGRoot* svgRootTreeObject(RenderObject* start) return toRenderSVGRoot(start); } +static inline void invalidateResourcesOfChildren(RenderObject* start) +{ + ASSERT(!start->needsLayout()); + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(start)) + resources->removeClientFromCache(start, false); + + for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) + invalidateResourcesOfChildren(child); +} + void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout) { bool layoutSizeChanged = svgRootTreeObject(start)->isLayoutSizeChanged(); + HashSet<RenderObject*> notlayoutedObjects; for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { bool needsLayout = selfNeedsLayout; @@ -252,11 +263,25 @@ void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout) if (needsLayout) { child->setNeedsLayout(true, false); child->layout(); - } else - child->layoutIfNeeded(); + } else { + if (child->needsLayout()) + child->layout(); + else if (layoutSizeChanged) + notlayoutedObjects.add(child); + } ASSERT(!child->needsLayout()); } + + if (!layoutSizeChanged) { + ASSERT(notlayoutedObjects.isEmpty()); + return; + } + + // If the layout size changed, invalidate all resources of all children that didn't go through the layout() code path. + HashSet<RenderObject*>::iterator end = notlayoutedObjects.end(); + for (HashSet<RenderObject*>::iterator it = notlayoutedObjects.begin(); it != end; ++it) + invalidateResourcesOfChildren(*it); } bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index db4c07a..0c9b7e1 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -43,6 +43,7 @@ #include "RenderPath.h" #include "RenderSVGContainer.h" #include "RenderSVGGradientStop.h" +#include "RenderSVGImage.h" #include "RenderSVGInlineText.h" #include "RenderSVGResourceClipper.h" #include "RenderSVGResourceFilter.h" @@ -708,7 +709,7 @@ void writeSVGInlineText(TextStream& ts, const RenderText& text, int indent) writeSVGInlineTextBoxes(ts, text, indent); } -void writeSVGImage(TextStream& ts, const RenderImage& image, int indent) +void writeSVGImage(TextStream& ts, const RenderSVGImage& image, int indent) { writeStandardPrefix(ts, image, indent); writePositionAndStyle(ts, image); diff --git a/WebCore/rendering/SVGRenderTreeAsText.h b/WebCore/rendering/SVGRenderTreeAsText.h index 0fda958..d4aeaac 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.h +++ b/WebCore/rendering/SVGRenderTreeAsText.h @@ -44,6 +44,7 @@ namespace WebCore { class RenderObject; class RenderPath; class RenderSVGGradientStop; + class RenderSVGImage; class RenderSVGRoot; class RenderText; class AffineTransform; @@ -55,7 +56,7 @@ void write(TextStream&, const RenderSVGRoot&, int indent); void writeSVGGradientStop(TextStream&, const RenderSVGGradientStop&, int indent); void writeSVGResourceContainer(TextStream&, const RenderObject&, int indent); void writeSVGContainer(TextStream&, const RenderObject&, int indent); -void writeSVGImage(TextStream&, const RenderImage&, int indent); +void writeSVGImage(TextStream&, const RenderSVGImage&, int indent); void writeSVGInlineText(TextStream&, const RenderText&, int indent); void writeSVGText(TextStream&, const RenderBlock&, int indent); void writeResources(TextStream&, const RenderObject&, int indent); diff --git a/WebCore/rendering/SVGResources.cpp b/WebCore/rendering/SVGResources.cpp index 290ef41..799301b 100644 --- a/WebCore/rendering/SVGResources.cpp +++ b/WebCore/rendering/SVGResources.cpp @@ -279,7 +279,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen return foundResources; } -void SVGResources::invalidateClient(RenderObject* object) const +void SVGResources::removeClientFromCache(RenderObject* object, bool markForInvalidation) const { if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) return; @@ -288,35 +288,35 @@ void SVGResources::invalidateClient(RenderObject* object) const ASSERT(!m_clipperFilterMaskerData); ASSERT(!m_markerData); ASSERT(!m_fillStrokeData); - m_linkedResource->invalidateClient(object); + m_linkedResource->removeClientFromCache(object, markForInvalidation); return; } if (m_clipperFilterMaskerData) { if (m_clipperFilterMaskerData->clipper) - m_clipperFilterMaskerData->clipper->invalidateClient(object); + m_clipperFilterMaskerData->clipper->removeClientFromCache(object, markForInvalidation); #if ENABLE(FILTERS) if (m_clipperFilterMaskerData->filter) - m_clipperFilterMaskerData->filter->invalidateClient(object); + m_clipperFilterMaskerData->filter->removeClientFromCache(object, markForInvalidation); #endif if (m_clipperFilterMaskerData->masker) - m_clipperFilterMaskerData->masker->invalidateClient(object); + m_clipperFilterMaskerData->masker->removeClientFromCache(object, markForInvalidation); } if (m_markerData) { if (m_markerData->markerStart) - m_markerData->markerStart->invalidateClient(object); + m_markerData->markerStart->removeClientFromCache(object, markForInvalidation); if (m_markerData->markerMid) - m_markerData->markerMid->invalidateClient(object); + m_markerData->markerMid->removeClientFromCache(object, markForInvalidation); if (m_markerData->markerEnd) - m_markerData->markerEnd->invalidateClient(object); + m_markerData->markerEnd->removeClientFromCache(object, markForInvalidation); } if (m_fillStrokeData) { if (m_fillStrokeData->fill) - m_fillStrokeData->fill->invalidateClient(object); + m_fillStrokeData->fill->removeClientFromCache(object, markForInvalidation); if (m_fillStrokeData->stroke) - m_fillStrokeData->stroke->invalidateClient(object); + m_fillStrokeData->stroke->removeClientFromCache(object, markForInvalidation); } } @@ -330,7 +330,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) ASSERT(!m_clipperFilterMaskerData); ASSERT(!m_markerData); ASSERT(!m_fillStrokeData); - m_linkedResource->invalidateClients(); + m_linkedResource->removeAllClientsFromCache(); m_linkedResource = 0; return; } @@ -340,7 +340,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) if (!m_clipperFilterMaskerData) break; if (m_clipperFilterMaskerData->masker == resource) { - m_clipperFilterMaskerData->masker->invalidateClients(); + m_clipperFilterMaskerData->masker->removeAllClientsFromCache(); m_clipperFilterMaskerData->masker = 0; } break; @@ -348,15 +348,15 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) if (!m_markerData) break; if (m_markerData->markerStart == resource) { - m_markerData->markerStart->invalidateClients(); + m_markerData->markerStart->removeAllClientsFromCache(); m_markerData->markerStart = 0; } if (m_markerData->markerMid == resource) { - m_markerData->markerMid->invalidateClients(); + m_markerData->markerMid->removeAllClientsFromCache(); m_markerData->markerMid = 0; } if (m_markerData->markerEnd == resource) { - m_markerData->markerEnd->invalidateClients(); + m_markerData->markerEnd->removeAllClientsFromCache(); m_markerData->markerEnd = 0; } break; @@ -366,11 +366,11 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) if (!m_fillStrokeData) break; if (m_fillStrokeData->fill == resource) { - m_fillStrokeData->fill->invalidateClients(); + m_fillStrokeData->fill->removeAllClientsFromCache(); m_fillStrokeData->fill = 0; } if (m_fillStrokeData->stroke == resource) { - m_fillStrokeData->stroke->invalidateClients(); + m_fillStrokeData->stroke->removeAllClientsFromCache(); m_fillStrokeData->stroke = 0; } break; @@ -379,7 +379,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) if (!m_clipperFilterMaskerData) break; if (m_clipperFilterMaskerData->filter == resource) { - m_clipperFilterMaskerData->filter->invalidateClients(); + m_clipperFilterMaskerData->filter->removeAllClientsFromCache(); m_clipperFilterMaskerData->filter = 0; } #else @@ -390,7 +390,7 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) if (!m_clipperFilterMaskerData) break; if (m_clipperFilterMaskerData->clipper == resource) { - m_clipperFilterMaskerData->clipper->invalidateClients(); + m_clipperFilterMaskerData->clipper->removeAllClientsFromCache(); m_clipperFilterMaskerData->clipper = 0; } break; diff --git a/WebCore/rendering/SVGResources.h b/WebCore/rendering/SVGResources.h index a07a990..5f6e746 100644 --- a/WebCore/rendering/SVGResources.h +++ b/WebCore/rendering/SVGResources.h @@ -64,7 +64,7 @@ public: void buildSetOfResources(HashSet<RenderSVGResourceContainer*>&); // Methods operating on all cached resources - void invalidateClient(RenderObject*) const; + void removeClientFromCache(RenderObject*, bool markForInvalidation = true) const; void resourceDestroyed(RenderSVGResourceContainer*); #ifndef NDEBUG diff --git a/WebCore/rendering/SVGResourcesCache.cpp b/WebCore/rendering/SVGResourcesCache.cpp index b922b44..a4089d6 100644 --- a/WebCore/rendering/SVGResourcesCache.cpp +++ b/WebCore/rendering/SVGResourcesCache.cpp @@ -121,7 +121,7 @@ void SVGResourcesCache::clientLayoutChanged(RenderObject* object) if (!resources) return; - resources->invalidateClient(object); + resources->removeClientFromCache(object); } void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifference diff, const RenderStyle* newStyle) diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp index cf0e864..9852aa6 100644 --- a/WebCore/rendering/TextControlInnerElements.cpp +++ b/WebCore/rendering/TextControlInnerElements.cpp @@ -345,9 +345,21 @@ void SpinButtonElement::setHovered(bool flag) inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Node* shadowParent) : TextControlInnerElement(shadowParent->document(), shadowParent) , m_capturing(false) + , m_state(Idle) + , m_listenerId(document()->page()->speechInput()->registerListener(this)) { } +InputFieldSpeechButtonElement::~InputFieldSpeechButtonElement() +{ + SpeechInput* speech = speechInput(); + if (speech) { // Could be null when page is unloading. + if (m_state != Idle) + speech->cancelRecognition(m_listenerId); + speech->unregisterListener(m_listenerId); + } +} + PassRefPtr<InputFieldSpeechButtonElement> InputFieldSpeechButtonElement::create(Node* shadowParent) { return adoptRef(new InputFieldSpeechButtonElement(shadowParent)); @@ -383,7 +395,18 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event) } if (event->type() == eventNames().clickEvent) { - speechInput()->startRecognition(this); + switch (m_state) { + case Idle: + if (speechInput()->startRecognition(m_listenerId)) + setState(Recording); + break; + case Recording: + speechInput()->stopRecording(m_listenerId); + break; + case Recognizing: + // Nothing to do here, we will continue to wait for results. + break; + } event->setDefaultHandled(); } @@ -391,23 +414,30 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event) HTMLDivElement::defaultEventHandler(event); } +void InputFieldSpeechButtonElement::setState(SpeechInputState state) +{ + if (m_state != state) { + m_state = state; + shadowAncestorNode()->renderer()->repaint(); + } +} + SpeechInput* InputFieldSpeechButtonElement::speechInput() { - return document()->page()->speechInput(); + return document()->page() ? document()->page()->speechInput() : 0; } -void InputFieldSpeechButtonElement::didCompleteRecording() +void InputFieldSpeechButtonElement::didCompleteRecording(int) { - // FIXME: Add UI feedback here to indicate that audio recording stopped and recognition is - // in progress. + setState(Recognizing); } -void InputFieldSpeechButtonElement::didCompleteRecognition() +void InputFieldSpeechButtonElement::didCompleteRecognition(int) { - // FIXME: Add UI feedback here to indicate that audio recognition has ended. + setState(Idle); } -void InputFieldSpeechButtonElement::setRecognitionResult(const String& result) +void InputFieldSpeechButtonElement::setRecognitionResult(int, const String& result) { HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); // The call to setValue() below dispatches an event, and an event handler in the page might diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h index 2859bd5..3fbc9c8 100644 --- a/WebCore/rendering/TextControlInnerElements.h +++ b/WebCore/rendering/TextControlInnerElements.h @@ -119,21 +119,32 @@ class InputFieldSpeechButtonElement : public TextControlInnerElement, public SpeechInputListener { public: + enum SpeechInputState { + Idle, + Recording, + Recognizing, + }; + static PassRefPtr<InputFieldSpeechButtonElement> create(Node*); + virtual ~InputFieldSpeechButtonElement(); virtual void detach(); virtual void defaultEventHandler(Event*); + SpeechInputState state() const { return m_state; } // SpeechInputListener methods. - void didCompleteRecording(); - void didCompleteRecognition(); - void setRecognitionResult(const String& result); + void didCompleteRecording(int); + void didCompleteRecognition(int); + void setRecognitionResult(int, const String& result); private: InputFieldSpeechButtonElement(Node*); SpeechInput* speechInput(); + void setState(SpeechInputState state); bool m_capturing; + SpeechInputState m_state; + int m_listenerId; }; #endif // ENABLE(INPUT_SPEECH) diff --git a/WebCore/rendering/style/BindingURI.h b/WebCore/rendering/style/BindingURI.h index 923f1aa..c844b1d 100644 --- a/WebCore/rendering/style/BindingURI.h +++ b/WebCore/rendering/style/BindingURI.h @@ -26,7 +26,7 @@ #define BindingURI_h #if ENABLE(XBL) -#include "StringImpl.h" +#include <wtf/text/StringImpl.h> namespace WebCore { diff --git a/WebCore/rendering/style/ContentData.cpp b/WebCore/rendering/style/ContentData.cpp index 410cad4..b0f9e81 100644 --- a/WebCore/rendering/style/ContentData.cpp +++ b/WebCore/rendering/style/ContentData.cpp @@ -23,8 +23,8 @@ #include "ContentData.h" #include "CounterContent.h" -#include "StringImpl.h" #include "StyleImage.h" +#include <wtf/text/StringImpl.h> namespace WebCore { diff --git a/WebCore/rendering/style/CounterContent.h b/WebCore/rendering/style/CounterContent.h index 702d9c2..52757ad 100644 --- a/WebCore/rendering/style/CounterContent.h +++ b/WebCore/rendering/style/CounterContent.h @@ -25,8 +25,8 @@ #ifndef CounterContent_h #define CounterContent_h -#include "AtomicString.h" #include "RenderStyleConstants.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/rendering/style/CounterDirectives.h b/WebCore/rendering/style/CounterDirectives.h index 9cbdeae..e54028e 100644 --- a/WebCore/rendering/style/CounterDirectives.h +++ b/WebCore/rendering/style/CounterDirectives.h @@ -25,9 +25,9 @@ #ifndef CounterDirectives_h #define CounterDirectives_h -#include "AtomicStringImpl.h" #include <wtf/HashMap.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringImpl.h> namespace WebCore { diff --git a/WebCore/rendering/style/KeyframeList.h b/WebCore/rendering/style/KeyframeList.h index b1009d2..bb5f180 100644 --- a/WebCore/rendering/style/KeyframeList.h +++ b/WebCore/rendering/style/KeyframeList.h @@ -25,10 +25,10 @@ #ifndef KeyframeList_h #define KeyframeList_h -#include "AtomicString.h" #include <wtf/Vector.h> #include <wtf/HashSet.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/rendering/style/StyleRareInheritedData.h b/WebCore/rendering/style/StyleRareInheritedData.h index 07541d3..ba914d4 100644 --- a/WebCore/rendering/style/StyleRareInheritedData.h +++ b/WebCore/rendering/style/StyleRareInheritedData.h @@ -25,11 +25,11 @@ #ifndef StyleRareInheritedData_h #define StyleRareInheritedData_h -#include "AtomicString.h" #include "Color.h" #include "Length.h" #include <wtf/RefCounted.h> #include <wtf/PassRefPtr.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/storage/AbstractDatabase.cpp b/WebCore/storage/AbstractDatabase.cpp index 7827ec8..8d3bf1e 100644 --- a/WebCore/storage/AbstractDatabase.cpp +++ b/WebCore/storage/AbstractDatabase.cpp @@ -36,12 +36,12 @@ #include "SQLiteStatement.h" #include "ScriptExecutionContext.h" #include "SecurityOrigin.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/DOMFileSystem.cpp b/WebCore/storage/DOMFileSystem.cpp index 19c75fc..c3dbd34 100644 --- a/WebCore/storage/DOMFileSystem.cpp +++ b/WebCore/storage/DOMFileSystem.cpp @@ -33,7 +33,7 @@ #if ENABLE(FILE_SYSTEM) -#include "Entry.h" +#include "DirectoryEntry.h" namespace WebCore { @@ -43,9 +43,9 @@ DOMFileSystem::DOMFileSystem(const String& name, const String& rootPath) { } -PassRefPtr<Entry> DOMFileSystem::root() +PassRefPtr<DirectoryEntry> DOMFileSystem::root() { - return Entry::create(this, "/"); + return DirectoryEntry::create(this, "/"); } } // namespace diff --git a/WebCore/storage/DOMFileSystem.h b/WebCore/storage/DOMFileSystem.h index 454205d..b87aaaf 100644 --- a/WebCore/storage/DOMFileSystem.h +++ b/WebCore/storage/DOMFileSystem.h @@ -39,7 +39,7 @@ namespace WebCore { -class Entry; +class DirectoryEntry; class DOMFileSystem : public RefCounted<DOMFileSystem> { public: @@ -49,7 +49,7 @@ public: } const String& name() const { return m_name; } - PassRefPtr<Entry> root(); + PassRefPtr<DirectoryEntry> root(); private: DOMFileSystem(const String& name, const String& rootPath); diff --git a/WebCore/storage/DOMFileSystem.idl b/WebCore/storage/DOMFileSystem.idl index 0241c4a..b7307e2 100644 --- a/WebCore/storage/DOMFileSystem.idl +++ b/WebCore/storage/DOMFileSystem.idl @@ -33,6 +33,6 @@ module storage { Conditional=FILE_SYSTEM ] DOMFileSystem { readonly attribute DOMString name; - readonly attribute Entry root; + readonly attribute DirectoryEntry root; }; } diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 9550083..961310d 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -183,13 +183,12 @@ String Database::version() const bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode& e) { - if (!m_scriptExecutionContext->databaseThread()) + DatabaseTaskSynchronizer synchronizer; + if (!m_scriptExecutionContext->databaseThread() || m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer)) return false; bool success = false; - DatabaseTaskSynchronizer synchronizer; OwnPtr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, e, success); - m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release()); synchronizer.waitForTaskCompletion(); @@ -204,14 +203,13 @@ void Database::markAsDeletedAndClose() LOG(StorageAPI, "Marking %s (%p) as deleted", stringIdentifier().ascii().data(), this); m_deleted = true; - if (m_scriptExecutionContext->databaseThread()->terminationRequested()) { + DatabaseTaskSynchronizer synchronizer; + if (m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer)) { LOG(StorageAPI, "Database handle %p is on a terminated DatabaseThread, cannot be marked for normal closure\n", this); return; } - DatabaseTaskSynchronizer synchronizer; OwnPtr<DatabaseCloseTask> task = DatabaseCloseTask::create(this, &synchronizer); - m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release()); synchronizer.waitForTaskCompletion(); } @@ -397,12 +395,11 @@ Vector<String> Database::tableNames() // FIXME: Not using threadsafeCopy on these strings looks ok since threads take strict turns // in dealing with them. However, if the code changes, this may not be true anymore. Vector<String> result; - if (!m_scriptExecutionContext->databaseThread()) + DatabaseTaskSynchronizer synchronizer; + if (!m_scriptExecutionContext->databaseThread() || m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer)) return result; - DatabaseTaskSynchronizer synchronizer; OwnPtr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result); - m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release()); synchronizer.waitForTaskCompletion(); diff --git a/WebCore/storage/DatabaseAuthorizer.h b/WebCore/storage/DatabaseAuthorizer.h index 66bc5d8..e7c3922 100644 --- a/WebCore/storage/DatabaseAuthorizer.h +++ b/WebCore/storage/DatabaseAuthorizer.h @@ -29,10 +29,10 @@ #define DatabaseAuthorizer_h #include "PlatformString.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashSet.h> #include <wtf/ThreadSafeShared.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/DatabaseTask.cpp b/WebCore/storage/DatabaseTask.cpp index 3526d9d..343ae1e 100644 --- a/WebCore/storage/DatabaseTask.cpp +++ b/WebCore/storage/DatabaseTask.cpp @@ -37,6 +37,9 @@ namespace WebCore { DatabaseTaskSynchronizer::DatabaseTaskSynchronizer() : m_taskCompleted(false) +#ifndef NDEBUG + , m_hasCheckedForTermination(false) +#endif { } @@ -67,6 +70,7 @@ DatabaseTask::DatabaseTask(Database* database, DatabaseTaskSynchronizer* synchro DatabaseTask::~DatabaseTask() { + ASSERT(m_complete || !m_synchronizer); } void DatabaseTask::performTask() @@ -81,6 +85,10 @@ void DatabaseTask::performTask() if (m_synchronizer) m_synchronizer->taskCompleted(); + +#ifndef NDEBUG + m_complete = true; +#endif } // *** DatabaseOpenTask *** diff --git a/WebCore/storage/DatabaseTask.h b/WebCore/storage/DatabaseTask.h index 9673a26..847846d 100644 --- a/WebCore/storage/DatabaseTask.h +++ b/WebCore/storage/DatabaseTask.h @@ -52,11 +52,19 @@ public: // Called by the task. void taskCompleted(); -private: +#ifndef NDEBUG + bool hasCheckedForTermination() const { return m_hasCheckedForTermination; } + void setHasCheckedForTermination() { m_hasCheckedForTermination = true; } +#endif + +private: bool m_taskCompleted; Mutex m_synchronousMutex; ThreadCondition m_synchronousCondition; +#ifndef NDEBUG + bool m_hasCheckedForTermination; +#endif }; class DatabaseTask : public Noncopyable { @@ -66,6 +74,10 @@ public: void performTask(); Database* database() const { return m_database; } +#ifndef NDEBUG + bool hasSynchronizer() const { return m_synchronizer; } + bool hasCheckedForTermination() const { return m_synchronizer->hasCheckedForTermination(); } +#endif protected: DatabaseTask(Database*, DatabaseTaskSynchronizer*); @@ -77,8 +89,8 @@ private: DatabaseTaskSynchronizer* m_synchronizer; #ifndef NDEBUG - virtual const char* debugTaskName() const = 0; - bool m_complete; + virtual const char* debugTaskName() const = 0; + bool m_complete; #endif }; diff --git a/WebCore/storage/DatabaseThread.cpp b/WebCore/storage/DatabaseThread.cpp index ae2a6c0..99cf3b9 100644 --- a/WebCore/storage/DatabaseThread.cpp +++ b/WebCore/storage/DatabaseThread.cpp @@ -37,6 +37,7 @@ #include "Logging.h" #include "SQLTransactionClient.h" #include "SQLTransactionCoordinator.h" +#include <wtf/UnusedParam.h> namespace WebCore { @@ -75,8 +76,15 @@ void DatabaseThread::requestTermination(DatabaseTaskSynchronizer *cleanupSync) m_queue.kill(); } -bool DatabaseThread::terminationRequested() const +bool DatabaseThread::terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer) const { +#ifndef NDEBUG + if (taskSynchronizer) + taskSynchronizer->setHasCheckedForTermination(); +#else + UNUSED_PARAM(taskSynchronizer); +#endif + return m_queue.killed(); } @@ -148,11 +156,13 @@ void DatabaseThread::recordDatabaseClosed(Database* database) void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) { + ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); m_queue.append(task); } void DatabaseThread::scheduleImmediateTask(PassOwnPtr<DatabaseTask> task) { + ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); m_queue.prepend(task); } diff --git a/WebCore/storage/DatabaseThread.h b/WebCore/storage/DatabaseThread.h index 3702619..c81e376 100644 --- a/WebCore/storage/DatabaseThread.h +++ b/WebCore/storage/DatabaseThread.h @@ -55,7 +55,7 @@ public: bool start(); void requestTermination(DatabaseTaskSynchronizer* cleanupSync); - bool terminationRequested() const; + bool terminationRequested(DatabaseTaskSynchronizer* taskSynchronizer = 0) const; void scheduleTask(PassOwnPtr<DatabaseTask>); void scheduleImmediateTask(PassOwnPtr<DatabaseTask>); // This just adds the task to the front of the queue - the caller needs to be extremely careful not to create deadlocks when waiting for completion. diff --git a/WebCore/storage/DatabaseTracker.cpp b/WebCore/storage/DatabaseTracker.cpp index 0764db0..e0ba422 100644 --- a/WebCore/storage/DatabaseTracker.cpp +++ b/WebCore/storage/DatabaseTracker.cpp @@ -686,7 +686,11 @@ void DatabaseTracker::setQuota(SecurityOrigin* origin, unsigned long long quota) } if (error) +#if OS(WINDOWS) + LOG_ERROR("Failed to set quota %I64u in tracker database for origin %s", quota, origin->databaseIdentifier().ascii().data()); +#else LOG_ERROR("Failed to set quota %llu in tracker database for origin %s", quota, origin->databaseIdentifier().ascii().data()); +#endif } // FIXME: Is it really OK to update the quota in memory if we failed to update it on disk? diff --git a/WebCore/storage/DatabaseTracker.h b/WebCore/storage/DatabaseTracker.h index 1557f0a..7145e6b 100644 --- a/WebCore/storage/DatabaseTracker.h +++ b/WebCore/storage/DatabaseTracker.h @@ -32,9 +32,9 @@ #if ENABLE(DATABASE) #include "PlatformString.h" -#include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> +#include <wtf/text/StringHash.h> #if !PLATFORM(CHROMIUM) #include "DatabaseDetails.h" diff --git a/WebCore/inspector/front-end/ObjectProxy.js b/WebCore/storage/DirectoryEntry.cpp index ef139c6..60dcace 100644 --- a/WebCore/inspector/front-end/ObjectProxy.js +++ b/WebCore/storage/DirectoryEntry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google 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 @@ -28,43 +28,39 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.ObjectProxy = function(injectedScriptId, objectId, path, description, hasChildren) +#include "config.h" +#include "DirectoryEntry.h" + +#if ENABLE(FILE_SYSTEM) + +#include "DirectoryReader.h" +#include "EntryCallback.h" +#include "ErrorCallback.h" + +namespace WebCore { + +DirectoryEntry::DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) + : Entry(fileSystem, fullPath) { - this.objectId = objectId; - this.injectedScriptId = injectedScriptId; - this.path = path || []; - this.description = description; - this.hasChildren = hasChildren; } -WebInspector.ObjectProxy.wrapPrimitiveValue = function(value) +PassRefPtr<DirectoryReader> DirectoryEntry::createReader() { - var proxy = new WebInspector.ObjectProxy(); - proxy.type = typeof value; - proxy.description = value; - return proxy; + return DirectoryReader::create(m_fileSystem, m_fullPath); } -WebInspector.ObjectProxy.getPropertiesAsync = function(objectProxy, propertiesToQueryFor, callback) +void DirectoryEntry::getFile(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) { - function createPropertiesMapThenCallback(propertiesPayload) - { - if (!propertiesPayload) { - callback(); - return; - } - - var result = []; - for (var i = 0; i < propertiesPayload.length; ++i) - if (propertiesToQueryFor.indexOf(propertiesPayload[i].name) !== -1) - result[propertiesPayload[i].name] = propertiesPayload[i].value.description; - callback(result); - }; - InjectedScriptAccess.get(objectProxy.injectedScriptId).getProperties(objectProxy, true, false, createPropertiesMapThenCallback); + // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } -WebInspector.ObjectPropertyProxy = function(name, value) +void DirectoryEntry::getDirectory(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) { - this.name = name; - this.value = value; + // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DirectoryEntry.h b/WebCore/storage/DirectoryEntry.h new file mode 100644 index 0000000..2ae4fb5 --- /dev/null +++ b/WebCore/storage/DirectoryEntry.h @@ -0,0 +1,68 @@ +/* + * 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 DirectoryEntry_h +#define DirectoryEntry_h + +#if ENABLE(FILE_SYSTEM) + +#include "Entry.h" +#include "Flags.h" +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class DirectoryReader; +class EntryCallback; +class ErrorCallback; + +class DirectoryEntry : public Entry { +public: + static PassRefPtr<DirectoryEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) + { + return adoptRef(new DirectoryEntry(fileSystem, fullPath)); + } + virtual bool isDirectory() const { return true; } + + PassRefPtr<DirectoryReader> createReader(); + void getFile(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + void getDirectory(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + +private: + DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath); +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // DirectoryEntry_h diff --git a/WebCore/storage/DirectoryEntry.idl b/WebCore/storage/DirectoryEntry.idl new file mode 100644 index 0000000..ac30c7f --- /dev/null +++ b/WebCore/storage/DirectoryEntry.idl @@ -0,0 +1,41 @@ +/* + * 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=FILE_SYSTEM, + GenerateNativeConverter, + GenerateToJS + ] DirectoryEntry : Entry { + DirectoryReader createReader(); + void getFile(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void getDirectory(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + }; +} diff --git a/WebCore/storage/DirectoryReader.cpp b/WebCore/storage/DirectoryReader.cpp new file mode 100644 index 0000000..0b30f70 --- /dev/null +++ b/WebCore/storage/DirectoryReader.cpp @@ -0,0 +1,56 @@ +/* + * 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 "DirectoryReader.h" + +#if ENABLE(FILE_SYSTEM) + +#include "DOMFileSystem.h" +#include "EntriesCallback.h" +#include "ErrorCallback.h" + +namespace WebCore { + +DirectoryReader::DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path) + : m_fileSystem(fileSystem) + , m_path(path) +{ +} + +void DirectoryReader::readEntries(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. + ASSERT_NOT_REACHED(); +} + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DirectoryReader.h b/WebCore/storage/DirectoryReader.h new file mode 100644 index 0000000..cf5da8f --- /dev/null +++ b/WebCore/storage/DirectoryReader.h @@ -0,0 +1,66 @@ +/* + * 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 DirectoryReader_h +#define DirectoryReader_h + +#if ENABLE(FILE_SYSTEM) + +#include "DOMFileSystem.h" +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class EntriesCallback; +class ErrorCallback; + +class DirectoryReader : public RefCounted<DirectoryReader> { +public: + static PassRefPtr<DirectoryReader> create(PassRefPtr<DOMFileSystem> fileSystem, const String& path) + { + return adoptRef(new DirectoryReader(fileSystem, path)); + } + + void readEntries(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback = 0); + +private: + DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path); + + RefPtr<DOMFileSystem> m_fileSystem; + String m_path; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // DirectoryReader_h diff --git a/WebCore/storage/DirectoryReader.idl b/WebCore/storage/DirectoryReader.idl new file mode 100644 index 0000000..c3c7012 --- /dev/null +++ b/WebCore/storage/DirectoryReader.idl @@ -0,0 +1,37 @@ +/* + * 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=FILE_SYSTEM + ] DirectoryReader { + void readEntries(in [Callback] EntriesCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + }; +} diff --git a/WebCore/storage/EntriesCallback.h b/WebCore/storage/EntriesCallback.h new file mode 100644 index 0000000..9f812e9 --- /dev/null +++ b/WebCore/storage/EntriesCallback.h @@ -0,0 +1,52 @@ +/* + * 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 EntriesCallback_h +#define EntriesCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class EntryArray; + +class EntriesCallback : public RefCounted<EntriesCallback> { +public: + virtual ~EntriesCallback() { } + virtual bool handleEvent(EntryArray*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // EntriesCallback_h diff --git a/WebCore/storage/EntriesCallback.idl b/WebCore/storage/EntriesCallback.idl new file mode 100644 index 0000000..73b374d --- /dev/null +++ b/WebCore/storage/EntriesCallback.idl @@ -0,0 +1,38 @@ +/* + * 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=FILE_SYSTEM, + Callback + ] EntriesCallback { + boolean handleEvent(in EntryArray entries); + }; +} diff --git a/WebCore/storage/Entry.cpp b/WebCore/storage/Entry.cpp index b882297..6783291 100644 --- a/WebCore/storage/Entry.cpp +++ b/WebCore/storage/Entry.cpp @@ -40,46 +40,51 @@ namespace WebCore { -Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory) +Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) : m_fileSystem(fileSystem) , m_fullPath(fullPath) - , m_isDirectory(isDirectory) { - int index = fullPath.reverseFind("/"); - if (index != -1) + size_t index = fullPath.reverseFind("/"); + if (index != notFound) m_name = fullPath.substring(index); else m_name = fullPath; } -void Entry::getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>) +void Entry::getMetadata(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>) { // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } -void Entry::moveTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +void Entry::moveTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) { // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } -void Entry::copyTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +void Entry::copyTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) { // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } -void Entry::remove(ScriptExecutionContext*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>) +void Entry::remove(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>) { // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } -void Entry::getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +void Entry::getParent(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) { // FIXME: to be implemented. + ASSERT_NOT_REACHED(); } String Entry::toURI(const String&) { // FIXME: to be implemented. + ASSERT_NOT_REACHED(); return String(); } diff --git a/WebCore/storage/Entry.h b/WebCore/storage/Entry.h index 1cabe58..7bbb265 100644 --- a/WebCore/storage/Entry.h +++ b/WebCore/storage/Entry.h @@ -42,42 +42,35 @@ namespace WebCore { class EntryCallback; class ErrorCallback; class MetadataCallback; -class ScriptExecutionContext; class VoidCallback; class Entry : public RefCounted<Entry> { public: - static PassRefPtr<Entry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory = false) - { - return adoptRef(new Entry(fileSystem, fullPath, isDirectory)); - } - virtual ~Entry() { } - virtual bool isFile() const { return !m_isDirectory; } - virtual bool isDirectory() const { return m_isDirectory; } + virtual bool isFile() const { return false; } + virtual bool isDirectory() const { return false; } const String& fullPath() const { return m_fullPath; } const String& name() const { return m_name; } DOMFileSystem* filesystem() const { return m_fileSystem.get(); } - virtual void getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void getMetadata(PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void moveTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void copyTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void remove(ScriptExecutionContext*, PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); - virtual void getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void moveTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void copyTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void remove(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); virtual String toURI(const String& mimeType = String()); protected: - Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory); + Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath); RefPtr<DOMFileSystem> m_fileSystem; String m_fullPath; // virtual path String m_name; - bool m_isDirectory; }; } // namespace WebCore diff --git a/WebCore/storage/Entry.idl b/WebCore/storage/Entry.idl index 972751e..7d4ffee 100644 --- a/WebCore/storage/Entry.idl +++ b/WebCore/storage/Entry.idl @@ -38,10 +38,10 @@ module storage { readonly attribute DOMString fullPath; readonly attribute DOMFileSystem filesystem; - [CallWith=ScriptExecutionContext] void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - [CallWith=ScriptExecutionContext] void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); DOMString toURI(in [Optional] DOMString mimeType); - [CallWith=ScriptExecutionContext] void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - [CallWith=ScriptExecutionContext] void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); }; } diff --git a/WebCore/storage/EntryArray.cpp b/WebCore/storage/EntryArray.cpp new file mode 100644 index 0000000..6c4f74f --- /dev/null +++ b/WebCore/storage/EntryArray.cpp @@ -0,0 +1,51 @@ +/* + * 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 "EntryArray.h" + +#if ENABLE(FILE_SYSTEM) + +namespace WebCore { + +EntryArray::EntryArray() +{ +} + +Entry* EntryArray::item(unsigned index) const +{ + if (index >= m_entries.size()) + return 0; + return m_entries[index].get(); +} + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/EntryArray.h b/WebCore/storage/EntryArray.h new file mode 100644 index 0000000..e5957ab --- /dev/null +++ b/WebCore/storage/EntryArray.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: + * + * * 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 EntryArray_h +#define EntryArray_h + +#if ENABLE(FILE_SYSTEM) + +#include "Entry.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class EntryArray : public RefCounted<EntryArray> { +public: + static PassRefPtr<EntryArray> create() + { + return adoptRef(new EntryArray()); + } + + unsigned length() const { return m_entries.size(); } + Entry* item(unsigned index) const; + void set(unsigned index, PassRefPtr<Entry> entry); + + bool isEmpty() const { return m_entries.isEmpty(); } + void clear() { m_entries.clear(); } + void append(PassRefPtr<Entry> entry) { m_entries.append(entry); } + +private: + EntryArray(); + + Vector<RefPtr<Entry> > m_entries; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // EntryArray_h diff --git a/WebCore/storage/EntryArray.idl b/WebCore/storage/EntryArray.idl new file mode 100644 index 0000000..e987ece --- /dev/null +++ b/WebCore/storage/EntryArray.idl @@ -0,0 +1,39 @@ +/* + * 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=FILE_SYSTEM, + HasIndexGetter, + ] EntryArray { + readonly attribute unsigned long length; + Entry item(in [IsIndex] unsigned long index); + }; +} diff --git a/WebCore/storage/FileEntry.cpp b/WebCore/storage/FileEntry.cpp new file mode 100644 index 0000000..4bec01d --- /dev/null +++ b/WebCore/storage/FileEntry.cpp @@ -0,0 +1,45 @@ +/* + * 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 "FileEntry.h" + +#if ENABLE(FILE_SYSTEM) + +namespace WebCore { + +FileEntry::FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) + : Entry(fileSystem, fullPath) +{ +} + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/FileEntry.h b/WebCore/storage/FileEntry.h new file mode 100644 index 0000000..b02b5c7 --- /dev/null +++ b/WebCore/storage/FileEntry.h @@ -0,0 +1,61 @@ +/* + * 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 FileEntry_h +#define FileEntry_h + +#if ENABLE(FILE_SYSTEM) + +#include "Entry.h" +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class DOMFileSystem; + +class FileEntry : public Entry { +public: + static PassRefPtr<FileEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath) + { + return adoptRef(new FileEntry(fileSystem, fullPath)); + } + virtual bool isFile() const { return true; } + +private: + FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath); +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // FileEntry_h diff --git a/WebCore/storage/FileEntry.idl b/WebCore/storage/FileEntry.idl new file mode 100644 index 0000000..af3b807 --- /dev/null +++ b/WebCore/storage/FileEntry.idl @@ -0,0 +1,38 @@ +/* + * 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=FILE_SYSTEM, + GenerateNativeConverter, + GenerateToJS + ] FileEntry : Entry { + }; +} diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp index fa1807c..b00695b 100644 --- a/WebCore/storage/IDBDatabase.cpp +++ b/WebCore/storage/IDBDatabase.cpp @@ -39,6 +39,7 @@ namespace WebCore { IDBDatabase::IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface> backend) : m_backend(backend) + , m_description(m_backend->description()) { // We pass a reference to this object before it can be adopted. relaxAdoptionRequirement(); diff --git a/WebCore/storage/IDBDatabase.h b/WebCore/storage/IDBDatabase.h index 6900efd..1ad3c65 100644 --- a/WebCore/storage/IDBDatabase.h +++ b/WebCore/storage/IDBDatabase.h @@ -52,7 +52,7 @@ public: // Implement the IDL String name() const { return m_backend->name(); } - String description() const { return m_backend->description(); } + String description() const { return m_description; } String version() const { return m_backend->version(); } PassRefPtr<DOMStringList> objectStores() const { return m_backend->objectStores(); } @@ -65,6 +65,8 @@ private: IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface>); RefPtr<IDBDatabaseBackendInterface> m_backend; + + String m_description; }; } // namespace WebCore diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp index 09b9dee..e550e18 100644 --- a/WebCore/storage/IDBDatabaseBackendImpl.cpp +++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp @@ -29,22 +29,89 @@ #include "DOMStringList.h" #include "IDBDatabaseException.h" #include "IDBObjectStoreBackendImpl.h" +#include "SQLiteDatabase.h" +#include "SQLiteStatement.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, const String& version) - : m_name(name) - , m_description(description) - , m_version(version) +static bool extractMetaData(SQLiteDatabase* sqliteDatabase, const String& expectedName, String& foundDescription, String& foundVersion) { + SQLiteStatement metaDataQuery(*sqliteDatabase, "SELECT name, description, version FROM MetaData"); + if (metaDataQuery.prepare() != SQLResultOk || metaDataQuery.step() != SQLResultRow) + return false; + + if (metaDataQuery.getColumnText(0) != expectedName) { + LOG_ERROR("Name in MetaData (%s) doesn't match expected (%s) for IndexedDB", metaDataQuery.getColumnText(0).utf8().data(), expectedName.utf8().data()); + ASSERT_NOT_REACHED(); + } + foundDescription = metaDataQuery.getColumnText(1); + foundVersion = metaDataQuery.getColumnText(2); + + if (metaDataQuery.step() == SQLResultRow) { + LOG_ERROR("More than one row found in MetaData table"); + ASSERT_NOT_REACHED(); + } + + return true; +} + +static bool setMetaData(SQLiteDatabase* sqliteDatabase, const String& name, const String& description, const String& version) +{ + ASSERT(!name.isNull() && !description.isNull() && !version.isNull()); + + sqliteDatabase->executeCommand("DELETE FROM MetaData"); + + SQLiteStatement insert(*sqliteDatabase, "INSERT INTO MetaData (name, description, version) VALUES (?, ?, ?)"); + if (insert.prepare() != SQLResultOk) { + LOG_ERROR("Failed to prepare MetaData insert statement for IndexedDB"); + return false; + } + + insert.bindText(1, name); + insert.bindText(2, description); + insert.bindText(3, version); + + if (insert.step() != SQLResultDone) { + LOG_ERROR("Failed to insert row into MetaData for IndexedDB"); + return false; + } + + // FIXME: Should we assert there's only one row? + + return true; +} + +IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> sqliteDatabase) + : m_sqliteDatabase(sqliteDatabase) + , m_name(name) + , m_version("") +{ + ASSERT(!m_name.isNull()); + + // FIXME: The spec is in flux about how to handle description. Sync it up once a final decision is made. + String foundDescription = ""; + bool result = extractMetaData(m_sqliteDatabase.get(), m_name, foundDescription, m_version); + m_description = description.isNull() ? foundDescription : description; + + if (!result || m_description != foundDescription) + setMetaData(m_sqliteDatabase.get(), m_name, m_description, m_version); } IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl() { } +void IDBDatabaseBackendImpl::setDescription(const String& description) +{ + if (description == m_description) + return; + + m_description = description; + setMetaData(m_sqliteDatabase.get(), m_name, m_description, m_version); +} + PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStores() const { RefPtr<DOMStringList> objectStoreNames = DOMStringList::create(); diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h index f6ff058..60bec1f 100644 --- a/WebCore/storage/IDBDatabaseBackendImpl.h +++ b/WebCore/storage/IDBDatabaseBackendImpl.h @@ -28,21 +28,25 @@ #include "IDBCallbacks.h" #include "IDBDatabase.h" -#include "StringHash.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> #if ENABLE(INDEXED_DATABASE) namespace WebCore { +class SQLiteDatabase; + class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface { public: - static PassRefPtr<IDBDatabaseBackendInterface> create(const String& name, const String& description, const String& version) + static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database) { - return adoptRef(new IDBDatabaseBackendImpl(name, description, version)); + return adoptRef(new IDBDatabaseBackendImpl(name, description, database)); } virtual ~IDBDatabaseBackendImpl(); + void setDescription(const String& description); + // Implements IDBDatabase virtual String name() const { return m_name; } virtual String description() const { return m_description; } @@ -54,7 +58,9 @@ public: virtual void removeObjectStore(const String& name, PassRefPtr<IDBCallbacks>); virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, unsigned long timeout); private: - IDBDatabaseBackendImpl(const String& name, const String& description, const String& version); + IDBDatabaseBackendImpl(const String& name, const String& description, PassOwnPtr<SQLiteDatabase> database); + + OwnPtr<SQLiteDatabase> m_sqliteDatabase; String m_name; String m_description; diff --git a/WebCore/storage/IDBFactory.h b/WebCore/storage/IDBFactory.h index 61619b9..a96aa38 100644 --- a/WebCore/storage/IDBFactory.h +++ b/WebCore/storage/IDBFactory.h @@ -54,7 +54,7 @@ public: } ~IDBFactory(); - PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description); + PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description = String()); private: IDBFactory(IDBFactoryBackendInterface*); diff --git a/WebCore/storage/IDBFactory.idl b/WebCore/storage/IDBFactory.idl index cd887f0..215d67c 100644 --- a/WebCore/storage/IDBFactory.idl +++ b/WebCore/storage/IDBFactory.idl @@ -28,7 +28,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE ] IDBFactory { - [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in DOMString description); + [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in [Optional, ConvertUndefinedOrNullToNullString] DOMString description); }; } diff --git a/WebCore/storage/IDBFactoryBackendImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp index 7bdd70d..905726f 100644 --- a/WebCore/storage/IDBFactoryBackendImpl.cpp +++ b/WebCore/storage/IDBFactoryBackendImpl.cpp @@ -30,7 +30,10 @@ #include "IDBFactoryBackendImpl.h" #include "DOMStringList.h" +#include "FileSystem.h" #include "IDBDatabaseBackendImpl.h" +#include "IDBDatabaseException.h" +#include "SQLiteDatabase.h" #include "SecurityOrigin.h" #include <wtf/Threading.h> #include <wtf/UnusedParam.h> @@ -39,31 +42,74 @@ namespace WebCore { -PassRefPtr<IDBFactoryBackendImpl> IDBFactoryBackendImpl::create() +IDBFactoryBackendImpl::IDBFactoryBackendImpl() { - return adoptRef(new IDBFactoryBackendImpl); } -IDBFactoryBackendImpl::IDBFactoryBackendImpl() +IDBFactoryBackendImpl::~IDBFactoryBackendImpl() { } -IDBFactoryBackendImpl::~IDBFactoryBackendImpl() +static PassOwnPtr<SQLiteDatabase> openSQLiteDatabase(SecurityOrigin* securityOrigin, String name) { + String pathBase = "/tmp/temporary-indexed-db-files"; // FIXME: Write a PageGroupSettings class and have this value come from that. + if (!makeAllDirectories(pathBase)) { + // FIXME: Is there any other thing we could possibly do to recover at this point? If so, do it rather than just erroring out. + LOG_ERROR("Unabled to create LocalStorage database path %s", pathBase.utf8().data()); + return 0; + } + + String databaseIdentifier = securityOrigin->databaseIdentifier(); + String santizedName = encodeForFileName(name); + String path = pathByAppendingComponent(pathBase, databaseIdentifier + "_" + santizedName + ".indexeddb"); + + OwnPtr<SQLiteDatabase> sqliteDatabase = adoptPtr(new SQLiteDatabase()); + if (!sqliteDatabase->open(path)) { + // FIXME: Is there any other thing we could possibly do to recover at this point? If so, do it rather than just erroring out. + LOG_ERROR("Failed to open database file %s for IndexedDB", path.utf8().data()); + return 0; + } + + return sqliteDatabase.release(); } -void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*) +static bool createTables(SQLiteDatabase* sqliteDatabase) +{ + static const char* commands[] = { + "CREATE TABLE IF NOT EXISTS MetaData (name TEXT, description TEXT, version TEXT)" + }; + + for (size_t i = 0; i < arraysize(commands); ++i) { + if (!sqliteDatabase->executeCommand(commands[i])) { + // FIXME: We should try to recover from this situation. Maybe nuke the database and start over? + LOG_ERROR("Failed to run the following command for IndexedDB: %s", commands[i]); + return false; + } + } + return true; +} + +void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*) { - RefPtr<IDBDatabaseBackendInterface> databaseBackend; IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(name); - if (it == m_databaseBackendMap.end()) { - // FIXME: What should the version be? The spec doesn't define it yet. - databaseBackend = IDBDatabaseBackendImpl::create(name, description, ""); - m_databaseBackendMap.set(name, databaseBackend); - } else - databaseBackend = it->second; - - callbacks->onSuccess(databaseBackend.release()); + if (it != m_databaseBackendMap.end()) { + if (!description.isNull()) + it->second->setDescription(description); // The description may have changed. + callbacks->onSuccess(it->second.get()); + return; + } + + // FIXME: Everything from now on should be done on another thread. + + OwnPtr<SQLiteDatabase> sqliteDatabase = openSQLiteDatabase(securityOrigin.get(), name); + if (!sqliteDatabase || !createTables(sqliteDatabase.get())) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error.")); + return; + } + + RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, description, sqliteDatabase.release()); + callbacks->onSuccess(databaseBackend.get()); + m_databaseBackendMap.set(name, databaseBackend.release()); } } // namespace WebCore diff --git a/WebCore/storage/IDBFactoryBackendImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h index bbcc537..e87ea39 100644 --- a/WebCore/storage/IDBFactoryBackendImpl.h +++ b/WebCore/storage/IDBFactoryBackendImpl.h @@ -29,18 +29,22 @@ #define IDBFactoryBackendImpl_h #include "IDBFactoryBackendInterface.h" -#include "StringHash.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> #if ENABLE(INDEXED_DATABASE) namespace WebCore { class DOMStringList; +class IDBDatabaseBackendImpl; class IDBFactoryBackendImpl : public IDBFactoryBackendInterface { public: - static PassRefPtr<IDBFactoryBackendImpl> create(); + static PassRefPtr<IDBFactoryBackendImpl> create() + { + return adoptRef(new IDBFactoryBackendImpl()); + } virtual ~IDBFactoryBackendImpl(); virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); @@ -48,7 +52,7 @@ public: private: IDBFactoryBackendImpl(); - typedef HashMap<String, RefPtr<IDBDatabaseBackendInterface> > IDBDatabaseBackendMap; + typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap; IDBDatabaseBackendMap m_databaseBackendMap; // We only create one instance of this class at a time. diff --git a/WebCore/storage/IDBKeyPath.cpp b/WebCore/storage/IDBKeyPath.cpp new file mode 100644 index 0000000..8833da0 --- /dev/null +++ b/WebCore/storage/IDBKeyPath.cpp @@ -0,0 +1,269 @@ +/* + * 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 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 "IDBKeyPath.h" + +#if ENABLE(INDEXED_DATABASE) + +#include <wtf/ASCIICType.h> +#include <wtf/dtoa.h> + +namespace WebCore { + +class IDBKeyPathLexer { +public: + enum TokenType { + TokenLeftBracket, + TokenRightBracket, + TokenIdentifier, + TokenNumber, + TokenDot, + TokenEnd, + TokenError + }; + + explicit IDBKeyPathLexer(const String& s) + : m_string(s) + , m_ptr(s.characters()) + , m_end(s.characters() + s.length()) + , m_currentTokenType(TokenError) + { + } + + TokenType currentTokenType() const { return m_currentTokenType; } + + TokenType nextTokenType() + { + m_currentTokenType = lex(m_currentElement); + return m_currentTokenType; + } + + const IDBKeyPathElement& currentElement() { return m_currentElement; } + +private: + TokenType lex(IDBKeyPathElement&); + TokenType lexIdentifier(IDBKeyPathElement&); + TokenType lexNumber(IDBKeyPathElement&); + IDBKeyPathElement m_currentElement; + String m_string; + const UChar* m_ptr; + const UChar* m_end; + TokenType m_currentTokenType; +}; + +IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(IDBKeyPathElement& element) +{ + while (m_ptr < m_end && isASCIISpace(*m_ptr)) + ++m_ptr; + + if (m_ptr >= m_end) + return TokenEnd; + + ASSERT(m_ptr < m_end); + switch (*m_ptr) { + case '[': + ++m_ptr; + return TokenLeftBracket; + case ']': + ++m_ptr; + return TokenRightBracket; + case '.': + ++m_ptr; + return TokenDot; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + return lexNumber(element); + default: + return lexIdentifier(element); + } + return TokenError; +} + +static inline bool isSafeIdentifierStartCharacter(UChar c) +{ + return isASCIIAlpha(c) || (c == '_') || (c == '$'); +} + +static inline bool isSafeIdentifierCharacter(UChar c) +{ + return isASCIIAlphanumeric(c) || (c == '_') || (c == '$'); +} + +IDBKeyPathLexer::TokenType IDBKeyPathLexer::lexIdentifier(IDBKeyPathElement& element) +{ + const UChar* start = m_ptr; + if (m_ptr < m_end && isSafeIdentifierStartCharacter(*m_ptr)) + ++m_ptr; + else + return TokenError; + + while (m_ptr < m_end && isSafeIdentifierCharacter(*m_ptr)) + ++m_ptr; + + element.type = IDBKeyPathElement::IsNamed; + element.identifier = String(start, m_ptr - start); + return TokenIdentifier; +} + +IDBKeyPathLexer::TokenType IDBKeyPathLexer::lexNumber(IDBKeyPathElement& element) +{ + if (m_ptr >= m_end) + return TokenError; + + const UChar* start = m_ptr; + // [0-9]* + while (m_ptr < m_end && isASCIIDigit(*m_ptr)) + ++m_ptr; + + String numberAsString; + numberAsString = String(start, m_ptr - start); + bool ok = false; + unsigned number = numberAsString.toUIntStrict(&ok); + if (!ok) + return TokenError; + + element.type = IDBKeyPathElement::IsIndexed; + element.index = number; + return TokenNumber; +} + +void IDBParseKeyPath(const String& keyPath, Vector<IDBKeyPathElement>& elements, IDBKeyPathParseError& error) +{ + // This is a simplified parser loosely based on LiteralParser. + // An IDBKeyPath is defined as a sequence of: + // identifierA{.identifierB{[numeric_value]} + // where "{}" represents an optional part + // The basic state machine is: + // Start => {Identifier, Array} + // Identifier => {Dot, Array, End} + // Array => {Start, Dot, End} + // Dot => {Identifier} + // It bails out as soon as it finds an error, but doesn't discard the bits it managed to parse. + enum ParserState { Identifier, Array, Dot, End }; + + IDBKeyPathLexer lexer(keyPath); + IDBKeyPathLexer::TokenType tokenType = lexer.nextTokenType(); + ParserState state; + if (tokenType == IDBKeyPathLexer::TokenIdentifier) + state = Identifier; + else if (tokenType == IDBKeyPathLexer::TokenLeftBracket) + state = Array; + else if (tokenType == IDBKeyPathLexer::TokenEnd) + state = End; + else { + error = IDBKeyPathParseErrorStart; + return; + } + + while (1) { + switch (state) { + case Identifier : { + IDBKeyPathLexer::TokenType tokenType = lexer.currentTokenType(); + ASSERT(tokenType == IDBKeyPathLexer::TokenIdentifier); + + IDBKeyPathElement element = lexer.currentElement(); + ASSERT(element.type == IDBKeyPathElement::IsNamed); + elements.append(element); + + tokenType = lexer.nextTokenType(); + if (tokenType == IDBKeyPathLexer::TokenDot) + state = Dot; + else if (tokenType == IDBKeyPathLexer::TokenLeftBracket) + state = Array; + else if (tokenType == IDBKeyPathLexer::TokenEnd) + state = End; + else { + error = IDBKeyPathParseErrorIdentifier; + return; + } + break; + } + case Array : { + IDBKeyPathLexer::TokenType tokenType = lexer.currentTokenType(); + ASSERT(tokenType == IDBKeyPathLexer::TokenLeftBracket); + + tokenType = lexer.nextTokenType(); + if (tokenType != IDBKeyPathLexer::TokenNumber) { + error = IDBKeyPathParseErrorArrayIndex; + return; + } + + ASSERT(tokenType == IDBKeyPathLexer::TokenNumber); + IDBKeyPathElement element = lexer.currentElement(); + ASSERT(element.type == IDBKeyPathElement::IsIndexed); + elements.append(element); + + tokenType = lexer.nextTokenType(); + if (tokenType != IDBKeyPathLexer::TokenRightBracket) { + error = IDBKeyPathParseErrorArrayIndex; + return; + } + + tokenType = lexer.nextTokenType(); + if (tokenType == IDBKeyPathLexer::TokenDot) + state = Dot; + else if (tokenType == IDBKeyPathLexer::TokenLeftBracket) + state = Array; + else if (tokenType == IDBKeyPathLexer::TokenEnd) + state = End; + else { + error = IDBKeyPathParseErrorAfterArray; + return; + } + break; + } + case Dot: { + IDBKeyPathLexer::TokenType tokenType = lexer.currentTokenType(); + ASSERT(tokenType == IDBKeyPathLexer::TokenDot); + + tokenType = lexer.nextTokenType(); + if (tokenType != IDBKeyPathLexer::TokenIdentifier) { + error = IDBKeyPathParseErrorDot; + return; + } + + state = Identifier; + break; + } + case End: { + error = IDBKeyPathParseErrorNone; + return; + } + } + } +} + +} // namespace WebCore + +#endif // ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IDBKeyPath.h b/WebCore/storage/IDBKeyPath.h new file mode 100644 index 0000000..7787980 --- /dev/null +++ b/WebCore/storage/IDBKeyPath.h @@ -0,0 +1,64 @@ +/* + * 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 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 IDBKeyPath_h +#define IDBKeyPath_h + +#if ENABLE(INDEXED_DATABASE) + +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +struct IDBKeyPathElement { + enum Type { + IsIndexed, + IsNamed, + }; + + Type type; + unsigned index; + String identifier; +}; + +enum IDBKeyPathParseError { + IDBKeyPathParseErrorNone, + IDBKeyPathParseErrorStart, + IDBKeyPathParseErrorIdentifier, + IDBKeyPathParseErrorArrayIndex, + IDBKeyPathParseErrorAfterArray, + IDBKeyPathParseErrorDot, +}; + +void IDBParseKeyPath(const String&, Vector<IDBKeyPathElement>&, IDBKeyPathParseError&); + +} // namespace WebCore + +#endif + +#endif // IDBKeyPath_h diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.h b/WebCore/storage/IDBObjectStoreBackendImpl.h index fc63658..4b909af 100644 --- a/WebCore/storage/IDBObjectStoreBackendImpl.h +++ b/WebCore/storage/IDBObjectStoreBackendImpl.h @@ -27,8 +27,8 @@ #define IDBObjectStoreBackendImpl_h #include "IDBObjectStoreBackendInterface.h" -#include "StringHash.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> #if ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/OriginQuotaManager.h b/WebCore/storage/OriginQuotaManager.h index c904737..ec9620c 100644 --- a/WebCore/storage/OriginQuotaManager.h +++ b/WebCore/storage/OriginQuotaManager.h @@ -31,10 +31,10 @@ #if ENABLE(DATABASE) -#include "StringHash.h" #include "SecurityOriginHash.h" #include <wtf/HashMap.h> #include <wtf/Threading.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/OriginUsageRecord.h b/WebCore/storage/OriginUsageRecord.h index 25bddf2..a830e68 100644 --- a/WebCore/storage/OriginUsageRecord.h +++ b/WebCore/storage/OriginUsageRecord.h @@ -31,10 +31,9 @@ #if ENABLE(DATABASE) #include "PlatformString.h" -#include "StringHash.h" - #include <wtf/HashMap.h> -#include <wtf/HashSet.h> +#include <wtf/HashSet.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp index 3973157..19e9e38 100644 --- a/WebCore/storage/SQLStatement.cpp +++ b/WebCore/storage/SQLStatement.cpp @@ -39,6 +39,7 @@ #include "SQLStatementErrorCallback.h" #include "SQLTransaction.h" #include "SQLValue.h" +#include <wtf/text/CString.h> namespace WebCore { diff --git a/WebCore/storage/SQLTransactionCoordinator.h b/WebCore/storage/SQLTransactionCoordinator.h index 247ad13..94360c0 100644 --- a/WebCore/storage/SQLTransactionCoordinator.h +++ b/WebCore/storage/SQLTransactionCoordinator.h @@ -33,11 +33,11 @@ #if ENABLE(DATABASE) -#include "StringHash.h" #include <wtf/Deque.h> #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/RefPtr.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/StorageAreaSync.h b/WebCore/storage/StorageAreaSync.h index 94c4670..90aa6a7 100644 --- a/WebCore/storage/StorageAreaSync.h +++ b/WebCore/storage/StorageAreaSync.h @@ -29,9 +29,9 @@ #if ENABLE(DOM_STORAGE) #include "SQLiteDatabase.h" -#include "StringHash.h" #include "Timer.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/StorageMap.h b/WebCore/storage/StorageMap.h index fa5f46c..d162124 100644 --- a/WebCore/storage/StorageMap.h +++ b/WebCore/storage/StorageMap.h @@ -29,11 +29,10 @@ #if ENABLE(DOM_STORAGE) #include "PlatformString.h" -#include "StringHash.h" - #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp index 557dd76..0f07e07 100644 --- a/WebCore/storage/StorageNamespaceImpl.cpp +++ b/WebCore/storage/StorageNamespaceImpl.cpp @@ -29,11 +29,11 @@ #if ENABLE(DOM_STORAGE) #include "SecurityOriginHash.h" -#include "StringHash.h" #include "StorageAreaImpl.h" #include "StorageMap.h" #include "StorageSyncManager.h" #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/storage/chromium/QuotaTracker.h b/WebCore/storage/chromium/QuotaTracker.h index b913563..774475e 100644 --- a/WebCore/storage/chromium/QuotaTracker.h +++ b/WebCore/storage/chromium/QuotaTracker.h @@ -35,8 +35,8 @@ #include "PlatformString.h" #include "SecurityOrigin.h" -#include "StringHash.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/svg/SVGAllInOne.cpp b/WebCore/svg/SVGAllInOne.cpp index 6bcf945..2cb63af 100644 --- a/WebCore/svg/SVGAllInOne.cpp +++ b/WebCore/svg/SVGAllInOne.cpp @@ -107,6 +107,7 @@ #include "SVGNumberList.cpp" #include "SVGPaint.cpp" #include "SVGParserUtilities.cpp" +#include "SVGPathBlender.cpp" #include "SVGPathBuilder.cpp" #include "SVGPathByteStreamBuilder.cpp" #include "SVGPathByteStreamSource.cpp" @@ -129,6 +130,7 @@ #include "SVGPathSegMoveto.cpp" #include "SVGPathStringBuilder.cpp" #include "SVGPathStringSource.cpp" +#include "SVGPathTraversalStateBuilder.cpp" #include "SVGPatternElement.cpp" #include "SVGPointList.cpp" #include "SVGPolyElement.cpp" diff --git a/WebCore/svg/SVGAltGlyphElement.h b/WebCore/svg/SVGAltGlyphElement.h index 8cba5bd..cc5364b 100644 --- a/WebCore/svg/SVGAltGlyphElement.h +++ b/WebCore/svg/SVGAltGlyphElement.h @@ -23,9 +23,9 @@ #define SVGAltGlyphElement_h #if ENABLE(SVG_FONTS) -#include "AtomicString.h" #include "SVGTextPositioningElement.h" #include "SVGURIReference.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/svg/SVGAnimateElement.cpp b/WebCore/svg/SVGAnimateElement.cpp index 2723804..df0c3bc 100644 --- a/WebCore/svg/SVGAnimateElement.cpp +++ b/WebCore/svg/SVGAnimateElement.cpp @@ -42,6 +42,7 @@ SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document* doc , m_fromNumber(0) , m_toNumber(0) , m_animatedNumber(numeric_limits<double>::infinity()) + , m_animatedPathPointer(0) { } @@ -131,19 +132,31 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat } AnimationMode animationMode = this->animationMode(); if (m_propertyType == PathProperty) { - if (percentage == 0) - results->m_animatedPath = m_fromPath; - else if (percentage == 1.f) - results->m_animatedPath = m_toPath; - else { - if (m_fromPath && m_toPath) - results->m_animatedPath = SVGPathSegList::createAnimated(m_fromPath.get(), m_toPath.get(), percentage); - else - results->m_animatedPath.clear(); + if (!percentage) { + ASSERT(m_fromPath); + ASSERT(percentage >= 0); + results->m_animatedPathPointer = m_fromPath.get(); + } else if (percentage == 1.f) { + ASSERT(m_toPath); + results->m_animatedPathPointer = m_toPath.get(); + } else { + if (m_fromPath && m_toPath) { + SVGPathParserFactory* factory = SVGPathParserFactory::self(); + if (!factory->buildAnimatedSVGPathByteStream(m_fromPath.get(), m_toPath.get(), results->m_animatedPath, percentage)) { + results->m_animatedPath.clear(); + results->m_animatedPathPointer = 0; + } else + results->m_animatedPathPointer = results->m_animatedPath.get(); + } else + results->m_animatedPathPointer = 0; // Fall back to discrete animation if the paths are not compatible - if (!results->m_animatedPath) - results->m_animatedPath = ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f) - ? m_toPath : m_fromPath; + if (!results->m_animatedPathPointer) { + ASSERT(m_fromPath); + ASSERT(m_toPath); + ASSERT(!results->m_animatedPath); + results->m_animatedPathPointer = ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f) + ? m_toPath.get() : m_fromPath.get(); + } } return; } else if (m_propertyType == PointsProperty) { @@ -189,11 +202,9 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const return true; } } else if (m_propertyType == PathProperty) { - m_fromPath = SVGPathSegList::create(SVGNames::dAttr); SVGPathParserFactory* factory = SVGPathParserFactory::self(); - if (factory->buildSVGPathSegListFromString(fromString, m_fromPath.get(), UnalteredParsing)) { - m_toPath = SVGPathSegList::create(SVGNames::dAttr); - if (factory->buildSVGPathSegListFromString(toString, m_toPath.get(), UnalteredParsing)) + if (factory->buildSVGPathByteStreamFromString(fromString, m_fromPath, UnalteredParsing)) { + if (factory->buildSVGPathByteStreamFromString(toString, m_toPath, UnalteredParsing)) return true; } m_fromPath.clear(); @@ -256,6 +267,7 @@ void SVGAnimateElement::resetToBaseValue(const String& baseString) return; } else if (m_propertyType == PathProperty) { m_animatedPath.clear(); + m_animatedPathPointer = 0; return; } else if (m_propertyType == PointsProperty) { m_animatedPoints.clear(); @@ -272,7 +284,7 @@ void SVGAnimateElement::applyResultsToTarget() else if (m_propertyType == NumberProperty) valueToApply = String::number(m_animatedNumber) + m_numberUnit; else if (m_propertyType == PathProperty) { - if (!m_animatedPath || !m_animatedPath->numberOfItems()) + if (!m_animatedPathPointer || m_animatedPathPointer->isEmpty()) valueToApply = m_animatedString; else { // We need to keep going to string and back because we are currently only able to paint @@ -280,7 +292,7 @@ void SVGAnimateElement::applyResultsToTarget() // morphing needs to be done with unprocessed paths. // FIXME: This could be optimized if paths were not processed at parse time. SVGPathParserFactory* factory = SVGPathParserFactory::self(); - factory->buildStringFromSVGPathSegList(m_animatedPath.get(), valueToApply, UnalteredParsing); + factory->buildStringFromByteStream(m_animatedPathPointer, valueToApply, UnalteredParsing); } } else if (m_propertyType == PointsProperty) { if (!m_animatedPoints || !m_animatedPoints->numberOfItems()) diff --git a/WebCore/svg/SVGAnimateElement.h b/WebCore/svg/SVGAnimateElement.h index 5c8d1e5..43522a7 100644 --- a/WebCore/svg/SVGAnimateElement.h +++ b/WebCore/svg/SVGAnimateElement.h @@ -26,6 +26,8 @@ #include "Color.h" #include "SVGAnimationElement.h" +#include "SVGPathByteStream.h" +#include <wtf/OwnPtr.h> namespace WebCore { class SVGPathSegList; @@ -59,9 +61,10 @@ namespace WebCore { String m_fromString; String m_toString; String m_animatedString; - RefPtr<SVGPathSegList> m_fromPath; - RefPtr<SVGPathSegList> m_toPath; - RefPtr<SVGPathSegList> m_animatedPath; + OwnPtr<SVGPathByteStream> m_fromPath; + OwnPtr<SVGPathByteStream> m_toPath; + OwnPtr<SVGPathByteStream> m_animatedPath; + SVGPathByteStream* m_animatedPathPointer; RefPtr<SVGPointList> m_fromPoints; RefPtr<SVGPointList> m_toPoints; RefPtr<SVGPointList> m_animatedPoints; diff --git a/WebCore/svg/SVGDocumentExtensions.cpp b/WebCore/svg/SVGDocumentExtensions.cpp index 22ab399..819d12b 100644 --- a/WebCore/svg/SVGDocumentExtensions.cpp +++ b/WebCore/svg/SVGDocumentExtensions.cpp @@ -24,7 +24,6 @@ #if ENABLE(SVG) #include "SVGDocumentExtensions.h" -#include "AtomicString.h" #include "Console.h" #include "DOMWindow.h" #include "Document.h" @@ -37,6 +36,7 @@ #include "SVGSVGElement.h" #include "ScriptController.h" #include "ScriptableDocumentParser.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/svg/SVGDocumentExtensions.h b/WebCore/svg/SVGDocumentExtensions.h index ad2fb60..da23cd0 100644 --- a/WebCore/svg/SVGDocumentExtensions.h +++ b/WebCore/svg/SVGDocumentExtensions.h @@ -22,13 +22,13 @@ #define SVGDocumentExtensions_h #if ENABLE(SVG) -#include "AtomicStringHash.h" #include "SVGResourcesCache.h" -#include "StringImpl.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/AtomicStringHash.h> +#include <wtf/text/StringImpl.h> namespace WebCore { diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp index f481892..92534e8 100644 --- a/WebCore/svg/SVGFEImageElement.cpp +++ b/WebCore/svg/SVGFEImageElement.cpp @@ -137,7 +137,7 @@ PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*) SVGRenderSupport::renderSubtreeToImage(m_targetImage.get(), renderer); } - return FEImage::create(m_targetImage ? m_targetImage->image() : m_cachedImage->image(), preserveAspectRatio()); + return FEImage::create(m_targetImage ? m_targetImage->copyImage() : m_cachedImage->image(), preserveAspectRatio()); } void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp index 83fd952..c78a619 100644 --- a/WebCore/svg/SVGFitToViewBox.cpp +++ b/WebCore/svg/SVGFitToViewBox.cpp @@ -30,7 +30,7 @@ #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGPreserveAspectRatio.h" -#include "StringImpl.h" +#include <wtf/text/StringImpl.h> namespace WebCore { diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp index ee7c192..898c259 100644 --- a/WebCore/svg/SVGFont.cpp +++ b/WebCore/svg/SVGFont.cpp @@ -182,8 +182,8 @@ static inline bool isCompatibleGlyph(const SVGGlyphIdentifier& identifier, bool // Split subcode from language, if existant. String languagePrefix; - int subCodeSeparator = language.find('-'); - if (subCodeSeparator != -1) + size_t subCodeSeparator = language.find('-'); + if (subCodeSeparator != notFound) languagePrefix = language.left(subCodeSeparator); Vector<String>::const_iterator it = identifier.languages.begin(); diff --git a/WebCore/svg/SVGImageElement.cpp b/WebCore/svg/SVGImageElement.cpp index df867f3..c5e4802 100644 --- a/WebCore/svg/SVGImageElement.cpp +++ b/WebCore/svg/SVGImageElement.cpp @@ -171,7 +171,7 @@ void SVGImageElement::attach() { SVGStyledTransformableElement::attach(); - if (RenderImage* imageObj = toRenderImage(renderer())) { + if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) { if (imageObj->hasImage()) return; diff --git a/WebCore/svg/SVGLangSpace.h b/WebCore/svg/SVGLangSpace.h index e2a5635..64e435d 100644 --- a/WebCore/svg/SVGLangSpace.h +++ b/WebCore/svg/SVGLangSpace.h @@ -22,7 +22,7 @@ #define SVGLangSpace_h #if ENABLE(SVG) -#include "AtomicString.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/svg/SVGPathBlender.cpp b/WebCore/svg/SVGPathBlender.cpp new file mode 100644 index 0000000..8320890 --- /dev/null +++ b/WebCore/svg/SVGPathBlender.cpp @@ -0,0 +1,292 @@ +/* + * 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" + +#if ENABLE(SVG) +#include "SVGPathBlender.h" + +#include "SVGPathSeg.h" + +namespace WebCore { + +SVGPathBlender::SVGPathBlender() + : m_fromSource(0) + , m_toSource(0) + , m_consumer(0) + , m_progress(0) +{ +} + +SVGPathBlender::~SVGPathBlender() +{ +} + +float SVGPathBlender::blendAnimatedFloat(float from, float to) +{ + return (to - from) * m_progress + from; +} + +FloatPoint SVGPathBlender::blendAnimatedFloatPoint(FloatPoint& from, FloatPoint& to) +{ + return FloatPoint((to.x() - from.x()) * m_progress + from.x(), (to.y() - from.y()) * m_progress + from.y()); +} + +bool SVGPathBlender::blendMoveToSegment() +{ + FloatPoint fromTargetPoint; + FloatPoint toTargetPoint; + if (!m_fromSource->parseMoveToSegment(fromTargetPoint) + || !m_toSource->parseMoveToSegment(toTargetPoint)) + return false; + + m_consumer->moveTo(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), false, m_mode); + return true; +} + +bool SVGPathBlender::blendLineToSegment() +{ + FloatPoint fromTargetPoint; + FloatPoint toTargetPoint; + if (!m_fromSource->parseLineToSegment(fromTargetPoint) + || !m_toSource->parseLineToSegment(toTargetPoint)) + return false; + + m_consumer->lineTo(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), m_mode); + return true; +} + +bool SVGPathBlender::blendLineToHorizontalSegment() +{ + float fromX; + float toX; + if (!m_fromSource->parseLineToHorizontalSegment(fromX) + || !m_toSource->parseLineToHorizontalSegment(toX)) + return false; + + m_consumer->lineToHorizontal(blendAnimatedFloat(fromX, toX), m_mode); + return true; +} + +bool SVGPathBlender::blendLineToVerticalSegment() +{ + float fromY; + float toY; + if (!m_fromSource->parseLineToVerticalSegment(fromY) + || !m_toSource->parseLineToVerticalSegment(toY)) + return false; + + m_consumer->lineToVertical(blendAnimatedFloat(fromY, toY), m_mode); + return true; +} + +bool SVGPathBlender::blendCurveToCubicSegment() +{ + FloatPoint fromTargetPoint; + FloatPoint fromPoint1; + FloatPoint fromPoint2; + FloatPoint toTargetPoint; + FloatPoint toPoint1; + FloatPoint toPoint2; + if (!m_fromSource->parseCurveToCubicSegment(fromPoint1, fromPoint2, fromTargetPoint) + || !m_toSource->parseCurveToCubicSegment(toPoint1, toPoint2, toTargetPoint)) + return false; + + m_consumer->curveToCubic(blendAnimatedFloatPoint(fromPoint1, toPoint1), + blendAnimatedFloatPoint(fromPoint2, toPoint2), + blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), + m_mode); + return true; +} + +bool SVGPathBlender::blendCurveToCubicSmoothSegment() +{ + FloatPoint fromTargetPoint; + FloatPoint fromPoint2; + FloatPoint toTargetPoint; + FloatPoint toPoint2; + if (!m_fromSource->parseCurveToCubicSmoothSegment(fromPoint2, fromTargetPoint) + || !m_toSource->parseCurveToCubicSmoothSegment(toPoint2, toTargetPoint)) + return false; + + m_consumer->curveToCubicSmooth(blendAnimatedFloatPoint(fromPoint2, toPoint2), + blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), + m_mode); + return true; +} + +bool SVGPathBlender::blendCurveToQuadraticSegment() +{ + FloatPoint fromTargetPoint; + FloatPoint fromPoint1; + FloatPoint toTargetPoint; + FloatPoint toPoint1; + if (!m_fromSource->parseCurveToQuadraticSegment(fromPoint1, fromTargetPoint) + || !m_toSource->parseCurveToQuadraticSegment(toPoint1, toTargetPoint)) + return false; + + m_consumer->curveToQuadratic(blendAnimatedFloatPoint(fromPoint1, toPoint1), + blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), + m_mode); + return true; +} + +bool SVGPathBlender::blendCurveToQuadraticSmoothSegment() +{ + FloatPoint fromTargetPoint; + FloatPoint toTargetPoint; + if (!m_fromSource->parseCurveToQuadraticSmoothSegment(fromTargetPoint) + || !m_toSource->parseCurveToQuadraticSmoothSegment(toTargetPoint)) + return false; + + m_consumer->curveToQuadraticSmooth(blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), m_mode); + return true; +} + +bool SVGPathBlender::blendArcToSegment() +{ + float fromRx; + float fromRy; + float fromAngle; + bool fromLargeArc; + bool fromSweep; + FloatPoint fromTargetPoint; + float toRx; + float toRy; + float toAngle; + bool toLargeArc; + bool toSweep; + FloatPoint toTargetPoint; + if (!m_fromSource->parseArcToSegment(fromRx, fromRy, fromAngle, fromLargeArc, fromSweep, fromTargetPoint) + || !m_toSource->parseArcToSegment(toRx, toRy, toAngle, toLargeArc, toSweep, toTargetPoint)) + return false; + + m_consumer->arcTo(blendAnimatedFloat(fromRx, toRx), + blendAnimatedFloat(fromRy, toRy), + blendAnimatedFloat(fromAngle, toAngle), + m_progress < 0.5 ? fromLargeArc : toLargeArc, + m_progress < 0.5 ? fromSweep : toSweep, + blendAnimatedFloatPoint(fromTargetPoint, toTargetPoint), + m_mode); + return true; +} + +bool SVGPathBlender::blendAnimatedPath(float progress, SVGPathSource* fromSource, SVGPathSource* toSource, SVGPathConsumer* consumer) +{ + ASSERT(fromSource); + ASSERT(toSource); + ASSERT(consumer); + m_fromSource = fromSource; + m_toSource = toSource; + m_consumer = consumer; + + m_progress = progress; + while (true) { + SVGPathSegType fromCommand; + SVGPathSegType toCommand; + if (!m_fromSource->parseSVGSegmentType(fromCommand) || !m_toSource->parseSVGSegmentType(toCommand)) + return false; + if (fromCommand != toCommand) + return false; + + m_mode = AbsoluteCoordinates; + switch (fromCommand) { + case PathSegMoveToRel: + m_mode = RelativeCoordinates; + case PathSegMoveToAbs: + if (!blendMoveToSegment()) + return false; + break; + case PathSegLineToRel: + m_mode = RelativeCoordinates; + case PathSegLineToAbs: + if (!blendLineToSegment()) + return false; + break; + case PathSegLineToHorizontalRel: + m_mode = RelativeCoordinates; + case PathSegLineToHorizontalAbs: + if (!blendLineToHorizontalSegment()) + return false; + break; + case PathSegLineToVerticalRel: + m_mode = RelativeCoordinates; + case PathSegLineToVerticalAbs: + if (!blendLineToVerticalSegment()) + return false; + break; + case PathSegClosePath: + m_consumer->closePath(); + break; + case PathSegCurveToCubicRel: + m_mode = RelativeCoordinates; + case PathSegCurveToCubicAbs: + if (!blendCurveToCubicSegment()) + return false; + break; + case PathSegCurveToCubicSmoothRel: + m_mode = RelativeCoordinates; + case PathSegCurveToCubicSmoothAbs: + if (!blendCurveToCubicSmoothSegment()) + return false; + break; + case PathSegCurveToQuadraticRel: + m_mode = RelativeCoordinates; + case PathSegCurveToQuadraticAbs: + if (!blendCurveToQuadraticSegment()) + return false; + break; + case PathSegCurveToQuadraticSmoothRel: + m_mode = RelativeCoordinates; + case PathSegCurveToQuadraticSmoothAbs: + if (!blendCurveToQuadraticSmoothSegment()) + return false; + break; + case PathSegArcRel: + m_mode = RelativeCoordinates; + case PathSegArcAbs: + if (!blendArcToSegment()) + return false; + break; + default: + return false; + } + if (m_fromSource->hasMoreData() != m_toSource->hasMoreData()) + return false; + if (!m_fromSource->hasMoreData() || !m_toSource->hasMoreData()) + break; + } + return true; +} + +void SVGPathBlender::cleanup() +{ + ASSERT(m_toSource); + ASSERT(m_fromSource); + ASSERT(m_consumer); + + m_consumer->cleanup(); + m_toSource = 0; + m_fromSource = 0; + m_consumer = 0; +} + +} + +#endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGPathBlender.h b/WebCore/svg/SVGPathBlender.h new file mode 100644 index 0000000..a15c0ad --- /dev/null +++ b/WebCore/svg/SVGPathBlender.h @@ -0,0 +1,62 @@ +/* + * 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 SVGPathBlender_h +#define SVGPathBlender_h + +#if ENABLE(SVG) +#include "SVGPathConsumer.h" +#include "SVGPathSource.h" +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class SVGPathBlender : public Noncopyable { +public: + SVGPathBlender(); + ~SVGPathBlender(); + + bool blendAnimatedPath(float, SVGPathSource*, SVGPathSource*, SVGPathConsumer*); + void cleanup(); + +private: + bool blendMoveToSegment(); + bool blendLineToSegment(); + bool blendLineToHorizontalSegment(); + bool blendLineToVerticalSegment(); + bool blendCurveToCubicSegment(); + bool blendCurveToCubicSmoothSegment(); + bool blendCurveToQuadraticSegment(); + bool blendCurveToQuadraticSmoothSegment(); + bool blendArcToSegment(); + + float blendAnimatedFloat(float, float); + FloatPoint blendAnimatedFloatPoint(FloatPoint&, FloatPoint&); + + SVGPathSource* m_fromSource; + SVGPathSource* m_toSource; + SVGPathConsumer* m_consumer; + PathCoordinateMode m_mode; + float m_progress; +}; + +} // namespace WebCore + +#endif // ENABLE(SVG) +#endif // SVGPathBlender_h diff --git a/WebCore/svg/SVGPathBuilder.h b/WebCore/svg/SVGPathBuilder.h index 3a1088d..38eabd4 100644 --- a/WebCore/svg/SVGPathBuilder.h +++ b/WebCore/svg/SVGPathBuilder.h @@ -36,6 +36,8 @@ public: SVGPathBuilder(); void setCurrentPath(Path* path) { m_path = path; } + virtual void incrementPathSegmentCount() { } + virtual bool continueConsuming() { return true; } virtual void cleanup() { m_path = 0; } private: diff --git a/WebCore/svg/SVGPathByteStreamBuilder.h b/WebCore/svg/SVGPathByteStreamBuilder.h index f1e7524..c89856f 100644 --- a/WebCore/svg/SVGPathByteStreamBuilder.h +++ b/WebCore/svg/SVGPathByteStreamBuilder.h @@ -34,6 +34,8 @@ public: SVGPathByteStreamBuilder(); void setCurrentByteStream(SVGPathByteStream* byteStream) { m_byteStream = byteStream; } + virtual void incrementPathSegmentCount() { } + virtual bool continueConsuming() { return true; } virtual void cleanup() { m_byteStream = 0; } private: diff --git a/WebCore/svg/SVGPathConsumer.h b/WebCore/svg/SVGPathConsumer.h index b0deb52..629c1bf 100644 --- a/WebCore/svg/SVGPathConsumer.h +++ b/WebCore/svg/SVGPathConsumer.h @@ -42,6 +42,8 @@ enum PathParsingMode { class SVGPathConsumer : public Noncopyable { public: + virtual void incrementPathSegmentCount() = 0; + virtual bool continueConsuming() = 0; virtual void cleanup() = 0; public: diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp index 2adc05f..6d801fb 100644 --- a/WebCore/svg/SVGPathElement.cpp +++ b/WebCore/svg/SVGPathElement.cpp @@ -69,9 +69,12 @@ FloatPoint SVGPathElement::getPointAtLength(float length) return toPathData().pointAtLength(length, ok); } -unsigned long SVGPathElement::getPathSegAtLength(float length, ExceptionCode& ec) +unsigned long SVGPathElement::getPathSegAtLength(float length) { - return pathSegList()->getPathSegAtLength(length, ec); + SVGPathParserFactory* factory = SVGPathParserFactory::self(); + unsigned long pathSeg = 0; + factory->getSVGPathSegAtLengthFromSVGPathSegList(pathSegList(), length, pathSeg); + return pathSeg; } PassRefPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClosePath() diff --git a/WebCore/svg/SVGPathElement.h b/WebCore/svg/SVGPathElement.h index 718f05b..07612c6 100644 --- a/WebCore/svg/SVGPathElement.h +++ b/WebCore/svg/SVGPathElement.h @@ -62,7 +62,7 @@ namespace WebCore { virtual bool isValid() const { return SVGTests::isValid(); } float getTotalLength(); FloatPoint getPointAtLength(float distance); - unsigned long getPathSegAtLength(float distance, ExceptionCode&); + unsigned long getPathSegAtLength(float distance); static PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath(); static PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y); diff --git a/WebCore/svg/SVGPathElement.idl b/WebCore/svg/SVGPathElement.idl index 8506225..1c1dca7 100644 --- a/WebCore/svg/SVGPathElement.idl +++ b/WebCore/svg/SVGPathElement.idl @@ -37,8 +37,7 @@ module svg { float getTotalLength(); SVGPoint getPointAtLength(in float distance); - unsigned long getPathSegAtLength(in float distance) - raises(DOMException, SVGException); + unsigned long getPathSegAtLength(in float distance); SVGPathSegClosePath createSVGPathSegClosePath(); diff --git a/WebCore/svg/SVGPathParser.cpp b/WebCore/svg/SVGPathParser.cpp index c729dfb..66bd00f 100644 --- a/WebCore/svg/SVGPathParser.cpp +++ b/WebCore/svg/SVGPathParser.cpp @@ -366,6 +366,9 @@ bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode) default: return false; } + if (!m_consumer->continueConsuming()) + return true; + m_lastCommand = command; if (!m_source->hasMoreData()) @@ -382,6 +385,8 @@ bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode) && m_lastCommand != PathSegCurveToQuadraticSmoothAbs && m_lastCommand != PathSegCurveToQuadraticSmoothRel) m_controlPoint = m_currentPoint; + + m_consumer->incrementPathSegmentCount(); } return false; diff --git a/WebCore/svg/SVGPathParserFactory.cpp b/WebCore/svg/SVGPathParserFactory.cpp index cf1a888..b251ec4 100644 --- a/WebCore/svg/SVGPathParserFactory.cpp +++ b/WebCore/svg/SVGPathParserFactory.cpp @@ -22,7 +22,8 @@ #if ENABLE(SVG) #include "SVGPathParserFactory.h" -#include "StringBuilder.h" +#include "PathTraversalState.h" +#include "SVGPathBlender.h" #include "SVGPathBuilder.h" #include "SVGPathByteStreamBuilder.h" #include "SVGPathByteStreamSource.h" @@ -31,6 +32,8 @@ #include "SVGPathSegListSource.h" #include "SVGPathStringBuilder.h" #include "SVGPathStringSource.h" +#include "SVGPathTraversalStateBuilder.h" +#include "StringBuilder.h" namespace WebCore { @@ -73,6 +76,17 @@ static SVGPathStringBuilder* globalSVGPathStringBuilder() return s_builder; } +static SVGPathTraversalStateBuilder* globalSVGPathTraversalStateBuilder(PathTraversalState& traversalState, float length) +{ + static SVGPathTraversalStateBuilder* s_builder = 0; + if (!s_builder) + s_builder = new SVGPathTraversalStateBuilder; + + s_builder->setCurrentTraversalState(&traversalState); + s_builder->setDesiredLength(length); + return s_builder; +} + static SVGPathParser* globalSVGPathParser(SVGPathSource* source, SVGPathConsumer* consumer) { static SVGPathParser* s_parser = 0; @@ -84,6 +98,15 @@ static SVGPathParser* globalSVGPathParser(SVGPathSource* source, SVGPathConsumer return s_parser; } +static SVGPathBlender* globalSVGPathBlender() +{ + static SVGPathBlender* s_blender = 0; + if (!s_blender) + s_blender = new SVGPathBlender; + + return s_blender; +} + SVGPathParserFactory* SVGPathParserFactory::self() { static SVGPathParserFactory* s_instance = 0; @@ -224,6 +247,42 @@ bool SVGPathParserFactory::buildSVGPathByteStreamFromString(const String& d, Own return ok; } +bool SVGPathParserFactory::buildAnimatedSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* toStream, OwnPtr<SVGPathByteStream>& result, float progress) +{ + ASSERT(fromStream); + ASSERT(toStream); + if (fromStream->isEmpty() || toStream->isEmpty()) + return false; + + OwnPtr<SVGPathByteStream> stream = SVGPathByteStream::create(); + SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(stream.get()); + + OwnPtr<SVGPathByteStreamSource> fromSource = SVGPathByteStreamSource::create(fromStream); + OwnPtr<SVGPathByteStreamSource> toSource = SVGPathByteStreamSource::create(toStream); + SVGPathBlender* blender = globalSVGPathBlender(); + bool ok = blender->blendAnimatedPath(progress, fromSource.get(), toSource.get(), builder); + result = stream.release(); + blender->cleanup(); + return ok; +} + +bool SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathSegList(SVGPathSegList* pathSegList, float length, unsigned long& pathSeg) +{ + ASSERT(pathSegList); + if (!pathSegList->numberOfItems()) + return false; + + PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength); + SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length); + + OwnPtr<SVGPathSegListSource> source = SVGPathSegListSource::create(pathSegList); + SVGPathParser* parser = globalSVGPathParser(source.get(), builder); + bool ok = parser->parsePathDataFromSource(NormalizedParsing); + pathSeg = builder->pathSegmentIndex(); + parser->cleanup(); + return ok; +} + } #endif diff --git a/WebCore/svg/SVGPathParserFactory.h b/WebCore/svg/SVGPathParserFactory.h index 37418d4..b8a2dd5 100644 --- a/WebCore/svg/SVGPathParserFactory.h +++ b/WebCore/svg/SVGPathParserFactory.h @@ -46,6 +46,10 @@ public: bool buildSVGPathByteStreamFromString(const String&, OwnPtr<SVGPathByteStream>&, PathParsingMode); + bool buildAnimatedSVGPathByteStream(SVGPathByteStream*, SVGPathByteStream*, OwnPtr<SVGPathByteStream>&, float); + + bool getSVGPathSegAtLengthFromSVGPathSegList(SVGPathSegList*, float, unsigned long&); + private: SVGPathParserFactory(); ~SVGPathParserFactory(); diff --git a/WebCore/svg/SVGPathSegList.cpp b/WebCore/svg/SVGPathSegList.cpp index b445d3e..3b86f55 100644 --- a/WebCore/svg/SVGPathSegList.cpp +++ b/WebCore/svg/SVGPathSegList.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> * Copyright (C) 2007 Eric Seidel <eric@webkit.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,22 +25,6 @@ #if ENABLE(SVG) #include "SVGPathSegList.h" -#include "FloatConversion.h" -#include "FloatPoint.h" -#include "FloatSize.h" -#include "Path.h" -#include "PathTraversalState.h" -#include "SVGPathSegArc.h" -#include "SVGPathSegClosePath.h" -#include "SVGPathSegMoveto.h" -#include "SVGPathSegLineto.h" -#include "SVGPathSegLinetoHorizontal.h" -#include "SVGPathSegLinetoVertical.h" -#include "SVGPathSegCurvetoCubic.h" -#include "SVGPathSegCurvetoCubicSmooth.h" -#include "SVGPathSegCurvetoQuadratic.h" -#include "SVGPathSegCurvetoQuadraticSmooth.h" - namespace WebCore { SVGPathSegList::SVGPathSegList(const QualifiedName& attributeName) @@ -51,179 +36,6 @@ SVGPathSegList::~SVGPathSegList() { } -unsigned SVGPathSegList::getPathSegAtLength(double length, ExceptionCode& ec) -{ - // FIXME : to be useful this will need to support non-normalized SVGPathSegLists - int len = numberOfItems(); - // FIXME: Eventually this will likely move to a "path applier"-like model, until then PathTraversalState is less useful as we could just use locals - PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength); - traversalState.m_desiredLength = narrowPrecisionToFloat(length); - for (int i = 0; i < len; ++i) { - SVGPathSeg* segment = getItem(i, ec).get(); - if (ec) - return 0; - float segmentLength = 0; - switch (segment->pathSegType()) { - case PathSegMoveToAbs: - { - SVGPathSegMovetoAbs* moveTo = static_cast<SVGPathSegMovetoAbs*>(segment); - segmentLength = traversalState.moveTo(FloatPoint(moveTo->x(), moveTo->y())); - break; - } - case PathSegLineToAbs: - { - SVGPathSegLinetoAbs* lineTo = static_cast<SVGPathSegLinetoAbs*>(segment); - segmentLength = traversalState.lineTo(FloatPoint(lineTo->x(), lineTo->y())); - break; - } - case PathSegCurveToCubicAbs: - { - SVGPathSegCurvetoCubicAbs* curveTo = static_cast<SVGPathSegCurvetoCubicAbs*>(segment); - segmentLength = traversalState.cubicBezierTo(FloatPoint(curveTo->x1(), curveTo->y1()), - FloatPoint(curveTo->x2(), curveTo->y2()), - FloatPoint(curveTo->x(), curveTo->y())); - break; - } - case PathSegClosePath: - segmentLength = traversalState.closeSubpath(); - break; - default: - ASSERT(false); // FIXME: This only works with normalized/processed path data. - break; - } - traversalState.m_totalLength += segmentLength; - if ((traversalState.m_action == PathTraversalState::TraversalSegmentAtLength) - && (traversalState.m_totalLength >= traversalState.m_desiredLength)) { - return traversalState.m_segmentIndex; - } - traversalState.m_segmentIndex++; - } - - // The SVG spec is unclear as to what to return when the distance is not on the path. - // WebKit/Opera/FF all return the last path segment if the distance exceeds the actual path length: - return traversalState.m_segmentIndex ? traversalState.m_segmentIndex - 1 : 0; -} - -float adjustAnimatedValue(float from, float to, float progress) -{ - return (to - from) * progress + from; -} - -#define BLENDPATHSEG1(class, attr1) \ - class::create(adjustAnimatedValue(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress)) - -#define BLENDPATHSEG2(class, attr1, attr2) \ - class::create(adjustAnimatedValue(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress)) - -#define BLENDPATHSEG4(class, attr1, attr2, attr3, attr4) \ - class::create(adjustAnimatedValue(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr3(), static_cast<class*>(to)->attr3(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr4(), static_cast<class*>(to)->attr4(), progress)) - -#define BLENDPATHSEG6(class, attr1, attr2, attr3, attr4, attr5, attr6) \ - class::create(adjustAnimatedValue(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr3(), static_cast<class*>(to)->attr3(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr4(), static_cast<class*>(to)->attr4(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr5(), static_cast<class*>(to)->attr5(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr6(), static_cast<class*>(to)->attr6(), progress)) - -#define BLENDPATHSEG7(class, attr1, attr2, attr3, attr4, attr5, bool1, bool2) \ - class::create(adjustAnimatedValue(static_cast<class*>(from)->attr1(), static_cast<class*>(to)->attr1(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr2(), static_cast<class*>(to)->attr2(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr3(), static_cast<class*>(to)->attr3(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr4(), static_cast<class*>(to)->attr4(), progress), \ - adjustAnimatedValue(static_cast<class*>(from)->attr5(), static_cast<class*>(to)->attr5(), progress), \ - static_cast<bool>(adjustAnimatedValue(static_cast<class*>(from)->bool1(), static_cast<class*>(to)->bool1(), progress)), \ - static_cast<bool>(adjustAnimatedValue(static_cast<class*>(from)->bool2(), static_cast<class*>(to)->bool2(), progress))) - -PassRefPtr<SVGPathSegList> SVGPathSegList::createAnimated(const SVGPathSegList* fromList, const SVGPathSegList* toList, float progress) -{ - unsigned itemCount = fromList->numberOfItems(); - if (!itemCount || itemCount != toList->numberOfItems()) - return 0; - RefPtr<SVGPathSegList> result = create(fromList->associatedAttributeName()); - ExceptionCode ec = 0; - for (unsigned n = 0; n < itemCount; ++n) { - SVGPathSeg* from = fromList->getItem(n, ec).get(); - if (ec) - return 0; - SVGPathSeg* to = toList->getItem(n, ec).get(); - if (ec) - return 0; - if (from->pathSegType() == PathSegUnknown || from->pathSegType() != to->pathSegType()) - return 0; - RefPtr<SVGPathSeg> segment = 0; - switch (static_cast<SVGPathSegType>(from->pathSegType())) { - case PathSegClosePath: - segment = SVGPathSegClosePath::create(); - break; - case PathSegLineToHorizontalAbs: - segment = BLENDPATHSEG1(SVGPathSegLinetoHorizontalAbs, x); - break; - case PathSegLineToHorizontalRel: - segment = BLENDPATHSEG1(SVGPathSegLinetoHorizontalRel, x); - break; - case PathSegLineToVerticalAbs: - segment = BLENDPATHSEG1(SVGPathSegLinetoVerticalAbs, y); - break; - case PathSegLineToVerticalRel: - segment = BLENDPATHSEG1(SVGPathSegLinetoVerticalRel, y); - break; - case PathSegMoveToAbs: - segment = BLENDPATHSEG2(SVGPathSegMovetoAbs, x, y); - break; - case PathSegMoveToRel: - segment = BLENDPATHSEG2(SVGPathSegMovetoRel, x, y); - break; - case PathSegLineToAbs: - segment = BLENDPATHSEG2(SVGPathSegLinetoAbs, x, y); - break; - case PathSegLineToRel: - segment = BLENDPATHSEG2(SVGPathSegLinetoRel, x, y); - break; - case PathSegCurveToCubicAbs: - segment = BLENDPATHSEG6(SVGPathSegCurvetoCubicAbs, x, y, x1, y1, x2, y2); - break; - case PathSegCurveToCubicRel: - segment = BLENDPATHSEG6(SVGPathSegCurvetoCubicRel, x, y, x1, y1, x2, y2); - break; - case PathSegCurveToCubicSmoothAbs: - segment = BLENDPATHSEG4(SVGPathSegCurvetoCubicSmoothAbs, x, y, x2, y2); - break; - case PathSegCurveToCubicSmoothRel: - segment = BLENDPATHSEG4(SVGPathSegCurvetoCubicSmoothRel, x, y, x2, y2); - break; - case PathSegCurveToQuadraticAbs: - segment = BLENDPATHSEG4(SVGPathSegCurvetoQuadraticAbs, x, y, x1, y1); - break; - case PathSegCurveToQuadraticRel: - segment = BLENDPATHSEG4(SVGPathSegCurvetoQuadraticRel, x, y, x1, y1); - break; - case PathSegCurveToQuadraticSmoothAbs: - segment = BLENDPATHSEG2(SVGPathSegCurvetoQuadraticSmoothAbs, x, y); - break; - case PathSegCurveToQuadraticSmoothRel: - segment = BLENDPATHSEG2(SVGPathSegCurvetoQuadraticSmoothRel, x, y); - break; - case PathSegArcAbs: - segment = BLENDPATHSEG7(SVGPathSegArcAbs, x, y, r1, r2, angle, largeArcFlag, sweepFlag); - break; - case PathSegArcRel: - segment = BLENDPATHSEG7(SVGPathSegArcRel, x, y, r1, r2, angle, largeArcFlag, sweepFlag); - break; - case PathSegUnknown: - ASSERT_NOT_REACHED(); - } - result->appendItem(segment, ec); - if (ec) - return 0; - } - return result.release(); -} - } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGPathSegList.h b/WebCore/svg/SVGPathSegList.h index 7e7134f..f27c653 100644 --- a/WebCore/svg/SVGPathSegList.h +++ b/WebCore/svg/SVGPathSegList.h @@ -26,23 +26,16 @@ namespace WebCore { - class Path; - class SVGElement; - - class SVGPathSegList : public SVGList<RefPtr<SVGPathSeg> > { - public: - static PassRefPtr<SVGPathSegList> create(const QualifiedName& attributeName) { return adoptRef(new SVGPathSegList(attributeName)); } - virtual ~SVGPathSegList(); - - unsigned getPathSegAtLength(double, ExceptionCode&); - - static PassRefPtr<SVGPathSegList> createAnimated(const SVGPathSegList* fromList, const SVGPathSegList* toList, float progress); - - private: - SVGPathSegList(const QualifiedName&); - }; - - float adjustAnimatedValue(float from, float to, float progress); +class SVGElement; + +class SVGPathSegList : public SVGList<RefPtr<SVGPathSeg> > { +public: + static PassRefPtr<SVGPathSegList> create(const QualifiedName& attributeName) { return adoptRef(new SVGPathSegList(attributeName)); } + virtual ~SVGPathSegList(); + +private: + SVGPathSegList(const QualifiedName&); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGPathSegListBuilder.h b/WebCore/svg/SVGPathSegListBuilder.h index aa4a782..2fd2667 100644 --- a/WebCore/svg/SVGPathSegListBuilder.h +++ b/WebCore/svg/SVGPathSegListBuilder.h @@ -36,6 +36,8 @@ public: SVGPathSegListBuilder(); void setCurrentSVGPathSegList(SVGPathSegList* pathSegList) { m_pathSegList = pathSegList; } + virtual void incrementPathSegmentCount() { } + virtual bool continueConsuming() { return true; } virtual void cleanup() { m_pathSegList = 0; } private: diff --git a/WebCore/svg/SVGPathStringBuilder.h b/WebCore/svg/SVGPathStringBuilder.h index f25f791..ebb8596 100644 --- a/WebCore/svg/SVGPathStringBuilder.h +++ b/WebCore/svg/SVGPathStringBuilder.h @@ -32,6 +32,8 @@ public: SVGPathStringBuilder(); virtual void cleanup() { m_stringBuilder.clear(); } + virtual void incrementPathSegmentCount() { } + virtual bool continueConsuming() { return true; } String result() { return m_stringBuilder.toString(ConcatAddingSpacesBetweenIndividualStrings); } private: diff --git a/WebCore/svg/SVGPathTraversalStateBuilder.cpp b/WebCore/svg/SVGPathTraversalStateBuilder.cpp new file mode 100644 index 0000000..a4ef2fb --- /dev/null +++ b/WebCore/svg/SVGPathTraversalStateBuilder.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> + * Copyright (C) 2007 Eric Seidel <eric@webkit.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" + +#if ENABLE(SVG) +#include "SVGPathTraversalStateBuilder.h" + +namespace WebCore { + +SVGPathTraversalStateBuilder::SVGPathTraversalStateBuilder() + : m_traversalState(0) + , m_desiredLength(0) +{ +} + +void SVGPathTraversalStateBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode) +{ + ASSERT(m_traversalState); + m_traversalState->m_totalLength += m_traversalState->moveTo(targetPoint); +} + +void SVGPathTraversalStateBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode) +{ + ASSERT(m_traversalState); + m_traversalState->m_totalLength += m_traversalState->lineTo(targetPoint); +} + +void SVGPathTraversalStateBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode) +{ + ASSERT(m_traversalState); + m_traversalState->m_totalLength += m_traversalState->cubicBezierTo(point1, point2, targetPoint); +} + +void SVGPathTraversalStateBuilder::closePath() +{ + ASSERT(m_traversalState); + m_traversalState->m_totalLength += m_traversalState->closeSubpath(); +} + +void SVGPathTraversalStateBuilder::setDesiredLength(float desiredLength) +{ + ASSERT(m_traversalState); + m_traversalState->m_desiredLength = desiredLength; +} + +bool SVGPathTraversalStateBuilder::continueConsuming() +{ + ASSERT(m_traversalState); + ASSERT(m_traversalState->m_action == PathTraversalState::TraversalSegmentAtLength); + return m_traversalState->m_totalLength < m_traversalState->m_desiredLength; +} + +void SVGPathTraversalStateBuilder::incrementPathSegmentCount() +{ + ASSERT(m_traversalState); + ++m_traversalState->m_segmentIndex; +} + +unsigned long SVGPathTraversalStateBuilder::pathSegmentIndex() +{ + ASSERT(m_traversalState); + return m_traversalState->m_segmentIndex; +} + +} + +#endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGPathTraversalStateBuilder.h b/WebCore/svg/SVGPathTraversalStateBuilder.h new file mode 100644 index 0000000..a5f3f79 --- /dev/null +++ b/WebCore/svg/SVGPathTraversalStateBuilder.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2007 Eric Seidel <eric@webkit.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. + */ + +#ifndef SVGPathTraversalStateBuilder_h +#define SVGPathTraversalStateBuilder_h + +#if ENABLE(SVG) +#include "FloatPoint.h" +#include "PathTraversalState.h" +#include "SVGPathConsumer.h" + +namespace WebCore { + +class SVGPathTraversalStateBuilder : public SVGPathConsumer { +public: + SVGPathTraversalStateBuilder(); + + unsigned long pathSegmentIndex(); + void setCurrentTraversalState(PathTraversalState* traversalState) { m_traversalState = traversalState; } + void setDesiredLength(float); + virtual void incrementPathSegmentCount(); + virtual bool continueConsuming(); + virtual void cleanup() { m_traversalState = 0; } + +private: + // Used in UnalteredParisng/NormalizedParsing modes. + virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode); + virtual void lineTo(const FloatPoint&, PathCoordinateMode); + virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode); + virtual void closePath(); + +private: + // Not used for PathTraversalState. + virtual void lineToHorizontal(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); } + virtual void lineToVertical(float, PathCoordinateMode) { ASSERT_NOT_REACHED(); } + virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); } + virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); } + virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); } + virtual void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) { ASSERT_NOT_REACHED(); } + + PathTraversalState* m_traversalState; + float m_desiredLength; +}; + +} // namespace WebCore + +#endif // ENABLE(SVG) +#endif // SVGPathTraversalStateBuilder_h diff --git a/WebCore/svg/SVGPointList.cpp b/WebCore/svg/SVGPointList.cpp index 3be16ea..8a3d870 100644 --- a/WebCore/svg/SVGPointList.cpp +++ b/WebCore/svg/SVGPointList.cpp @@ -54,6 +54,11 @@ String SVGPointList::valueAsString() const return result; } +float inline adjustAnimatedValue(float from, float to, float progress) +{ + return (to - from) * progress + from; +} + PassRefPtr<SVGPointList> SVGPointList::createAnimated(const SVGPointList* fromList, const SVGPointList* toList, float progress) { unsigned itemCount = fromList->numberOfItems(); diff --git a/WebCore/svg/SVGURIReference.cpp b/WebCore/svg/SVGURIReference.cpp index e3a7003..97003e5 100644 --- a/WebCore/svg/SVGURIReference.cpp +++ b/WebCore/svg/SVGURIReference.cpp @@ -53,12 +53,11 @@ bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) String SVGURIReference::getTarget(const String& url) { if (url.startsWith("url(")) { // URI References, ie. fill:url(#target) - unsigned int start = url.find('#') + 1; - unsigned int end = url.reverseFind(')'); - + size_t start = url.find('#') + 1; + size_t end = url.reverseFind(')'); return url.substring(start, end - start); - } else if (url.find('#') > -1) { // format is #target - unsigned int start = url.find('#') + 1; + } else if (url.find('#') != notFound) { // format is #target + size_t start = url.find('#') + 1; return url.substring(start, url.length() - start); } else // The url doesn't have any target. return String(); diff --git a/WebCore/svg/animation/SMILTimeContainer.h b/WebCore/svg/animation/SMILTimeContainer.h index dde41f1..4664c68 100644 --- a/WebCore/svg/animation/SMILTimeContainer.h +++ b/WebCore/svg/animation/SMILTimeContainer.h @@ -30,12 +30,12 @@ #include "PlatformString.h" #include "SMILTime.h" -#include "StringHash.h" #include "Timer.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/svg/animation/SVGSMILElement.cpp b/WebCore/svg/animation/SVGSMILElement.cpp index 0352b43..99a5189 100644 --- a/WebCore/svg/animation/SVGSMILElement.cpp +++ b/WebCore/svg/animation/SVGSMILElement.cpp @@ -219,8 +219,8 @@ SMILTime SVGSMILElement::parseClockValue(const String& data) double result = 0; bool ok; - int doublePointOne = parse.find(':'); - int doublePointTwo = parse.find(':', doublePointOne + 1); + size_t doublePointOne = parse.find(':'); + size_t doublePointTwo = parse.find(':', doublePointOne + 1); if (doublePointOne == 2 && doublePointTwo == 5 && parse.length() >= 8) { result += parse.substring(0, 2).toUIntStrict(&ok) * 60 * 60; if (!ok) @@ -229,7 +229,7 @@ SMILTime SVGSMILElement::parseClockValue(const String& data) if (!ok) return SMILTime::unresolved(); result += parse.substring(6).toDouble(&ok); - } else if (doublePointOne == 2 && doublePointTwo == -1 && parse.length() >= 5) { + } else if (doublePointOne == 2 && doublePointTwo == notFound && parse.length() >= 5) { result += parse.substring(0, 2).toUIntStrict(&ok) * 60; if (!ok) return SMILTime::unresolved(); @@ -253,15 +253,15 @@ bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd) double sign = 1.; bool ok; - int pos = parseString.find('+'); - if (pos == -1) { + size_t pos = parseString.find('+'); + if (pos == notFound) { pos = parseString.find('-'); - if (pos != -1) + if (pos != notFound) sign = -1.; } String conditionString; SMILTime offset = 0; - if (pos == -1) + if (pos == notFound) conditionString = parseString; else { conditionString = parseString.left(pos).stripWhiteSpace(); @@ -277,7 +277,7 @@ bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd) String baseID; String nameString; - if (pos == -1) + if (pos == notFound) nameString = conditionString; else { baseID = conditionString.left(pos); diff --git a/WebCore/svg/graphics/SVGImage.cpp b/WebCore/svg/graphics/SVGImage.cpp index 990e41f..6608c9e 100644 --- a/WebCore/svg/graphics/SVGImage.cpp +++ b/WebCore/svg/graphics/SVGImage.cpp @@ -221,12 +221,13 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame() if (!m_frameCache) { if (!m_page) return 0; - m_frameCache = ImageBuffer::create(size()); - if (!m_frameCache) // failed to allocate image + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size()); + if (!buffer) // failed to allocate image return 0; - draw(m_frameCache->context(), rect(), rect(), DeviceColorSpace, CompositeSourceOver); + draw(buffer->context(), rect(), rect(), DeviceColorSpace, CompositeSourceOver); + m_frameCache = buffer->copyImage(); } - return m_frameCache->image()->nativeImageForCurrentFrame(); + return m_frameCache->nativeImageForCurrentFrame(); } bool SVGImage::dataChanged(bool allDataReceived) diff --git a/WebCore/svg/graphics/SVGImage.h b/WebCore/svg/graphics/SVGImage.h index 1936626..01eae71 100644 --- a/WebCore/svg/graphics/SVGImage.h +++ b/WebCore/svg/graphics/SVGImage.h @@ -33,7 +33,6 @@ namespace WebCore { - class ImageBuffer; class Page; class SVGImageChromeClient; @@ -72,7 +71,7 @@ namespace WebCore { OwnPtr<SVGImageChromeClient> m_chromeClient; OwnPtr<Page> m_page; - OwnPtr<ImageBuffer> m_frameCache; + RefPtr<Image> m_frameCache; }; } diff --git a/WebCore/svg/graphics/filters/SVGFEMerge.cpp b/WebCore/svg/graphics/filters/SVGFEMerge.cpp index 649f670..11c7407 100644 --- a/WebCore/svg/graphics/filters/SVGFEMerge.cpp +++ b/WebCore/svg/graphics/filters/SVGFEMerge.cpp @@ -79,7 +79,7 @@ void FEMerge::apply(Filter* filter) for (unsigned i = 0; i < m_mergeInputs.size(); i++) { FloatRect destRect = calculateDrawingRect(m_mergeInputs[i]->scaledSubRegion()); - filterContext->drawImage(m_mergeInputs[i]->resultImage()->image(), DeviceColorSpace, destRect); + filterContext->drawImageBuffer(m_mergeInputs[i]->resultImage(), DeviceColorSpace, destRect); } } diff --git a/WebCore/svg/graphics/filters/SVGFEOffset.cpp b/WebCore/svg/graphics/filters/SVGFEOffset.cpp index f6c1a3c..e12b8e0 100644 --- a/WebCore/svg/graphics/filters/SVGFEOffset.cpp +++ b/WebCore/svg/graphics/filters/SVGFEOffset.cpp @@ -91,7 +91,7 @@ void FEOffset::apply(Filter* filter) m_in->scaledSubRegion().width(), m_in->scaledSubRegion().height()); - filterContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, dstRect); + filterContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, dstRect); } void FEOffset::dump() diff --git a/WebCore/svg/graphics/filters/SVGFETile.cpp b/WebCore/svg/graphics/filters/SVGFETile.cpp index fc172ee..56cbc1e 100644 --- a/WebCore/svg/graphics/filters/SVGFETile.cpp +++ b/WebCore/svg/graphics/filters/SVGFETile.cpp @@ -72,8 +72,8 @@ void FETile::apply(Filter* filter) OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(tileRect.size()); GraphicsContext* tileImageContext = tileImage->context(); - tileImageContext->drawImage(m_in->resultImage()->image(), DeviceColorSpace, IntPoint()); - RefPtr<Pattern> pattern = Pattern::create(tileImage->image(), true, true); + tileImageContext->drawImageBuffer(m_in->resultImage(), DeviceColorSpace, IntPoint()); + RefPtr<Pattern> pattern = Pattern::create(tileImage->copyImage(), true, true); AffineTransform matrix; matrix.translate(m_in->scaledSubRegion().x() - scaledSubRegion().x(), m_in->scaledSubRegion().y() - scaledSubRegion().y()); diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp index 7bf40ed..399f7fc 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp @@ -181,7 +181,7 @@ inline void FETurbulence::initPaint(PaintingData& paintingData) gradient[1] /= normalizationFactor; } } - for (int i = s_blockSize - 1; i >= 0; --i) { + for (int i = s_blockSize - 1; i > 0; --i) { int k = paintingData.latticeSelector[i]; int j = paintingData.random() % s_blockSize; ASSERT(j >= 0); @@ -311,10 +311,12 @@ unsigned char FETurbulence::calculateTurbulenceValueForPoint(PaintingData& paint } } - // Clamp result - turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 255.f), 0.f); + // The value of turbulenceFunctionResult comes from ((turbulenceFunctionResult * 255) + 255) / 2 by fractalNoise + // and (turbulenceFunctionResult * 255) by turbulence. if (m_type == FETURBULENCE_TYPE_FRACTALNOISE) - return static_cast<unsigned char>(turbulenceFunctionResult * 127.5f + 127.5f); // It comes form (turbulenceFunctionResult * 255 + 255) / 2 + turbulenceFunctionResult = turbulenceFunctionResult * 0.5f + 0.5f; + // Clamp result + turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 1.f), 0.f); return static_cast<unsigned char>(turbulenceFunctionResult * 255); } @@ -328,7 +330,7 @@ void FETurbulence::apply(Filter* filter) return; RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height()); - PaintingData paintingData(floorf(fabsf(m_seed)), imageRect.size()); + PaintingData paintingData(m_seed, imageRect.size()); initPaint(paintingData); FloatRect filterRegion = filter->filterRegion(); diff --git a/WebCore/svg/graphics/filters/SVGFilterBuilder.h b/WebCore/svg/graphics/filters/SVGFilterBuilder.h index 3325dac..4ef6ffe 100644 --- a/WebCore/svg/graphics/filters/SVGFilterBuilder.h +++ b/WebCore/svg/graphics/filters/SVGFilterBuilder.h @@ -23,12 +23,12 @@ #include "config.h" #if ENABLE(SVG) && ENABLE(FILTERS) -#include "AtomicStringHash.h" #include "FilterEffect.h" #include "PlatformString.h" #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/websockets/WebSocket.h b/WebCore/websockets/WebSocket.h index 15508b4..fd3ee56 100644 --- a/WebCore/websockets/WebSocket.h +++ b/WebCore/websockets/WebSocket.h @@ -34,7 +34,6 @@ #if ENABLE(WEB_SOCKETS) #include "ActiveDOMObject.h" -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -43,6 +42,7 @@ #include <wtf/Forward.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp index 5859fd7..54be16a 100644 --- a/WebCore/websockets/WebSocketChannel.cpp +++ b/WebCore/websockets/WebSocketChannel.cpp @@ -41,11 +41,11 @@ #include "ScriptExecutionContext.h" #include "SocketStreamError.h" #include "SocketStreamHandle.h" -#include "StringHash.h" #include "WebSocketChannelClient.h" #include "WebSocketHandshake.h" #include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> #include <wtf/Deque.h> #include <wtf/FastMalloc.h> #include <wtf/HashMap.h> @@ -61,6 +61,7 @@ WebSocketChannel::WebSocketChannel(ScriptExecutionContext* context, WebSocketCha , m_resumeTimer(this, &WebSocketChannel::resumeTimerFired) , m_suspended(false) , m_closed(false) + , m_shouldDiscardReceivedData(false) , m_unhandledBufferedAmount(0) { } @@ -171,10 +172,14 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da return; } if (!m_client) { + m_shouldDiscardReceivedData = true; handle->close(); return; } + if (m_shouldDiscardReceivedData) + return; if (!appendToBuffer(data, len)) { + m_shouldDiscardReceivedData = true; handle->close(); return; } @@ -187,6 +192,7 @@ void WebSocketChannel::didFail(SocketStreamHandle* handle, const SocketStreamErr { LOG(Network, "WebSocketChannel %p didFail", this); ASSERT(handle == m_handle || !m_handle); + m_shouldDiscardReceivedData = true; handle->close(); } @@ -198,23 +204,28 @@ void WebSocketChannel::didCancelAuthenticationChallenge(SocketStreamHandle*, con { } -bool WebSocketChannel::appendToBuffer(const char* data, int len) +bool WebSocketChannel::appendToBuffer(const char* data, size_t len) { + size_t newBufferSize = m_bufferSize + len; + if (newBufferSize < m_bufferSize) { + LOG(Network, "WebSocket buffer overflow (%lu+%lu)", static_cast<unsigned long>(m_bufferSize), static_cast<unsigned long>(len)); + return false; + } char* newBuffer = 0; - if (tryFastMalloc(m_bufferSize + len).getValue(newBuffer)) { + if (tryFastMalloc(newBufferSize).getValue(newBuffer)) { if (m_buffer) memcpy(newBuffer, m_buffer, m_bufferSize); memcpy(newBuffer + m_bufferSize, data, len); fastFree(m_buffer); m_buffer = newBuffer; - m_bufferSize += len; + m_bufferSize = newBufferSize; return true; } - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket frame (at %d bytes) is too long.", m_bufferSize + len), 0, m_handshake.clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket frame (at %lu bytes) is too long.", static_cast<unsigned long>(newBufferSize)), 0, m_handshake.clientOrigin()); return false; } -void WebSocketChannel::skipBuffer(int len) +void WebSocketChannel::skipBuffer(size_t len) { ASSERT(len <= m_bufferSize); m_bufferSize -= len; @@ -231,6 +242,8 @@ bool WebSocketChannel::processBuffer() ASSERT(!m_suspended); ASSERT(m_client); ASSERT(m_buffer); + if (m_shouldDiscardReceivedData) + return false; if (m_handshake.mode() == WebSocketHandshake::Incomplete) { int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize); @@ -250,11 +263,12 @@ bool WebSocketChannel::processBuffer() LOG(Network, "WebSocketChannel %p connected", this); skipBuffer(headerLength); m_client->didConnect(); - LOG(Network, "remaining in read buf %ul", m_bufferSize); + LOG(Network, "remaining in read buf %lu", static_cast<unsigned long>(m_bufferSize)); return m_buffer; } LOG(Network, "WebSocketChannel %p connection failed", this); skipBuffer(headerLength); + m_shouldDiscardReceivedData = true; if (!m_closed) m_handle->close(); return false; @@ -268,27 +282,52 @@ bool WebSocketChannel::processBuffer() unsigned char frameByte = static_cast<unsigned char>(*p++); if ((frameByte & 0x80) == 0x80) { - int length = 0; + size_t length = 0; + bool errorFrame = false; while (p < end) { - if (length > std::numeric_limits<int>::max() / 128) { - LOG(Network, "frame length overflow %d", length); - skipBuffer(p + length - m_buffer); - m_client->didReceiveMessageError(); - if (!m_client) - return false; - if (!m_closed) - m_handle->close(); - return false; + if (length > std::numeric_limits<size_t>::max() / 128) { + LOG(Network, "frame length overflow %lu", static_cast<unsigned long>(length)); + errorFrame = true; + break; + } + size_t newLength = length * 128; + unsigned char msgByte = static_cast<unsigned char>(*p); + unsigned int lengthMsgByte = msgByte & 0x7f; + if (newLength > std::numeric_limits<size_t>::max() - lengthMsgByte) { + LOG(Network, "frame length overflow %lu+%u", static_cast<unsigned long>(newLength), lengthMsgByte); + errorFrame = true; + break; } - char msgByte = *p; - length = length * 128 + (msgByte & 0x7f); + newLength += lengthMsgByte; + if (newLength < length) { // sanity check + LOG(Network, "frame length integer wrap %lu->%lu", static_cast<unsigned long>(length), static_cast<unsigned long>(newLength)); + errorFrame = true; + break; + } + length = newLength; ++p; if (!(msgByte & 0x80)) break; } + if (p + length < p) { + LOG(Network, "frame buffer pointer wrap %p+%lu->%p", p, static_cast<unsigned long>(length), p + length); + errorFrame = true; + } + if (errorFrame) { + skipBuffer(m_bufferSize); // Save memory. + m_shouldDiscardReceivedData = true; + m_client->didReceiveMessageError(); + if (!m_client) + return false; + if (!m_closed) + m_handle->close(); + return false; + } + ASSERT(p + length >= p); if (p + length < end) { p += length; nextFrame = p; + ASSERT(nextFrame > m_buffer); skipBuffer(nextFrame - m_buffer); m_client->didReceiveMessageError(); return m_buffer; diff --git a/WebCore/websockets/WebSocketChannel.h b/WebCore/websockets/WebSocketChannel.h index 893b4c6..43d431a 100644 --- a/WebCore/websockets/WebSocketChannel.h +++ b/WebCore/websockets/WebSocketChannel.h @@ -79,8 +79,8 @@ namespace WebCore { private: WebSocketChannel(ScriptExecutionContext*, WebSocketChannelClient*, const KURL&, const String& protocol); - bool appendToBuffer(const char* data, int len); - void skipBuffer(int len); + bool appendToBuffer(const char* data, size_t len); + void skipBuffer(size_t len); bool processBuffer(); void resumeTimerFired(Timer<WebSocketChannel>* timer); @@ -89,11 +89,12 @@ namespace WebCore { WebSocketHandshake m_handshake; RefPtr<SocketStreamHandle> m_handle; char* m_buffer; - int m_bufferSize; + size_t m_bufferSize; Timer<WebSocketChannel> m_resumeTimer; bool m_suspended; bool m_closed; + bool m_shouldDiscardReceivedData; unsigned long m_unhandledBufferedAmount; }; diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp index 7711604..effbb67 100644 --- a/WebCore/websockets/WebSocketHandshake.cpp +++ b/WebCore/websockets/WebSocketHandshake.cpp @@ -34,7 +34,6 @@ #include "WebSocketHandshake.h" -#include "AtomicString.h" #include "CharacterNames.h" #include "Cookie.h" #include "CookieJar.h" @@ -51,6 +50,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicString.h> #include <wtf/text/CString.h> namespace WebCore { diff --git a/WebCore/websockets/WebSocketHandshakeResponse.cpp b/WebCore/websockets/WebSocketHandshakeResponse.cpp index 753cecf..2e0dad7 100644 --- a/WebCore/websockets/WebSocketHandshakeResponse.cpp +++ b/WebCore/websockets/WebSocketHandshakeResponse.cpp @@ -34,8 +34,8 @@ #include "WebSocketHandshakeResponse.h" -#include "AtomicString.h" #include <wtf/Assertions.h> +#include <wtf/text/AtomicString.h> using namespace std; diff --git a/WebCore/wml/WMLInputElement.h b/WebCore/wml/WMLInputElement.h index fe1ae89..329d869 100644 --- a/WebCore/wml/WMLInputElement.h +++ b/WebCore/wml/WMLInputElement.h @@ -47,6 +47,7 @@ public: virtual bool isIndeterminate() const { return false; } virtual bool isTextFormControl() const { return true; } virtual bool isRadioButton() const { return false; } + virtual bool isCheckbox() const { return false; } virtual bool isTextField() const { return true; } virtual bool isSearchField() const { return false; } virtual bool isInputTypeHidden() const { return false; } diff --git a/WebCore/wml/WMLPageState.h b/WebCore/wml/WMLPageState.h index 614bc94..0ea7cbb 100644 --- a/WebCore/wml/WMLPageState.h +++ b/WebCore/wml/WMLPageState.h @@ -24,9 +24,9 @@ #define WMLPageState_h #if ENABLE(WML) -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/workers/AbstractWorker.h b/WebCore/workers/AbstractWorker.h index 789dba2..f4cc50b 100644 --- a/WebCore/workers/AbstractWorker.h +++ b/WebCore/workers/AbstractWorker.h @@ -34,13 +34,13 @@ #if ENABLE(WORKERS) #include "ActiveDOMObject.h" -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/workers/DefaultSharedWorkerRepository.h b/WebCore/workers/DefaultSharedWorkerRepository.h index 2ce4422..21e14a1 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.h +++ b/WebCore/workers/DefaultSharedWorkerRepository.h @@ -34,7 +34,6 @@ #if ENABLE(SHARED_WORKERS) #include "ExceptionCode.h" -#include "StringHash.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> @@ -42,6 +41,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/workers/Worker.h b/WebCore/workers/Worker.h index 2470b71..0e673ac 100644 --- a/WebCore/workers/Worker.h +++ b/WebCore/workers/Worker.h @@ -31,7 +31,6 @@ #include "AbstractWorker.h" #include "ActiveDOMObject.h" -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -42,6 +41,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index 56b0324..9e9e54f 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -29,7 +29,6 @@ #if ENABLE(WORKERS) -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -40,6 +39,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/wscript b/WebCore/wscript deleted file mode 100644 index 58886aa..0000000 --- a/WebCore/wscript +++ /dev/null @@ -1,247 +0,0 @@ -#! /usr/bin/env python - -# Copyright (C) 2009 Kevin Ollivier 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. -# -# WebCore build script for the waf build system - -from settings import * - -webcore_sources = {} - -if build_port == "wx": - webcore_sources['wx'] = ['platform/KillRingNone.cpp', 'bindings/cpp/WebDOMEventTarget.cpp'] - - if building_on_win32: - # make sure platform/wx comes after this so we get the right - # FontPlatformData.h - webcore_dirs.extend(['platform/wx/wxcode/win', 'plugins/win']) - webcore_sources['wx-win'] = [ - 'platform/graphics/win/TransformationMatrixWin.cpp', - # wxTimer on Windows has a bug that causes it to eat crashes in callbacks - # so we need to use the Win port's implementation until the wx bug fix is - # widely available (it was fixed in 2.8.10). - 'platform/win/SharedTimerWin.cpp', - 'platform/win/WebCoreInstanceHandle.cpp', - # Use the Windows plugin architecture - 'plugins/win/PluginDataWin.cpp', - 'plugins/win/PluginDatabaseWin.cpp', - 'plugins/win/PluginMessageThrottlerWin.cpp', - 'plugins/win/PluginPackageWin.cpp', - 'plugins/win/PluginViewWin.cpp', - ] - elif sys.platform.startswith('darwin'): - webcore_dirs.append('plugins/mac') - webcore_dirs.append('platform/wx/wxcode/mac/carbon') - webcore_dirs.append('platform/mac') - webcore_dirs.append('platform/text/mac') - webcore_sources['wx-mac'] = [ - 'platform/mac/PurgeableBufferMac.cpp', - 'platform/mac/WebCoreNSStringExtras.mm', - 'platform/mac/WebCoreSystemInterface.mm', - 'platform/graphics/cg/FloatSizeCG.cpp', - 'platform/graphics/mac/ComplexTextController.cpp', - 'platform/graphics/mac/ComplexTextControllerCoreText.cpp', - 'platform/graphics/mac/ComplexTextControllerATSUI.cpp', - 'platform/graphics/mac/GlyphPageTreeNodeMac.cpp', - 'platform/graphics/mac/SimpleFontDataATSUI.mm', - 'platform/graphics/mac/SimpleFontDataCoreText.cpp', - 'platform/graphics/wx/FontPlatformDataWxMac.mm', - 'platform/text/mac/ShapeArabic.c', - 'platform/wx/wxcode/mac/carbon/fontprops.mm', - 'plugins/mac/PluginPackageMac.cpp', - 'plugins/mac/PluginViewMac.mm' - ] - else: - webcore_sources['wx-gtk'] = [ - 'plugins/PluginDataNone.cpp', - 'plugins/PluginViewNone.cpp', - 'plugins/PluginPackageNone.cpp' - ] - webcore_dirs.append('platform/wx/wxcode/gtk') - -import TaskGen -from TaskGen import taskgen, feature, after -import Task, ccroot - -def generate_webcore_derived_sources(): - # build the derived sources - derived_sources_dir = os.path.join(webcore_dir, 'DerivedSources') - wc_dir = webcore_dir - if building_on_win32: - wc_dir = get_output('cygpath --unix "%s"' % wc_dir) - if not os.path.exists(derived_sources_dir): - os.mkdir(derived_sources_dir) - - olddir = os.getcwd() - os.chdir(derived_sources_dir) - - os.system('make -f %s/DerivedSources.make WebCore=%s SOURCE_ROOT=%s all FEATURE_DEFINES="%s"' % (wc_dir, wc_dir, wc_dir, ' '.join(feature_defines))) - os.chdir(olddir) - -def set_options(opt): - common_set_options(opt) - -def configure(conf): - common_configure(conf) - generate_webcore_derived_sources() - if sys.platform.startswith('win'): - graphics_dir = os.path.join(wk_root, 'WebCore', 'platform', 'graphics') - # HACK ALERT: MSVC automatically adds the source file's directory as the first entry in the - # path. Unfortunately, that means when compiling these files we will end up including - # win/FontPlatformData.h, which breaks wx compilation. So we copy the files to the wx dir. - for afile in ['UniscribeController.h', 'UniscribeController.cpp', 'GlyphPageTreeNodeCairoWin.cpp']: - shutil.copy(os.path.join(graphics_dir, 'win', afile), os.path.join(graphics_dir, 'wx')) - -def build(bld): - import Options - - import TaskGen - - if sys.platform.startswith('darwin'): - TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] - TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] - - wk_includes = ['.', '..', 'DerivedSources', - wk_root, - os.path.join(wk_root, 'JavaScriptCore'), - os.path.join(wk_root, 'JavaScriptCore', 'wtf', 'text'), - os.path.join(wk_root, 'WebCore'), - os.path.join(wk_root, 'WebKit/wx'), - 'platform/image-decoders', - 'platform/win', - 'platform/wx/wxcode', - 'workers', - ] - - features = [build_port] - exclude_patterns = ['*AllInOne.cpp', '*Brew.cpp', '*CFNet.cpp', '*Chromium*.cpp', - '*Efl.cpp', '*Gtk.cpp', '*Haiku.cpp', '*Mac.cpp', '*None.cpp', '*Qt.cpp', '*Safari.cpp', - 'test*bindings.*', '*Wince.cpp', "WebDOMCanvas*.cpp", "WebDOMSVG*.cpp"] - if build_port == 'wx': - features.append('curl') - if not building_on_win32: - exclude_patterns.append('*Win.cpp') - - if sys.platform.startswith('darwin'): - features.append('cf') - bld.install_files(os.path.join(output_dir, 'WebCore'), 'platform/mac/WebCoreSystemInterface.h') - else: - exclude_patterns.append('*CF.cpp') - - full_dirs = get_dirs_for_features(webcore_dir, features=features, dirs=webcore_dirs) - - jscore_dir = os.path.join(wk_root, 'JavaScriptCore') - for item in os.listdir(jscore_dir): - fullpath = os.path.join(jscore_dir, item) - if os.path.isdir(fullpath) and not item == "os-win32" and not item == 'icu': - wk_includes.append(fullpath) - - wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode')) - wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode', 'icu')) - wk_includes += common_includes + full_dirs - if sys.platform.startswith('darwin'): - wk_includes.append(os.path.join(webcore_dir, 'icu')) - - cxxflags = [] - if building_on_win32: - cxxflags.append('/FIWebCorePrefix.h') - else: - cxxflags.extend(['-include', 'WebCorePrefix.h']) - - webcore = bld.new_task_gen( - features = 'cc cxx cstaticlib', - includes = ' '.join(wk_includes), - source = ' '.join(flattenSources(webcore_sources.values())), - cxxflags = cxxflags, - defines = ['WXMAKINGDLL_WEBKIT'], - target = 'webcore', - uselib = 'WX ICU XML XSLT CURL SQLITE3 ' + get_config(), - uselib_local = '', - install_path = output_dir, - ) - - excludes = [] - - if build_port == 'wx': - excludes = get_excludes(webcore_dir, exclude_patterns) - excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp']) - - # intermediate sources - excludes.append('CSSValueKeywords.cpp') - excludes.append('CSSPropertyNames.cpp') - excludes.append('tokenizer.cpp') - - # FIXME: these three require headers that I can't seem to find in trunk. - # Investigate how to resolve these issues. - excludes.append('JSAbstractView.cpp') - excludes.append('JSPositionCallback.cpp') - excludes.append('JSInspectorController.cpp') - - # The bindings generator seems to think these are ref-counted, while they aren't in trunk. - excludes.append('JSElementTimeControl.cpp') - excludes.append('JSSVGAnimatedPathData.cpp') - excludes.append('JSSVGAnimatedPoints.cpp') - excludes.append('JSSVGExternalResourcesRequired.cpp') - excludes.append('JSSVGFilterPrimitiveStandardAttributes.cpp') - excludes.append('JSSVGLocatable.cpp') - excludes.append('JSSVGStyleTable.cpp') - excludes.append('JSSVGTests.cpp') - excludes.append('JSSVGStylable.cpp') - excludes.append('JSSVGZoomAndPan.cpp') - - # These are files that expect methods not in the base C++ class, usually XYZAnimated methods. - excludes.append('JSSVGFitToViewBox.cpp') - excludes.append('JSSVGLangSpace.cpp') - excludes.append('JSSVGTransformable.cpp') - excludes.append('JSSVGURIReference.cpp') - - # These are C++ DOM Bindings that won't compile because they look for things not in trunk. - excludes.append('WebDOMEventTarget.cpp') - excludes.append('WebDOMAbstractView.cpp') - excludes.append('WebDOMBlobBuilder.cpp') - excludes.append('WebDOMDatabaseCallback.cpp') - excludes.append('WebDOMEventListenerCustom.cpp') - excludes.append('WebDOMElementTimeControl.cpp') - excludes.append('WebDOMImageData.cpp') - excludes.append('WebDOMInspectorBackend.cpp') - excludes.append('WebDOMScriptProfile.cpp') - excludes.append('WebDOMScriptProfileNode.cpp') - excludes.append('WebDOMSQLStatementCallback.cpp') - excludes.append('WebDOMSQLTransactionErrorCallback.cpp') - excludes.append('WebDOMSQLTransactionSyncCallback.cpp') - excludes.append('WebDOMSQLTransactionCallback.cpp') - excludes.append('WebNativeEventListener.cpp') - - if building_on_win32: - excludes.append('SharedTimerWx.cpp') - excludes.append('RenderThemeWin.cpp') - excludes.append('KeyEventWin.cpp') - - if building_on_win32 or sys.platform.startswith('darwin'): - excludes.append('GlyphMapWx.cpp') - excludes.append('AuthenticationCF.cpp') - excludes.append('LoaderRunLoopCF.cpp') - excludes.append('ResourceErrorCF.cpp') - - webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp']) diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h index 363fdf8..2947b46 100644 --- a/WebCore/xml/XMLHttpRequest.h +++ b/WebCore/xml/XMLHttpRequest.h @@ -21,7 +21,6 @@ #define XMLHttpRequest_h #include "ActiveDOMObject.h" -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -31,6 +30,7 @@ #include "ThreadableLoaderClient.h" #include "XMLHttpRequestProgressEventThrottle.h" #include <wtf/OwnPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/xml/XMLHttpRequestUpload.cpp b/WebCore/xml/XMLHttpRequestUpload.cpp index 9d0fafc..739082d 100644 --- a/WebCore/xml/XMLHttpRequestUpload.cpp +++ b/WebCore/xml/XMLHttpRequestUpload.cpp @@ -26,13 +26,13 @@ #include "config.h" #include "XMLHttpRequestUpload.h" -#include "AtomicString.h" #include "Event.h" #include "EventException.h" #include "EventNames.h" #include "XMLHttpRequest.h" #include "XMLHttpRequestProgressEvent.h" #include <wtf/Assertions.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/xml/XMLHttpRequestUpload.h b/WebCore/xml/XMLHttpRequestUpload.h index 7a605fb..984d86a 100644 --- a/WebCore/xml/XMLHttpRequestUpload.h +++ b/WebCore/xml/XMLHttpRequestUpload.h @@ -26,7 +26,6 @@ #ifndef XMLHttpRequestUpload_h #define XMLHttpRequestUpload_h -#include "AtomicStringHash.h" #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" @@ -36,6 +35,7 @@ #include <wtf/RefPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/WebCore/xml/XPathExpressionNode.h b/WebCore/xml/XPathExpressionNode.h index 38070b9..c04d45b 100644 --- a/WebCore/xml/XPathExpressionNode.h +++ b/WebCore/xml/XPathExpressionNode.h @@ -29,11 +29,11 @@ #if ENABLE(XPATH) -#include "StringHash.h" #include "Node.h" #include "XPathValue.h" #include <wtf/HashMap.h> #include <wtf/Vector.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/WebCore/xml/XPathFunctions.cpp b/WebCore/xml/XPathFunctions.cpp index 41bf795..8b4e720 100644 --- a/WebCore/xml/XPathFunctions.cpp +++ b/WebCore/xml/XPathFunctions.cpp @@ -477,9 +477,9 @@ Value FunSubstringBefore::evaluate() const if (s2.isEmpty()) return ""; - int i = s1.find(s2); + size_t i = s1.find(s2); - if (i == -1) + if (i == notFound) return ""; return s1.left(i); @@ -490,8 +490,8 @@ Value FunSubstringAfter::evaluate() const String s1 = arg(0)->evaluate().toString(); String s2 = arg(1)->evaluate().toString(); - int i = s1.find(s2); - if (i == -1) + size_t i = s1.find(s2); + if (i == notFound) return ""; return s1.substring(i + s2.length()); @@ -556,11 +556,11 @@ Value FunTranslate::evaluate() const // FIXME: Building a String a character at a time is quite slow. for (unsigned i1 = 0; i1 < s1.length(); ++i1) { UChar ch = s1[i1]; - int i2 = s2.find(ch); + size_t i2 = s2.find(ch); - if (i2 == -1) + if (i2 == notFound) newString += String(&ch, 1); - else if ((unsigned)i2 < s3.length()) { + else if (i2 < s3.length()) { UChar c2 = s3[i2]; newString += String(&c2, 1); } @@ -608,8 +608,8 @@ Value FunLang::evaluate() const return true; // Remove suffixes one by one. - int index = langValue.reverseFind('-'); - if (index == -1) + size_t index = langValue.reverseFind('-'); + if (index == notFound) break; langValue = langValue.left(index); } diff --git a/WebCore/xml/XPathNamespace.h b/WebCore/xml/XPathNamespace.h index 996cb9a..c34eeef 100644 --- a/WebCore/xml/XPathNamespace.h +++ b/WebCore/xml/XPathNamespace.h @@ -29,8 +29,8 @@ #if ENABLE(XPATH) -#include "AtomicString.h" #include "Node.h" +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/WebCore/xml/XPathParser.cpp b/WebCore/xml/XPathParser.cpp index 5501df1..20e7590 100644 --- a/WebCore/xml/XPathParser.cpp +++ b/WebCore/xml/XPathParser.cpp @@ -31,12 +31,12 @@ #if ENABLE(XPATH) #include "ExceptionCode.h" -#include "StringHash.h" #include "XPathEvaluator.h" #include "XPathException.h" #include "XPathNSResolver.h" #include "XPathStep.h" #include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> int xpathyyparse(void*); @@ -453,8 +453,8 @@ int Parser::lex(void* data) bool Parser::expandQName(const String& qName, String& localName, String& namespaceURI) { - int colon = qName.find(':'); - if (colon >= 0) { + size_t colon = qName.find(':'); + if (colon != notFound) { if (!m_resolver) return false; namespaceURI = m_resolver->lookupNamespaceURI(qName.left(colon)); diff --git a/WebCore/xml/XSLTProcessor.cpp b/WebCore/xml/XSLTProcessor.cpp index 7e07ee3..6e149a1 100644 --- a/WebCore/xml/XSLTProcessor.cpp +++ b/WebCore/xml/XSLTProcessor.cpp @@ -100,11 +100,11 @@ static inline RefPtr<DocumentFragment> createFragmentFromSource(const String& so RefPtr<DocumentFragment> fragment = outputDoc->createDocumentFragment(); if (sourceMIMEType == "text/html") - fragment->parseHTML(sourceString, outputDoc->documentElement()); + fragment->parseHTML(sourceString, 0); else if (sourceMIMEType == "text/plain") - fragment->legacyParserAddChild(Text::create(outputDoc, sourceString)); + fragment->parserAddChild(Text::create(outputDoc, sourceString)); else { - bool successfulParse = fragment->parseXML(sourceString, outputDoc->documentElement()); + bool successfulParse = fragment->parseXML(sourceString, 0); if (!successfulParse) return 0; } diff --git a/WebCore/xml/XSLTProcessor.h b/WebCore/xml/XSLTProcessor.h index 9b91017..5be6b17 100644 --- a/WebCore/xml/XSLTProcessor.h +++ b/WebCore/xml/XSLTProcessor.h @@ -26,9 +26,9 @@ #if ENABLE(XSLT) #include "Node.h" -#include "StringHash.h" #include "XSLStyleSheet.h" #include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> #if !USE(QXMLQUERY) #include <libxml/parserInternals.h> |