diff options
Diffstat (limited to 'WebCore')
505 files changed, 19041 insertions, 5466 deletions
diff --git a/WebCore/Android.derived.mk b/WebCore/Android.derived.mk index e2d3e13..e69de29 100644 --- a/WebCore/Android.derived.mk +++ b/WebCore/Android.derived.mk @@ -1,741 +0,0 @@ -## -## -## Copyright 2007, The Android Open Source Project -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# -# The following files are intentionally not included -# LOCAL_SRC_FILES_EXCLUDED := \ -# css/RGBColor.idl \ -# dom/EventListener.idl \ -# dom/EventTarget.idl \ -# html/CanvasPixelArray.idl \ -# page/AbstractView.idl \ -# svg/ElementTimeControl.idl \ -# svg/SVGAnimatedPathData.idl \ -# svg/SVGAnimatedPoints.idl \ -# svg/SVGExternalResourcesRequired.idl \ -# svg/SVGFilterPrimitiveStandardAttributes.idl \ -# svg/SVGFitToViewBox.idl \ -# svg/SVGLangSpace.idl \ -# svg/SVGLocatable.idl \ -# svg/SVGStylable.idl \ -# svg/SVGTests.idl \ -# svg/SVGTransformable.idl \ -# svg/SVGURIReference.idl \ -# svg/SVGViewSpec.idl \ -# svg/SVGZoomAndPan.idl \ - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# -# The following files are intentionally not generated -# LOCAL_GENERATED_FILES_EXCLUDED := \ -# WMLElementFactory.cpp \ -# WMLNames.cpp \ -# XLinkNames.cpp \ - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# -# The following directory wildcard matches are intentionally not included -# If an entry starts with '/', any subdirectory may match -# If an entry starts with '^', the first directory must match -# LOCAL_DIR_WILDCARD_EXCLUDED := -# - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# If you edit it, keep it in alphabetical order -# -# These files are Android extensions -# LOCAL_ANDROID_SRC_FILES_INCLUDED := \ -# dom/Touch*.idl \ - -LOCAL_SRC_FILES := -# CSS property names and value keywords - -GEN := $(intermediates)/css/CSSPropertyNames.h -$(GEN): SCRIPT := $(LOCAL_PATH)/css/makeprop.pl -$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSPropertyNames.in - @echo "Generating CSSPropertyNames.h <= CSSPropertyNames.in" - @mkdir -p $(dir $@) - @cat $< > $(dir $@)/$(notdir $<) -ifeq ($(ENABLE_SVG),true) - @cat $^ > $(@:%.h=%.in) -endif - @cp -f $(SCRIPT) $(dir $@) - @cd $(dir $@) ; perl ./$(notdir $(SCRIPT)) -LOCAL_GENERATED_SOURCES += $(GEN) - -GEN := $(intermediates)/css/CSSValueKeywords.h -$(GEN): SCRIPT := $(LOCAL_PATH)/css/makevalues.pl -$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSValueKeywords.in - @echo "Generating CSSValueKeywords.h <= CSSValueKeywords.in" - @mkdir -p $(dir $@) - @cp -f $(SCRIPT) $(dir $@) -ifeq ($(ENABLE_SVG),true) - @perl -ne 'print lc' $^ > $(@:%.h=%.in) -else - @perl -ne 'print lc' $< > $(@:%.h=%.in) -endif - @cd $(dir $@); perl makevalues.pl -LOCAL_GENERATED_SOURCES += $(GEN) - - -# DOCTYPE strings - -GEN := $(intermediates)/html/DocTypeStrings.cpp -$(GEN): PRIVATE_CUSTOM_TOOL = gperf -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $< > $@ -$(GEN): $(LOCAL_PATH)/html/DocTypeStrings.gperf - $(transform-generated-source) -# we have to do this dep by hand: -$(intermediates)/html/HTMLDocument.o : $(GEN) - - -# HTML entity names - -GEN := $(intermediates)/html/HTMLEntityNames.c -$(GEN): PRIVATE_CUSTOM_TOOL = gperf -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 $< > $@ -$(GEN): $(LOCAL_PATH)/html/HTMLEntityNames.gperf - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - - -# color names - -GEN := $(intermediates)/platform/ColorData.c -$(GEN): PRIVATE_CUSTOM_TOOL = gperf -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ -$(GEN): $(LOCAL_PATH)/platform/ColorData.gperf - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - - -# CSS tokenizer - -GEN := $(intermediates)/css/tokenizer.cpp -$(GEN): PRIVATE_CUSTOM_TOOL = $(OLD_FLEX) -t $< | perl $(dir $<)/maketokenizer > $@ -$(GEN): $(LOCAL_PATH)/css/tokenizer.flex $(LOCAL_PATH)/css/maketokenizer - $(transform-generated-source) -# we have to do this dep by hand: -$(intermediates)/css/CSSParser.o : $(GEN) - -# CSS grammar - -GEN := $(intermediates)/CSSGrammar.cpp -$(GEN) : PRIVATE_YACCFLAGS := -p cssyy -$(GEN): $(LOCAL_PATH)/css/CSSGrammar.y - $(call local-transform-y-to-cpp,.cpp) -$(GEN): $(LOCAL_BISON) - -LOCAL_GENERATED_SOURCES += $(GEN) - -# XPath grammar - -GEN := $(intermediates)/XPathGrammar.cpp -$(GEN) : PRIVATE_YACCFLAGS := -p xpathyy -$(GEN): $(LOCAL_PATH)/xml/XPathGrammar.y - $(call local-transform-y-to-cpp,.cpp) -$(GEN): $(LOCAL_BISON) - -LOCAL_GENERATED_SOURCES += $(GEN) - -# user agent style sheets - -style_sheets := $(LOCAL_PATH)/css/html4.css $(LOCAL_PATH)/css/quirks.css $(LOCAL_PATH)/css/view-source.css $(LOCAL_PATH)/css/mediaControls.css -ifeq ($(ENABLE_SVG), true) -style_sheets := $(style_sheets) $(LOCAL_PATH)/css/svg.css -endif -GEN := $(intermediates)/css/UserAgentStyleSheets.h -make_css_file_arrays := $(LOCAL_PATH)/css/make-css-file-arrays.pl -$(GEN): PRIVATE_CUSTOM_TOOL = $< $@ $(basename $@).cpp $(filter %.css,$^) -$(GEN): $(make_css_file_arrays) $(style_sheets) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# character set name table - -#gen_inputs := \ - $(LOCAL_PATH)/platform/make-charset-table.pl \ - $(LOCAL_PATH)/platform/character-sets.txt \ - $(LOCAL_PATH)/platform/android/android-encodings.txt -#GEN := $(intermediates)/platform/CharsetData.cpp -#$(GEN): PRIVATE_CUSTOM_TOOL = $^ "android::Encoding::ENCODING_" > $@ -#$(GEN): $(gen_inputs) -# $(transform-generated-source) -#LOCAL_GENERATED_SOURCES += $(GEN) - -# the above rule will make this build too -$(intermediates)/css/UserAgentStyleSheets.cpp : $(GEN) - - -# lookup tables for old-style JavaScript bindings -create_hash_table := $(LOCAL_PATH)/../JavaScriptCore/create_hash_table - -GEN := $(addprefix $(intermediates)/, \ - bindings/js/JSDOMWindowBase.lut.h \ - bindings/js/JSRGBColor.lut.h \ - ) -$(GEN): PRIVATE_CUSTOM_TOOL = perl $(create_hash_table) $< > $@ -$(GEN): $(intermediates)/bindings/js/%.lut.h: $(LOCAL_PATH)/bindings/js/%.cpp $(create_hash_table) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - - -GEN := $(intermediates)/bindings/js/JSHTMLInputElementBaseTable.cpp -$(GEN): PRIVATE_CUSTOM_TOOL = perl $(create_hash_table) $< > $@ -$(GEN): $(intermediates)/bindings/js/%Table.cpp: $(LOCAL_PATH)/bindings/js/%.cpp $(create_hash_table) - $(transform-generated-source) -$(intermediates)/bindings/js/JSHTMLInputElementBase.o : $(GEN) - -# lookup tables for old-style JavaScript bindings -js_binding_scripts := $(addprefix $(LOCAL_PATH)/,\ - bindings/scripts/CodeGenerator.pm \ - bindings/scripts/IDLParser.pm \ - bindings/scripts/IDLStructure.pm \ - bindings/scripts/generate-bindings.pl \ - ) - -FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 - -GEN := \ - $(intermediates)/css/JSCSSCharsetRule.h \ - $(intermediates)/css/JSCSSFontFaceRule.h \ - $(intermediates)/css/JSCSSImportRule.h \ - $(intermediates)/css/JSCSSMediaRule.h \ - $(intermediates)/css/JSCSSPageRule.h \ - $(intermediates)/css/JSCSSPrimitiveValue.h \ - $(intermediates)/css/JSCSSRule.h \ - $(intermediates)/css/JSCSSRuleList.h \ - $(intermediates)/css/JSCSSStyleDeclaration.h \ - $(intermediates)/css/JSCSSStyleRule.h \ - $(intermediates)/css/JSCSSStyleSheet.h \ - $(intermediates)/css/JSCSSUnknownRule.h \ - $(intermediates)/css/JSCSSValue.h \ - $(intermediates)/css/JSCSSValueList.h \ - $(intermediates)/css/JSCSSVariablesDeclaration.h \ - $(intermediates)/css/JSCSSVariablesRule.h \ - $(intermediates)/css/JSCounter.h \ - $(intermediates)/css/JSMediaList.h \ - $(intermediates)/css/JSRect.h \ - $(intermediates)/css/JSStyleSheet.h \ - $(intermediates)/css/JSStyleSheetList.h \ - $(intermediates)/css/JSWebKitCSSKeyframeRule.h \ - $(intermediates)/css/JSWebKitCSSKeyframesRule.h \ - $(intermediates)/css/JSWebKitCSSMatrix.h \ - $(intermediates)/css/JSWebKitCSSTransformValue.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/css/JS%.h : $(LOCAL_PATH)/css/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/css/%.cpp : $(intermediates)/css/%.h - -# MANUAL MERGE : I took this out because compiling the result shows: -# out/.../JSEventTarget.cpp: In function 'JSC::JSValue* WebCore::jsEventTargetPrototypeFunctionAddEventListener(JSC::ExecState*, JSC::JSObject*, JSC::JSValue*, const JSC::ArgList&)': -# out/.../JSEventTarget.cpp:90: error: 'toEventListener' was not declared in this scope -# but I can't find toEventListener anywhere, nor can I figure out how toEventListener -# is generated -# $(intermediates)/dom/JSEventTarget.h \ - -GEN := \ - $(intermediates)/dom/JSAttr.h \ - $(intermediates)/dom/JSCDATASection.h \ - $(intermediates)/dom/JSCharacterData.h \ - $(intermediates)/dom/JSClientRect.h \ - $(intermediates)/dom/JSClientRectList.h \ - $(intermediates)/dom/JSClipboard.h \ - $(intermediates)/dom/JSComment.h \ - $(intermediates)/dom/JSDOMCoreException.h \ - $(intermediates)/dom/JSDOMImplementation.h \ - $(intermediates)/dom/JSDOMStringList.h \ - $(intermediates)/dom/JSDocument.h \ - $(intermediates)/dom/JSDocumentFragment.h \ - $(intermediates)/dom/JSDocumentType.h \ - $(intermediates)/dom/JSElement.h \ - $(intermediates)/dom/JSEntity.h \ - $(intermediates)/dom/JSEntityReference.h \ - $(intermediates)/dom/JSEvent.h \ - $(intermediates)/dom/JSEventException.h \ - $(intermediates)/dom/JSKeyboardEvent.h \ - $(intermediates)/dom/JSMessageChannel.h \ - $(intermediates)/dom/JSMessageEvent.h \ - $(intermediates)/dom/JSMessagePort.h \ - $(intermediates)/dom/JSMouseEvent.h \ - $(intermediates)/dom/JSMutationEvent.h \ - $(intermediates)/dom/JSNamedNodeMap.h \ - $(intermediates)/dom/JSNode.h \ - $(intermediates)/dom/JSNodeFilter.h \ - $(intermediates)/dom/JSNodeIterator.h \ - $(intermediates)/dom/JSNodeList.h \ - $(intermediates)/dom/JSNotation.h \ - $(intermediates)/dom/JSOverflowEvent.h \ - $(intermediates)/dom/JSProcessingInstruction.h \ - $(intermediates)/dom/JSProgressEvent.h \ - $(intermediates)/dom/JSRange.h \ - $(intermediates)/dom/JSRangeException.h \ - $(intermediates)/dom/JSText.h \ - $(intermediates)/dom/JSTextEvent.h \ - $(intermediates)/dom/JSTouch.h \ - $(intermediates)/dom/JSTouchEvent.h \ - $(intermediates)/dom/JSTouchList.h \ - $(intermediates)/dom/JSTreeWalker.h \ - $(intermediates)/dom/JSUIEvent.h \ - $(intermediates)/dom/JSWebKitAnimationEvent.h \ - $(intermediates)/dom/JSWebKitTransitionEvent.h \ - $(intermediates)/dom/JSWheelEvent.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/dom/JS%.h : $(LOCAL_PATH)/dom/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/dom/%.cpp : $(intermediates)/dom/%.h - - -GEN := \ - $(intermediates)/html/JSCanvasGradient.h \ - $(intermediates)/html/JSCanvasPattern.h \ - $(intermediates)/html/JSCanvasRenderingContext2D.h \ - $(intermediates)/html/JSFile.h \ - $(intermediates)/html/JSFileList.h \ - $(intermediates)/html/JSHTMLAnchorElement.h \ - $(intermediates)/html/JSHTMLAppletElement.h \ - $(intermediates)/html/JSHTMLAreaElement.h \ - $(intermediates)/html/JSHTMLAudioElement.h \ - $(intermediates)/html/JSHTMLBRElement.h \ - $(intermediates)/html/JSHTMLBaseElement.h \ - $(intermediates)/html/JSHTMLBaseFontElement.h \ - $(intermediates)/html/JSHTMLBlockquoteElement.h \ - $(intermediates)/html/JSHTMLBodyElement.h \ - $(intermediates)/html/JSHTMLButtonElement.h \ - $(intermediates)/html/JSHTMLCanvasElement.h \ - $(intermediates)/html/JSHTMLCollection.h \ - $(intermediates)/html/JSHTMLDListElement.h \ - $(intermediates)/html/JSHTMLDirectoryElement.h \ - $(intermediates)/html/JSHTMLDivElement.h \ - $(intermediates)/html/JSHTMLDocument.h \ - $(intermediates)/html/JSHTMLElement.h \ - $(intermediates)/html/JSHTMLEmbedElement.h \ - $(intermediates)/html/JSHTMLFieldSetElement.h \ - $(intermediates)/html/JSHTMLFontElement.h \ - $(intermediates)/html/JSHTMLFormElement.h \ - $(intermediates)/html/JSHTMLFrameElement.h \ - $(intermediates)/html/JSHTMLFrameSetElement.h \ - $(intermediates)/html/JSHTMLHRElement.h \ - $(intermediates)/html/JSHTMLHeadElement.h \ - $(intermediates)/html/JSHTMLHeadingElement.h \ - $(intermediates)/html/JSHTMLHtmlElement.h \ - $(intermediates)/html/JSHTMLIFrameElement.h \ - $(intermediates)/html/JSHTMLImageElement.h \ - $(intermediates)/html/JSHTMLInputElement.h \ - $(intermediates)/html/JSHTMLIsIndexElement.h \ - $(intermediates)/html/JSHTMLLIElement.h \ - $(intermediates)/html/JSHTMLLabelElement.h \ - $(intermediates)/html/JSHTMLLegendElement.h \ - $(intermediates)/html/JSHTMLLinkElement.h \ - $(intermediates)/html/JSHTMLMapElement.h \ - $(intermediates)/html/JSHTMLMarqueeElement.h \ - $(intermediates)/html/JSHTMLMediaElement.h \ - $(intermediates)/html/JSHTMLMenuElement.h \ - $(intermediates)/html/JSHTMLMetaElement.h \ - $(intermediates)/html/JSHTMLModElement.h \ - $(intermediates)/html/JSHTMLOListElement.h \ - $(intermediates)/html/JSHTMLObjectElement.h \ - $(intermediates)/html/JSHTMLOptGroupElement.h \ - $(intermediates)/html/JSHTMLOptionElement.h \ - $(intermediates)/html/JSHTMLOptionsCollection.h \ - $(intermediates)/html/JSHTMLParagraphElement.h \ - $(intermediates)/html/JSHTMLParamElement.h \ - $(intermediates)/html/JSHTMLPreElement.h \ - $(intermediates)/html/JSHTMLQuoteElement.h \ - $(intermediates)/html/JSHTMLScriptElement.h \ - $(intermediates)/html/JSHTMLSelectElement.h \ - $(intermediates)/html/JSHTMLSourceElement.h \ - $(intermediates)/html/JSHTMLStyleElement.h \ - $(intermediates)/html/JSHTMLTableCaptionElement.h \ - $(intermediates)/html/JSHTMLTableCellElement.h \ - $(intermediates)/html/JSHTMLTableColElement.h \ - $(intermediates)/html/JSHTMLTableElement.h \ - $(intermediates)/html/JSHTMLTableRowElement.h \ - $(intermediates)/html/JSHTMLTableSectionElement.h \ - $(intermediates)/html/JSHTMLTextAreaElement.h \ - $(intermediates)/html/JSHTMLTitleElement.h \ - $(intermediates)/html/JSHTMLUListElement.h \ - $(intermediates)/html/JSHTMLVideoElement.h \ - $(intermediates)/html/JSImageData.h \ - $(intermediates)/html/JSMediaError.h \ - $(intermediates)/html/JSTextMetrics.h \ - $(intermediates)/html/JSTimeRanges.h \ - $(intermediates)/html/JSVoidCallback.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/html/JS%.h : $(LOCAL_PATH)/html/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/html/%.cpp : $(intermediates)/html/%.h - -GEN := \ - $(intermediates)/inspector/JSJavaScriptCallFrame.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/inspector/JS%.h : $(LOCAL_PATH)/inspector/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/inspector/%.cpp : $(intermediates)/inspector/%.h - -GEN := \ - $(intermediates)/loader/appcache/JSDOMApplicationCache.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/loader/appcache/JS%.h : $(LOCAL_PATH)/loader/appcache/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/loader/appcache/%.cpp : $(intermediates)/loader/appcache/%.h - -# MANUAL MERGE : I took this out because compiling the result shows: -# out/.../JSAbstractView.cpp:27:26: error: AbstractView.h: No such file or directory -# I can't find AbstractView.h anywhere -# $(intermediates)/page/JSAbstractView.h \ - -GEN := \ - $(intermediates)/page/JSBarInfo.h \ - $(intermediates)/page/JSConsole.h \ - $(intermediates)/page/JSCoordinates.h \ - $(intermediates)/page/JSDOMSelection.h \ - $(intermediates)/page/JSDOMWindow.h \ - $(intermediates)/page/JSGeolocation.h \ - $(intermediates)/page/JSGeoposition.h \ - $(intermediates)/page/JSHistory.h \ - $(intermediates)/page/JSLocation.h \ - $(intermediates)/page/JSNavigator.h \ - $(intermediates)/page/JSPositionError.h \ - $(intermediates)/page/JSScreen.h \ - $(intermediates)/page/JSWebKitPoint.h \ - $(intermediates)/page/JSWorkerNavigator.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/page/JS%.h : $(LOCAL_PATH)/page/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/page/%.cpp : $(intermediates)/page/%.h - -GEN := \ - $(intermediates)/plugins/JSMimeType.h \ - $(intermediates)/plugins/JSMimeTypeArray.h \ - $(intermediates)/plugins/JSPlugin.h \ - $(intermediates)/plugins/JSPluginArray.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/plugins/JS%.h : $(LOCAL_PATH)/plugins/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/plugins/%.cpp : $(intermediates)/plugins/%.h - -# New section for Database storage API -GEN := \ - $(intermediates)/storage/JSDatabase.h \ - $(intermediates)/storage/JSSQLError.h \ - $(intermediates)/storage/JSSQLResultSet.h \ - $(intermediates)/storage/JSSQLResultSetRowList.h \ - $(intermediates)/storage/JSSQLTransaction.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/storage/JS%.h : $(LOCAL_PATH)/storage/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h - -# new section for DOM Storage APIs -GEN := \ - $(intermediates)/storage/JSStorage.h \ - $(intermediates)/storage/JSStorageEvent.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/storage/JS%.h : $(LOCAL_PATH)/storage/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h - -#new section for svg -ifeq ($(ENABLE_SVG), true) -GEN := \ - $(intermediates)/svg/JSSVGAElement.h \ - $(intermediates)/svg/JSSVGAltGlyphElement.h \ - $(intermediates)/svg/JSSVGAngle.h \ - $(intermediates)/svg/JSSVGAnimateColorElement.h \ - $(intermediates)/svg/JSSVGAnimateElement.h \ - $(intermediates)/svg/JSSVGAnimateTransformElement.h \ - $(intermediates)/svg/JSSVGAnimatedAngle.h \ - $(intermediates)/svg/JSSVGAnimatedBoolean.h \ - $(intermediates)/svg/JSSVGAnimatedEnumeration.h \ - $(intermediates)/svg/JSSVGAnimatedInteger.h \ - $(intermediates)/svg/JSSVGAnimatedLength.h \ - $(intermediates)/svg/JSSVGAnimatedLengthList.h \ - $(intermediates)/svg/JSSVGAnimatedNumber.h \ - $(intermediates)/svg/JSSVGAnimatedNumberList.h \ - $(intermediates)/svg/JSSVGAnimatedPreserveAspectRatio.h \ - $(intermediates)/svg/JSSVGAnimatedRect.h \ - $(intermediates)/svg/JSSVGAnimatedString.h \ - $(intermediates)/svg/JSSVGAnimatedTransformList.h \ - $(intermediates)/svg/JSSVGAnimationElement.h \ - $(intermediates)/svg/JSSVGCircleElement.h \ - $(intermediates)/svg/JSSVGClipPathElement.h \ - $(intermediates)/svg/JSSVGColor.h \ - $(intermediates)/svg/JSSVGComponentTransferFunctionElement.h \ - $(intermediates)/svg/JSSVGCursorElement.h \ - $(intermediates)/svg/JSSVGDefinitionSrcElement.h \ - $(intermediates)/svg/JSSVGDefsElement.h \ - $(intermediates)/svg/JSSVGDescElement.h \ - $(intermediates)/svg/JSSVGDocument.h \ - $(intermediates)/svg/JSSVGElement.h \ - $(intermediates)/svg/JSSVGElementInstance.h \ - $(intermediates)/svg/JSSVGElementInstanceList.h \ - $(intermediates)/svg/JSSVGEllipseElement.h \ - $(intermediates)/svg/JSSVGException.h \ - $(intermediates)/svg/JSSVGFEBlendElement.h \ - $(intermediates)/svg/JSSVGFEColorMatrixElement.h \ - $(intermediates)/svg/JSSVGFEComponentTransferElement.h \ - $(intermediates)/svg/JSSVGFECompositeElement.h \ - $(intermediates)/svg/JSSVGFEDiffuseLightingElement.h \ - $(intermediates)/svg/JSSVGFEDisplacementMapElement.h \ - $(intermediates)/svg/JSSVGFEDistantLightElement.h \ - $(intermediates)/svg/JSSVGFEFloodElement.h \ - $(intermediates)/svg/JSSVGFEFuncAElement.h \ - $(intermediates)/svg/JSSVGFEFuncBElement.h \ - $(intermediates)/svg/JSSVGFEFuncGElement.h \ - $(intermediates)/svg/JSSVGFEFuncRElement.h \ - $(intermediates)/svg/JSSVGFEGaussianBlurElement.h \ - $(intermediates)/svg/JSSVGFEImageElement.h \ - $(intermediates)/svg/JSSVGFEMergeElement.h \ - $(intermediates)/svg/JSSVGFEMergeNodeElement.h \ - $(intermediates)/svg/JSSVGFEOffsetElement.h \ - $(intermediates)/svg/JSSVGFEPointLightElement.h \ - $(intermediates)/svg/JSSVGFESpecularLightingElement.h \ - $(intermediates)/svg/JSSVGFESpotLightElement.h \ - $(intermediates)/svg/JSSVGFETileElement.h \ - $(intermediates)/svg/JSSVGFETurbulenceElement.h \ - $(intermediates)/svg/JSSVGFilterElement.h \ - $(intermediates)/svg/JSSVGFontElement.h \ - $(intermediates)/svg/JSSVGFontFaceElement.h \ - $(intermediates)/svg/JSSVGFontFaceFormatElement.h \ - $(intermediates)/svg/JSSVGFontFaceNameElement.h \ - $(intermediates)/svg/JSSVGFontFaceSrcElement.h \ - $(intermediates)/svg/JSSVGFontFaceUriElement.h \ - $(intermediates)/svg/JSSVGForeignObjectElement.h \ - $(intermediates)/svg/JSSVGGElement.h \ - $(intermediates)/svg/JSSVGGlyphElement.h \ - $(intermediates)/svg/JSSVGGradientElement.h \ - $(intermediates)/svg/JSSVGHKernElement.h \ - $(intermediates)/svg/JSSVGImageElement.h \ - $(intermediates)/svg/JSSVGLength.h \ - $(intermediates)/svg/JSSVGLengthList.h \ - $(intermediates)/svg/JSSVGLineElement.h \ - $(intermediates)/svg/JSSVGLinearGradientElement.h \ - $(intermediates)/svg/JSSVGMarkerElement.h \ - $(intermediates)/svg/JSSVGMaskElement.h \ - $(intermediates)/svg/JSSVGMatrix.h \ - $(intermediates)/svg/JSSVGMetadataElement.h \ - $(intermediates)/svg/JSSVGMissingGlyphElement.h \ - $(intermediates)/svg/JSSVGNumber.h \ - $(intermediates)/svg/JSSVGNumberList.h \ - $(intermediates)/svg/JSSVGPaint.h \ - $(intermediates)/svg/JSSVGPathElement.h \ - $(intermediates)/svg/JSSVGPathSeg.h \ - $(intermediates)/svg/JSSVGPathSegArcAbs.h \ - $(intermediates)/svg/JSSVGPathSegArcRel.h \ - $(intermediates)/svg/JSSVGPathSegClosePath.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicRel.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicSmoothAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicSmoothRel.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticRel.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticSmoothAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticSmoothRel.h \ - $(intermediates)/svg/JSSVGPathSegLinetoAbs.h \ - $(intermediates)/svg/JSSVGPathSegLinetoHorizontalAbs.h \ - $(intermediates)/svg/JSSVGPathSegLinetoHorizontalRel.h \ - $(intermediates)/svg/JSSVGPathSegLinetoRel.h \ - $(intermediates)/svg/JSSVGPathSegLinetoVerticalAbs.h \ - $(intermediates)/svg/JSSVGPathSegLinetoVerticalRel.h \ - $(intermediates)/svg/JSSVGPathSegList.h \ - $(intermediates)/svg/JSSVGPathSegMovetoAbs.h \ - $(intermediates)/svg/JSSVGPathSegMovetoRel.h \ - $(intermediates)/svg/JSSVGPatternElement.h \ - $(intermediates)/svg/JSSVGPoint.h \ - $(intermediates)/svg/JSSVGPointList.h \ - $(intermediates)/svg/JSSVGPolygonElement.h \ - $(intermediates)/svg/JSSVGPolylineElement.h \ - $(intermediates)/svg/JSSVGPreserveAspectRatio.h \ - $(intermediates)/svg/JSSVGRadialGradientElement.h \ - $(intermediates)/svg/JSSVGRect.h \ - $(intermediates)/svg/JSSVGRectElement.h \ - $(intermediates)/svg/JSSVGRenderingIntent.h \ - $(intermediates)/svg/JSSVGSVGElement.h \ - $(intermediates)/svg/JSSVGScriptElement.h \ - $(intermediates)/svg/JSSVGSetElement.h \ - $(intermediates)/svg/JSSVGStopElement.h \ - $(intermediates)/svg/JSSVGStringList.h \ - $(intermediates)/svg/JSSVGStyleElement.h \ - $(intermediates)/svg/JSSVGSwitchElement.h \ - $(intermediates)/svg/JSSVGSymbolElement.h \ - $(intermediates)/svg/JSSVGTRefElement.h \ - $(intermediates)/svg/JSSVGTSpanElement.h \ - $(intermediates)/svg/JSSVGTextContentElement.h \ - $(intermediates)/svg/JSSVGTextElement.h \ - $(intermediates)/svg/JSSVGTextPathElement.h \ - $(intermediates)/svg/JSSVGTextPositioningElement.h \ - $(intermediates)/svg/JSSVGTitleElement.h \ - $(intermediates)/svg/JSSVGTransform.h \ - $(intermediates)/svg/JSSVGTransformList.h \ - $(intermediates)/svg/JSSVGUnitTypes.h \ - $(intermediates)/svg/JSSVGUseElement.h \ - $(intermediates)/svg/JSSVGViewElement.h \ - $(intermediates)/svg/JSSVGZoomEvent.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include external/webkit/WebCore/dom --include external/webkit/WebCore/html --include external/webkit/WebCore/svg --outputdir $(dir $@) $< -$(GEN): $(intermediates)/svg/JS%.h : $(LOCAL_PATH)/svg/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/svg/%.cpp : $(intermediates)/svg/%.h -endif - -# new section for Workers -GEN := \ - $(intermediates)/workers/JSWorker.h \ - $(intermediates)/workers/JSWorkerContext.h \ - $(intermediates)/workers/JSWorkerLocation.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/workers/JS%.h : $(LOCAL_PATH)/workers/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/workers/%.cpp : $(intermediates)/workers/%.h - -#new section for xml/DOMParser.idl -GEN := \ - $(intermediates)/xml/JSDOMParser.h \ - $(intermediates)/xml/JSXMLHttpRequest.h \ - $(intermediates)/xml/JSXMLHttpRequestException.h \ - $(intermediates)/xml/JSXMLHttpRequestProgressEvent.h \ - $(intermediates)/xml/JSXMLHttpRequestUpload.h \ - $(intermediates)/xml/JSXMLSerializer.h \ - $(intermediates)/xml/JSXPathEvaluator.h \ - $(intermediates)/xml/JSXPathException.h \ - $(intermediates)/xml/JSXPathExpression.h \ - $(intermediates)/xml/JSXPathNSResolver.h \ - $(intermediates)/xml/JSXPathResult.h \ - $(intermediates)/xml/JSXSLTProcessor.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/xml/JS%.h : $(LOCAL_PATH)/xml/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/xml/%.cpp : $(intermediates)/xml/%.h -#end - -# HTML tag and attribute names - -GEN:= $(intermediates)/HTMLNames.cpp $(intermediates)/HTMLElementFactory.cpp $(intermediates)/JSHTMLElementWrapperFactory.cpp -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --tags $(html_tags) --attrs $(html_attrs) --extraDefines "$(FEATURE_DEFINES)" --factory --wrapperFactory --output $(dir $@) -$(GEN): html_tags := $(LOCAL_PATH)/html/HTMLTagNames.in -$(GEN): html_attrs := $(LOCAL_PATH)/html/HTMLAttributeNames.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(html_tags) $(html_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - -# SVG tag and attribute names - -ifeq ($(ENABLE_SVG), true) -GEN:= $(intermediates)/SVGNames.cpp $(intermediates)/SVGElementFactory.cpp $(intermediates)/JSSVGElementWrapperFactory.cpp -SVG_FLAGS:=ENABLE_SVG_AS_IMAGE=1 ENABLE_SVG_FILTERS=1 ENABLE_SVG_FONTS=1 ENABLE_SVG_FOREIGN_OBJECT=1 ENABLE_SVG_USE=1 -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --tags $(svg_tags) --attrs $(svg_attrs) --extraDefines "$(SVG_FLAGS)" --factory --wrapperFactory --output $(dir $@) -$(GEN): svg_tags := $(LOCAL_PATH)/svg/svgtags.in -$(GEN): svg_attrs := $(LOCAL_PATH)/svg/svgattrs.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(svg_tags) $(svg_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) -endif - -# XML attribute names - -GEN:= $(intermediates)/XMLNames.cpp -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xml_attrs) --output $(dir $@) -$(GEN): xml_attrs := $(LOCAL_PATH)/xml/xmlattrs.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xml_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - -# XLink attribute names - -ifeq ($(ENABLE_SVG), true) -GEN:= $(intermediates)/XLinkNames.cpp -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xlink_attrs) --output $(dir $@) -$(GEN): xlink_attrs := $(LOCAL_PATH)/svg/xlinkattrs.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xlink_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) -endif diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 3de7e2f..3564483 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -124,6 +124,7 @@ LOCAL_SRC_FILES := \ bindings/js/JSAudioConstructor.cpp \ bindings/js/JSCDATASectionCustom.cpp \ bindings/js/JSCSSRuleCustom.cpp \ + bindings/js/JSCSSRuleListCustom.cpp \ bindings/js/JSCSSStyleDeclarationCustom.cpp \ bindings/js/JSCSSValueCustom.cpp \ bindings/js/JSCanvasRenderingContext2DCustom.cpp \ @@ -148,15 +149,19 @@ LOCAL_SRC_FILES := \ bindings/js/JSDataGridDataSource.cpp \ bindings/js/JSDatabaseCustom.cpp \ bindings/js/JSDedicatedWorkerContextCustom.cpp \ + bindings/js/JSDesktopNotificationsCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ bindings/js/JSDocumentFragmentCustom.cpp \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ bindings/js/JSEventListener.cpp \ + bindings/js/JSEventSourceConstructor.cpp \ + bindings/js/JSEventSourceCustom.cpp \ bindings/js/JSEventTarget.cpp \ bindings/js/JSGeolocationCustom.cpp \ bindings/js/JSHTMLAllCollection.cpp \ bindings/js/JSHTMLAppletElementCustom.cpp \ + bindings/js/JSHTMLCanvasElementCustom.cpp \ bindings/js/JSHTMLCollectionCustom.cpp \ bindings/js/JSHTMLDataGridElementCustom.cpp \ bindings/js/JSHTMLDocumentCustom.cpp \ @@ -269,6 +274,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ bridge/runtime_object.cpp \ bridge/runtime_root.cpp \ bridge/testbindings.cpp \ + bridge/testqtbindings.cpp \ \ css/CSSBorderImageValue.cpp \ css/CSSCanvasValue.cpp \ @@ -511,6 +517,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/HTMLDataGridColElement.cpp \ html/HTMLDataGridElement.cpp \ html/HTMLDataGridRowElement.cpp \ + html/HTMLDataListElement.cpp \ html/HTMLDirectoryElement.cpp \ html/HTMLDivElement.cpp \ html/HTMLDocument.cpp \ @@ -583,6 +590,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/PreloadScanner.cpp \ html/TimeRanges.cpp \ html/ValidityState.cpp \ + html/canvas/CanvasGradient.cpp \ \ loader/Cache.cpp \ loader/CachedCSSStyleSheet.cpp \ @@ -638,6 +646,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ loader/loader.cpp \ \ + notifications/Notification.cpp \ + notifications/NotificationCenter.cpp \ page/BarInfo.cpp \ page/Chrome.cpp \ page/Console.cpp \ @@ -648,6 +658,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ page/DOMWindow.cpp \ page/DragController.cpp \ page/EventHandler.cpp \ + page/EventSource.cpp \ page/FocusController.cpp \ page/Frame.cpp \ page/FrameTree.cpp \ @@ -672,18 +683,15 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ page/android/DragControllerAndroid.cpp \ page/android/EventHandlerAndroid.cpp \ - page/android/EventHandlerAndroid.cpp \ - page/android/InspectorControllerAndroid.cpp \ page/android/InspectorControllerAndroid.cpp \ - page/android/DragControllerAndroid.cpp \ \ - page/XSSAuditor.cpp \ page/animation/AnimationBase.cpp \ page/animation/AnimationController.cpp \ page/animation/CompositeAnimation.cpp \ page/animation/ImplicitAnimation.cpp \ page/animation/KeyframeAnimation.cpp \ page/haiku/DragControllerHaiku.cpp \ + page/haiku/EventHandlerHaiku.cpp \ \ platform/Arena.cpp \ platform/ContentType.cpp \ @@ -757,6 +765,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/GraphicsTypes.cpp \ platform/graphics/Image.cpp \ platform/graphics/ImageBuffer.cpp \ + platform/graphics/ImageSource.cpp \ platform/graphics/IntRect.cpp \ platform/graphics/MediaPlayer.cpp \ platform/graphics/Path.cpp \ @@ -792,6 +801,15 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ + platform/graphics/haiku/ColorHaiku.cpp \ + platform/graphics/haiku/FloatPointHaiku.cpp \ + platform/graphics/haiku/FloatRectHaiku.cpp \ + platform/graphics/haiku/GradientHaiku.cpp \ + platform/graphics/haiku/GraphicsContextHaiku.cpp \ + platform/graphics/haiku/IntPointHaiku.cpp \ + platform/graphics/haiku/IntRectHaiku.cpp \ + platform/graphics/haiku/IntSizeHaiku.cpp \ + platform/graphics/haiku/PathHaiku.cpp \ platform/graphics/opentype/OpenTypeUtilities.cpp \ platform/graphics/skia/NativeImageSkia.cpp \ \ @@ -804,7 +822,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/transforms/TransformOperations.cpp \ platform/graphics/transforms/TransformationMatrix.cpp \ platform/graphics/transforms/TranslateTransformOperation.cpp \ + platform/graphics/wince/ColorWince.cpp \ platform/graphics/wince/FontCacheWince.cpp \ + platform/graphics/wince/FontCustomPlatformData.cpp \ \ platform/haiku/ClipboardHaiku.cpp \ platform/haiku/ContextMenuHaiku.cpp \ @@ -816,14 +836,19 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/haiku/EventLoopHaiku.cpp \ platform/haiku/FileChooserHaiku.cpp \ platform/haiku/FileSystemHaiku.cpp \ + platform/haiku/LocalizedStringsHaiku.cpp \ + platform/haiku/LoggingHaiku.cpp \ platform/haiku/MIMETypeRegistryHaiku.cpp \ platform/haiku/PasteboardHaiku.cpp \ platform/haiku/PlatformKeyboardEventHaiku.cpp \ platform/haiku/PlatformMouseEventHaiku.cpp \ platform/haiku/PlatformWheelEventHaiku.cpp \ platform/haiku/PopupMenuHaiku.cpp \ + platform/haiku/RenderThemeHaiku.cpp \ platform/haiku/ScreenHaiku.cpp \ + platform/haiku/ScrollbarThemeHaiku.cpp \ platform/haiku/SearchPopupMenuHaiku.cpp \ + platform/haiku/SharedBufferHaiku.cpp \ platform/haiku/SoundHaiku.cpp \ platform/haiku/TemporaryLinkStubs.cpp \ platform/haiku/WidgetHaiku.cpp \ @@ -881,6 +906,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ platform/text/android/TextBreakIteratorInternalICU.cpp \ platform/text/haiku/StringHaiku.cpp \ + platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp \ \ plugins/MimeType.cpp \ plugins/MimeTypeArray.cpp \ @@ -1060,12 +1086,14 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ storage/SQLResultSetRowList.cpp \ storage/SQLStatement.cpp \ storage/SQLTransaction.cpp \ + storage/SQLTransactionCoordinator.cpp \ storage/Storage.cpp \ storage/StorageAreaImpl.cpp \ storage/StorageAreaSync.cpp \ storage/StorageEvent.cpp \ storage/StorageMap.cpp \ storage/StorageNamespace.cpp \ + storage/StorageNamespaceImpl.cpp \ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 53c2690..5175089 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,4247 @@ +2009-08-18 Kent Tamura <tkent@chromium.org> + + Reviewed by Eric Seidel. + + Support for parsing <datalist> element and generating HTMLDataListElement nodes. + https://bugs.webkit.org/show_bug.cgi?id=26915 + + Tests: fast/forms/datalist-nonoption-child.html + fast/forms/datalist.html + + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/build-generated-files.sh: + * WebCore.xcodeproj/project.pbxproj: + * WebCoreSources.bkl: + * css/html.css: + * html/CollectionType.h: + (WebCore::): + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::itemAfter): + * html/HTMLDataListElement.cpp: Added. + (WebCore::HTMLDataListElement::HTMLDataListElement): + (WebCore::HTMLDataListElement::~HTMLDataListElement): + (WebCore::HTMLDataListElement::checkDTD): + (WebCore::HTMLDataListElement::options): + * html/HTMLDataListElement.h: Added. + * html/HTMLDataListElement.idl: Added. + * html/HTMLElement.cpp: + (WebCore::inlineTagList): + * html/HTMLParser.cpp: + (WebCore::HTMLParser::isAffectedByResidualStyle): + * html/HTMLTagNames.in: + +2009-08-17 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + -webkit-box-orient:horizontal doesn't work on <button> tag + https://bugs.webkit.org/show_bug.cgi?id=34445 + + Make a flexible button's anonymous child flexible and pass the + parent's box-orient to the anonymous child. + + Also, added a renderName for anonymous flexible boxes. + + Test: fast/flexbox/box-orient-button.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::createAnonymousBlock): + * rendering/RenderBlock.h: + * rendering/RenderButton.cpp: + (WebCore::RenderButton::addChild): + (WebCore::RenderButton::setupInnerStyle): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::renderName): + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Render -webkit-mask via compositing layers when possible + https://bugs.webkit.org/show_bug.cgi?id=28414 + + Implement accelerated compositing of -webkit-mask, when combined + with already-composited content. + + RenderLayerBacking now creates an additional GraphicsLayer for the mask contents, + and sets this as the mask on another GraphicsLayer via the setMaskLayer() method. + GraphicsLayerCA then applies the mask using -[CALayer setMask:]. + + The enum values for GraphicsLayerPaintingPhase were renamed to avoid the + confusion with "mask", and a new value, GraphicsLayerPaintMask, was added which + indicates that just the mask is painting. + + When painting the composited mask, we need to paint with the normal compositing + mode rather than CompositeDestinationIn, so InlineFlowBox and RenderBox now consult + layer()->hasCompositedMask() to pick the mode. If the mask is composited, they no longer + need to make transparency layers. + + We no longer have to throw video rendering into software because of masks. + + When a masked element has composited descendants, that element needs to + become composited so that the mask can be applied via compositing. + + Tests: compositing/masks/masked-ancestor.html + compositing/masks/simple-composited-mask.html + + * platform/graphics/GraphicsLayer.cpp: + (WebCore::GraphicsLayer::GraphicsLayer): + * platform/graphics/GraphicsLayer.h: + (WebCore::GraphicsLayer::maskLayer): + (WebCore::GraphicsLayer::setMaskLayer): + (WebCore::GraphicsLayer::paintingPhase): + (WebCore::GraphicsLayer::setPaintingPhase): + * platform/graphics/GraphicsLayerClient.h: + (WebCore::): + * platform/graphics/mac/GraphicsLayerCA.h: + (WebCore::GraphicsLayerCA::): + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayerCA::setMaskLayer): + (WebCore::GraphicsLayerCA::recursiveCommitChanges): + (WebCore::GraphicsLayerCA::commitLayerChanges): + (WebCore::GraphicsLayerCA::updateMaskLayer): + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::paintMask): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::paintMaskImages): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hasCompositedMask): + * rendering/RenderLayer.h: + (WebCore::RenderLayer::hasCompositedMask): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::~RenderLayerBacking): + (WebCore::RenderLayerBacking::destroyGraphicsLayer): + (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + (WebCore::RenderLayerBacking::updateForegroundLayer): + (WebCore::RenderLayerBacking::updateMaskLayer): + (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer): + (WebCore::RenderLayerBacking::setContentsNeedDisplay): + (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): + (WebCore::RenderLayerBacking::paintIntoLayer): + (WebCore::RenderLayerBacking::paintContents): + * rendering/RenderLayerBacking.h: + (WebCore::RenderLayerBacking::hasMaskLayer): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + (WebCore::RenderLayerCompositor::canAccelerateVideoRendering): + (WebCore::RenderLayerCompositor::requiresCompositingWhenDescendantsAreCompositing): + * rendering/RenderLayerCompositor.h: + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Layer content misplaced with compositing, z-index and overflow + https://bugs.webkit.org/show_bug.cgi?id=28361 + + The foreground GraphicsLayer (used to render element foreground when the element has + negative z-order children) was misplaced when there is a clipping layer (which clips + children). The foreground layer is parented under the clipping layer so that the foreground + depth-sorts with the layer's children, so its geometry needs to be computed relative to + that clipping layer. + + Also clarified some FIXME comments, and corrected a debug-only layer name. + + Test: compositing/geometry/clipping-foreground.html + + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayerCA::updateSublayerList): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + (WebCore::RenderLayerBacking::updateForegroundLayer): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): + +2009-08-17 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Fix leaks of SVGElementInstance seen during regression tests. + + r47313 made TreeShared types start with a ref-count of 1, but SVGElementInstance was mistakenly + not updated to have a create method that adopted the initial reference. This lead to the instances + of SVGElementInstance allocated by SVGUseElement being leaked. + + * svg/SVGElementInstance.h: + (WebCore::SVGElementInstance::create): + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::buildPendingResource): + (WebCore::SVGUseElement::buildInstanceTree): + (WebCore::SVGUseElement::handleDeepUseReferencing): + +2009-08-17 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Some cleanup towards https://bugs.webkit.org/show_bug.cgi?id=13631 + Page Cache should support pages with frames. + + - Re-factor all remaining page cache code out of DocumentLoader, as CachedPage/CacheFrame loads + are solely the responsibility of FrameLoader. + - Enhance some page cache related Logging to help development. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::identifierForInitialRequest): + + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::DocumentLoader): + * loader/DocumentLoader.h: + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::FrameLoader): + (WebCore::FrameLoader::commitProvisionalLoad): + (WebCore::FrameLoader::continueLoadAfterWillSubmitForm): + (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): + * loader/FrameLoader.h: + (WebCore::FrameLoader::isLoadingFromCachedPage): + +2009-08-17 Roland Steiner <rolandsteiner@google.com> + + Reviewed by Eric Seidel. + + Moved implementation of isAfterContent to RenderObject + (as inline method to avoid potential performance regressions). + + BUG 28376 - [Cleanup] isAfterContent() implemented twice, should be member of RenderObject + (https://bugs.webkit.org/show_bug.cgi?id=28376) + + * rendering/RenderBox.cpp: + * rendering/RenderBox.h: + * rendering/RenderInline.cpp: + * rendering/RenderObject.h: + (WebCore::RenderObject::isAfterContent): + +2009-08-17 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Assertion failure in WebCore::RenderHTMLCanvas::layout + https://bugs.webkit.org/show_bug.cgi?id=12052 + + Don't handle run-in if the element is not a block element. + + Test: fast/runin/nonblock-runin.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::handleRunInChild): + +2009-08-17 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by Darin Adler. + + Fix createImageData to raise the NOT_SUPPORTED_ERR exception when + either of the arguments are not finite. + + According to + http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation: + "If any of the arguments to createImageData() or getImageData() are + infinite or NaN, or if the createImageData() method is invoked with + only one argument but that argument is null, the method must instead + raise a NOT_SUPPORTED_ERR exception." + + Test: http://philip.html5.org/tests/canvas/suite/tests/2d.imageData.create.nonfinite.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::createImageData): + * html/canvas/CanvasRenderingContext2D.h: + * html/canvas/CanvasRenderingContext2D.idl: + +2009-08-17 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Add a way to release the storage lock + https://bugs.webkit.org/show_bug.cgi?id=28411 + + Two scripts within the same origin that are accessing LocalStorage must not do + it simultaneously, according to the spec. There are some cases, however, where + a script might want to override this behavior. navigator.getStorageUpdates() + was added for this reason: + http://dev.w3.org/html5/spec/Overview.html#manually-releasing-the-storage-mutex + + Add this function to navigator and hook it up to DOM Storage. + + * page/Navigator.cpp: + (WebCore::Navigator::getStorageUpdates): + * page/Navigator.h: + * page/Navigator.idl: + * storage/StorageNamespace.h: + * storage/StorageNamespaceImpl.cpp: + (WebCore::StorageNamespaceImpl::unlock): + * storage/StorageNamespaceImpl.h: + +2009-08-17 Mark Rowe <mrowe@apple.com> + + Build fix. + + CFNetwork isn't present in the framework search path on Mac OS X so we can't directly include its headers. + We include CoreServices.h, the umbrella framework that contains CFNetwork, from the prefix header which + results in the CFNetwork headers being included on Mac OS X. CoreServices.h doesn't include CFNetwork.h on + Windows though so we explicitly include this header from the prefix header when on Windows. + + * WebCorePrefix.h: + * platform/network/cf/DNSCFNet.cpp: Remove #include that is no longer needed. + +2009-08-17 Alexey Proskuryakov <ap@apple.com> + + Trying a better build fix (the previous one broke Leopard bots, although it did build for me). + + * platform/network/cf/DNSCFNet.cpp: Include CFNetwork/CFNetwork.h instead. + +2009-08-17 Alexey Proskuryakov <ap@apple.com> + + Trying to fix Windows build. + + * platform/network/cf/DNSCFNet.cpp: Include CFNetwork/CFHost.h. + +2009-08-17 Peter Kasting <pkasting@google.com> + + Reviewed by Steve Falkenburg. + + https://bugs.webkit.org/show_bug.cgi?id=27323 + Only add Cygwin to the path when it isn't already there. This avoids + causing problems for people who purposefully have non-Cygwin versions of + executables like svn in front of the Cygwin ones in their paths. + + * WebCore.vcproj/QTMovieWin.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/WebCoreGenerated.vcproj: + +2009-08-17 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=28401 + Add support for DNS prefetching with CFNetwork + + This is just an optimization, no behavior change, so no tests. + + * platform/network/cf/DNSCFNet.cpp: + (WebCore::clientCallback): + (WebCore::prefetchDNS): + Use async CFHostStartInfoResolution() for implementation. + +2009-08-17 Aaron Boodman <aa@chromium.org> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=28313: Combine ThreadableLoaderOptions::crossOriginRequestPolicy and + ThreadableLoaderOptions::crossOriginRedirectPolicy since they are always set the same way. + + Also, tightened up behavior of XMLHttpRequest with cross-origin redirects and access control. We have not implemented + redirects access control, so we should never redirect across origins. But in two edge cases, we were: + + * Asynchronous XHR: Script on origin A requests resource from origin B. Server redirects (without sending access control + authorization headers) to a resource on origin A. + * Synchronous XHR: Script on origin A requests resource from origin B. Server redirects (without sending access control + authorization headers) to another resource on origin B (this time sending access control authorization headers). + + Test: http/tests/xmlhttprequest/access-control-and-redirects.html + + * loader/DocumentThreadableLoader.cpp: + (WebCore::DocumentThreadableLoader::willSendRequest): Refactor redirect checking code into shared location. + (WebCore::DocumentThreadableLoader::loadRequest): Ditto. + (WebCore::DocumentThreadableLoader::isAllowedRedirect): Ditto. + * loader/DocumentThreadableLoader.h: + * loader/ThreadableLoader.h: + (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Remove ThreadableLoaderOptions::crossOriginRedirectPolicy. + * page/EventSource.cpp: + (WebCore::EventSource::connect): Ditto. + * workers/Worker.cpp: Ditto. + (WebCore::Worker::Worker): Ditto. + * workers/WorkerContext.cpp: Ditto. + (WebCore::WorkerContext::importScripts): Ditto. + * workers/WorkerScriptLoader.cpp: + (WebCore::WorkerScriptLoader::loadSynchronously): Ditto. + (WebCore::WorkerScriptLoader::loadAsynchronously): Ditto. + * workers/WorkerScriptLoader.h: + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::createRequest): Ditto. + +2009-08-17 Adam Langley <agl@google.com> + + Reviewed by Dan Bernstein (relanding of r47157). + + Fix a typo in platform/graphics/skia/PlatformContextSkia.cpp + + https://bugs.webkit.org/show_bug.cgi?id=28172 + + This was originally fixed in r47157, however it triggered a bug in + Skia which caused Chromium Linux to fail layout tests in debug mode. + It was reverted in r47189 while we sorted it out. + + The Skia bug was fixed in Skia's r321 [1] and rolled into Chromium in + Chromium's r23523. This is a reland of the original patch. + + No new tests because it's a just typo fix. + + [1] http://code.google.com/p/skia/source/detail?r=321 + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::setupPaintCommon): + +2009-08-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Protect ResourceHandle for g_file_query_info_async call, using the + same technique we already use for HTTP requests that take the soup + path. + + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::ResourceHandleInternal::~ResourceHandleInternal): + (WebCore::ResourceHandle::~ResourceHandle): + (WebCore::finishedCallback): + (WebCore::): + +2009-08-17 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r47255): MediaWiki's (including Wikipedia) navigation pane + appears below the main content + https://bugs.webkit.org/show_bug.cgi?id=28350 + + A particular version of the MediaWiki software detects WebKit through + user agent sniffing and imports a style sheet called KHTMLFixes.css, + which contains a single rule that was meant to work around some KHTML + bug, but currently has the sole effect of causing the float containing + the main article content to extend all the way to the left and thus push + down the left navigation pane. + + * css/CSSImportRule.cpp: + (WebCore::CSSImportRule::setCSSStyleSheet): If site specific hacks are + enabled, check if the imported style sheet is the MediaWiki + KHTMLFixes.css. If so, remove the offending rule. + +2009-08-17 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Kevin Ollivier. + + Correct crash when processing local cancelled requests. + + No new tests. Existing fast/images/favicon-as-image.html + displays the problem. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::writeCallback): Add check for m_cancelled after + performing local-file processing. + (WebCore::ResourceHandleManager::downloadTimerCallback): Add + check for m_cancelled after performing local-file processing. + +2009-08-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed. Reverts 47371, since it breaks GTK+. + + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): + * platform/image-decoders/ImageDecoder.cpp: Removed. + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::ImageDecoder): + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::convertCMYKToRGBA): + (WebCore::convertRGBToRGBA): + (WebCore::JPEGImageDecoder::outputScanlines): + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::headerAvailable): + (WebCore::PNGImageDecoder::rowAvailable): + +2009-08-17 Yong Li <yong.li@torchmobile.com> + + Reviewed by Adam Treat. + + Allow image decoders to down-sample the image directly + to scaled output buffer. This can be enabled/disabled by + macro ENABLE(IMAGE_DECODER_DOWN_SAMPLING). + Only JPEG and PNG decoders are modified to support it now. + https://bugs.webkit.org/show_bug.cgi?id=28308 + + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): + * platform/image-decoders/ImageDecoder.cpp: Added. + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::ImageDecoder): + (WebCore::ImageDecoder::setMaxNumPixels): + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::convertCMYKToRGBA): + (WebCore::convertRGBToRGBA): + (WebCore::JPEGImageDecoder::outputScanlines): + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + (WebCore::JPEGImageDecoder::setSize): + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::headerAvailable): + (WebCore::PNGImageDecoder::rowAvailable): + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Build fix: fix float literals to avoid casting warnings. + + * rendering/MediaControlElements.cpp: + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Eric Seidel. + + Use OwnPtrs for GraphicsLayers + https://bugs.webkit.org/show_bug.cgi?id=28399 + + Convert RenderLayerBacking and RenderLayerCompositor to use OwnPtrs + for their references to GraphicsLayers. + + * platform/graphics/GraphicsLayer.h: + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayer::create): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::RenderLayerBacking): + (WebCore::RenderLayerBacking::createGraphicsLayer): + (WebCore::RenderLayerBacking::destroyGraphicsLayer): + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + (WebCore::RenderLayerBacking::updateInternalHierarchy): + (WebCore::RenderLayerBacking::updateClippingLayers): + (WebCore::RenderLayerBacking::updateForegroundLayer): + (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): + * rendering/RenderLayerBacking.h: + (WebCore::RenderLayerBacking::graphicsLayer): + (WebCore::RenderLayerBacking::clippingLayer): + (WebCore::RenderLayerBacking::ancestorClippingLayer): + (WebCore::RenderLayerBacking::foregroundLayer): + (WebCore::RenderLayerBacking::parentForSublayers): + (WebCore::RenderLayerBacking::childForSuperlayers): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::~RenderLayerCompositor): + (WebCore::RenderLayerCompositor::rootPlatformLayer): + (WebCore::RenderLayerCompositor::didMoveOnscreen): + (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): + (WebCore::RenderLayerCompositor::destroyRootPlatformLayer): + * rendering/RenderLayerCompositor.h: + +2009-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Reset InjectedScript styles cache on document change. + + https://bugs.webkit.org/show_bug.cgi?id=28390 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::close): + (WebCore::InspectorController::populateScriptObjects): + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::resetInjectedScript): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setDocument): + * inspector/InspectorDOMAgent.h: + * inspector/front-end/InjectedScript.js: + (InjectedScript._reset): + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + * rendering/MediaControlElements.cpp: Removed unneeded include of CString.h, + resorted includes, renamed "doc" to "document" and fixed formatting. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Removed functions now unneeded due to use of Reflect to create + language bindings. + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityParentForImageMap): + Get at usemap attribute directly. + + * editing/DeleteButtonController.cpp: + (WebCore::DeleteButtonController::createDeletionUI): + Get at id attribute directly. + * editing/EditorCommand.cpp: + (WebCore::executeInsertHorizontalRule): Ditto. + + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::dir): Get at dir attribute of body directly. + (WebCore::HTMLDocument::setDir): Ditto. + + * html/HTMLElement.cpp: Deleted unused functions. + * html/HTMLElement.h: Ditto. + + * html/HTMLImageElement.cpp: Deleted unused functions. + (WebCore::HTMLImageElement::alt): Changed to return const AtomicString&. + (WebCore::HTMLImageElement::addSubresourceAttributeURLs): Changed to + get at usemap attribute directly, but added a FIXME because although + it is what the old code did, it looks to not be entirely correct. + + * html/HTMLImageElement.h: Deleted unused functions. + + * rendering/HitTestResult.cpp: + (WebCore::HitTestResult::altDisplayString): Get at alt attribute directly. + + * rendering/RenderImage.cpp: + (WebCore::RenderImage::imageMap): Get at usemap attribute directly. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::createGraphicsLayer): Get at id attribute + directly. + (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): Removed + explicit HTMLNames namespace qualification. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + * dom/Document.cpp: + (WebCore::Document::setFocusedNode): Removed unneeded calls + to RefPtr::get. + +2009-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Discard DOM Node bindings on any document change. + + https://bugs.webkit.org/show_bug.cgi?id=28389 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setDocument): + +2009-08-13 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Improve Cookie DataGrid to Show Hidden Data + https://bugs.webkit.org/show_bug.cgi?id=28269 + + * English.lproj/localizedStrings.js: DataGrid Headers "Name", "Value", "Size", ... + * WebCore.gypi: added missing files + + Implemented Bindings for InspectorController.deleteCookie(name) + + * inspector/InspectorBackend.idl: + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::cookies): + (WebCore::JSInspectorBackend::deleteCookie): + + v8 Bindings Stubs + + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + + Removed WebInspector.Cookie + + * inspector/front-end/Cookie.js: Removed. + * inspector/front-end/inspector.html: + * inspector/front-end/WebKit.qrc: + + Improved DataGrid and Kept Fallback Behavior for Platforms that don't + yet provide access to raw cookies. + + * inspector/front-end/CookieItemsView.js: + (WebInspector.CookieItemsView): + (WebInspector.CookieItemsView.prototype.get statusBarItems): + (WebInspector.CookieItemsView.prototype.update): + (WebInspector.CookieItemsView.prototype.buildCookies): + (WebInspector.CookieItemsView.prototype.dataGridForCookies): + (WebInspector.CookieItemsView.prototype.fallbackUpdate.callback): + (WebInspector.CookieItemsView.prototype.fallbackUpdate): + (WebInspector.CookieItemsView.prototype.fallbackBuildCookiesFromString): + (WebInspector.CookieItemsView.prototype.fallbackDataGridForCookies): + (WebInspector.CookieItemsView.prototype._deleteButtonClicked): + + Interaction with the page through Injected Script (for fallback behavior) + + * inspector/front-end/DOMAgent.js: + (InspectorController.getCookies): + * inspector/front-end/InjectedScript.js: + (InjectedScript.setStyleProperty): style fix + (InjectedScript.getCookies): + + Allow alignment of text inside DataGrids. + + * inspector/front-end/DataGrid.js: + (WebInspector.DataGrid): + (WebInspector.DataGridNode.prototype.createCell): + * inspector/front-end/DatabasesPanel.js: + (WebInspector.DatabasesPanel.prototype.dataGridForDOMStorage): + * inspector/front-end/inspector.css: + + Added deleteCookie(., ., String name) + Modified getRawCookies to return a bool to know if its implemented + + * platform/CookieJar.h: + + + Implemented deleteCookie for Macs + + * platform/mac/CookieJar.mm: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + + Stub Implementations for Other Platforms + + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/curl/CookieJarCurl.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/soup/CookieJarSoup.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/win/CookieJarCFNetWin.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/win/CookieJarWin.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/qt/CookieJarQt.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + +2009-08-17 Adam Treat <adam.treat@torchmobile.com> + + Blind build fix for Leopard. + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::adjustLineToPixelBoundaries): + +2009-08-13 Mike Fenton <mike.fenton@torchmobile.com> + + Reviewed by Adam Treat. + + Style fixes based on cpp_style.py and WebKit Style guide for + GraphicsContextCG.cpp + + https://bugs.webkit.org/show_bug.cgi?id=28268 + + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::drawEllipse): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::applyStrokePattern): + (WebCore::GraphicsContext::drawPath): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipOutEllipseInRect): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::clipToImageBuffer): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::GraphicsContext::roundToDevicePixels): + (WebCore::GraphicsContext::drawLineForText): + (WebCore::GraphicsContext::setURLForRect): + (WebCore::GraphicsContext::setImageInterpolationQuality): + (WebCore::GraphicsContext::imageInterpolationQuality): + (WebCore::GraphicsContext::setPlatformTextDrawingMode): + (WebCore::GraphicsContext::setCompositeOperation): + +2009-08-13 Mike Fenton <mike.fenton@torchmobile.com> + + Reviewed by Adam Treat. + + Style fixes based on cpp_style.py and WebKit Style guide for + GraphicsContext.cpp/h, GraphicsContextCairo.cpp and GraphicsContextQt.cpp. + + https://bugs.webkit.org/show_bug.cgi?id=28268 + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::save): + (WebCore::GraphicsContext::restore): + (GraphicsContext::drawText): + (GraphicsContext::initFocusRing): + (GraphicsContext::focusRingBoundingRect): + (GraphicsContext::drawImage): + * platform/graphics/GraphicsContext.h: + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::toCairoOperator): + * platform/graphics/qt/GraphicsContextQt.cpp: + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Change HTMLAreaElement to use OwnArrayPtr + https://bugs.webkit.org/show_bug.cgi?id=28386 + + * html/HTMLAreaElement.cpp: + (WebCore::HTMLAreaElement::HTMLAreaElement): Removed unneeded initializer. + (WebCore::HTMLAreaElement::~HTMLAreaElement): Removed unneeded delete call. + (WebCore::HTMLAreaElement::parseMappedAttribute): Use the set function + instead of deletion followed by assignment. + * html/HTMLAreaElement.h: Use OwnArrayPtr. + +2009-08-17 Darin Adler <darin@apple.com> + + Fix Windows build. + + * dom/make_names.pl: Add back cast to (void*) needed on Windows. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Move noResize from HTMLFrameElementBase to HTMLFrameElement + https://bugs.webkit.org/show_bug.cgi?id=28384 + + * html/HTMLFrameElement.cpp: + (WebCore::HTMLFrameElement::HTMLFrameElement): Initialize m_noResize. + (WebCore::HTMLFrameElement::parseMappedAttribute): Set m_noResize to true + here if noresizeAttr is changed. This code was moved here from + HTMLFrameElementBase, but I added some FIXME comments. + (WebCore::HTMLFrameElement::setNoResize): Set the attribute based on + boolean argument. Moved here from HTMLFrameElementBase. + + * html/HTMLFrameElement.h: Moved noResize, setNoResize, and m_noResize + here from HTMLFrameElementBase. + + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::HTMLFrameElementBase): Removed m_noResize. + (WebCore::HTMLFrameElementBase::parseMappedAttribute): Removed code to parse + noresizeAttr. + + * html/HTMLFrameElementBase.h: Removed noResize, setNoResize, and m_noResize. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Tweak HTMLFrameElementBase so that m_URL can be private + https://bugs.webkit.org/show_bug.cgi?id=28385 + + * html/HTMLFrameElement.cpp: + (WebCore::HTMLFrameElement::rendererIsNeeded): Removed m_URL argument. + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::isURLAllowed): Use m_URL instead of + taking an argument. + (WebCore::HTMLFrameElementBase::openURL): Removed m_URL argument. + * html/HTMLFrameElementBase.h: Removed argument from isURLAllowed function. + * html/HTMLIFrameElement.cpp: + (WebCore::HTMLIFrameElement::rendererIsNeeded): Removed m_URL argument. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + HTMLViewSourceDocument should use smart pointers + https://bugs.webkit.org/show_bug.cgi?id=28378 + + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument): Don't initialize + pointers any more since RefPtr starts 0 by default. + (WebCore::HTMLViewSourceDocument::createContainingTable): Use more specific + types for local variables. + (WebCore::HTMLViewSourceDocument::addSpanWithClassName): Return a PassRefPtr, + and use a RefPtr of a more specific type for a local variable. + (WebCore::HTMLViewSourceDocument::addLine): Use more specific types for local + variables, and use RefPtr as well. + (WebCore::HTMLViewSourceDocument::addLink): Return a PassRefPtr, and use a + RefPtr of a more specific type for a local variable. + + * html/HTMLViewSourceDocument.h: Change return types to PassRefPtr and + data member types to RefPtr. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + DOM attribute getter/setter functions should use const AtomicString& type + https://bugs.webkit.org/show_bug.cgi?id=25425 + + Convert 4 more classes. These are classes I am going to make other changes + to soon, so it's good to have this use of Reflect in the IDL out of the way. + + * html/HTMLEmbedElement.idl: Use Reflect for many attributes. + * html/HTMLFrameElement.idl: Ditto. + * html/HTMLIFrameElement.idl: Ditto. + * html/HTMLObjectElement.idl: Ditto. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Script to create element factory needs changes to accommodate calling create + https://bugs.webkit.org/show_bug.cgi?id=28379 + + * dom/make_names.pl: Tweak formatting. Remove lots of unneeded quotes + around names used inside {}. Added new createWithNew property for tags + that makes the factory use a create function instead of calling new. + Renamed functions with initialize in their name to have default in their + name, since they return an array full of default values and don't themselves + initialize anything. + +2009-08-16 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + StyledElement should use ASCIICType instead of having its own toHex function + https://bugs.webkit.org/show_bug.cgi?id=28377 + + * dom/StyledElement.cpp: + (WebCore::StyledElement::addCSSColor): Use isASCIIHexDigit and toASCIIHexValue. + +2009-08-16 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + execCommand("InsertHorizontalRule") inserts a broken <hr> element + https://bugs.webkit.org/show_bug.cgi?id=28375 + + * editing/EditorCommand.cpp: + (WebCore::executeInsertHorizontalRule): Create an HTMLHRElement + instead of just an HTMLElement. + +2009-08-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> + + Reviewed by George Staikos. + + [WML] <option> element & 'onpick' events - history navigation is broken + https://bugs.webkit.org/show_bug.cgi?id=28371 + + After selecting an option element with an 'onpick' event associated with a 'go' task, + the navigation is executed. When going back in history, the same 'onpick' event is fired + again. Fix that problem, add wml/option-element-onpick-recursion.html covering the bug. + + Test: wml/option-element-onpick-recursion.html + + * wml/WMLOptionElement.cpp: + (WebCore::WMLOptionElement::handleIntrinsicEventIfNeeded): + * wml/WMLSelectElement.cpp: + (WebCore::WMLSelectElement::WMLSelectElement): + (WebCore::WMLSelectElement::selectInitialOptions): + * wml/WMLSelectElement.h: + (WebCore::WMLSelectElement::initialized): + +2009-08-16 Anthony Ricaud <rik@webkit.org> + + Reviewed by Timothy Hatcher. + + Inspector Resource filtering: keyboard Navigation always uses ALL resources + https://bugs.webkit.org/show_bug.cgi?id=28231 + + Determine if a resource is selectable on user action. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourceSidebarTreeElement.prototype.get selectable): + +2009-08-16 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/28355> Replace MAX()/MIN() macros with type-safe std::max()/min() templates + + Reviewed by Dan Bernstein. + + * accessibility/mac/AccessibilityObjectWrapper.mm: + (AXAttributeStringSetSpelling): Changed MIN() to min(). + * platform/graphics/mac/FontMacATSUI.mm: + (WebCore::Font::selectionRectForComplexText): Changed MAX() to + max() and MIN() to min(). + (WebCore::Font::floatWidthForComplexText): Ditto. + * platform/graphics/mac/SimpleFontDataMac.mm: Added using + std::max statement. + (WebCore::SimpleFontData::platformInit): Changed MAX() to max(). + * platform/text/mac/TextCodecMac.cpp: + (WebCore::TextCodecMac::decode): Changed MIN() to min(). + +2009-08-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> + + Reviewed by George Staikos. + + [WML] Cleanup WMLIntrinsicEventHandling code + https://bugs.webkit.org/show_bug.cgi?id=28358 + + Remove superflous "Event* evt" parameter from executeTask() methods. It's a leftover from the initial WML merge. + + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::defaultEventHandler): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::defaultEventHandler): + * wml/WMLGoElement.cpp: + (WebCore::WMLGoElement::executeTask): + * wml/WMLGoElement.h: + * wml/WMLIntrinsicEventHandler.cpp: + (WebCore::WMLIntrinsicEventHandler::triggerIntrinsicEvent): + * wml/WMLPrevElement.cpp: + (WebCore::WMLPrevElement::executeTask): + * wml/WMLPrevElement.h: + * wml/WMLRefreshElement.cpp: + (WebCore::WMLRefreshElement::executeTask): + * wml/WMLRefreshElement.h: + * wml/WMLTaskElement.h: + +2009-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: A handful of DOMAgent-related fixes and cleanups. + + - renamed elementId to nodeId in operations on nodes. + - added load listeners to frame owners in InspectorDOMAgent. + - removed InspectorController::inspectedWindowScriptObjectCleared event. + - preserved isViaInspector flag for 'via inspector' marker to survive styles update. + - removed contentDocument-related logic from ElementsPanel since it is handled in + the InspectorDOMAgent. + - removed DOM listeners unregistration and corresponding events from InspectorController. + - made this.styles 'private' in ElementsPanel. + - added TODO for the handleCopy processing. + + https://bugs.webkit.org/show_bug.cgi?id=28356 + + * WebCore.order: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::getChildNodes): + (WebCore::InspectorBackend::setTextNodeValue): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::startListening): + (WebCore::InspectorDOMAgent::stopListening): + (WebCore::InspectorDOMAgent::handleEvent): + (WebCore::InspectorDOMAgent::pushChildNodesToFrontend): + (WebCore::InspectorDOMAgent::getChildNodes): + (WebCore::InspectorDOMAgent::pushNodePathToFrontend): + (WebCore::InspectorDOMAgent::setTextNodeValue): + (WebCore::InspectorDOMAgent::buildObjectForNode): + (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): + (WebCore::InspectorDOMAgent::innerParentNode): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorFrontend.cpp: + * inspector/InspectorFrontend.h: + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMDocument.prototype.addEventListener): + (WebInspector.DOMDocument.prototype.removeEventListener): + (WebInspector.DOMDocument.prototype._fireDomEvent): + (WebInspector.DOMAgent.prototype.getChildNodesAsync.mycallback): + (WebInspector.DOMAgent.prototype.getChildNodesAsync): + (WebInspector.DOMAgent.prototype._setChildNodes): + (WebInspector.CSSStyleDeclaration.parseRule): + (WebInspector.childNodeInserted): + (WebInspector.childNodeRemoved): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel): + (WebInspector.ElementsPanel.prototype.reset): + (WebInspector.ElementsPanel.prototype.addStyleChange): + (WebInspector.ElementsPanel.prototype.removeStyleChange): + (WebInspector.ElementsPanel.prototype._updateModifiedNodes): + (WebInspector.ElementsPanel.prototype.updateBreadcrumb): + (WebInspector.ElementsPanel.prototype.handleCopyEvent): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype.set rootDOMNode): + (WebInspector.ElementsTreeOutline.prototype.findTreeElement): + (WebInspector.ElementsTreeElement): + (WebInspector.ElementsTreeElement.prototype._updateChildren.updateChildrenOfNode): + (WebInspector.ElementsTreeElement.prototype._updateChildren): + (WebInspector.ElementsTreeElement.prototype.onexpand): + * inspector/front-end/InjectedScript.js: + (InjectedScript.addStyleSelector): + (InjectedScript._serializeRule): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection): + * inspector/front-end/inspector.js: + (WebInspector.set hoveredDOMNode): + * inspector/front-end/treeoutline.js: + (TreeOutline.prototype.findTreeElement): + * inspector/front-end/utilities.js: + (Node.prototype.enclosingNodeOrSelfWithNodeNameInArray): + (Node.prototype.enclosingNodeOrSelfWithClass): + (isAncestorNode): + (firstCommonNodeAncestor): + (traverseNextNode): + (traversePreviousNode): + (): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::dispatchWindowObjectAvailable): + * page/android/InspectorControllerAndroid.cpp: + +2009-08-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt + + Optimize updateFillImages() to not add/remove clients every time + https://bugs.webkit.org/show_bug.cgi?id=28334 + + Optimize the case where old and new just have a single layer pointing to the same (or no) + image. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::updateFillImages): + +2009-08-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Implement animations of multiple text-shadows and -webkit-box-shadows. + https://bugs.webkit.org/show_bug.cgi?id=28266 + + Test: transitions/multiple-shadow-transitions.html + + * page/animation/AnimationBase.cpp: + (WebCore::PropertyWrapperShadow::equals): + (WebCore::PropertyWrapperShadow::blend): + +2009-08-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Make transitions work for position and size of multiple backgrounds and masks. + https://bugs.webkit.org/show_bug.cgi?id=28266 + + Make background-position, background-size, -webkit-mask-position and -webkit-mask-size + properties animatable with multiple backgrounds, rather than just animating the first one. + + Tests: transitions/multiple-background-size-transitions.html + transitions/multiple-background-transitions.html + transitions/multiple-mask-transitions.html + + * page/animation/AnimationBase.cpp: + (WebCore::FillLayerPropertyWrapperBase::FillLayerPropertyWrapperBase): + (WebCore::FillLayerPropertyWrapperBase::~FillLayerPropertyWrapperBase): + (WebCore::FillLayerPropertyWrapperGetter::FillLayerPropertyWrapperGetter): + (WebCore::FillLayerPropertyWrapperGetter::equals): + (WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper): + (WebCore::FillLayerPropertyWrapper::blend): + (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper): + (WebCore::FillLayersPropertyWrapper::equals): + (WebCore::FillLayersPropertyWrapper::blend): + (WebCore::ensurePropertyMap): + * rendering/style/FillLayer.h: + (WebCore::FillLayer::setXPosition): + (WebCore::FillLayer::setYPosition): + (WebCore::FillLayer::setSize): + +2009-08-15 George Staikos <george.staikos@torchmobile.com> + + Reviewed by Jan Alonzo. + + Don't crash in fieldset code when WML is enabled. + https://bugs.webkit.org/show_bug.cgi?id=28012 + + Test: fast/wml/html-fieldset-crash.html + + * rendering/RenderFieldset.cpp: + (WebCore::RenderFieldset::findLegend): ++brackets + +2009-08-15 Sam Weinig <sam@webkit.org> + + Try and enable EventSource on Windows. + + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/build-generated-files.sh: + +2009-08-15 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Setting attribute event listeners to the body does not set them on the window + https://bugs.webkit.org/show_bug.cgi?id=28343 + + Tests: fast/dom/Window/HTMLBodyElement-window-eventListener-attributes.html + fast/dom/Window/HTMLFrameSetElement-window-eventListener-attributes.html + + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::setOnblur): Use setWindowAttributeEventListener instead of setAttributeEventListener. + (WebCore::HTMLBodyElement::setOnerror): Ditto. + (WebCore::HTMLBodyElement::setOnfocus): Ditto. + (WebCore::HTMLBodyElement::setOnload): Ditto. + (WebCore::HTMLBodyElement::setOnbeforeunload): Ditto. + (WebCore::HTMLBodyElement::setOnmessage): Ditto. + (WebCore::HTMLBodyElement::setOnoffline): Ditto. + (WebCore::HTMLBodyElement::setOnonline): Ditto. + (WebCore::HTMLBodyElement::setOnresize): Ditto. + (WebCore::HTMLBodyElement::setOnstorage): Ditto. + (WebCore::HTMLBodyElement::setOnunload): Ditto. + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::setOnblur): Ditto. + (WebCore::HTMLFrameSetElement::setOnerror): Ditto. + (WebCore::HTMLFrameSetElement::setOnfocus): Ditto. + (WebCore::HTMLFrameSetElement::setOnload): Ditto. + (WebCore::HTMLFrameSetElement::setOnbeforeunload): Ditto. + (WebCore::HTMLFrameSetElement::setOnmessage): Ditto. + (WebCore::HTMLFrameSetElement::setOnoffline): Ditto. + (WebCore::HTMLFrameSetElement::setOnonline): Ditto. + (WebCore::HTMLFrameSetElement::setOnresize): Ditto. + (WebCore::HTMLFrameSetElement::setOnstorage): Ditto. + (WebCore::HTMLFrameSetElement::setOnunload): Ditto. + +2009-08-15 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fix up some IDL comments. + + * html/HTMLBodyElement.idl: + * html/HTMLFrameSetElement.idl: + +2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com> + + Reviewed by Sam Weinig. + + Added implementation of the EventSource object that enables + server-sent events from HTML5. + http://dev.w3.org/html5/eventsource/ + https://bugs.webkit.org/show_bug.cgi?id=14997 + + Tests: fast/eventsource/eventsource-attribute-listeners.html + fast/eventsource/eventsource-constructor.html + http/tests/eventsource/eventsource-bad-mime-type.html + http/tests/eventsource/eventsource-parse-event-stream.html + http/tests/eventsource/eventsource-reconnect.html + http/tests/eventsource/eventsource-status-code-states.html + http/tests/eventsource/workers/eventsource-simple.html + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::eventSource): + * bindings/js/JSEventSourceConstructor.cpp: Added. + (WebCore::): + (WebCore::JSEventSourceConstructor::JSEventSourceConstructor): + (WebCore::constructEventSource): + (WebCore::JSEventSourceConstructor::getConstructData): + * bindings/js/JSEventSourceConstructor.h: Added. + (WebCore::JSEventSourceConstructor::classInfo): + * bindings/js/JSEventSourceCustom.cpp: Added. + (WebCore::JSEventSource::markChildren): + (WebCore::JSEventSource::addEventListener): + (WebCore::JSEventSource::removeEventListener): + * bindings/js/JSEventTarget.cpp: + (WebCore::toJS): + (WebCore::toEventTarget): + * bindings/js/JSWorkerContextCustom.cpp: + (WebCore::JSWorkerContext::eventSource): + * dom/EventNames.h: + * dom/EventTarget.cpp: + (WebCore::EventTarget::toEventSource): + * dom/EventTarget.h: + * page/DOMWindow.idl: + * page/EventSource.cpp: Added. + (WebCore::EventSource::EventSource): + (WebCore::EventSource::~EventSource): + (WebCore::EventSource::connect): + (WebCore::EventSource::endRequest): + (WebCore::EventSource::scheduleReconnect): + (WebCore::EventSource::reconnectTimerFired): + (WebCore::EventSource::url): + (WebCore::EventSource::readyState): + (WebCore::EventSource::close): + (WebCore::EventSource::scriptExecutionContext): + (WebCore::EventSource::addEventListener): + (WebCore::EventSource::removeEventListener): + (WebCore::EventSource::dispatchEvent): + (WebCore::EventSource::didReceiveResponse): + (WebCore::EventSource::didReceiveData): + (WebCore::EventSource::didFinishLoading): + (WebCore::EventSource::didFail): + (WebCore::EventSource::didFailRedirectCheck): + (WebCore::EventSource::parseEventStream): + (WebCore::EventSource::parseEventStreamLine): + (WebCore::EventSource::dispatchGenericEvent): + (WebCore::EventSource::dispatchMessageEvent): + (WebCore::EventSource::stop): + * page/EventSource.h: Added. + (WebCore::EventSource::create): + (WebCore::EventSource::): + (WebCore::EventSource::setOnopen): + (WebCore::EventSource::onopen): + (WebCore::EventSource::setOnmessage): + (WebCore::EventSource::onmessage): + (WebCore::EventSource::setOnerror): + (WebCore::EventSource::onerror): + (WebCore::EventSource::toEventSource): + (WebCore::EventSource::eventListeners): + (WebCore::EventSource::refEventTarget): + (WebCore::EventSource::derefEventTarget): + * page/EventSource.idl: Added. + * workers/WorkerContext.idl: + +2009-08-15 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Minor DOMAgent bugfixes. + + https://bugs.webkit.org/show_bug.cgi?id=28177 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::nodeForId): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + +2009-08-15 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Evaluating objects while on a breakpoint dumps string + representation instead of live object. + + https://bugs.webkit.org/show_bug.cgi?id=28280 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.completions.this._evalInInspectedWindow): + (WebInspector.ConsoleView.prototype.completions): + (WebInspector.ConsoleView.prototype._reportCompletions): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame.delayedEvaluation): + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame): + (WebInspector.ScriptsPanel.prototype.variablesInSelectedCallFrame): + +2009-08-15 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding two new files to WebCore/platform/haiku: + LocalizedStringsHaiku.cpp and LoggingHaiku.cpp + https://bugs.webkit.org/show_bug.cgi?id=28129 + + * platform/haiku/LocalizedStringsHaiku.cpp: Added. + (WebCore::submitButtonDefaultLabel): + (WebCore::inputElementAltText): + (WebCore::resetButtonDefaultLabel): + (WebCore::defaultLanguage): + (WebCore::searchableIndexIntroduction): + (WebCore::fileButtonChooseFileLabel): + (WebCore::fileButtonNoFileSelectedLabel): + (WebCore::contextMenuItemTagOpenLinkInNewWindow): + (WebCore::contextMenuItemTagDownloadLinkToDisk): + (WebCore::contextMenuItemTagCopyLinkToClipboard): + (WebCore::contextMenuItemTagOpenImageInNewWindow): + (WebCore::contextMenuItemTagDownloadImageToDisk): + (WebCore::contextMenuItemTagCopyImageToClipboard): + (WebCore::contextMenuItemTagOpenFrameInNewWindow): + (WebCore::contextMenuItemTagCopy): + (WebCore::contextMenuItemTagGoBack): + (WebCore::contextMenuItemTagGoForward): + (WebCore::contextMenuItemTagStop): + (WebCore::contextMenuItemTagReload): + (WebCore::contextMenuItemTagCut): + (WebCore::contextMenuItemTagPaste): + (WebCore::contextMenuItemTagNoGuessesFound): + (WebCore::contextMenuItemTagIgnoreSpelling): + (WebCore::contextMenuItemTagLearnSpelling): + (WebCore::contextMenuItemTagSearchWeb): + (WebCore::contextMenuItemTagLookUpInDictionary): + (WebCore::contextMenuItemTagOpenLink): + (WebCore::contextMenuItemTagIgnoreGrammar): + (WebCore::contextMenuItemTagSpellingMenu): + (WebCore::contextMenuItemTagShowSpellingPanel): + (WebCore::contextMenuItemTagCheckSpelling): + (WebCore::contextMenuItemTagCheckSpellingWhileTyping): + (WebCore::contextMenuItemTagCheckGrammarWithSpelling): + (WebCore::contextMenuItemTagFontMenu): + (WebCore::contextMenuItemTagBold): + (WebCore::contextMenuItemTagItalic): + (WebCore::contextMenuItemTagUnderline): + (WebCore::contextMenuItemTagOutline): + (WebCore::contextMenuItemTagWritingDirectionMenu): + (WebCore::contextMenuItemTagDefaultDirection): + (WebCore::contextMenuItemTagLeftToRight): + (WebCore::contextMenuItemTagRightToLeft): + (WebCore::contextMenuItemTagInspectElement): + (WebCore::searchMenuNoRecentSearchesText): + (WebCore::searchMenuRecentSearchesText): + (WebCore::searchMenuClearRecentSearchesText): + (WebCore::unknownFileSizeText): + (WebCore::AXWebAreaText): + (WebCore::AXLinkText): + (WebCore::AXListMarkerText): + (WebCore::AXImageMapText): + (WebCore::AXHeadingText): + (WebCore::imageTitle): + (WebCore::contextMenuItemTagTextDirectionMenu): + (WebCore::AXButtonActionVerb): + (WebCore::AXTextFieldActionVerb): + (WebCore::AXRadioButtonActionVerb): + (WebCore::AXCheckedCheckBoxActionVerb): + (WebCore::AXUncheckedCheckBoxActionVerb): + (WebCore::AXLinkActionVerb): + (WebCore::AXDefinitionListTermText): + (WebCore::AXDefinitionListDefinitionText): + * platform/haiku/LoggingHaiku.cpp: Added. + (WebCore::InitializeLoggingChannelsIfNecessary): + +2009-08-15 Darin Adler <darin@apple.com> + + Fix GTK build. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (fallbackObject): Pass 0 for document. Should be OK at least for now. + +2009-08-15 Darin Adler <darin@apple.com> + + Fix Qt build. + + * dom/XMLTokenizerQt.cpp: Use create functions instead of calling new + directly to make CDATASection and Comment nodes. + +2009-08-14 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Make DOM classes start with a reference count of 1, like all other RefCounted + https://bugs.webkit.org/show_bug.cgi?id=28068 + + First half, everything except for element classes. + + * GNUmakefile.am: Removed DocPtr.h. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + + * dom/Attr.cpp: + (WebCore::Attr::Attr): Added a call to createTextChild here so callers don't + have to call it explicitly. + (WebCore::Attr::create): Added. + (WebCore::Attr::setValue): Changed to take AtomicString. + (WebCore::Attr::cloneNode): Use create. + + * dom/Attr.h: Added a create function. Made the constructor private, + and a lot of other functions private as well. + + * dom/Attribute.cpp: + (WebCore::Attribute::createAttrIfNeeded): Use Attr::create. + + * dom/CDATASection.cpp: + (WebCore::CDATASection::create): Added. + (WebCore::CDATASection::cloneNode): Use create. + (WebCore::CDATASection::virtualCreate): Ditto. + + * dom/CDATASection.h: Added a create function. Made everything private. + Removed unneeded destructor declaration. + + * dom/CharacterData.cpp: + (WebCore::CharacterData::CharacterData): Replaced the multiple constructors + with a single one that takes ConstructionType. + + * dom/CharacterData.h: Made more functions be protected and private. + Made m_data be private. + + * dom/Comment.cpp: + (WebCore::Comment::Comment): Got rid of an extra constructor. + (WebCore::Comment::create): Added. + (WebCore::Comment::cloneNode): Call create. + + * dom/Comment.h: Added a create function. Made everything private. + + * dom/ContainerNode.cpp: + (WebCore::dispatchChildInsertionEvents): Use RefPtr instead of DocPtr. + (WebCore::dispatchChildRemovalEvents): Ditto. + + * dom/ContainerNode.h: Made the constructor protected and passed + ConstructionType instead of an isElement boolean. + + * dom/DocPtr.h: Removed. + + * dom/Document.cpp: + (WebCore::Document::Document): Simplified the code that sets m_document + since it's no longer a smart pointer. + (WebCore::Document::removedLastRef): Use explicit calls to selfOnlyRef + and selfOnlyDeref instead of a DocPtr in here. + (WebCore::Document::~Document): Simplified the code that sets m_document + since it's no longer a smart pointer. + (WebCore::Document::createDocumentFragment): Call create. + (WebCore::Document::createTextNode): Ditto. + (WebCore::Document::createComment): Ditto. + (WebCore::Document::createCDATASection): Ditto. + (WebCore::Document::createProcessingInstruction): Ditto. + (WebCore::Document::createEntityReference): Ditto. + (WebCore::Document::createEditingTextNode): Ditto. + (WebCore::Document::importNode): Call Attr::create. + (WebCore::Document::createAttributeNS): Ditto. + + * dom/Document.h: Call adoptRef. Made a lot of functions private and + protected and sorted them so public functions come first. + + * dom/DocumentFragment.cpp: + (WebCore::DocumentFragment::create): Added. + (WebCore::DocumentFragment::cloneNode): Call create. + * dom/DocumentFragment.h: Added create. + + * dom/DocumentType.cpp: + (WebCore::DocumentType::DocumentType): Pass type to Node constructor. + (WebCore::DocumentType::cloneNode): Use create. + * dom/DocumentType.h: + (WebCore::DocumentType::create): Call adoptRef. + + * dom/EditingText.cpp: + (WebCore::EditingText::create): Added. + * dom/EditingText.h: Added a create function. Made everything private. + + * dom/Element.cpp: + (WebCore::Element::Element): Pass CreateElementZeroRefCount to preserve + the zero reference count behavior for classes derived from Element. + + * dom/EntityReference.cpp: + (WebCore::EntityReference::create): Added. + (WebCore::EntityReference::cloneNode): Call create. + * dom/EntityReference.h: Added create. Made everything private. + + * dom/Node.cpp: + (WebCore::Node::initialRefCount): Added. Inline helper function for + the constructor. + (WebCore::Node::isContainer): Ditto. + (WebCore::Node::isElement): Ditto. + (WebCore::Node::isText): Ditto. + (WebCore::Node::Node): Changed to take a construction type argument. + Since m_document is now a normal pointer, added a call to selfOnlyRef. + (WebCore::Node::~Node): Ditto, but selfOnlyDeref. + (WebCore::Node::setDocument): Added selfOnlyRef/Deref calls. + (WebCore::Node::appendTextContent): Use the data function instead of + calling nodeValue functions, which do the same thing in a roundabout way. + + * dom/Node.h: Made the constructor protected and replaced the multiple + arguments iwth a single ConstructionType argument. Sorted the public + things first. + + * dom/Notation.h: Made most things private. + * dom/Notation.cpp: Removed extra constructor. + + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::create): Added. + (WebCore::ProcessingInstruction::cloneNode): Call create. + * dom/ProcessingInstruction.h: Added create function. Made many other + members private. + + * dom/Range.cpp: + (WebCore::Range::processContents): Use DocumentFragment::create. + + * dom/Text.cpp: + (WebCore::Text::Text): Updated for base class change. + (WebCore::Text::create): Added. + (WebCore::Text::splitText): Changed to not require access to m_data. + (WebCore::Text::cloneNode): Call create. + (WebCore::Text::createRenderer): Call dataImpl. + (WebCore::Text::attach): Call data. + (WebCore::Text::recalcStyle): Call dataImpl. + (WebCore::Text::virtualCreate): Call create. + (WebCore::Text::createWithLengthLimit): Call create. + (WebCore::Text::formatForDebugger): Call data. + + * dom/Text.h: Added a create function. Made many other members private. + Renamed createNew to virtualCreate. + + * dom/XMLTokenizer.cpp: + (WebCore::XMLTokenizer::enterText): Call Text::create. + + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::XMLTokenizer::cdataBlock): Call CDATASection::create. + (WebCore::XMLTokenizer::comment): Call Comment::create. + + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::deleteInsignificantText): + Call data instead of string. + + * editing/CreateLinkCommand.cpp: + (WebCore::CreateLinkCommand::doApply): Call Text::create. + + * editing/EditorCommand.cpp: + (WebCore::executeInsertNode): Call DocumentFragment::create. + + * editing/SplitTextNodeCommand.cpp: + (WebCore::SplitTextNodeCommand::doApply): Call Text::create. + + * editing/markup.cpp: + (WebCore::appendStartMarkup): Call data instead of nodeValue. + + * html/HTMLDocument.h: + (WebCore::HTMLDocument::create): Call adoptRef. + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::createContextualFragment): Call DocumentFragment::create. + (WebCore::replaceChildrenWithFragment): Call data instead of string. + (WebCore::replaceChildrenWithText): Call Text::create. + (WebCore::HTMLElement::setInnerText): Call DocumentFragment::create and + Text::create. + (WebCore::HTMLElement::setOuterText): Call Text::create. + + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): Call Text::create. + + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::setText): Call Text::create. + + * html/HTMLParser.cpp: + (WebCore::HTMLParser::textCreateErrorCheck): Call Text::create. + (WebCore::HTMLParser::commentCreateErrorCheck): Call Comment::create. + (WebCore::HTMLParser::handleIsindex): Call Text::create. + + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::addText): Call Text::create. + + * html/HTMLViewSourceDocument.h: + (WebCore::HTMLViewSourceDocument::create): Call adoptRef. + + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryTokenizer::appendEntry): Call Text::create. + (WebCore::FTPDirectoryTokenizer::createTDForFilename): Call Text::create. + + * loader/FTPDirectoryDocument.h: + (WebCore::FTPDirectoryDocument::create): Call adoptRef. + * loader/ImageDocument.h: + (WebCore::ImageDocument::create): Ditto. + * loader/MediaDocument.h: + (WebCore::MediaDocument::create): Ditto. + * loader/PlaceholderDocument.h: + (WebCore::PlaceholderDocument::create): Ditto. + * loader/PluginDocument.h: + (WebCore::PluginDocument::create): Ditto. + * loader/TextDocument.h: + (WebCore::TextDocument::create): Ditto. + + * loader/loader.cpp: + (WebCore::Loader::Host::didFinishLoading): Use RefPtr instead of DocPtr. + (WebCore::Loader::Host::didFail): Ditto. + + * platform/TreeShared.h: + (WebCore::TreeShared::TreeShared): Added an initialRefCount argument, + defaulting to 1. Node still sometimes initializes it to 0 instead for now. + + * rendering/RenderText.cpp: + (WebCore::RenderText::originalText): Use dataImpl instead of string. + + * rendering/RenderTextFragment.cpp: + (WebCore::RenderTextFragment::originalText): Use dataImpl instead of string. + (WebCore::RenderTextFragment::previousCharacter): Ditto. + + * svg/SVGDocument.h: + (WebCore::SVGDocument::create): Use adoptRef. + + * svg/SVGElementInstance.cpp: + (WebCore::SVGElementInstance::SVGElementInstance): Updated to take a + PassRefPtr. + + * svg/SVGElementInstance.h: Made everything private. + + * wml/WMLDocument.h: + (WebCore::WMLDocument::create): Called adoptRef. + + * xml/XPathNamespace.cpp: + (WebCore::XPathNamespace::XPathNamespace): Take AtomicString arguments. + * xml/XPathNamespace.h: Made everything private. + + * xml/XSLTProcessor.cpp: + (WebCore::createFragmentFromSource): Use DocumentFragment::create and + Text::create. + +2009-08-13 Jon Honeycutt <jhoneycutt@apple.com> + + Part of <rdar://problem/6218721> No MSAA focus events fired for Webkit + nightly (20866) + + https://bugs.webkit.org/show_bug.cgi?id=20866 + + Reviewed by Oliver Hunt. + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::AXObjectCache): + Changed to take a pointer to its owner document. This is used by + AXObjectCache::handleFocusedUIElementChanged(). + (WebCore::AXObjectCache::focusedUIElementForPage): + Code moved from AccessibilityRenderObject::focusedUIElement(). Modified + to be a static function and to take a pointer to a Page. + (WebCore::AXObjectCache::platformGenerateAXID): + Moved the code to generate the next AXID from getAXID() to here. Added + a #if to make this non-WIN only, because Windows has its own + implementation. + (WebCore::AXObjectCache::getAXID): + Ensure that we generate a positive AXID, ranging from 1 to LONG_MAX. + + * accessibility/AXObjectCache.h: + Add a declaration for Document and Page. Removed the declaration of + AccessibilityObject, because we include the header. Reordered the + declaration of Node alphabetically. Moved the typedef for AXID to + AccessibilityObject. Removed some trailing whitespace. Added a member + variable to hold a pointer to the owner Document. + (WebCore::AXObjectCache::AXObjectCache): + Changed to take a pointer to its owner Document. + (WebCore::AXObjectCache::focusedUIElementForPage): + Added; code moved from AccessiblityRenderObject::focusedUIElement(). + Returns the focused element with respect to accessibility. + (WebCore::AXObjectCache::platformGenerateAXID): + Declare a function to generate an AXID. + (WebCore::AXObjectCache::objectFromAXID): + Return the AccessibilityObject with the given AXID. + + * accessibility/AccessibilityObject.h: + Moved the typedef for AXID from AXObjectCache to here. Made the m_id + member use the typedef. + (WebCore::AccessibilityObject::axObjectID): + Changed the return type to use the typedef. + (WebCore::AccessibilityObject::setAXObjectID): + Changed the argument type to use the typedef. + + * accessibility/AccessibilityRenderObject.cpp: + Removed some unneeded #includes. + (WebCore::AccessibilityRenderObject::focusedUIElement): + Moved the code to AXObjectCache::focusedUIElementForPage(), which we now + call. + + * accessibility/win/AXObjectCacheWin.cpp: + (WebCore::AXObjectCache::platformGenerateAXID): + Ensure that we generate an AXID that is in the range 1 to LONG_MAX. + (WebCore::AXObjectCache::handleFocusedUIElementChanged): + If the Document has no Page, return. If the Page has not focused + element (respecting accessibility), return. Assert that the + accessibility of the focused element is not ignored, and that the + object's AXID will be negative and fit into a LONG when negated. + Broadcast a focus event for the object. + + * dom/Document.cpp: + (WebCore::Document::axObjectCache): + Pass this when creating the AXObjectCache. + (WebCore::Document::setFocusedNode): + Call AXObjectCache::handleFocusedUIElementChanged() on Windows. + +2009-08-14 Jiahua Huang <jhuangjiahua@gmail.com> + + Reviewed by Jan Alonzo. + + [gtk] Pasteboard/GtkClipboard can't handle the "text/html" target. + https://bugs.webkit.org/show_bug.cgi?id=27028 + + Remove the improper set of enum WebKitWebViewTargetInfo + by grabbing the target infos via m_helper. + + * manual-tests/gtk/copy-htmltext.html: Added. + * platform/Pasteboard.h: + * platform/gtk/PasteboardGtk.cpp: + (WebCore::clipboard_get_contents_cb): + * platform/gtk/PasteboardHelper.h: + +2009-08-14 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Fix an assertion when bringing up the Inspector. + https://bugs.webkit.org/show_bug.cgi?id=28318 + + The fix for bug 28295 assumed that image clients count the number of times + addClient/removeClient is called. That was true for CachedResource clients, + but not StyleGeneratedImage clients, which pass the call onto CSSImageGeneratorValue. + + Fix by making CSSImageGeneratorValue count the number of times a client is + added/removed. + + * css/CSSCanvasValue.cpp: + (WebCore::CSSCanvasValue::canvasChanged): + (WebCore::CSSCanvasValue::canvasResized): + * css/CSSImageGeneratorValue.cpp: + (WebCore::CSSImageGeneratorValue::addClient): + (WebCore::CSSImageGeneratorValue::removeClient): + (WebCore::CSSImageGeneratorValue::getImage): + * css/CSSImageGeneratorValue.h: + +2009-08-14 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Kevin Ollivier. + + Correct libcurl crash when downloading local files. + https://bugs.webkit.org/show_bug.cgi?id=28312 + + No new tests. Test is covered by fast/encoding/char-encoding-mac.html. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::handleLocalReceiveResponse): New static function that + performs the local setting of valid URL and firing didReceiveResponse. + This code was moved from writeCallback. + (WebCore::writeCallback): Move local file handling to static function + (above) and use the function instead. + (WebCore::readCallback): Add check + for responseFired, and handle as a local file if it was not. + +2009-08-14 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Oliver Hunt. + + [Haiku] Fix RenderThemeHaiku build. + https://bugs.webkit.org/show_bug.cgi?id=28307 + + * platform/haiku/RenderThemeHaiku.cpp: Included RenderThemeHaiku.h + instead of RenderTheme.h. + (WebCore::RenderThemeHaiku::paintCheckbox): Removed the wrong 'virtual' + before the function. + (WebCore::RenderThemeHaiku::paintRadio): Removed the wrong 'virtual' + before the function. + * platform/haiku/RenderThemeHaiku.h: Corrected wrong function definitions. + +2009-08-14 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Oliver Hunt. + + [Haiku] Adding SharedBufferHaiku to WebCore. + https://bugs.webkit.org/show_bug.cgi?id=28309 + + * platform/haiku/SharedBufferHaiku.cpp: Added. + (WebCore::SharedBuffer::createWithContentsOfFile): + * platform/haiku/TemporaryLinkStubs.cpp: Removed unnecessary headers + and functions. + (WebCore::signedPublicKeyAndChallengeString): + (WebCore::getSupportedKeySizes): + +2009-08-14 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + Ensure we're getting the right v8 context in the V8 DOMWindowEvent custom getter. + + https://bugs.webkit.org/show_bug.cgi?id=28311 + + This should fix Chromium failing LayoutTests/fast/events/set-event-in-another-frame.html. + + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_GETTER): + +2009-08-14 Aaron Boodman <aa@chromium.org> + + Reviewed by Alexey Proskuryakov. + + BUG 28134: Move the remaining parts of Access Control from XMLHttpRequest to ThreadableDocumentLoader. + https://bugs.webkit.org/show_bug.cgi?id=28134 + + No new tests added since Access Control was already well tested and this is a pure refactor. + + * loader/DocumentThreadableLoader.cpp: Move a lot of the access control code from XHR in, preserving its + basic strategy. Also, modify the synchronous path to not be a special case, but reuse more of the async + path. + + (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Go through the async path and pass additional flags. + (WebCore::DocumentThreadableLoader::create): Group enum params into an options struct. + (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto. + (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Brought mostly from XHR. + (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight): Ditto. + (WebCore::DocumentThreadableLoader::willSendRequest): Handle preflight case. + (WebCore::DocumentThreadableLoader::didReceiveResponse): Ditto. + (WebCore::DocumentThreadableLoader::didFinishLoading): Ditto. + (WebCore::DocumentThreadableLoader::getShouldUseCredentialStorage): Ditto. + (WebCore::DocumentThreadableLoader::preflightSuccess): Preflight handling. + (WebCore::DocumentThreadableLoader::preflightFailure): Ditto. + (WebCore::DocumentThreadableLoader::loadRequest): Common request function that handles async/sync. + * loader/DocumentThreadableLoader.h: Group enum params into an options struct. + * loader/ThreadableLoader.cpp: Ditto. + (WebCore::ThreadableLoader::create): Ditto. + (WebCore::ThreadableLoader::loadResourceSynchronously): Ditto. + * loader/ThreadableLoader.h: Ditto. + (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Ditto. + * loader/WorkerThreadableLoader.cpp: Ditto. + (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):Ditto. + (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto. + (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Ditto. + (WebCore::WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader): Ditto. + * loader/WorkerThreadableLoader.h: Ditto. + (WebCore::WorkerThreadableLoader::create): Ditto. + * platform/CrossThreadCopier.h: Allow ThreadableLoaderOptions to be copied across threads. + (WebCore::): + * workers/WorkerScriptLoader.cpp: More enum->struct grouping. + (WebCore::WorkerScriptLoader::loadSynchronously): More enum->struct grouping. + (WebCore::WorkerScriptLoader::loadAsynchronously): More enum->struct grouping. + * xml/XMLHttpRequest.cpp: Remove all the access control code and some supporting state. + (WebCore::XMLHttpRequest::XMLHttpRequest): Ditto. + (WebCore::XMLHttpRequest::createRequest): Ditto. + (WebCore::XMLHttpRequest::didFinishLoading): Ditto. + (WebCore::XMLHttpRequest::didReceiveResponse): Ditto. + (WebCore::XMLHttpRequest::didReceiveData): Ditto. + * xml/XMLHttpRequest.h: Ditto. + +2009-08-14 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Rename the confusing isObject(<class>) to inherits(<class>). + It still works on non-objects, returning false. + + * bindings/js/JSEventTarget.cpp: + (WebCore::toEventTarget): + * bindings/js/JSGeolocationCustom.cpp: + (WebCore::createPositionCallback): + (WebCore::createPositionErrorCallback): + * bindings/js/JSNodeFilterCustom.cpp: + (WebCore::toNodeFilter): + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::send): + * bindings/js/JSXSLTProcessorCustom.cpp: + (WebCore::JSXSLTProcessor::importStylesheet): + (WebCore::JSXSLTProcessor::transformToFragment): + (WebCore::JSXSLTProcessor::transformToDocument): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/objc/objc_runtime.mm: + (JSC::Bindings::callObjCFallbackObject): + * bridge/runtime_method.cpp: + (JSC::callRuntimeMethod): + Updated to new name, inherits, from old name, isObject. + +2009-08-14 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + Allow Qt API to list and to remove URL schemes that were registered as + local URL schemes. + [Qt] Allow applications to register their own local URL scheme. + https://bugs.webkit.org/show_bug.cgi?id=28240 + + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::removeURLSchemeRegisteredAsLocal): + (WebCore::SecurityOrigin::localURLSchemes): + * page/SecurityOrigin.h: + +2009-08-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Wrap console objects late (in the frontend) so that injected + script was already in place. + + https://bugs.webkit.org/show_bug.cgi?id=28297 + + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::ConsoleMessage): + * inspector/ConsoleMessage.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::addMessageToConsole): + (WebCore::InspectorController::startGroup): + (WebCore::InspectorController::setFrontendProxyObject): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::InspectorFrontend): + (WebCore::InspectorFrontend::addMessageToConsole): + * inspector/InspectorFrontend.h: + +2009-08-13 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Fix logic in RenderObject::updateFillImages() that led to incorrect client + counts if an image was used twice in the background-image property. + https://bugs.webkit.org/show_bug.cgi?id=28295 + + Test: fast/backgrounds/multiple-backgrounds-assert.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::updateFillImages): + Simplify the logic to call addClient()/removeClient() for every background + image, but go through the new layers first to avoid removing all the + clients of an image. + +2009-08-13 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + Devirtualise marking + https://bugs.webkit.org/show_bug.cgi?id=28294 + + Make sure we override the JSObject createStructure method on those + objects that have custom marking routines. + + * bindings/scripts/CodeGeneratorJS.pm: + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by Mark Rowe. + + Follow-up to earlier work to remove dependencies on JavaScriptCore. + + * ForwardingHeaders/parser/Parser.h: Removed. + * inspector/JavaScriptDebugServer.cpp: Removed now-unneeded includes + of Parser.h. + +2009-08-13 Dan Bernstein <mitz@apple.com> + + Reviewed by Eric Seidel. + + 'box-orient: block-axis' behaves like 'box-orient: horizontal', causes + an assertion failure in debug builds + https://bugs.webkit.org/show_bug.cgi?id=28279 + + Test: fast/flexbox/block-axis.html + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::operator EBoxOrient): Map block-axis to + vertical. + +2009-08-13 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Fix crash when removing reflection on an absolutely-positioned image. + https://bugs.webkit.org/show_bug.cgi?id=28289 + + Make sure we clean up the reflection layer when removing the reflection, + so that the RenderLayer tree does not contain pointers to deleted layers. + + Test: fast/reflections/reflected-img-crash.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::~RenderLayer): + (WebCore::RenderLayer::styleChanged): + (WebCore::RenderLayer::removeReflection): + * rendering/RenderLayer.h: + +2009-08-13 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + misalignment because of float:left of <div> tag + https://bugs.webkit.org/show_bug.cgi?id=15869 + + One section of http://edgar.sec.gov site draws to the right of the rest + of the content + <rdar://problem/7135951> + + Tests: fast/block/float/avoidance-percent-width-compat.html + fast/block/float/avoidance-percent-width-strict.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::getClearDelta): Changed to apply the same float + avoidance logic in strict mode and in compatibility mode, which + matches Firefox and IE. Changed to compute and use the computed + width of the child, instead of ignoring non-fixed widths. + +2009-08-13 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Geolocation PositionOptions does not use correct default values. + https://bugs.webkit.org/show_bug.cgi?id=27254 + + Sets the correct default values for the properties of the PositionOptions object + passed to Geolocation methods. See http://www.w3.org/TR/geolocation-API/. + + Also adds checking to throw an exception if arguments of the incorrect type are + passed to Geolocation methods. Adds a layout test to test this. This test should + pass on all platforms where Geolocation is implemented. + + Test: fast/dom/Geolocation/argument-types.html + + * bindings/js/JSGeolocationCustom.cpp: + (WebCore::createPositionCallback): Added. Creates the callback. + (WebCore::createPositionErrorCallback): Added. Creates the calback. + (WebCore::createPositionOptions): Added. Creates the PositionOptions object, setting defaults where required. + (WebCore::JSGeolocation::getCurrentPosition): Modified. Now uses above helper functions. + (WebCore::JSGeolocation::watchPosition): Modified. Now uses above helper functions. + * page/Geolocation.cpp: + (WebCore::Geolocation::GeoNotifier::GeoNotifier): Modified. Asserts that PositionOptions object is present. + (WebCore::Geolocation::GeoNotifier::startTimer): Modified. Only starts timer if timeout has been set. + * page/PositionOptions.h: + (WebCore::PositionOptions::create): Modified. Creates object with default values. + (WebCore::PositionOptions::timeout): Modified. Uses correct type. + (WebCore::PositionOptions::hasTimeout): Added. Determines whether a timeout has been set. + (WebCore::PositionOptions::setTimeout): Modified. Uses correct type. + (WebCore::PositionOptions::maximumAge): Modified. Uses correct type. + (WebCore::PositionOptions::setMaximumAge): Modified. Uses correct type. + (WebCore::PositionOptions::PositionOptions): Modified. Creates object with default values. + +2009-08-13 David Levin <levin@chromium.org> + + Unreviewed chromium build fix. + + [Chromium] Let CodeGeneratorV8.pm know that RGBColor is ref-counted. + + * bindings/scripts/CodeGeneratorV8.pm: + +2009-08-13 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + Merge error in SharedWorker code + https://bugs.webkit.org/show_bug.cgi?id=28277 + + Fixed merge error that prevents WebKit from compiling with SHARED_WORKERS enabled. + No new tests needed. + + * workers/DefaultSharedWorkerRepository.cpp: + Removed duplicated functions. + +2009-08-13 Kyle Prete <kylep@chromium.org> + + Reviewed by Dave Levin. + + Chromium: Show a "Playback Disabled" button on media error. + https://bugs.webkit.org/show_bug.cgi?id=28196 + Use a disabled play button when the media file cannot be played. + + No new tests needed. Covered by LayoutTests/media/video-empty-source.html + + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::paintMediaPlayButton): + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Try and fix the Qt build. + + * bridge/qt/qt_runtime.cpp: + +2009-08-13 Zan Dobersek <zandobersek@gmail.com> + + Reviewed by Gustavo Noronha. + + [GTK] Drag and drop support + https://bugs.webkit.org/show_bug.cgi?id=23642 + + Utilizes functions that are being called upon drag and drop actions. + Uses different GTK clipboards that hold different types + of drag data - images, HTML markup, text, URL, URL label. + Also clears each clipboard before setting new data to it. + + No new tests - despite some implementations, no new functionality + is added until implementations of the GTK drag and drop protocol + in WebKit part. + + * platform/gtk/ClipboardGtk.cpp: + (WebCore::ClipboardGtk::ClipboardGtk): + (WebCore::ClipboardGtk::~ClipboardGtk): + (WebCore::getCachedImage): + (WebCore::ClipboardGtk::declareAndWriteDragImage): + (WebCore::ClipboardGtk::writeURL): + (WebCore::ClipboardGtk::writeRange): + * platform/gtk/ClipboardGtk.h: ClipboardGdk -> ClipboardGtk + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by David Levin. + + JavaScriptCore tweaks to get ready for the parser arena + https://bugs.webkit.org/show_bug.cgi?id=28243 + + * ForwardingHeaders/runtime/CollectorHeapIterator.h: Removed. + + * WebCore.xcodeproj/project.pbxproj: Exposed a couple header + files as Private that are now needed to compile Mac WebKit. + + * bindings/js/JSAudioConstructor.cpp: + * bindings/js/JSDOMBinding.cpp: + * bindings/js/JSDOMBinding.h: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSHTMLInputElementCustom.cpp: + * bindings/js/JSHistoryCustom.cpp: + * bindings/js/JSImageConstructor.cpp: + * bindings/js/JSLazyEventListener.cpp: + * bindings/js/JSLocationCustom.cpp: + * bindings/js/JSMessageChannelConstructor.cpp: + * bindings/js/JSOptionConstructor.cpp: + * bindings/js/JSWebSocketConstructor.cpp: + * bindings/js/JSWebSocketCustom.cpp: + * bindings/js/JSWorkerConstructor.cpp: + * bindings/js/JSXMLHttpRequestConstructor.cpp: + * bridge/jni/jni_jsobject.mm: + Updated includes. + + * inspector/JavaScriptDebugServer.cpp: + (WebCore::JavaScriptDebugServer::sourceParsed): + Change to not assert if this is called with no listeners. + I don't think this was guaranteed before, and we now use + this code path when recompiling. Slightly less efficient, + but this is a one-time cost when turning on the debugger. + (WebCore::JavaScriptDebugServer::recompileAllJSFunctions): + Change to call Debugger::recompileAllJSFunctions. + +2009-08-13 Brady Eidson <beidson@apple.com> + + Reviewed by Eric Seidel. + + <rdar://problem/7138591> and https://bugs.webkit.org/show_bug.cgi?id=28260 + onhashchange property cannot be set from javascript. + + Test: fast/loader/onhashchange-attribute-listeners.html + + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::onhashchange): + (WebCore::HTMLBodyElement::setOnhashchange): + * html/HTMLBodyElement.h: + * html/HTMLBodyElement.idl: + + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::onhashchange): + (WebCore::HTMLFrameSetElement::setOnhashchange): + * html/HTMLFrameSetElement.h: + * html/HTMLFrameSetElement.idl: + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::onhashchange): + (WebCore::DOMWindow::setOnhashchange): + * page/DOMWindow.h: + * page/DOMWindow.idl: + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Reviewed by Geoff Garen. + + Fix leaks of RGBColor instances from below SVGColor::rgbColor. + + * svg/SVGColor.cpp: + (WebCore::SVGColor::rgbColor): Return a PassRefPtr to ensure that the newly-allocated + RGBColor is cleaned up by the caller. + * svg/SVGColor.h: + +2009-08-13 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Migrate to DOMAgent (serialized access to DOM). + + https://bugs.webkit.org/show_bug.cgi?id=28177 + + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::highlightDOMNode): + (WebCore::JSInspectorBackend::nodeForId): + (WebCore::JSInspectorBackend::idForNode): + (WebCore::JSInspectorBackend::wrapObject): + (WebCore::JSInspectorBackend::unwrapObject): + (WebCore::JSInspectorBackend::pushNodePathToFrontend): + (WebCore::JSInspectorBackend::selectDatabase): + (WebCore::JSInspectorBackend::selectDOMStorage): + * bindings/js/ScriptObjectQuarantine.cpp: + (WebCore::getQuarantinedScriptObject): + * bindings/js/ScriptObjectQuarantine.h: + * bindings/js/ScriptValue.cpp: + (WebCore::ScriptValue::isObject): + * bindings/js/ScriptValue.h: + * bindings/v8/ScriptObjectQuarantine.cpp: + (WebCore::getQuarantinedScriptObject): + * bindings/v8/ScriptObjectQuarantine.h: + * bindings/v8/ScriptValue.h: + (WebCore::ScriptValue::isObject): + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::ConsoleMessage): + * inspector/ConsoleMessage.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::clearMessages): + (WebCore::InspectorBackend::loaded): + (WebCore::InspectorBackend::highlight): + (WebCore::InspectorBackend::nodeForId): + (WebCore::InspectorBackend::idForNode): + (WebCore::InspectorBackend::wrapObject): + (WebCore::InspectorBackend::unwrapObject): + (WebCore::InspectorBackend::pushNodePathToFrontend): + (WebCore::InspectorBackend::addNodesToSearchResult): + (WebCore::InspectorBackend::selectDatabase): + (WebCore::InspectorBackend::selectDOMStorage): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::focusNode): + (WebCore::InspectorController::addMessageToConsole): + (WebCore::InspectorController::clearConsoleMessages): + (WebCore::InspectorController::startGroup): + (WebCore::InspectorController::scriptObjectReady): + (WebCore::InspectorController::setFrontendProxyObject): + (WebCore::InspectorController::close): + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::wrapObject): + (WebCore::InspectorController::unwrapObject): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setDocument): + (WebCore::InspectorDOMAgent::handleEvent): + (WebCore::InspectorDOMAgent::pushDocumentToFrontend): + (WebCore::InspectorDOMAgent::pushChildNodesToFrontend): + (WebCore::InspectorDOMAgent::nodeForId): + (WebCore::InspectorDOMAgent::pushNodePathToFrontend): + (WebCore::InspectorDOMAgent::buildObjectForNode): + (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): + (WebCore::InspectorDOMAgent::innerParentElement): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::bind): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::clearConsoleMessages): + (WebCore::InspectorFrontend::updateFocusedNode): + (WebCore::InspectorFrontend::setDocument): + (WebCore::InspectorFrontend::selectDatabase): + (WebCore::InspectorFrontend::selectDOMStorage): + (WebCore::InspectorFrontend::addNodesToSearchResult): + * inspector/InspectorFrontend.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.clearMessages): + (WebInspector.ConsoleView.prototype.completions): + (WebInspector.ConsoleView.prototype._reportCompletions): + (WebInspector.ConsoleView.prototype._messagesClicked): + (WebInspector.ConsoleView.prototype.doEvalInWindow.evalCallback): + (WebInspector.ConsoleView.prototype.doEvalInWindow): + (WebInspector.ConsoleView.prototype._format): + (WebInspector.ConsoleView.prototype._formatfunction): + (WebInspector.ConsoleView.prototype._formatdate): + (WebInspector.ConsoleView.prototype._formatregexp): + (WebInspector.ConsoleView.prototype._formatnode): + (WebInspector.ConsoleView.prototype._formatobject): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMNode): + (WebInspector.DOMNode.prototype._renumber): + (WebInspector.DOMDocument): + (WebInspector.DOMAgent): + (WebInspector.DOMAgent.prototype.getChildNodesAsync): + (WebInspector.DOMAgent.prototype.setAttributeAsync): + (WebInspector.DOMAgent.prototype.removeAttributeAsync): + (WebInspector.DOMAgent.prototype.setTextNodeValueAsync): + (WebInspector.DOMAgent.prototype.nodeForId): + (WebInspector.DOMAgent.prototype._setDocument): + (WebInspector.DOMAgent.prototype._setChildNodes): + (WebInspector.DOMAgent.prototype._bindNodes): + (WebInspector.DOMAgent.prototype._childNodeInserted): + (WebInspector.CSSStyleDeclaration): + (WebInspector.CSSStyleDeclaration.parseRule): + (WebInspector.setDocument): + (InspectorController.getStyles): + (InspectorController.getComputedStyle): + (InspectorController.getInlineStyle): + (InspectorController.applyStyleText): + (InspectorController.setStyleText): + (InspectorController.toggleStyleEnabled): + (InspectorController.applyStyleRuleText): + (InspectorController.addStyleSelector): + (InspectorController.setStyleProperty): + (InspectorController.getPrototypes): + (InspectorController.getProperties): + (InspectorController.setPropertyValue): + (InspectorController.evaluate): + (InspectorController.addInspectedNode): + (InspectorController.performSearch): + (InspectorController.searchCanceled): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + (WebInspector.ElementsPanel.prototype.searchCanceled): + (WebInspector.ElementsPanel.prototype.performSearch): + (WebInspector.ElementsPanel.prototype._updateMatchesCount): + (WebInspector.ElementsPanel.prototype._updateMatchesCountSoon): + (WebInspector.ElementsPanel.prototype.addNodesToSearchResult): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype.set focusedDOMNode.restoreHighlightToHoveredNode): + (WebInspector.ElementsTreeOutline.prototype.set focusedDOMNode): + (WebInspector.ElementsTreeElement.prototype.updateChildren): + (WebInspector.ElementsTreeElement.prototype._attributeEditingCommitted): + * inspector/front-end/InjectedScript.js: + (InjectedScript.applyStyleRuleText): + (InjectedScript.addStyleSelector): + (InjectedScript._doesSelectorAffectNode): + (InjectedScript._serializeRule): + (InjectedScript._serializeStyle): + (InjectedScript.getProperties): + (InjectedScript.evaluate): + (InjectedScript.addInspectedNode): + (InjectedScript.performSearch.addNodesToResults): + (InjectedScript.performSearch.matchExactItems): + (InjectedScript.performSearch.matchExactId.addNodesToResults.call): + (InjectedScript.performSearch.matchExactId): + (InjectedScript.performSearch): + (InjectedScript.performSearch.matchExactTagNames): + (InjectedScript.performSearch.matchExactAttributeNames): + (InjectedScript.performSearch.matchPartialTagNames): + (InjectedScript.performSearch.matchStartOfTagNames): + (InjectedScript.performSearch.matchPartialTagNamesAndAttributeValues): + (InjectedScript.performSearch.matchPartialAttributeValues): + (InjectedScript.performSearch.matchStyleSelector): + (InjectedScript.performSearch.matchPlainText): + (InjectedScript.performSearch.matchXPathQuery): + (InjectedScript.performSearch.finishedSearching): + (InjectedScript.performSearch.processChunk): + (InjectedScript.searchCanceled): + (InjectedScript._ensureCommandLineAPIInstalled.inspectObject): + (InjectedScript._ensureCommandLineAPIInstalled): + (InjectedScript._resolveObject): + (InjectedScript._nodeForId): + (InjectedScript._objectForId): + (InjectedScript._createProxyObject): + * inspector/front-end/ObjectPropertiesSection.js: + (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): + (WebInspector.ObjectPropertyTreeElement.prototype.update): + * inspector/front-end/ObjectProxy.js: + (WebInspector.ObjectProxy): + (WebInspector.ObjectPropertyProxy): + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + (WebInspector.PropertiesSidebarPane.prototype.update): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype.update.callback): + (WebInspector.StylesSidebarPane.prototype.update): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCancelled): + (WebInspector.BlankStylePropertiesSection.prototype.editingCommitted.callback): + (WebInspector.BlankStylePropertiesSection.prototype.editingCommitted): + (WebInspector.StylePropertyTreeElement.prototype): + * inspector/front-end/inspector.js: + (WebInspector._updateHoverHighlight): + (WebInspector.loaded): + (WebInspector.clearConsoleMessages): + (WebInspector.selectDatabase): + (WebInspector.selectDOMStorage): + (WebInspector.updateFocusedNode): + (WebInspector.addNodesToSearchResult): + * inspector/front-end/utilities.js: + (Object.proxyType): + * storage/Storage.h: + (WebCore::Storage::frame): + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Reviewed by Geoff Garen. + + Fix leaks of RGBColor instances from below CSSPrimitiveValue::getRGBColorValue. + + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::getRGBColorValue): Return a PassRefPtr to ensure that the + newly-allocated RGBColor is cleaned up by the caller. + * css/CSSPrimitiveValue.h: + +2009-08-13 Eric Seidel <eric@webkit.org> + + Reviewed by David Hyatt. + + wrong font size when css font-family includes monospace + https://bugs.webkit.org/show_bug.cgi?id=19161 + + Firefox only uses fixed-width default size for exactly "font-family: monospace;". + WebKit has historically used fixed-width default size any time a + font-family includes monospace in the fallback list. + + This patch corrects WebKit's behavior to match Firefox. + I also had to fix a bug in WebKit's font-family fallback behavior where + child elements would inherit parts of their parents fallback lists. + + This patch is mostly just replacing all cases where we used to check for: + fontDescription.genericFontFamily() == MonospaceFamily + with: + fontDescription.useFixedDefaultSize() + + Tests: fast/css/getComputedStyle/computed-style-font-family-monospace.html + fast/css/getComputedStyle/font-family-fallback-reset.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + Deploy useFixedDefaultSize(). Also fix the bug where child + FontDescriptions would carry part of the parent font-family fallback list. + (WebCore::CSSStyleSelector::checkForGenericFamilyChange): + It's no longer alright to just check genericFontFamily(), + we have to check to make sure the changed style has a matching useFixedDefaultSize(). + * platform/graphics/FontDescription.h: + (WebCore::FontDescription::useFixedDefaultSize): + Only use the fixed default size if we have one font family and it is "monospace". + "-webkit-monospace" is the internal representation of the CSS identifier "monospace". + +2009-08-13 Christian Plesner Hansen <christian.plesner.hansen@gmail.com> + + Reviewed by Dimitri Glazkov. + + [v8] Fix atomic string externalization crash. + Atomic string externalization assumes that all non-empty strings + can be externalized which is untrue on 64-bit. This change fixed + that. + + https://bugs.webkit.org/show_bug.cgi?id=28215 + + This bug causes loads of test crashes, no need to add new tests + specifically for this. + + * bindings/v8/V8Binding.cpp: + (WebCore::v8StringToAtomicWebCoreString): + +2009-08-13 George Staikos <george.staikos@torchmobile.com> + + Rubberstamped by Darin Adler. + + Use ASSERT_UNUSED instead of UNUSED_PARAM + + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::deregisterTask): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::deregisterTask): + +2009-08-13 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Fixes a couple of bugs in SecurityOrigin::createFromDatabaseIdentifier. + https://bugs.webkit.org/show_bug.cgi?id=28262 + + No new tests possible. + + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::createFromDatabaseIdentifier): + +2009-08-13 Dirk Schulze <krit@webkit.org> + + Reviewed by Eric Seidel. + + [CAIRO] getImageData fails on a given rect bigger than the image rect + + The destination image and the source image was mixed up on creating the + imageData. + + This is just a clean up and doesn't affect the current behavior. It's not + possible to test this failure in a LayoutTest. Only canvas uses getImageData + at the moment and returns before calling getImageData, if the image rect does + not contain the requested rect. + + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::getImageData): + +2009-08-13 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding RenderTheme to WebCore. + https://bugs.webkit.org/show_bug.cgi?id=28258 + + * platform/haiku/RenderThemeHaiku.cpp: Added. + (WebCore::RenderThemeHaiku::create): + (WebCore::RenderTheme::themeForPage): + (WebCore::RenderThemeHaiku::RenderThemeHaiku): + (WebCore::RenderThemeHaiku::~RenderThemeHaiku): + (WebCore::supportsFocus): + (WebCore::RenderThemeHaiku::supportsFocusRing): + (WebCore::RenderThemeHaiku::platformActiveSelectionBackgroundColor): + (WebCore::RenderThemeHaiku::platformInactiveSelectionBackgroundColor): + (WebCore::RenderThemeHaiku::platformActiveSelectionForegroundColor): + (WebCore::RenderThemeHaiku::platformInactiveSelectionForegroundColor): + (WebCore::RenderThemeHaiku::platformTextSearchHighlightColor): + (WebCore::RenderThemeHaiku::systemFont): + (WebCore::RenderThemeHaiku::paintCheckbox): + (WebCore::RenderThemeHaiku::setCheckboxSize): + (WebCore::RenderThemeHaiku::paintRadio): + (WebCore::RenderThemeHaiku::setRadioSize): + (WebCore::RenderThemeHaiku::adjustMenuListStyle): + (WebCore::RenderThemeHaiku::paintMenuList): + * platform/haiku/RenderThemeHaiku.h: Added. + (WebCore::RenderThemeHaiku::supportsHover): + +2009-08-13 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Remove the "m_point" code from ContextMenuHaiku.cpp + https://bugs.webkit.org/show_bug.cgi?id=28256 + + * platform/haiku/ContextMenuHaiku.cpp: + (WebCore::ContextMenuReceiver::ContextMenuReceiver): + (WebCore::ContextMenu::ContextMenu): + (WebCore::ContextMenu::appendItem): + (WebCore::ContextMenu::insertItem): + +2009-08-13 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Darin Adler. + + Inspector: Show Hidden Cookie Data + https://bugs.webkit.org/show_bug.cgi?id=28185 + + Added new file Cookie.h to the WebCore XCode + + * WebCore.xcodeproj/project.pbxproj: + + InspectorController.cookies() binding + + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::cookies): + * inspector/InspectorBackend.idl: + + Struct for static Cookie information + (name, value, path, domain, expires, httpOnly, secure, session) + + * platform/Cookie.h: Added. + (WebCore::Cookie::Cookie): + + Getter for the a list of raw Cookies + getRawCookies(., ., out Vector<Cookie>) + + * platform/CookieJar.h: + + Implementation of getRawCookies for the mac platform. + + * platform/mac/CookieJar.mm: + (WebCore::getRawCookies): + + Stub other CookieJar implementations to satisfy the interface. + + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::getRawCookies): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::getRawCookies): + * platform/network/curl/CookieJarCurl.cpp: + (WebCore::getRawCookies): + * platform/network/soup/CookieJarSoup.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarCFNetWin.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarWin.cpp: + (WebCore::getRawCookies): + * platform/qt/CookieJarQt.cpp: + (WebCore::getRawCookies): + +2009-08-13 Patrick Mueller <Patrick_Mueller@us.ibm.com> + + Reviewed by Timothy Hatcher. + + Add a new gesture in Web Inspector to remove breakpoints + https://bugs.webkit.org/show_bug.cgi?id=19131 + + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._documentMouseDown): + +2009-08-13 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Simon Hausmann. + + Symbian target components (library and executable files) + require Unique Identifiers (i.e., UID3). + These identifiers are defined in the respective project + file, conditionally for "symbian" platform. + + * WebCore.pro: + +2009-08-13 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + wrong calculation of overflow size for flexbox and table + https://bugs.webkit.org/show_bug.cgi?id=28064 + + RenderFlexibleBox and RenderTable were using the width of overflow + to update height of overflow, so height became wrong value and + width was not updated. As the corresponding code of RenderBlock + was sane, I factored it out and used from RenderFlexibleBox and + RenderTable. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::updateOverflowWithShadowAndReflection): created from code of layoutBlock + (WebCore::RenderBlock::layoutBlock): + * rendering/RenderBlock.h: + * rendering/RenderFlexibleBox.cpp: use updateOverflowWithShadowAndReflection + (WebCore::RenderFlexibleBox::layoutBlock): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::layout): use updateOverflowWithShadowAndReflection + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Revert r47185, the fix for <https://bugs.webkit.org/show_bug.cgi?id=28185>, as it broke the + Windows build in a non-obvious manner. + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSInspectorBackendCustom.cpp: + * inspector/InspectorBackend.idl: + * platform/Cookie.h: Removed. + * platform/CookieJar.h: + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::setCookies): + (WebCore::cookies): + * platform/mac/CookieJar.mm: + * platform/network/chromium/CookieJarChromium.cpp: + * platform/network/curl/CookieJarCurl.cpp: + * platform/network/soup/CookieJarSoup.cpp: + * platform/network/win/CookieJarCFNetWin.cpp: + * platform/network/win/CookieJarWin.cpp: + * platform/qt/CookieJarQt.cpp: + +2009-08-13 Ariya Hidayat <ariya.hidayat@nokia.com> + + Not reviewed: build fix (for r47192), adding new file from + https://bugs.webkit.org/show_bug.cgi?id=28174 + + * inspector/front-end/StatusBarButton.js: Added. + +2009-08-13 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Timothy Hatcher. + + Introduced StatusBarButton class that encapsulates glyphs support. + Views updated accordingly. + + https://bugs.webkit.org/show_bug.cgi?id=28174 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/CookieItemsView.js: + (WebInspector.CookieItemsView): + (WebInspector.CookieItemsView.prototype.get statusBarItems): Updated to retrieve DOM element from StatusBarButton instance (here and in similar getters below.) + (WebInspector.CookieItemsView.prototype.hide): + (WebInspector.CookieItemsView.prototype.update): + * inspector/front-end/DOMStorageItemsView.js: + (WebInspector.DOMStorageItemsView): + (WebInspector.DOMStorageItemsView.prototype.get statusBarItems): + (WebInspector.DOMStorageItemsView.prototype.hide): + (WebInspector.DOMStorageItemsView.prototype.update): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel): + (WebInspector.ElementsPanel.prototype.get statusBarItems): + (WebInspector.ElementsPanel.prototype.hide): + (WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked): + * inspector/front-end/Panel.js: + * inspector/front-end/ProfileView.js: + (WebInspector.ProfileView): + (WebInspector.ProfileView.prototype.get statusBarItems): + (WebInspector.ProfileView.prototype._updatePercentButton): + (WebInspector.ProfileView.prototype._focusClicked): + (WebInspector.ProfileView.prototype._excludeClicked): + (WebInspector.ProfileView.prototype._resetClicked): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel): + (WebInspector.ProfilesPanel.prototype.get statusBarItems): + (WebInspector.ProfilesPanel.prototype.setRecordingProfile): + (WebInspector.ProfilesPanel.prototype._updateInterface): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.get statusBarItems): + (WebInspector.ResourcesPanel.prototype.reset): + (WebInspector.ResourcesPanel.prototype._toggleLargerResources): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype.get statusBarItems): + (WebInspector.ScriptsPanel.prototype._updatePauseOnExceptionsButton): + (WebInspector.ScriptsPanel.prototype._updateDebuggerButtons): + * inspector/front-end/StatusBarButton.js: Added. + (WebInspector.StatusBarButton): + (WebInspector.StatusBarButton.prototype._clicked): + (WebInspector.StatusBarButton.prototype.get disabled): + (WebInspector.StatusBarButton.prototype.set disabled): + (WebInspector.StatusBarButton.prototype.get title): + (WebInspector.StatusBarButton.prototype.set title): + (WebInspector.StatusBarButton.prototype.get toggled): + (WebInspector.StatusBarButton.prototype.set toggled): + (WebInspector.StatusBarButton.prototype.get visible): + (WebInspector.StatusBarButton.prototype.set visible): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: For uniformity, class names are always used to identify status bar buttons. Also, fixed "Reload" button style to use glyphs. + * inspector/front-end/inspector.html: + +2009-08-12 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add shadow support in GraphicsContext::fillRect(). + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::fillRect): Paint shadow if necessary. + (WebCore::GraphicsContext::setPlatformShadow): Inverse y offset. + +2009-08-13 David Levin <levin@chromium.org> + + Unreviewed build fix for Chromium Linux. + + Rollback r47157 as this broke debug tests of Chromium Linux. + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::setupPaintCommon): + +2009-08-13 David Levin <levin@chromium.org> + + Unreviewed build fix for chromium. + + The chromium build broke due to r47185 which added + a cookies array to inspector/InspectorBackend.idl. + + * bindings/v8/custom/V8CustomBinding.h: Added the declaration for the cookies callback. + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL(InspectorBackendCookies)): Stubbed out an implementation + for the cookies callback. + +2009-08-12 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Show Hidden Cookie Data + https://bugs.webkit.org/show_bug.cgi?id=28185 + + Added new file Cookie.h to the WebCore XCode + + * WebCore.xcodeproj/project.pbxproj: + + InspectorController.cookies() binding + + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::cookies): + * inspector/InspectorBackend.idl: + + Struct for static Cookie information + (name, value, path, domain, expires, httpOnly, secure, session) + + * platform/Cookie.h: Added. + (WebCore::Cookie::Cookie): + + Getter for the a list of raw Cookies + getRawCookies(., ., out Vector<Cookie>) + + * platform/CookieJar.h: + + Implementation of getRawCookies for the mac platform. + + * platform/mac/CookieJar.mm: + (WebCore::getRawCookies): + + Stub other CookieJar implementations to satisfy the interface. + + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::getRawCookies): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::getRawCookies): + * platform/network/curl/CookieJarCurl.cpp: + (WebCore::getRawCookies): + * platform/network/soup/CookieJarSoup.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarCFNetWin.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarWin.cpp: + (WebCore::getRawCookies): + * platform/qt/CookieJarQt.cpp: + (WebCore::getRawCookies): + +2009-08-08 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Cookies in Storage Panel + https://bugs.webkit.org/show_bug.cgi?id=27202 + + Data Structure for a Cookie. Just Key/Value for Now: + + * inspector/front-end/Cookie.js: Added. + (WebInspector.Cookie): + (WebInspector.Cookie.prototype.get key): + (WebInspector.Cookie.prototype.set key): + (WebInspector.Cookie.prototype.get value): + (WebInspector.Cookie.prototype.set value): + + A Storage View for Cookies. Allows for Refresh/Delete: + + * inspector/front-end/CookieItemsView.js: Added. + (WebInspector.CookieItemsView): + (WebInspector.CookieItemsView.prototype.get statusBarItems): refresh and delete buttons + (WebInspector.CookieItemsView.prototype.show): + (WebInspector.CookieItemsView.prototype.hide): + (WebInspector.CookieItemsView.prototype.update): + (WebInspector.CookieItemsView.prototype.buildCookies): parses the inspected window's document.cookie string + (WebInspector.CookieItemsView.prototype.dataGridForCookies): creates a datagrid for cookies + (WebInspector.CookieItemsView.prototype._deleteButtonClicked): attempt at deleting the cookie (not flawless) + (WebInspector.CookieItemsView.prototype._refreshButtonClicked): rebuild the datagrid + + Include a SidebarSection Section in the Databases Panel: + + * inspector/front-end/DatabasesPanel.js: + (WebInspector.DatabasesPanel): + (WebInspector.DatabasesPanel.prototype.show): calls populateInterface + (WebInspector.DatabasesPanel.prototype.populateInterface): adds cookies if they don't exist + (WebInspector.DatabasesPanel.prototype.reset): remove cookie specific parts + (WebInspector.DatabasesPanel.prototype.addCookies): add cookies sidebar tree element + (WebInspector.DatabasesPanel.prototype.showCookies): sets the visible view to a CookiesItemView + (WebInspector.CookieSidebarTreeElement): + (WebInspector.CookieSidebarTreeElement.prototype.onselect): + (WebInspector.CookieSidebarTreeElement.prototype.get mainTitle): just "Cookies" at the moment + (WebInspector.CookieSidebarTreeElement.prototype.set mainTitle): + (WebInspector.CookieSidebarTreeElement.prototype.get subtitle): no subtitle yet + (WebInspector.CookieSidebarTreeElement.prototype.set subtitle): + + New "Cookies" Image for the Sidebar: + + * inspector/front-end/Images/cookie.png: Added. + * inspector/front-end/inspector.css: + + Include the Added Files where appropriate: + + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2009-08-12 George Wright <george.wright@torchmobile.com> + + Reviewed by George Staikos. + + Add SQLTransactionCoordinator.[h,cpp] to WebCore.pro. + + https://bugs.webkit.org/show_bug.cgi?id=28246 + + * WebCore.pro: + +2009-08-12 George Staikos <george.staikos@torchmobile.com> + + Reviewed by Adam Treat. + + Mark unused variables to avoid compile failures in -Werror. + + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::deregisterTask): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::deregisterTask): + +2009-08-12 Charles Wei <charles.wei@torchmobile.com.cn> + + Reviewed by Niko Zimmermann. + + This is to add WCSS marquee support , which is defined by OMA and is an extension for CSS2, + It extends CSS display with "display:-wap-marquee;-wap-marquee-dir:xxx;-wap-marquee-speed:xxx;-wap-marquee-style:xxx" + Minor fixes by Eric Seidel and George Staikos. + https://bugs.webkit.org/show_bug.cgi?id=23727 + + No new tests, the tests have already been landed at LayoutTests/fast/wcss/ + + * WebCore.pro: + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + * css/CSSValueKeywords.in: + * css/WCSSPropertyNames.in: Added. + * css/WCSSValueKeywords.in: Added. + * rendering/RenderMarquee.cpp: + (WebCore::RenderMarquee::start): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::createObject): + * rendering/style/RenderStyleConstants.h: + (WebCore::): + +2009-08-12 George Wright <george.wright@torchmobile.com> + + Reviewed by David Hyatt. + + Update the canvas renderer's intrinsic size with the zoomed + lengths and ensure the intrinsic size is correct when setting + an initial style. + + https://bugs.webkit.org/show_bug.cgi?id=26908 + + Test: fast/canvas/canvas-zoom.html + + * rendering/RenderHTMLCanvas.cpp: + (WebCore::RenderHTMLCanvas::canvasSizeChanged): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::styleDidChange): + +2009-08-12 Alpha Lam <hclam@chromium.org> + + Reviewed by Simon Fraser. + + Fix regression for dragging the media controller thumb. + https://bugs.webkit.org/show_bug.cgi?id=28211 + + Modified the conditions for rejecting events on the media controller + to only rejecting mouse events not from the left button. + + Test: media/controls-drag-timebar.html + + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlTimelineElement::defaultEventHandler): + +2009-08-12 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Eric Seidel. + + Fixing a deadlock caused by two transactions that run on two + different database handles for the same DB. Adding a per-DB thread + transaction coordinator that allows the DB thread to run only one + transaction per DB file at any given time. + + Adding a regression test for this bug. + + Test: storage/multiple-transactions-on-different-handles.html + + https://bugs.webkit.org/show_bug.cgi?id=27966 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * storage/Database.cpp: + (WebCore::Database::transactionCoordinator): + * storage/Database.h: + * storage/DatabaseThread.cpp: + (WebCore::DatabaseThread::DatabaseThread): + * storage/DatabaseThread.h: + (WebCore::DatabaseThread::transactionCoordinator): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::SQLTransaction): + (WebCore::SQLTransaction::debugStepName): + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::aquireLock): + (WebCore::SQLTransaction::lockAquired): + (WebCore::SQLTransaction::cleanupAfterSuccessCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + * storage/SQLTransactionCoordinator.cpp: Added. + * storage/SQLTransactionCoordinator.h: Added. + +2009-08-12 Darin Adler <darin@apple.com> + + Reviewed by Geoff Garen. + + Custom properties on DOM objects are lost after GC (as demonstrated by the gc-9.html test) + https://bugs.webkit.org/show_bug.cgi?id=28194 + + * GNUmakefile.am: Added the two new source files. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * WebCoreSources.bkl: Ditto. + + * bindings/js/JSCSSRuleListCustom.cpp: Added. + (WebCore::JSCSSRuleList::markChildren): Call markDOMObjectWrapper + on rules in the list. + + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + (WebCore::JSCSSStyleDeclaration::markChildren): Added. Call + markDOMObjectWrapper on the CSSValue objects that are owned by the + declaration as values of the properties. + + * bindings/js/JSDOMBinding.cpp: + (WebCore::isObservableThroughDOM): Added code to handle some + cases where nodes are observable because they own objects that + in turn have custom properties. + + * bindings/js/JSDOMBinding.h: Fix a typo in the header. + + * bindings/js/JSDocumentCustom.cpp: + (WebCore::JSDocument::markChildren): Added call to markDOMObjectWrapper + for implementation and styleSheets. + + * bindings/js/JSElementCustom.cpp: + (WebCore::JSElement::markChildren): Added. Calls markDOMObjectWrapper + for attributes and style. + + * bindings/js/JSHTMLCanvasElementCustom.cpp: Added. + (WebCore::JSHTMLCanvasElement::markChildren): Call markDOMObjectWrapper + on the rendering context. + + * bindings/js/JSStyleSheetCustom.cpp: + (WebCore::JSStyleSheet::markChildren): Call markDOMObjectWrapper on + items in the stylesheet. + + * bindings/js/JSStyleSheetListCustom.cpp: + (WebCore::JSStyleSheetList::markChildren): Added. Calls + markDOMObjectWrapper on stylesheets in the list. + + * css/CSSRuleList.idl: Added CustomMarkFunction. + * css/CSSStyleDeclaration.idl: Ditto. + * css/StyleSheetList.idl: Ditto. + * dom/Element.idl: Ditto. + * html/HTMLCanvasElement.idl: Ditto. + + * dom/Element.h: Made everything private that could be. + Added access to the attributeMap that does returns + the existing map without doing any of the lazy-updating work. This + is needed to get at the existing attributes during garbage collection + without having side effects. + + * html/HTMLCanvasElement.h: Cleaned up the header a bit, making + members private. Added renderingContext2D function for use in + JSHTMLCanvasElement::markChildren. + +2009-08-12 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Eric Seidel. + + Fixes two bugs about Pan Scrolling - Scrolling with middle mouse button doesn't + work in Expanded view on reader.google.com, and Can enter auto scroll from a non-scrollable area. + https://bugs.webkit.org/show_bug.cgi?id=28023 + https://bugs.webkit.org/show_bug.cgi?id=24794 + + Added a new method to RenderBox seeing if the Box can be scrolled and actually has something to + scroll, and use that for pan scrolling. + + Test: platform/win/fast/events/panScroll-nested-divs.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMouseDraggedEvent): + (WebCore::EventHandler::updateAutoscrollRenderer): + (WebCore::EventHandler::handleMousePressEvent): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::canBeScrolledAndHasScrollableArea): + * rendering/RenderBox.h: + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollByRecursively): + +2009-08-12 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Fix of <rdar://6728361> Mouse wheel scrolling on a page with expanded drop down + list detaches drop down. + + Added a function for Windows PopupMenu's to return their class name. + + * platform/PopupMenu.h: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::popupClassName): + +2009-08-12 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Dan Bernstein. + + WINCE PORT: Color and Gradient + https://bugs.webkit.org/show_bug.cgi?id=27511 + + * platform/graphics/wince/ColorWince.cpp: Added. + * platform/graphics/wince/GradientWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by Eric Seidel. + + fix a typo in platform/graphics/skia/PlatformContextSkia.cpp + https://bugs.webkit.org/show_bug.cgi?id=28172 + + No new tests because it's a just typo fix. + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::setupPaintCommon): + +2009-08-12 Michelangelo De Simone <micdesim@gmail.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=27458 + Support for the :default CSS pseudoclass, as per HTML5 spec. + http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#selector-default + + Tests: fast/css/pseudo-default-001.html + fast/css/pseudo-default-002.html + fast/css/pseudo-default-003.html + fast/css/pseudo-default-004.html + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::extractPseudoType): pseudoDefault + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::canShareStyleWithElement): sharing stuff is + aware that only one default button can be present in a form + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): applies + the :default CSS pseudoclass + * dom/Element.h: + (WebCore::Element::isDefaultButtonForForm): new method to determine + whether a FormControl is a default button for a given form + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::isDefaultButtonForForm): ditto + * html/HTMLFormControlElement.h: + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::defaultButton): extracts the default button + from the form + * html/HTMLFormElement.h: + +2009-08-12 David Levin <levin@chromium.org> + + No review, rolling out r47106. + https://bugs.webkit.org/show_bug.cgi?id=28215 + + This patch relied on a new version of v8 which is not available + in chromium yet. + + * bindings/v8/V8Binding.cpp: + (WebCore::v8StringToAtomicWebCoreString): + +2009-08-12 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + Bug 26993 : Geolocation::requestPermission() + https://bugs.webkit.org/show_bug.cgi?id=26993 + + Second patch to allow the Geolocation permission request to chrome to be asynchronous + or synchronous. Fixes a bug where callbacks were called twice when permissions + are granted synchronously. + + No new tests required. + + * page/Geolocation.cpp: + (WebCore::Geolocation::setIsAllowed): Modified. Calls makeSuccessCallbacks() rather than geolocationServicePositionChanged(). + (WebCore::Geolocation::geolocationServicePositionChanged): Modified. Updated logic to avoid repeated callbacks when permissions are granted synchronously. + (WebCore::Geolocation::makeSuccessCallbacks): Added. Calls success callbacks. + * page/Geolocation.h: Modified. Adds makeSuccessCallbacks(). + +2009-08-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/6952336> + CrashTracer: [USER] 3 crashes in Safari at com.apple.WebCore • WebCore::SecurityOrigin::canAccess const + 27 + + Make sure to set the security origin before calling dispatchWindowObjectAvailable. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::begin): + +2009-08-12 Xiaomei Ji <xji@chromium.org> + + Reviewed by Eric Seidel. + + Fix [Chromium] drop down menu letter selection, skip selections + https://bugs.webkit.org/show_bug.cgi?id=28205 + + Not auto-testable since it is chromim platform specific code, and it involves sending a keyboard + event to the popup, which is not possible (eventSender sends the key + events through webview, we want to go through the webwidget). + + * manual-tests/keyboard_select_elements_with_same_beginning.html: Added. + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::isCharacterTypeEvent): style change. + (WebCore::PopupListBox::handleKeyEvent): typeAheadFind should be called only when the event is + a character type event to avoid calling twice for English. + (WebCore::PopupListBox::typeAheadFind): remove unnecessary checking of isCharacterTypeEvent() since the whole function is only called under that condition. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding GraphicsContext to WebCore/platform/graphics/haiku. + https://bugs.webkit.org/show_bug.cgi?id=28130 + + * platform/graphics/haiku/GraphicsContextHaiku.cpp: Added. + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::GraphicsContext): + (WebCore::GraphicsContext::~GraphicsContext): + (WebCore::GraphicsContext::platformContext): + (WebCore::GraphicsContext::savePlatformState): + (WebCore::GraphicsContext::restorePlatformState): + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::drawEllipse): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::beginPath): + (WebCore::GraphicsContext::addPath): + (WebCore::GraphicsContext::clip): + (WebCore::GraphicsContext::drawFocusRing): + (WebCore::GraphicsContext::drawLineForText): + (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar): + (WebCore::GraphicsContext::roundToDevicePixels): + (WebCore::GraphicsContext::beginTransparencyLayer): + (WebCore::GraphicsContext::endTransparencyLayer): + (WebCore::GraphicsContext::clearRect): + (WebCore::GraphicsContext::strokeRect): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::GraphicsContext::setMiterLimit): + (WebCore::GraphicsContext::setAlpha): + (WebCore::GraphicsContext::setCompositeOperation): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipToImageBuffer): + (WebCore::GraphicsContext::getCTM): + (WebCore::GraphicsContext::translate): + (WebCore::GraphicsContext::origin): + (WebCore::GraphicsContext::rotate): + (WebCore::GraphicsContext::scale): + (WebCore::GraphicsContext::clipOutEllipseInRect): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::concatCTM): + (WebCore::GraphicsContext::setPlatformShouldAntialias): + (WebCore::GraphicsContext::setImageInterpolationQuality): + (WebCore::GraphicsContext::setURLForRect): + (WebCore::GraphicsContext::setPlatformFont): + (WebCore::GraphicsContext::setPlatformStrokeColor): + (WebCore::GraphicsContext::getHaikuStrokeStyle): + (WebCore::GraphicsContext::setPlatformStrokeStyle): + (WebCore::GraphicsContext::setPlatformStrokeThickness): + (WebCore::GraphicsContext::setPlatformFillColor): + (WebCore::GraphicsContext::clearPlatformShadow): + (WebCore::GraphicsContext::setPlatformShadow): + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Modifying WebCore/platform/graphics files to allow Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28128 + + * platform/graphics/BitmapImage.h: Adding getBBitmap() function. + * platform/graphics/Color.h: rgb_color is the Color struct in Haiku. + * platform/graphics/FloatPoint.h: BPoint is the Point class in Haiku. + * platform/graphics/FloatRect.h: BRect is the Rect class in Haiku. + * platform/graphics/GraphicsContext.cpp: + * platform/graphics/GraphicsContext.h: BView is the PlatformGraphicsContext + class for Haiku. Adding getHaikuStrokeStyle() function. + * platform/graphics/Icon.h: Adding an empty Icon() constructor because + this class isn't implemented for the moment. + * platform/graphics/ImageSource.h: BBitmap is the native bitmap class + for Haiku. + * platform/graphics/IntPoint.h: BPoint is the Point class in Haiku. + * platform/graphics/IntRect.h: BRect is the Rect class in Haiku. + * platform/graphics/IntSize.h: BSize is the Size class in Haiku. + * platform/graphics/Path.h: BRegion is the Path class in Haiku. + * platform/graphics/Pattern.h: Adding the GraphicsDef.h header and the + native pattern type. + * platform/graphics/SimpleFontData.h: Adding Haiku's Font.h header. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding modification to the WebCore/platform/ files to allow + the Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28128 + + * platform/ContextMenuItem.h: BMenu is the PlatformMenuItemDescription + class of Haiku. + * platform/Cursor.h: BCursor is the Cursor class of Haiku. + * platform/DragData.h: Use a BMessage as DragDataRef. + * platform/DragImage.h: Use a BBitmap as DragImageRef. + * platform/PlatformKeyboardEvent.h: Use BMessage as event vehicle. + * platform/PlatformMenuDescription.h: BMenu is the + PlatformMenuDescription class of Haiku. + * platform/PlatformMouseEvent.h: Use BMessage as event vehicle. + * platform/PlatformWheelEvent.h: Use BMessage as event vehicle. + * platform/PopupMenu.h: Adding a m_menu attribute for Haiku. + * platform/Widget.h: BView is the PlatformWidget class of Haiku. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Tiny modifications on WebCore files to allow Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28128 + + * bindings/js/ScriptControllerHaiku.cpp: Style cleanup. + * loader/CachedFont.cpp: Haiku behaves like Qt, Gtk, or Chromium, + so many PLATFORM(HAIKU) were added to these functions. + (WebCore::CachedFont::~CachedFont): + (WebCore::CachedFont::ensureCustomFontData): + (WebCore::CachedFont::platformDataFromCustomData): + (WebCore::CachedFont::allClientsRemoved): + * page/EventHandler.cpp: Like the mac and Qt port, Haiku doesn't need the + invertSenseOfTabsToLinks() function. + * page/haiku/DragControllerHaiku.cpp: Style cleanup. + * platform/image-decoders/ImageDecoder.h: For image decoding Haiku + behaves like Cairo or Wx, (not like Skia). + (WebCore::RGBA32Buffer::getAddr): + * platform/text/PlatformString.h: Adding the String(BString&) and BString() + methods specific to Haiku. + * platform/text/UnicodeRange.h: Haiku needs to include stdint.h. + * platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp: + (WebCore::currentSearchLocaleID): Missing function. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding the ScrollbarTheme files. + https://bugs.webkit.org/show_bug.cgi?id=28125 + + * platform/haiku/ScrollbarThemeHaiku.cpp: Added. + (buttonWidth): + (WebCore::ScrollbarTheme::nativeTheme): + (WebCore::ScrollbarThemeHaiku::ScrollbarThemeHaiku): + (WebCore::ScrollbarThemeHaiku::~ScrollbarThemeHaiku): + (WebCore::ScrollbarThemeHaiku::scrollbarThickness): + (WebCore::ScrollbarThemeHaiku::hasButtons): + (WebCore::ScrollbarThemeHaiku::hasThumb): + (WebCore::ScrollbarThemeHaiku::backButtonRect): + (WebCore::ScrollbarThemeHaiku::forwardButtonRect): + (WebCore::ScrollbarThemeHaiku::trackRect): + (WebCore::ScrollbarThemeHaiku::paintScrollbarBackground): + (WebCore::ScrollbarThemeHaiku::paintButton): + (WebCore::ScrollbarThemeHaiku::paintThumb): + * platform/haiku/ScrollbarThemeHaiku.h: Added. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding eight simple files to WebCore/platform/graphics/haiku. + https://bugs.webkit.org/show_bug.cgi?id=28122 + + * platform/graphics/haiku/ColorHaiku.cpp: Added. + (WebCore::Color::Color): + (WebCore::Color::operator rgb_color): + (WebCore::focusRingColor): + * platform/graphics/haiku/FloatPointHaiku.cpp: Added. + (WebCore::FloatPoint::FloatPoint): + (WebCore::FloatPoint::operator BPoint): + * platform/graphics/haiku/FloatRectHaiku.cpp: Added. + (WebCore::FloatRect::FloatRect): + (WebCore::FloatRect::operator BRect): + * platform/graphics/haiku/GradientHaiku.cpp: Added. + (WebCore::Gradient::platformDestroy): + (WebCore::Gradient::platformGradient): + (WebCore::Gradient::fill): + * platform/graphics/haiku/IntPointHaiku.cpp: Added. + (WebCore::IntPoint::IntPoint): + (WebCore::IntPoint::operator BPoint): + * platform/graphics/haiku/IntRectHaiku.cpp: Added. + (WebCore::IntRect::IntRect): + (WebCore::IntRect::operator BRect): + * platform/graphics/haiku/IntSizeHaiku.cpp: Added. + (WebCore::IntSize::IntSize): + (WebCore::IntSize::operator BSize): + * platform/graphics/haiku/PathHaiku.cpp: Added. + (WebCore::Path::Path): + (WebCore::Path::~Path): + (WebCore::Path::operator=): + (WebCore::Path::hasCurrentPoint): + (WebCore::Path::contains): + (WebCore::Path::translate): + (WebCore::Path::boundingRect): + (WebCore::Path::moveTo): + (WebCore::Path::addLineTo): + (WebCore::Path::addQuadCurveTo): + (WebCore::Path::addBezierCurveTo): + (WebCore::Path::addArcTo): + (WebCore::Path::closeSubpath): + (WebCore::Path::addArc): + (WebCore::Path::addRect): + (WebCore::Path::addEllipse): + (WebCore::Path::clear): + (WebCore::Path::isEmpty): + (WebCore::Path::debugString): + (WebCore::Path::apply): + (WebCore::Path::transform): + (WebCore::Path::strokeBoundingRect): + +2009-08-12 Lyon Chen <lyon.chen@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: Implement Keygen for WINCE + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/KeygenWince.cpp: Added. + +2009-08-12 Brent Fulgham <bfulgham@webkit.org> + + Rubber-stamped by Kevin Ollivier. + + Handle crash in wx due to null value passed to strlen in + the CString constructor. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::certificatePath): Check for null return from getenv + and use default CString constructor instead. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by Eric Seidel. + + WINCE PORT: simple stubs to make it build for WINCE + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/DragDataWince.cpp: Added. + * platform/wince/DragImageWince.cpp: Added. + * platform/wince/EditorWince.cpp: Added. + * platform/wince/KURLWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by George Staikos. + + WINCEPORT: FileSystem and FileChooser + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/FileChooserWince.cpp: Added. + * platform/wince/FileSystemWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by Eric Seidel. + + WINCE PORT: implement Cursor for WINCE. There's no real cursor on most + WinMob devices. We pass the cursor info to application, which so that + can determine what to do. + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/CursorWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: MIMETypeRegistry + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/MIMETypeRegistryWince.cpp: Added. + +2009-08-12 Joe Mason <joe.mason@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: Pasteboard and SearchPopupMenu + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/PasteboardWince.cpp: Added. + * platform/wince/SearchPopupMenuWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: Add SharedTimerWince.cpp and SystemTimeWince.cpp + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/SharedTimerWince.cpp: Added. + * platform/wince/SystemTimeWince.cpp: Added. + +2009-08-12 Mark Mentovai <mark@chromium.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28204 + Allow C++ exceptions to be disabled in WebCore's V8 Mac build. + + * WebCorePrefix.h: + Only undefine |try| and |catch| when building Objective-C[++], + leaving the C++ library definitions intact for C++. + +2009-08-12 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Add a Custom Setter for DOMWindowEvent in the V8 bindings. + https://bugs.webkit.org/show_bug.cgi?id=27719 + + Tests: fast/events/set-event-in-another-frame.html + fast/events/set-event-to-null.html + + * bindings/scripts/CodeGeneratorV8.pm: Clean up custom getter/setter code, + as it currently doesn't support a custom getter + and a v8-specific custom setter simultaneously. + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_SETTER): + * page/DOMWindow.idl: + +2009-08-12 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27965 + Merge wx/ImageSourceWx.cpp into ImageSource.cpp. No changes to + ImageSource.cpp were needed, so this just deletes ImageSourceWx.cpp. + + * WebCore.gypi: + * WebCoreSources.bkl: + * platform/graphics/wx/ImageSourceWx.cpp: Removed. + * webcore-wx.bkl: + +2009-08-12 Peter Kasting <pkasting@google.com> + + Reviewed by Dave Levin. + + https://bugs.webkit.org/show_bug.cgi?id=27933 + Build fix after r47099. + + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::getImageData): + (WebCore::putImageData): + +2009-08-08 Yong Li <yong.li@torchmobile.com> + + Reviewed by Adam Treat. + + WINCE PORT: Implement Path for WINCE. Most code can be + reused for other ports that don't have native path support + https://bugs.webkit.org/show_bug.cgi?id=28188 + + Written also by George Staikos (including quadCurve() and bezier()) + + * platform/graphics/wince/PathWince.cpp: Added. + * platform/graphics/wince/PlatformPathWince.cpp: Added. + * platform/graphics/wince/PlatformPathWince.h: Added. + * platform/graphics/wince/WinceGraphicsExtras.h: Added. + +2009-08-12 Joseph Pecoraro <joepeck02@gmail.com> + + "Double-click to add" new style button does not always show up [quick fix] + https://bugs.webkit.org/show_bug.cgi?id=28187 + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype.updateTitle): + +2009-08-12 Crystal Zhang <crystal.zhang@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: MediaPlayerProxy and MediaPlayerPrivate + https://bugs.webkit.org/show_bug.cgi?id=28178 + + * platform/graphics/wince/MediaPlayerPrivateWince.h: Added. + * platform/graphics/wince/MediaPlayerProxy.cpp: Added. + * platform/graphics/wince/MediaPlayerProxy.h: Added. + +2009-08-12 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + HTML 5 database and LocalStorage is not persistent on the Symbian port of QtWebKit + https://bugs.webkit.org/show_bug.cgi?id=28175 + + Call QDir::toNativeSeparators() before the path is passed to the OS. + + Based on work by David Leong. + + * platform/qt/FileSystemQt.cpp: + (WebCore::pathByAppendingComponent): + +2009-08-12 Dirk Schulze <krit@webkit.org> + + Reviewed by Ariya Hidayat. + + Minor build-fix for SVG Filter. Use getUnmultipliedImageData instead + of getImageData. This changed since r47099. + + * platform/graphics/filters/FEColorMatrix.cpp: + (WebCore::FEColorMatrix::apply): + +2009-08-12 Viet-Trung Luu <viettrungluu@gmail.com> + + Reviewed by Dimitri Glazkov. + + Explicitly set control tints for Chromium/Mac, since the controls' + NSCell(s) lack an NSView and hence their tint isn't updated + automatically when the application is activated/deactivated. + https://bugs.webkit.org/show_bug.cgi?id=28108 + http://crbug.com/18199 + + * rendering/RenderThemeChromiumMac.mm: + (WebCore::updateNSCellControlTint): + (WebCore::RenderThemeChromiumMac::paintCheckbox): + (WebCore::RenderThemeChromiumMac::paintRadio): + (WebCore::RenderThemeChromiumMac::paintButton): + (WebCore::RenderThemeChromiumMac::paintMenuList): + (WebCore::RenderThemeChromiumMac::paintSliderThumb): + (WebCore::RenderThemeChromiumMac::paintSearchField): + (WebCore::RenderThemeChromiumMac::paintSearchFieldCancelButton): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsButton): + +2009-08-12 Christian Plesner Hansen <christian.plesner.hansen@gmail.com> + + Reviewed by Dimitri Glazkov. + + [V8] Fix atomic string externalization crash. + Atomic string externalization assumes that all non-empty strings + can be externalized which is untrue on 64-bit. This change fixed + that. + + https://bugs.webkit.org/show_bug.cgi?id=28215 + + This bug causes loads of test crashes, no need to add new tests + specifically for this. + + * bindings/v8/V8Binding.cpp: + (WebCore::v8StringToAtomicWebCoreString): + +2009-08-12 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Holger Freyther. + + [Qt] Fix box-shadow painting in r47103. The edge should not be blurry. + Also optimize by not having to save and restore painter state. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::fillRect): + +2009-08-12 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Adam Treat. + + [Qt] Fix coding style in GraphicsContextQt.cpp + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::toQtCompositionMode): + (WebCore::toQtLineCap): + (WebCore::toQtLineJoin): + (WebCore::GraphicsContextPlatformPrivate::p): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::pen): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::clipPath): + (WebCore::GraphicsContext::drawFocusRing): + (WebCore::GraphicsContext::beginTransparencyLayer): + (WebCore::GraphicsContext::endTransparencyLayer): + (WebCore::GraphicsContext::clearRect): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::GraphicsContext::setMiterLimit): + (WebCore::GraphicsContext::setAlpha): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipOutEllipseInRect): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::setPlatformStrokeColor): + (WebCore::GraphicsContext::setPlatformStrokeStyle): + (WebCore::GraphicsContext::setPlatformStrokeThickness): + +2009-08-12 Szabo Carol <carol.szabo@nokia.com> + + Reviewed by Simon Hausmann and Ariya Hidayat. + + https://bugs.webkit.org/show_bug.cgi?id=23291 + + [Qt] Partial support for -webkit-box-shadow. Blur is not support and + the shadow still does not go well with border radius. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::fillRect): + +2009-08-12 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + Use AM_V_GEN in a few more places, for less noisy builds. + + * GNUmakefile.am: + +2009-08-12 Dirk Schulze <krit@webkit.org> + + Reviewed by Oliver Hunt. + + SVG Filter premultiplied color support for getImageDate/putImageData + [https://bugs.webkit.org/show_bug.cgi?id=27933] + + Some SVG Filters need premultiplied ImageData for the calculation. Therefore getImageData + and putImageData of ImageBuffer need support for premultiplied colors. + + * html/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::getImageData): + (WebCore::CanvasRenderingContext2D::putImageData): + * platform/graphics/ImageBuffer.h: + (WebCore::): + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/wx/ImageBufferWx.cpp: + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * svg/graphics/SVGResourceMasker.cpp: + (WebCore::SVGResourceMasker::applyMask): + +2009-08-12 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Timothy Hatcher. + + Changed Number.bytesToString to support low-resolution output. + + https://bugs.webkit.org/show_bug.cgi?id=28146 + + * inspector/front-end/utilities.js: + (Number.bytesToString): + +2009-08-12 Prasanth Ullattil <prasanth.ullattil@nokia.com> + + Reviewed by Simon Hausmann. + + Add support for hooking BeginPaint/EndPaint on 64Bit Windows + + Webkit uses the runtime patching trick explained by "Feng Yuan" for + hooking these paint functions. It currently supports only 32bit assembly + code. This patch adds support for 64Bit version. Since inline-assemblies + are not supported for 64Bit, we have use a seperate .asm file. + + * WebCore.pro: + * plugins/win/PaintHooks.asm: Added. + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::hookedBeginPaint): + (WebCore::PluginView::hookedEndPaint): + (WebCore::hook): + +2009-08-11 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Make it harder to misuse try* allocation routines + https://bugs.webkit.org/show_bug.cgi?id=27469 + + Add forwarding header for PossiblyNull type, and add missing null check + to ImageBuffer creation. + + * ForwardingHeaders/wtf/PossiblyNull.h: Added. + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::ImageBuffer::ImageBuffer): + +2009-08-11 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Restrict use of FuncDeclNode & FuncExprNode to the parser. + https://bugs.webkit.org/show_bug.cgi?id=28209 + + * inspector/JavaScriptDebugServer.cpp: + (WebCore::JavaScriptDebugServer::recompileAllJSFunctions): + Function signature change. + +2009-08-11 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27965 + Merge skia/ImageSourceSkia.cpp into ImageSource.cpp. + + * WebCore.gypi: Remove deleted file, plus a file that was deleted a while back. + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): Use slightly shorter syntax. + (WebCore::ImageSource::filenameExtension): Use shorter syntax. + (WebCore::ImageSource::createFrameAtIndex): Remove redundant call, clarify comments, reject all empty images. + (WebCore::ImageSource::frameHasAlphaAtIndex): Clarify comments, use shorter syntax. + * platform/graphics/skia/ImageSourceSkia.cpp: Removed. + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + SharedWorkers do not exit when the last parent document exits + https://bugs.webkit.org/show_bug.cgi?id=28170 + + Prevents Documents from being suspended/placed in the page cache if they are associated with shared workers. + + Added vector cache instead of nested hash tables for SharedWorker repository. + + Added SharedWorkerRepository::documentDetached API. + + * dom/Document.cpp: + (WebCore::Document::detach): + Notifies SharedWorkerRepository when the document is closing. + * loader/FrameLoader.cpp: + Updated FrameLoader to not cache the Document if it is associated with a SharedWorker (since we can't suspend workers yet, we need to shut them down). + (WebCore::FrameLoader::canCachePageContainingThisFrame): + (WebCore::FrameLoader::logCanCacheFrameDecision): + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerProxy::create): + (WebCore::SharedWorkerProxy::isClosing): + Renamed from closing(). + (WebCore::SharedWorkerProxy::matches): + Added manual equality function to replace old hash lookup. + (WebCore::SharedWorkerProxy::isDocumentInWorkerDocuments): + Checks to see if a document is in the worker's list of documents. Used to determine if page is suspendable. + (WebCore::SharedWorkerProxy::SharedWorkerProxy): + (WebCore::SharedWorkerProxy::addToWorkerDocuments): + Added tracking of the worker's list of documents for lifecycle purposes. + (WebCore::SharedWorkerProxy::documentDetached): + Shuts down the proxy when the last associated document is detached. + (WebCore::SharedWorkerProxy::close): + Marks the proxy as closed so it is no longer shared with new instances. + (WebCore::SharedWorkerProxy::workerContextDestroyed): + Removes the proxy from the repository/frees the proxy when the associated SharedWorkerContext is destroyed. + (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded): + closing()->isClosing() + (WebCore::SharedWorkerRepository::documentDetached): + (WebCore::SharedWorkerRepository::hasSharedWorkers): + Used by FrameLoader to determine if a page has shared workers and so cannot be suspended/cached. + (WebCore::DefaultSharedWorkerRepository::hasSharedWorkers): + (WebCore::DefaultSharedWorkerRepository::removeProxy): + Invoked by workerContextDestroyed() to remove a SharedWorkerProxy from the repository. + (WebCore::DefaultSharedWorkerRepository::documentDetached): + (WebCore::DefaultSharedWorkerRepository::connectToWorker): + (WebCore::DefaultSharedWorkerRepository::getProxy): + * workers/DefaultSharedWorkerRepository.h: + * workers/SharedWorkerRepository.h: + +2009-08-11 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Bug 28200 - ListMarker should be included as part of the text value to parse + https://bugs.webkit.org/show_bug.cgi?id=28200 + + When returning text through the marker range attributes, the list marker text should + also be included. It isn't included by default because a TextIterator is used which + only looks at Nodes for text. A list marker does not have a corresponding node, + so its text is not returned through accessibility. That is, until now. + + Test: platform/mac/accessibility/string-range-contains-listmarker.html + + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::listMarkerTextForRange): + (WebCore::AccessibilityObject::stringForVisiblePositionRange): + * accessibility/AccessibilityObject.h: + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): + (-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): + (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): + * rendering/RenderListItem.h: + + Make markerText() public so that accessibility code can access it. + +2009-08-11 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27965 + Move cairo/ImageSourceCairo.cpp to ImageSource.cpp in preparation for + merging most of the other ImageSource*.cpp files with it. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * platform/graphics/ImageSource.cpp: Copied from WebCore/platform/graphics/cairo/ImageSourceCairo.cpp. + * platform/graphics/cairo/ImageSourceCairo.cpp: Removed. + +2009-08-10 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Adam Roben. + + Cairo-based Windows port does not handle the https protocol. + https://bugs.webkit.org/show_bug.cgi?id=28171. + + No new tests needed. Existing https tests show this failure + for WinCairo builds. + + * WebCore.vcproj/WebCoreCURL.vsprops: Add a few preprocessor + definitions for SSL support in cURL. + * platform/network/curl/ResourceHandleManager.h: Add new + certificate path member variable. + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::certificateBundlePath): New method to retrieve the + proper certificate resource bundle path. + (WebCore::ResourceHandleManager::initializeHandle): Check for + the resource bundle and use if available to activate SSL + support. + +2009-08-11 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Use Clipboard::create() instead of the constructor of Clipboard. + https://bugs.webkit.org/show_bug.cgi?id=28127 + + * editing/haiku/EditorHaiku.cpp: + (WebCore::Editor::newGeneralClipboard): + * page/haiku/EventHandlerHaiku.cpp: + (WebCore::EventHandler::passWheelEventToWidget): + (WebCore::EventHandler::createDraggingClipboard): + * platform/haiku/ClipboardHaiku.cpp: Style cleanup. There were many whitespace end of lines. + (WebCore::ClipboardHaiku::ClipboardHaiku): + (WebCore::ClipboardHaiku::clearAllData): + (WebCore::ClipboardHaiku::getData): + (WebCore::ClipboardHaiku::setData): + (WebCore::ClipboardHaiku::types): + (WebCore::ClipboardHaiku::dragLocation): + (WebCore::ClipboardHaiku::dragImage): + (WebCore::ClipboardHaiku::setDragImage): + (WebCore::ClipboardHaiku::dragImageElement): + (WebCore::ClipboardHaiku::createDragImage): + (WebCore::ClipboardHaiku::declareAndWriteDragImage): + (WebCore::ClipboardHaiku::writeURL): + (WebCore::ClipboardHaiku::writeRange): + (WebCore::ClipboardHaiku::hasData): + * platform/haiku/DragDataHaiku.cpp: + (WebCore::DragData::createClipboard): + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break). + + Speculative GTK build fix + + * GNUmakefile.am: + Added missing .idl file, and added notifications directory to IDL_PATH. + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break). + + Speculative Windows build fix + + * WebCore.vcproj/WebCore.vcproj: + Added missing build steps for non-debug targets. + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break) + + Speculative build fix for Qt build. + + * WebCore.pro: Added /notifications to include path + +2009-08-11 John Gregg <johnnyg@google.com> + + Reviewed by Maciej Stachowiak. + + Desktop Notifications API + https://bugs.webkit.org/show_bug.cgi?id=25463 + + Adds an implementation of desktop notifications, behind the compile-time + flag ENABLE(NOTIFICATIONS). This code simply relays calls on the JavaScript + API through a NotificationProvider interface, which must provide the services + to actually notify the user and manage the desktop. This provider is injected + into WebKit through the ChromeClient for normal page contexts and through the + WorkerThread for worker contexts. + + A permissions API is defined on a per-origin basis, which allows a web page + to check if its origin is allowed to show desktop notifications, and to request + permission for its origin. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSDesktopNotificationsCustom.cpp: Added. + (WebCore::JSNotificationCenter::requestPermission): + (WebCore::JSNotification::addEventListener): + (WebCore::JSNotification::removeEventListener): + * bindings/js/JSEventTarget.cpp: + (WebCore::toJS): + (WebCore::toEventTarget): + * dom/EventTarget.cpp: + (WebCore::EventTarget::toNotification): + * dom/EventTarget.h: + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::notificationPresenter): + * notifications: Added. + * notifications/Notification.cpp: Added. + (WebCore::Notification::Notification): + (WebCore::Notification::~Notification): + (WebCore::Notification::show): + (WebCore::Notification::cancel): + (WebCore::Notification::ondisplay): + (WebCore::Notification::setOndisplay): + (WebCore::Notification::onerror): + (WebCore::Notification::setOnerror): + (WebCore::Notification::onclose): + (WebCore::Notification::setOnclose): + (WebCore::Notification::getAttributeEventListener): + (WebCore::Notification::setAttributeEventListener): + (WebCore::Notification::clearAttributeEventListener): + (WebCore::Notification::dispatchDisplayEvent): + (WebCore::Notification::dispatchErrorEvent): + (WebCore::Notification::dispatchCloseEvent): + (WebCore::Notification::addEventListener): + (WebCore::Notification::removeEventListener): + (WebCore::Notification::handleEvent): + (WebCore::Notification::dispatchEvent): + * notifications/Notification.h: Added. + (WebCore::Notification::create): + (WebCore::Notification::isHTML): + (WebCore::Notification::url): + (WebCore::Notification::contents): + (WebCore::Notification::scriptExecutionContext): + (WebCore::Notification::toNotification): + (WebCore::Notification::refEventTarget): + (WebCore::Notification::derefEventTarget): + * notifications/Notification.idl: Added. + * notifications/NotificationCenter.cpp: Added. + (WebCore::NotificationCenter::NotificationCenter): + (WebCore::NotificationCenter::checkPermission): + (WebCore::NotificationCenter::requestPermission): + * notifications/NotificationCenter.h: Added. + (WebCore::NotificationCenter::create): + (WebCore::NotificationCenter::createHTMLNotification): + (WebCore::NotificationCenter::createNotification): + (WebCore::NotificationCenter::context): + (WebCore::NotificationCenter::presenter): + * notifications/NotificationCenter.idl: Added. + * notifications/NotificationContents.h: Added. + (WebCore::NotificationContents::NotificationContents): + (WebCore::NotificationContents::icon): + (WebCore::NotificationContents::title): + (WebCore::NotificationContents::body): + * notifications/NotificationPresenter.h: Added. + (WebCore::NotificationPresenter::): + (WebCore::NotificationPresenter::~NotificationPresenter): + * page/Chrome.cpp: + (WebCore::Chrome::notificationPresenter): + * page/Chrome.h: + * page/ChromeClient.h: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::clear): + (WebCore::DOMWindow::webkitNotifications): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/Page.h: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::~WorkerContext): + (WebCore::WorkerContext::webkitNotifications): + * workers/WorkerContext.h: + * workers/WorkerContext.idl: + * workers/WorkerThread.h: + (WebCore::WorkerThread::getNotificationPresenter): + (WebCore::WorkerThread::setNotificationPresenter): + +2009-08-11 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Console Drawer is Toggling instead of Staying Open + https://bugs.webkit.org/show_bug.cgi?id=28115 + + * inspector/front-end/Drawer.js: + (WebInspector.Drawer.prototype.showView): ensures the drawer will be open and showing the provided view + * inspector/front-end/inspector.js: + (WebInspector.showConsole): usees the new showView to guarantee the Drawer will be open + (WebInspector.showChanges): uses the new showView guarantee the Drawer will be open + +2009-08-11 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> + + Reviewed by George Staikos. + + [WML] WMLPageState is not allowed to store the active card, it needs to be done per document + https://bugs.webkit.org/show_bug.cgi?id=28180 + + Don't store the active WMLCardElement in WMLPageState, but in WMLDocument. + Otherwhise this may lead to crashes related to intrinsic event exeuction. + + Unfortunately select elements aren't testable by the layout tests, so adding + a new manual test reproducing the crash. + + * manual-tests/wml/select-onpick-event-crash.wml: Added. + * wml/WMLCardElement.cpp: + (WebCore::WMLCardElement::determineActiveCard): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::defaultEventHandler): + * wml/WMLDocument.cpp: + (WebCore::WMLDocument::finishedParsing): + * wml/WMLDocument.h: + (WebCore::WMLDocument::activeCard): + * wml/WMLGoElement.cpp: + (WebCore::WMLGoElement::executeTask): + * wml/WMLPageState.cpp: + (WebCore::WMLPageState::WMLPageState): + * wml/WMLPageState.h: + * wml/WMLPrevElement.cpp: + (WebCore::WMLPrevElement::executeTask): + * wml/WMLRefreshElement.cpp: + (WebCore::WMLRefreshElement::executeTask): + +2009-08-07 Peter Kasting <pkasting@google.com> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28073 + Treat icons with no bit count and no color count as 256-color for + purposes of quality ranking. Also fix a couple cases of a style + violation. + + Test: fast/images/icon-0colors.html + + * platform/image-decoders/ico/ICOImageDecoder.cpp: + (WebCore::ICOImageDecoder::processDirectory): + (WebCore::ICOImageDecoder::readDirectoryEntry): + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + Need to refactor WorkerObjectProxy. + https://bugs.webkit.org/show_bug.cgi?id=28136 + + Added WorkerReportingProxy for reporting worker state (exceptions, console messages, thread exited) to the parent. + + Existing tests are sufficient, as this is only a refactoring. + + * GNUmakefile.am: + Added WorkerReportingProxy.h to build. + * WebCore.gypi: + Added WorkerReportingProxy.h to build. + * WebCore.vcproj/WebCore.vcproj: + Added WorkerReportingProxy.h to build. + * WebCore.xcodeproj/project.pbxproj: + Added WorkerReportingProxy.h to build. + * workers/DedicatedWorkerContext.cpp: + * workers/DedicatedWorkerContext.h: + Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy. + * workers/DedicatedWorkerThread.cpp: + (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): + Changed constructor to pass WorkerReportingProxy to base class. + * workers/DefaultSharedWorkerRepository.cpp: + Updated SharedWorkerProxy to implement WorkerReportingProxy interface. + (WebCore::SharedWorkerProxy::postExceptionToWorkerObject): + (WebCore::SharedWorkerProxy::postConsoleMessageToWorkerObject): + (WebCore::SharedWorkerProxy::workerContextClosed): + (WebCore::SharedWorkerProxy::workerContextDestroyed): + (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded): + Now passes in WorkerReportingProxy when creating SharedWorkerThread. + * workers/SharedWorkerContext.cpp: + * workers/SharedWorkerContext.h: + Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy. + * workers/SharedWorkerThread.cpp: + (WebCore::SharedWorkerThread::create): + (WebCore::SharedWorkerThread::SharedWorkerThread): + Passes WorkerReportingProxy to base class constructor. + * workers/SharedWorkerThread.h: + Constructor now takes a WorkerReportingProxy. + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::~WorkerContext): + Moved code that calls workerContextDestroyed() into base class so shared workers share this functionality. + (WebCore::WorkerContext::close): + Now notifies WorkerReportingProxy when the thread is closing. + (WebCore::WorkerContext::reportException): + Reports exceptions via WorkerReportingProxy. + (WebCore::WorkerContext::addMessage): + Reports console messages via WorkerReportingProxy. + * workers/WorkerContext.h: + * workers/WorkerObjectProxy.h: + (WebCore::WorkerObjectProxy::workerContextClosed): + Default empty implementation for dedicated workers. + * workers/WorkerReportingProxy.h: Added. + Base interface that contains APIs moved from WorkerObjectProxy. + (WebCore::WorkerReportingProxy::~WorkerReportingProxy): + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::WorkerThread): + Updated constructor to accept a WorkerReportingProxy. + * workers/WorkerThread.h: + (WebCore::WorkerThread::workerReportingProxy): + +2009-08-11 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by NOBODY (build fix). + + Fix the Qt build after r47022. + + Use the new markChildren() pattern for marking aggregate/child objects. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtRuntimeObjectImp::markChildren): + (JSC::Bindings::QtInstance::markAggregate): + * bridge/qt/qt_instance.h: + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::QtRuntimeMetaMethod::markChildren): + * bridge/qt/qt_runtime.h: + 2009-08-11 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Holger Freyther. @@ -191,7 +4435,7 @@ * page/DOMWindow.cpp: (WebCore::DOMWindow::applicationCache): -2009-08-10 Crystal Zhang <crystal.zhang@staikos.net> +2009-08-10 Crystal Zhang <crystal.zhang@torchmobile.com> Reviewed by George Staikos. diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig index 37d2df6..2369253 100644 --- a/WebCore/Configurations/FeatureDefines.xcconfig +++ b/WebCore/Configurations/FeatureDefines.xcconfig @@ -37,11 +37,14 @@ ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ENABLE_DATAGRID; +ENABLE_DATALIST = ENABLE_DATALIST; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; +ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ; ENABLE_GEOLOCATION = ; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; +ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_RUBY = ENABLE_RUBY; ENABLE_SHARED_WORKERS = ; @@ -59,4 +62,4 @@ ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index b0311e2..d127c48 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -73,6 +73,7 @@ #include "JSErrorEvent.cpp" #include "JSEvent.cpp" #include "JSEventException.cpp" +#include "JSEventSource.cpp" #include "JSFile.cpp" #include "JSFileList.cpp" #include "JSHistory.cpp" @@ -92,6 +93,7 @@ #include "JSHTMLDataGridCellElement.cpp" #include "JSHTMLDataGridColElement.cpp" #include "JSHTMLDataGridRowElement.cpp" +#include "JSHTMLDataListElement.cpp" #include "JSHTMLDirectoryElement.cpp" #include "JSHTMLDivElement.cpp" #include "JSHTMLDListElement.cpp" @@ -166,6 +168,8 @@ #include "JSNodeIterator.cpp" #include "JSNodeList.cpp" #include "JSNotation.cpp" +#include "JSNotificationCenter.cpp" +#include "JSNotification.cpp" #include "JSOverflowEvent.cpp" #include "JSPlugin.cpp" #include "JSPluginArray.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 788c5ee..4cdde30 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -35,6 +35,7 @@ VPATH = \ $(WebCore)/html/canvas \ $(WebCore)/inspector \ $(WebCore)/loader/appcache \ + $(WebCore)/notifications \ $(WebCore)/page \ $(WebCore)/plugins \ $(WebCore)/storage \ @@ -99,6 +100,7 @@ DOM_CLASSES = \ Event \ EventException \ EventListener \ + EventSource \ EventTarget \ File \ FileList \ @@ -120,6 +122,7 @@ DOM_CLASSES = \ HTMLDataGridCellElement \ HTMLDataGridColElement \ HTMLDataGridRowElement \ + HTMLDataListElement \ HTMLDListElement \ HTMLDirectoryElement \ HTMLDivElement \ @@ -194,6 +197,8 @@ DOM_CLASSES = \ NodeIterator \ NodeList \ Notation \ + Notification \ + NotificationCenter \ OverflowEvent \ Plugin \ PluginArray \ @@ -554,6 +559,10 @@ UserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS) # HTML tag and attribute names +ifeq ($(findstring ENABLE_DATALIST,$(FEATURE_DEFINES)), ENABLE_DATALIST) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST=1 +endif + ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO) HTML_FLAGS := $(HTML_FLAGS) ENABLE_VIDEO=1 endif @@ -683,7 +692,7 @@ endif # JavaScript bindings GENERATE_BINDINGS = perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl \ - --include dom --include html --include css --include page --include xml --include svg --outputDir . + --include dom --include html --include css --include page --include notifications --include xml --include svg --outputDir . GENERATE_BINDINGS_SCRIPTS = \ bindings/scripts/CodeGenerator.pm \ diff --git a/WebCore/ForwardingHeaders/parser/Parser.h b/WebCore/ForwardingHeaders/parser/Parser.h deleted file mode 100644 index 863df59..0000000 --- a/WebCore/ForwardingHeaders/parser/Parser.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef WebCore_FWD_Parser_h -#define WebCore_FWD_Parser_h -#include <JavaScriptCore/Parser.h> -#endif diff --git a/WebCore/ForwardingHeaders/runtime/CollectorHeapIterator.h b/WebCore/ForwardingHeaders/runtime/CollectorHeapIterator.h deleted file mode 100644 index fcfe26d..0000000 --- a/WebCore/ForwardingHeaders/runtime/CollectorHeapIterator.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef WebCore_FWD_CollectorHeapIterator_h -#define WebCore_FWD_CollectorHeapIterator_h -#include <JavaScriptCore/CollectorHeapIterator.h> -#endif diff --git a/WebCore/ForwardingHeaders/wtf/PossiblyNull.h b/WebCore/ForwardingHeaders/wtf/PossiblyNull.h new file mode 100644 index 0000000..d52a4a0 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/PossiblyNull.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_PossiblyNull_h +#define WebCore_FWD_PossiblyNull_h +#include <JavaScriptCore/PossiblyNull.h> +#endif diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 5cc1fd6..e2240f7 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -26,6 +26,7 @@ webcore_cppflags += \ -I$(srcdir)/WebCore/loader/appcache \ -I$(srcdir)/WebCore/loader/archive \ -I$(srcdir)/WebCore/loader/icon \ + -I$(srcdir)/WebCore/notifications \ -I$(srcdir)/WebCore/page \ -I$(srcdir)/WebCore/page/animation \ -I$(srcdir)/WebCore/platform \ @@ -175,6 +176,7 @@ IDL_BINDINGS += \ WebCore/html/HTMLDataGridCellElement.idl \ WebCore/html/HTMLDataGridColElement.idl \ WebCore/html/HTMLDataGridRowElement.idl \ + WebCore/html/HTMLDataListElement.idl \ WebCore/html/HTMLDListElement.idl \ WebCore/html/HTMLDirectoryElement.idl \ WebCore/html/HTMLDivElement.idl \ @@ -234,11 +236,14 @@ IDL_BINDINGS += \ WebCore/html/VoidCallback.idl \ WebCore/inspector/JavaScriptCallFrame.idl \ WebCore/inspector/InspectorBackend.idl \ + WebCore/notifications/Notification.idl \ + WebCore/notifications/NotificationCenter.idl \ WebCore/page/BarInfo.idl \ WebCore/page/Console.idl \ WebCore/page/Coordinates.idl \ WebCore/page/DOMSelection.idl \ WebCore/page/DOMWindow.idl \ + WebCore/page/EventSource.idl \ WebCore/page/Geolocation.idl \ WebCore/page/Geoposition.idl \ WebCore/page/History.idl \ @@ -311,6 +316,7 @@ webcore_sources += \ WebCore/bindings/js/JSDataGridDataSource.cpp \ WebCore/bindings/js/JSDataGridDataSource.h \ WebCore/bindings/js/JSCSSRuleCustom.cpp \ + WebCore/bindings/js/JSCSSRuleListCustom.cpp \ WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp \ WebCore/bindings/js/JSCSSStyleDeclarationCustom.h \ WebCore/bindings/js/JSCSSValueCustom.cpp \ @@ -342,6 +348,9 @@ webcore_sources += \ WebCore/bindings/js/JSEventCustom.cpp \ WebCore/bindings/js/JSEventListener.cpp \ WebCore/bindings/js/JSEventListener.h \ + WebCore/bindings/js/JSEventSourceConstructor.cpp \ + WebCore/bindings/js/JSEventSourceConstructor.h \ + WebCore/bindings/js/JSEventSourceCustom.cpp \ WebCore/bindings/js/JSEventTarget.cpp \ WebCore/bindings/js/JSEventTarget.h \ WebCore/bindings/js/JSGeolocationCustom.cpp \ @@ -349,6 +358,7 @@ webcore_sources += \ WebCore/bindings/js/JSHTMLAllCollection.h \ WebCore/bindings/js/JSHTMLAppletElementCustom.cpp \ WebCore/bindings/js/JSHTMLAppletElementCustom.h \ + WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp \ WebCore/bindings/js/JSHTMLCollectionCustom.cpp \ WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp \ WebCore/bindings/js/JSHTMLDocumentCustom.cpp \ @@ -654,7 +664,6 @@ webcore_sources += \ WebCore/dom/DOMCoreException.h \ WebCore/dom/DOMImplementation.cpp \ WebCore/dom/DOMImplementation.h \ - WebCore/dom/DocPtr.h \ WebCore/dom/Document.cpp \ WebCore/dom/Document.h \ WebCore/dom/DocumentFragment.cpp \ @@ -958,6 +967,8 @@ webcore_sources += \ WebCore/html/HTMLDataGridColElement.h \ WebCore/html/HTMLDataGridRowElement.cpp \ WebCore/html/HTMLDataGridRowElement.h \ + WebCore/html/HTMLDataListElement.cpp \ + WebCore/html/HTMLDataListElement.h \ WebCore/html/HTMLDListElement.cpp \ WebCore/html/HTMLDListElement.h \ WebCore/html/HTMLDirectoryElement.cpp \ @@ -1267,6 +1278,8 @@ webcore_sources += \ WebCore/page/EditorClient.h \ WebCore/page/EventHandler.cpp \ WebCore/page/EventHandler.h \ + WebCore/page/EventSource.cpp \ + WebCore/page/EventSource.h \ WebCore/page/FocusController.cpp \ WebCore/page/FocusController.h \ WebCore/page/FocusDirection.h \ @@ -1466,6 +1479,7 @@ webcore_sources += \ WebCore/platform/graphics/ImageBuffer.cpp \ WebCore/platform/graphics/ImageBuffer.h \ WebCore/platform/graphics/ImageObserver.h \ + WebCore/platform/graphics/ImageSource.cpp \ WebCore/platform/graphics/ImageSource.h \ WebCore/platform/graphics/IntPoint.h \ WebCore/platform/graphics/IntRect.cpp \ @@ -1857,7 +1871,6 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/ImageBufferCairo.cpp \ WebCore/platform/graphics/cairo/ImageBufferData.h \ WebCore/platform/graphics/cairo/ImageCairo.cpp \ - WebCore/platform/graphics/cairo/ImageSourceCairo.cpp \ WebCore/platform/graphics/cairo/PathCairo.cpp \ WebCore/platform/graphics/cairo/PatternCairo.cpp \ WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \ @@ -2111,6 +2124,8 @@ webcore_sources += \ WebCore/storage/SQLTransaction.cpp \ WebCore/storage/SQLTransaction.h \ WebCore/storage/SQLTransactionCallback.h \ + WebCore/storage/SQLTransactionCoordinator.h \ + WebCore/storage/SQLTransactionCoordinator.cpp \ WebCore/storage/SQLTransactionErrorCallback.h else @@ -2119,6 +2134,30 @@ webcore_cppflags += -DENABLE_DATABASE=0 endif # END ENABLE_DATABASE # ---- +# HTML5 datalist Support +# ---- +if ENABLE_DATALIST + +HTML_FEATURES += ENABLE_DATALIST=1 +webcore_cppflags += -DENABLE_DATALIST=1 + +endif # END ENABLE_DATALIST + +# ---- +# HTML5 server-sent events +# ---- +if !ENABLE_EVENTSOURCE +global_cppflags += -DENABLE_EVENTSOURCE=0 +endif + +if ENABLE_EVENTSOURCE +FEATURE_DEFINES_JAVASCRIPT += ENABLE_EVENTSOURCE=1 + +webcore_cppflags += \ + -DENABLE_EVENTSOURCE=1 +endif # ENABLE_EVENTSOURCE + +# ---- # HTML5 client-side session and persistent storage # ---- if ENABLE_DOM_STORAGE @@ -2370,6 +2409,7 @@ webcore_sources += \ WebCore/workers/WorkerMessagingProxy.cpp \ WebCore/workers/WorkerMessagingProxy.h \ WebCore/workers/WorkerObjectProxy.h \ + WebCore/workers/WorkerReportingProxy.h \ WebCore/workers/WorkerRunLoop.cpp \ WebCore/workers/WorkerRunLoop.h \ WebCore/workers/WorkerScriptLoader.cpp \ @@ -2461,7 +2501,7 @@ webcore_sources += \ DerivedSources/WMLNames.cpp: DerivedSources/WMLElementFactory.cpp; DerivedSources/WMLElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/wml/WMLTagNames.in $(WebCore)/wml/WMLAttributeNames.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/wml/WMLTagNames.in --attrs $(WebCore)/wml/WMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/wml/WMLTagNames.in --attrs $(WebCore)/wml/WMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" endif # END ENABLE_WML # ---- @@ -2509,6 +2549,24 @@ webcoregtk_sources += \ WebCore/platform/gtk/GeolocationServiceGtk.h endif # END ENABLE_GEOLOCATION +# ---- +# Notifications support +# ---- +if ENABLE_NOTIFICATIONS +FEATURE_DEFINES_JAVASCRIPT += ENABLE_NOTIFICATIONS=1 + +webcore_cppflags += \ + -DENABLE_NOTIFICATIONS=1 + +webcore_sources += \ + WebCore/notifications/Notification.cpp \ + WebCore/notifications/Notification.h \ + WebCore/notifications/NotificationCenter.cpp \ + WebCore/notifications/NotificationCenter.h \ + WebCore/notifications/NotificationPresenter.h \ + WebCore/notifications/NotificationContents.h + +endif # END ENABLE_NOTIFICATIONS # ---- # SVG Support @@ -3121,10 +3179,10 @@ DerivedSources/JSSVGElementWrapperFactory.cpp: DerivedSources/SVGElementFactory. if SVG_FLAGS DerivedSources/SVGElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/svg/svgtags.in $(WebCore)/svg/svgattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(SVG_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(SVG_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" else DerivedSources/SVGElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/svg/svgtags.in $(WebCore)/svg/svgattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" endif # SVG_FLAGS @@ -3133,7 +3191,7 @@ endif # SVG_FLAGS DerivedSources/XLinkNames.h: DerivedSources/XLinkNames.cpp; DerivedSources/XLinkNames.cpp : $(WebCore)/dom/make_names.pl $(WebCore)/svg/xlinkattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/svg/xlinkattrs.in --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/svg/xlinkattrs.in --outputDir "$(GENSOURCES)" endif # END ENABLE_SVG @@ -3177,20 +3235,20 @@ DerivedSources/CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css # DOCTYPE strings DerivedSources/DocTypeStrings.cpp : $(WebCore)/html/DocTypeStrings.gperf - $(GPERF) -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $(WebCore)/html/DocTypeStrings.gperf > $@ + $(AM_V_GEN)$(GPERF) -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $(WebCore)/html/DocTypeStrings.gperf > $@ # HTML entity names DerivedSources/HTMLEntityNames.c : $(WebCore)/html/HTMLEntityNames.gperf - $(GPERF) -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 \ + $(AM_V_GEN)$(GPERF) -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 \ $(WebCore)/html/HTMLEntityNames.gperf > $@ # color names DerivedSources/ColorData.c: $(WebCore)/platform/ColorData.gperf - $(GPERF) -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ + $(AM_V_GEN)$(GPERF) -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ # CSS tokenizer DerivedSources/tokenizer.cpp : $(WebCore)/css/tokenizer.flex $(WebCore)/css/maketokenizer - $(FLEX) -t $< | $(PERL) $(WebCore)/css/maketokenizer > $@ + $(AM_V_GEN)$(FLEX) -t $< | $(PERL) $(WebCore)/css/maketokenizer > $@ # CSS grammar @@ -3227,7 +3285,7 @@ SCRIPTS_BINDINGS = \ DerivedSources/UserAgentStyleSheetsData.cpp: DerivedSources/UserAgentStyleSheets.h; DerivedSources/UserAgentStyleSheets.h: $(WebCore)/css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS) - $(PERL) $< $@ DerivedSources/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) + $(AM_V_GEN)$(PERL) $< $@ DerivedSources/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) # HTML tag and attribute names DerivedSources/HTMLElementFactory.cpp: DerivedSources/HTMLNames.cpp; @@ -3238,16 +3296,16 @@ DerivedSources/JSHTMLElementWrapperFactory.h: DerivedSources/JSHTMLElementWrappe if HTML_FLAGS DerivedSources/HTMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(HTML_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(HTML_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" else DerivedSources/HTMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" endif # HTML_FLAGS DerivedSources/XMLNames.h: DerivedSources/XMLNames.cpp; DerivedSources/XMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in --outputDir "$(GENSOURCES)" IDL_PATH := \ $(WebCore)/bindings/js \ @@ -3257,6 +3315,7 @@ IDL_PATH := \ $(WebCore)/html/canvas \ $(WebCore)/inspector \ $(WebCore)/loader/appcache \ + $(WebCore)/notifications \ $(WebCore)/page \ $(WebCore)/storage \ $(WebCore)/svg \ @@ -3271,7 +3330,7 @@ DerivedSources/JS%.h: DerivedSources/JS%.cpp; .SECONDARY: DerivedSources/JS%.cpp: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm - $(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "$(FEATURE_DEFINES_JAVASCRIPT)" --generator JS $< + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "$(FEATURE_DEFINES_JAVASCRIPT)" --generator JS $< IDL_BINDINGS_JS_PURE := \ WebCore/svg/ElementTimeControl.idl \ @@ -3381,4 +3440,3 @@ dist_webresources_DATA = \ CLEANFILES += \ libWebCoreJS.la - diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index 8738e15..1d7fa6c 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -100,6 +100,7 @@ 'html/HTMLDataGridColElement.idl', 'html/HTMLDataGridElement.idl', 'html/HTMLDataGridRowElement.idl', + 'html/HTMLDataListElement.idl', 'html/HTMLDirectoryElement.idl', 'html/HTMLDivElement.idl', 'html/HTMLDocument.idl', @@ -414,6 +415,7 @@ 'bindings/js/JSConsoleCustom.cpp', 'bindings/js/JSCoordinatesCustom.cpp', 'bindings/js/JSCSSRuleCustom.cpp', + 'bindings/js/JSCSSRuleListCustom.cpp', 'bindings/js/JSCSSStyleDeclarationCustom.cpp', 'bindings/js/JSCSSStyleDeclarationCustom.h', 'bindings/js/JSCSSValueCustom.cpp', @@ -464,6 +466,7 @@ 'bindings/js/JSHTMLAllCollection.h', 'bindings/js/JSHTMLAppletElementCustom.cpp', 'bindings/js/JSHTMLAppletElementCustom.h', + 'bindings/js/JSHTMLCanvasElementCustom.cpp', 'bindings/js/JSHTMLCollectionCustom.cpp', 'bindings/js/JSHTMLDataGridElementCustom.cpp', 'bindings/js/JSHTMLDocumentCustom.cpp', @@ -947,7 +950,6 @@ 'dom/DOMCoreException.h', 'dom/DOMImplementation.cpp', 'dom/DOMImplementation.h', - 'dom/DocPtr.h', 'dom/Document.cpp', 'dom/Document.h', 'dom/DocumentFragment.cpp', @@ -1263,6 +1265,8 @@ 'html/HTMLDataGridElement.h', 'html/HTMLDataGridRowElement.cpp', 'html/HTMLDataGridRowElement.h', + 'html/HTMLDataListElement.cpp', + 'html/HTMLDataListElement.h', 'html/HTMLDirectoryElement.cpp', 'html/HTMLDirectoryElement.h', 'html/HTMLDivElement.cpp', @@ -1748,7 +1752,6 @@ 'platform/graphics/cairo/ImageBufferCairo.cpp', 'platform/graphics/cairo/ImageBufferData.h', 'platform/graphics/cairo/ImageCairo.cpp', - 'platform/graphics/cairo/ImageSourceCairo.cpp', 'platform/graphics/cairo/PathCairo.cpp', 'platform/graphics/cairo/PatternCairo.cpp', 'platform/graphics/cairo/TransformationMatrixCairo.cpp', @@ -1912,8 +1915,6 @@ 'platform/graphics/skia/GraphicsContextSkia.cpp', 'platform/graphics/skia/ImageBufferSkia.cpp', 'platform/graphics/skia/ImageSkia.cpp', - 'platform/graphics/skia/ImageSourceSkia.cpp', - 'platform/graphics/skia/ImageSourceSkia.h', 'platform/graphics/skia/IntPointSkia.cpp', 'platform/graphics/skia/IntRectSkia.cpp', 'platform/graphics/skia/NativeImageSkia.cpp', @@ -1996,7 +1997,6 @@ 'platform/graphics/wx/GraphicsContextWx.cpp', 'platform/graphics/wx/ImageBufferData.h', 'platform/graphics/wx/ImageBufferWx.cpp', - 'platform/graphics/wx/ImageSourceWx.cpp', 'platform/graphics/wx/ImageWx.cpp', 'platform/graphics/wx/IntPointWx.cpp', 'platform/graphics/wx/IntRectWx.cpp', @@ -2060,6 +2060,7 @@ 'platform/graphics/ImageBuffer.h', 'platform/graphics/ImageObserver.h', 'platform/graphics/ImageSource.h', + 'platform/graphics/ImageSource.cpp', 'platform/graphics/IntPoint.h', 'platform/graphics/IntRect.cpp', 'platform/graphics/IntRect.h', @@ -2541,6 +2542,7 @@ 'platform/ContextMenu.cpp', 'platform/ContextMenu.h', 'platform/ContextMenuItem.h', + 'platform/Cookie.h', 'platform/CookieJar.h', 'platform/CrossThreadCopier.h', 'platform/CrossThreadCopier.cpp', @@ -2963,6 +2965,8 @@ 'storage/SQLTransaction.cpp', 'storage/SQLTransaction.h', 'storage/SQLTransactionCallback.h', + 'storage/SQLTransactionCoordinator.h', + 'storage/SQLTransactionCoordinator.cpp', 'storage/SQLTransactionErrorCallback.h', 'storage/Storage.cpp', 'storage/Storage.h', @@ -3353,6 +3357,7 @@ 'workers/WorkerMessagingProxy.cpp', 'workers/WorkerMessagingProxy.h', 'workers/WorkerObjectProxy.h', + 'workers/WorkerReportingProxy.h', 'workers/WorkerRunLoop.cpp', 'workers/WorkerRunLoop.h', 'workers/WorkerScriptLoader.cpp', @@ -3425,6 +3430,7 @@ 'inspector/front-end/ChangesView.js', 'inspector/front-end/Color.js', 'inspector/front-end/ConsoleView.js', + 'inspector/front-end/CookieItemsView.js', 'inspector/front-end/Database.js', 'inspector/front-end/DatabaseQueryView.js', 'inspector/front-end/DatabasesPanel.js', @@ -3466,6 +3472,7 @@ 'inspector/front-end/SidebarTreeElement.js', 'inspector/front-end/SourceFrame.js', 'inspector/front-end/SourceView.js', + 'inspector/front-end/StatusBarButton.js', 'inspector/front-end/StylesSidebarPane.js', 'inspector/front-end/TextPrompt.js', 'inspector/front-end/TopDownProfileDataGridTree.js', @@ -3481,6 +3488,7 @@ 'inspector/front-end/Images/clearConsoleButtonGlyph.png', 'inspector/front-end/Images/closeButtons.png', 'inspector/front-end/Images/consoleButtonGlyph.png', + 'inspector/front-end/Images/cookie.png', 'inspector/front-end/Images/database.png', 'inspector/front-end/Images/databasesIcon.png', 'inspector/front-end/Images/databaseTable.png', diff --git a/WebCore/WebCore.order b/WebCore/WebCore.order index 31b178c..c9441c6 100644 --- a/WebCore/WebCore.order +++ b/WebCore/WebCore.order @@ -2290,7 +2290,6 @@ __ZN3JSC8Bindings10RootObject9gcProtectEPNS_8JSObjectE __ZNK3WTF9HashTableIPN3JSC8JSObjectESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTra __ZN3WTF7HashMapIPN3JSC8JSObjectEjNS_7PtrHashIS3_EENS_10HashTraitsIS3_EENS6_IjEEE3addERKS3_RKj __ZN3WTF9HashTableIPN3JSC8JSObjectESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTrai -__ZN7WebCore19InspectorController34inspectedWindowScriptObjectClearedEPNS_5FrameE __ZN7WebCore6StringC1ERKN3JSC7UStringE __ZN7WebCore6StringC2ERKN3JSC7UStringE __ZNK7WebCore20StringSourceProvider4dataEv diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 6a19309..5eeadb7 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -10,6 +10,8 @@ symbian: { webkitlibs.sources = QtWebKit.dll webkitlibs.path = /sys/bin DEPLOYMENT += webkitlibs + + TARGET.UID3 = 0x200267C2 } include($$PWD/../WebKit.pri) @@ -106,6 +108,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=.): DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=1 !contains(DEFINES, ENABLE_DATABASE=.): DEFINES += ENABLE_DATABASE=1 +!contains(DEFINES, ENABLE_EVENTSOURCE=.): DEFINES += ENABLE_EVENTSOURCE=1 !contains(DEFINES, ENABLE_OFFLINE_WEB_APPLICATIONS=.): DEFINES += ENABLE_OFFLINE_WEB_APPLICATIONS=1 !contains(DEFINES, ENABLE_DOM_STORAGE=.): DEFINES += ENABLE_DOM_STORAGE=1 !contains(DEFINES, ENABLE_ICONDATABASE=.): DEFINES += ENABLE_ICONDATABASE=1 @@ -125,6 +128,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_XPATH=.): DEFINES += ENABLE_XPATH=1 !contains(DEFINES, ENABLE_XSLT=.): DEFINES += ENABLE_XSLT=0 #!contains(DEFINES, ENABLE_XBL=.): DEFINES += ENABLE_XBL=1 +!contains(DEFINES, ENABLE_WCSS=.): DEFINES += ENABLE_WCSS=0 !contains(DEFINES, ENABLE_WML=.): DEFINES += ENABLE_WML=0 !contains(DEFINES, ENABLE_SHARED_WORKERS=.): DEFINES += ENABLE_SHARED_WORKERS=0 !contains(DEFINES, ENABLE_WORKERS=.): DEFINES += ENABLE_WORKERS=1 @@ -152,6 +156,9 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { else:DEFINES += ENABLE_VIDEO=0 } +# HTML5 datalist support +!contains(DEFINES, ENABLE_DATALIST=.): DEFINES += ENABLE_DATALIST=1 + # Nescape plugins support (NPAPI) !contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) { unix|win32-*:!embedded:!wince*:!symbian { @@ -193,6 +200,7 @@ INCLUDEPATH = \ $$PWD/loader/appcache \ $$PWD/loader/archive \ $$PWD/loader/icon \ + $$PWD/notifications \ $$PWD/page \ $$PWD/page/animation \ $$PWD/platform \ @@ -254,9 +262,16 @@ WALDOCSSVALUES = $$PWD/css/CSSValueKeywords.in DASHBOARDSUPPORTCSSPROPERTIES = $$PWD/css/DashboardSupportCSSPropertyNames.in -SVGCSSPROPERTIES = $$PWD/css/SVGCSSPropertyNames.in -SVGCSSVALUES = $$PWD/css/SVGCSSValueKeywords.in +contains(DEFINES, ENABLE_SVG=1) { + EXTRACSSPROPERTIES += $$PWD/css/SVGCSSPropertyNames.in + EXTRACSSVALUES += $$PWD/css/SVGCSSValueKeywords.in +} + +contains(DEFINES, ENABLE_WCSS=1) { + EXTRACSSPROPERTIES += $$PWD/css/WCSSPropertyNames.in + EXTRACSSVALUES += $$PWD/css/WCSSValueKeywords.in +} STYLESHEETS_EMBED = \ $$PWD/css/html.css \ @@ -364,6 +379,7 @@ IDL_BINDINGS += \ html/HTMLDataGridCellElement.idl \ html/HTMLDataGridColElement.idl \ html/HTMLDataGridRowElement.idl \ + html/HTMLDataListElement.idl \ html/HTMLDirectoryElement.idl \ html/HTMLDivElement.idl \ html/HTMLDListElement.idl \ @@ -430,6 +446,7 @@ IDL_BINDINGS += \ page/Coordinates.idl \ page/DOMSelection.idl \ page/DOMWindow.idl \ + page/EventSource.idl \ page/Geolocation.idl \ page/Geoposition.idl \ page/History.idl \ @@ -628,6 +645,7 @@ SOURCES += \ bindings/js/JSClipboardCustom.cpp \ bindings/js/JSConsoleCustom.cpp \ bindings/js/JSCSSRuleCustom.cpp \ + bindings/js/JSCSSRuleListCustom.cpp \ bindings/js/JSCSSStyleDeclarationCustom.cpp \ bindings/js/JSCSSValueCustom.cpp \ bindings/js/JSCoordinatesCustom.cpp \ @@ -645,11 +663,14 @@ SOURCES += \ bindings/js/JSDOMWindowShell.cpp \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ + bindings/js/JSEventSourceConstructor.cpp \ + bindings/js/JSEventSourceCustom.cpp \ bindings/js/JSEventTarget.cpp \ bindings/js/JSGeolocationCustom.cpp \ bindings/js/JSHTMLAllCollection.cpp \ bindings/js/JSHistoryCustom.cpp \ bindings/js/JSHTMLAppletElementCustom.cpp \ + bindings/js/JSHTMLCanvasElementCustom.cpp \ bindings/js/JSHTMLCollectionCustom.cpp \ bindings/js/JSHTMLDataGridElementCustom.cpp \ bindings/js/JSHTMLDocumentCustom.cpp \ @@ -944,6 +965,7 @@ SOURCES += \ html/HTMLDataGridCellElement.cpp \ html/HTMLDataGridColElement.cpp \ html/HTMLDataGridRowElement.cpp \ + html/HTMLDataListElement.cpp \ html/HTMLDirectoryElement.cpp \ html/HTMLDivElement.cpp \ html/HTMLDListElement.cpp \ @@ -1076,6 +1098,7 @@ SOURCES += \ page/NavigatorBase.cpp \ page/DragController.cpp \ page/EventHandler.cpp \ + page/EventSource.cpp \ page/FocusController.cpp \ page/Frame.cpp \ page/FrameTree.cpp \ @@ -1323,6 +1346,7 @@ HEADERS += \ bindings/js/JSDOMWindowCustom.h \ bindings/js/JSDOMWindowShell.h \ bindings/js/JSEventListener.h \ + bindings/js/JSEventSourceConstructor.h \ bindings/js/JSEventTarget.h \ bindings/js/JSHistoryCustom.h \ bindings/js/JSHTMLAllCollection.h \ @@ -1748,6 +1772,7 @@ HEADERS += \ page/DOMWindow.h \ page/DragController.h \ page/EventHandler.h \ + page/EventSource.h \ page/FocusController.h \ page/Frame.h \ page/FrameTree.h \ @@ -2426,6 +2451,10 @@ contains(DEFINES, ENABLE_DATAGRID=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_DATAGRID=1 } +contains(DEFINES, ENABLE_EVENTSOURCE=1) { + FEATURE_DEFINES_JAVASCRIPT += ENABLE_EVENTSOURCE=1 +} + contains(DEFINES, ENABLE_SQLITE=1) { !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) { # Build sqlite3 into WebCore from source @@ -2473,6 +2502,7 @@ contains(DEFINES, ENABLE_DATABASE=1) { storage/SQLResultSetRowList.cpp \ storage/SQLStatement.cpp \ storage/SQLTransaction.cpp \ + storage/SQLTransactionCoordinator.cpp \ bindings/js/JSCustomSQLStatementCallback.cpp \ bindings/js/JSCustomSQLStatementErrorCallback.cpp \ bindings/js/JSCustomSQLTransactionCallback.cpp \ @@ -2500,6 +2530,7 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) { storage/SQLResultSetRowList.h \ storage/SQLStatement.h \ storage/SQLTransaction.h \ + storage/SQLTransactionCoordinator.h \ storage/StorageArea.h \ storage/StorageAreaImpl.h \ storage/StorageAreaSync.h \ @@ -2672,6 +2703,14 @@ contains(DEFINES, ENABLE_FILTERS=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_FILTERS=1 } +contains(DEFINES, ENABLE_WCSS=1) { + FEATURE_DEFINES_JAVASCRIPT += ENABLE_WCSS=1 + contains(DEFINES, ENABLE_XHTMLMP=0) { + DEFINES -= ENABLE_XHTMLMP=0 + DEFINES += ENABLE_XHTMLMP=1 + } +} + contains(DEFINES, ENABLE_WML=1) { SOURCES += \ wml/WMLAElement.cpp \ @@ -2980,42 +3019,25 @@ contains(DEFINES, ENABLE_SVG=1) { xlinknames.variable_out = GENERATED_SOURCES addExtraCompilerWithHeader(xlinknames) - # GENERATOR 6-A: - cssprops.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp - cssprops.input = WALDOCSSPROPS - cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$DASHBOARDSUPPORTCSSPROPERTIES $$SVGCSSPROPERTIES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makeprop.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf - cssprops.CONFIG = target_predeps no_link - cssprops.variable_out = - cssprops.depend = ${QMAKE_FILE_NAME} DASHBOARDSUPPORTCSSPROPERTIES SVGCSSPROPERTIES - addExtraCompilerWithHeader(cssprops) - - # GENERATOR 6-B: - cssvalues.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.c - cssvalues.input = WALDOCSSVALUES - cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$SVGCSSVALUES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makevalues.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.gperf - cssvalues.CONFIG = target_predeps no_link - cssvalues.variable_out = - cssvalues.depend = ${QMAKE_FILE_NAME} SVGCSSVALUES - addExtraCompilerWithHeader(cssvalues) -} else { - # GENERATOR 6-A: - cssprops.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp - cssprops.input = WALDOCSSPROPS - cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$DASHBOARDSUPPORTCSSPROPERTIES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makeprop.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf - cssprops.CONFIG = target_predeps no_link - cssprops.variable_out = - cssprops.depend = ${QMAKE_FILE_NAME} DASHBOARDSUPPORTCSSPROPERTIES - addExtraCompilerWithHeader(cssprops) - - # GENERATOR 6-B: - cssvalues.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.c - cssvalues.input = WALDOCSSVALUES - cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makevalues.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.gperf - cssvalues.CONFIG = target_predeps no_link - cssvalues.variable_out = - cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_GENERATED_SOURCES_DIR_SLASH}${QMAKE_FILE_BASE}.h - addExtraCompiler(cssvalues) -} +} +# GENERATOR 6-A: +cssprops.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp +cssprops.input = WALDOCSSPROPS +cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$DASHBOARDSUPPORTCSSPROPERTIES $$EXTRACSSPROPERTIES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makeprop.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf +cssprops.CONFIG = target_predeps no_link +cssprops.variable_out = +cssprops.depend = ${QMAKE_FILE_NAME} DASHBOARDSUPPORTCSSPROPERTIES EXTRACSSPROPERTIES +addExtraCompilerWithHeader(cssprops) + +# GENERATOR 6-B: +cssvalues.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.c +cssvalues.input = WALDOCSSVALUES +cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$EXTRACSSVALUES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makevalues.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.gperf +cssvalues.CONFIG = target_predeps no_link +cssvalues.variable_out = +cssvalues.depend = ${QMAKE_FILE_NAME} EXTRACSSVALUES +cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_GENERATED_SOURCES_DIR_SLASH}${QMAKE_FILE_BASE}.h +addExtraCompiler(cssvalues) contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_JAVASCRIPT_DEBUGGER=1 @@ -3241,3 +3263,20 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4 CONFIG += no_debug_info } +!win32-g++:win32:contains(QMAKE_HOST.arch, x86_64):{ + asm_compiler.commands = ml64 /c + asm_compiler.commands += /Fo ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} + asm_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + asm_compiler.input = ASM_SOURCES + asm_compiler.variable_out = OBJECTS + asm_compiler.name = compiling[asm] ${QMAKE_FILE_IN} + silent:asm_compiler.commands = @echo compiling[asm] ${QMAKE_FILE_IN} && $$asm_compiler.commands + QMAKE_EXTRA_COMPILERS += asm_compiler + + ASM_SOURCES += \ + plugins/win/PaintHooks.asm + if(win32-msvc2005|win32-msvc2008):equals(TEMPLATE_PREFIX, "vc") { + SOURCES += \ + plugins/win/PaintHooks.asm + } +} diff --git a/WebCore/WebCore.vcproj/QTMovieWin.vcproj b/WebCore/WebCore.vcproj/QTMovieWin.vcproj index 593855b..e53bd22 100644 --- a/WebCore/WebCore.vcproj/QTMovieWin.vcproj +++ b/WebCore/WebCore.vcproj/QTMovieWin.vcproj @@ -23,7 +23,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCCustomBuildTool" @@ -96,7 +96,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCCustomBuildTool" @@ -168,7 +168,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCCustomBuildTool" diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index 7aef730..9d08b56 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\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)..\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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="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\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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"
"
/>
</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\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)..\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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="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\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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"
"
/>
</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\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)..\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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="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\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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"
"
/>
</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\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)..\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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="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\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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"
"
/>
</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\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)..\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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="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\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\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\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\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)..\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\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.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\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"
"
/>
</Configuration>
</Configurations>
@@ -2779,6 +2779,54 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventSource.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>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventSource.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFile.cpp"
>
<FileConfiguration
@@ -3787,6 +3835,14 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLDataListElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLDataListElement.cpp"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLDirectoryElement.cpp"
>
<FileConfiguration
@@ -7387,6 +7443,102 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotification.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>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotification.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotificationCenter.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>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotificationCenter.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSOverflowEvent.cpp"
>
<FileConfiguration
@@ -16717,6 +16869,14 @@ >
</File>
<File
+ RelativePath="..\page\EventSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\EventSource.h"
+ >
+ </File>
+ <File
RelativePath="..\page\FocusController.cpp"
>
</File>
@@ -18389,6 +18549,34 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\ImageSource.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>
+ </File>
+ <File
RelativePath="..\platform\graphics\ImageSource.h"
>
</File>
@@ -19564,34 +19752,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\platform\graphics\cairo\ImageSourceCairo.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>
- </File>
- <File
RelativePath="..\platform\graphics\cairo\PathCairo.cpp"
>
<FileConfiguration
@@ -23632,10 +23792,6 @@ >
</File>
<File
- RelativePath="..\dom\DocPtr.h"
- >
- </File>
- <File
RelativePath="..\dom\Document.cpp"
>
</File>
@@ -24292,6 +24448,10 @@ >
</File>
<File
+ RelativePath="..\workers\WorkerReportingProxy.h"
+ >
+ </File>
+ <File
RelativePath="..\workers\WorkerRunLoop.cpp"
>
</File>
@@ -24321,6 +24481,34 @@ </File>
</Filter>
<Filter
+ Name="notifications"
+ >
+ <File
+ RelativePath="..\notifications\Notification.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\Notification.h"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationCenter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationCenter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationContents.h"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationPresenter.h"
+ >
+ </File>
+ </Filter>
+ <Filter
Name="editing"
>
<File
@@ -25552,6 +25740,14 @@ >
</File>
<File
+ RelativePath="..\html\HTMLDataListElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTMLDataListElement.h"
+ >
+ </File>
+ <File
RelativePath="..\html\HTMLDirectoryElement.cpp"
>
<FileConfiguration
@@ -28491,6 +28687,10 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSCSSRuleListCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSCSSStyleDeclarationCustom.cpp"
>
</File>
@@ -28575,6 +28775,10 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSDesktopNotificationsCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSDocumentCustom.cpp"
>
</File>
@@ -28643,6 +28847,18 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSEventSourceConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSEventSourceConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSEventSourceCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSEventTarget.cpp"
>
</File>
@@ -28671,6 +28887,10 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSHTMLCanvasElementCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSHTMLCollectionCustom.cpp"
>
</File>
@@ -30596,6 +30816,14 @@ >
</File>
<File
+ RelativePath="..\storage\SQLTransactionCoordinator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\SQLTransactionCoordinator.cpp"
+ >
+ </File>
+ <File
RelativePath="..\storage\SQLTransactionErrorCallback.h"
>
</File>
@@ -31083,6 +31311,10 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\StatusBarButton.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\StylesSidebarPane.js"
>
</File>
diff --git a/WebCore/WebCore.vcproj/WebCoreCURL.vsprops b/WebCore/WebCore.vcproj/WebCoreCURL.vsprops index aaadb97..4320e05 100644 --- a/WebCore/WebCore.vcproj/WebCoreCURL.vsprops +++ b/WebCore/WebCore.vcproj/WebCoreCURL.vsprops @@ -7,5 +7,6 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="$(ProjectDir)..\platform\network\curl"
+ PreprocessorDefinitions="USE_WINDOWS_SSPI;USE_SSLEAY;HAVE_ZLIB"
/>
</VisualStudioPropertySheet>
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 3dd37fc..cbf71e1 100644 --- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,8 +7,8 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ProjectDir)..\";"$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\icu";"$(WebKitLibrariesDir)\include\iconv";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)..\svg\animation"" - PreprocessorDefinitions="__WIN32__;WEBCORE_CONTEXT_MENUS;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT" + AdditionalIncludeDirectories=""$(ProjectDir)..\";"$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\icu";"$(WebKitLibrariesDir)\include\iconv";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)..\svg\animation"" + PreprocessorDefinitions="__WIN32__;WEBCORE_CONTEXT_MENUS;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DATALIST;ENABLE_DOM_STORAGE;ENABLE_EVENTSOURCE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT" UsePrecompiledHeader="2" PrecompiledHeaderThrough="WebCorePrefix.h" ForcedIncludeFiles="WebCorePrefix.h" @@ -19,6 +19,6 @@ /> <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")
exit /b
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")
exit /b
" /> </VisualStudioPropertySheet> diff --git a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj index a7e8f6f..4a39032 100644 --- a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj +++ b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj @@ -22,8 +22,8 @@ > <Tool Name="VCNMakeTool" - BuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" - ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
set PATH=%SystemDrive%\cygwin\bin;%PATH%
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" + BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" + ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" Output="" PreprocessorDefinitions="" diff --git a/WebCore/WebCore.vcproj/build-generated-files.sh b/WebCore/WebCore.vcproj/build-generated-files.sh index e4cbd45..46b8c7b 100644 --- a/WebCore/WebCore.vcproj/build-generated-files.sh +++ b/WebCore/WebCore.vcproj/build-generated-files.sh @@ -71,5 +71,5 @@ mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources" cd "${BUILT_PRODUCTS_DIR}/DerivedSources" export WebCore="${XSRCROOT}" -export FEATURE_DEFINES="ENABLE_CHANNEL_MESSAGING ENABLE_DATABASE ENABLE_DATAGRID ENABLE_DOM_STORAGE ENABLE_ICONDATABASE ENABLE_JAVASCRIPT_DEBUGGER ENABLE_OFFLINE_WEB_APPLICATIONS ENABLE_RUBY ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_WEB_SOCKETS ENABLE_WORKERS ENABLE_XPATH ENABLE_XSLT" +export FEATURE_DEFINES="ENABLE_CHANNEL_MESSAGING ENABLE_DATABASE ENABLE_DATAGRID ENABLE_DATALIST ENABLE_DOM_STORAGE ENABLE_EVENTSOURCE ENABLE_ICONDATABASE ENABLE_JAVASCRIPT_DEBUGGER ENABLE_OFFLINE_WEB_APPLICATIONS ENABLE_RUBY ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_WEB_SOCKETS ENABLE_WORKERS ENABLE_XPATH ENABLE_XSLT" make -f "$WebCore/DerivedSources.make" -j ${NUMCPUS} || exit 1 diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 96c4fc7..e4d8124 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -635,6 +635,16 @@ 31C0FF4C0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */; }; 31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */; }; 31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */; }; + 33503C9A10179A74003B47E1 /* NotificationPresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationPresenter.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503C9F10179AD7003B47E1 /* JSNotification.cpp */; }; + 33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; }; + 33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */; }; + 33503CA610179AD7003B47E1 /* JSNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */; }; + 33503CC010179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */; }; + 33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CC61017A1B1003B47E1 /* Notification.cpp */; }; + 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3390CA510FFC157B00921962 /* NotificationCenter.cpp */; }; + 3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA520FFC157B00921962 /* NotificationCenter.h */; }; + 3390CA580FFC157B00921962 /* NotificationContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA540FFC157B00921962 /* NotificationContents.h */; }; 371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 371F4F410D25B9AF00ECE0D5 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */; }; 371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */; }; @@ -675,6 +685,7 @@ 4162A4581011464700DFF3ED /* JSDedicatedWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A4561011464700DFF3ED /* JSDedicatedWorkerContext.h */; }; 4167EBF5102962BA003D252A /* DefaultSharedWorkerRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */; }; 4167EBF6102962BA003D252A /* DefaultSharedWorkerRepository.h in Headers */ = {isa = PBXBuildFile; fileRef = 4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */; }; + 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; }; 416E75BE0EDF8FD700360E1D /* ScriptCallStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */; }; 416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */; }; 416E75CB0EDF90C700360E1D /* ScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */; }; @@ -965,7 +976,7 @@ 6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6515EC8F0D9723FF0063D49A /* JSSVGAltGlyphElement.cpp */; }; 6515EC920D9723FF0063D49A /* JSSVGAltGlyphElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6515EC900D9723FF0063D49A /* JSSVGAltGlyphElement.h */; }; 652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */; }; - 65488D6B0DD5A83D009D83B2 /* StringSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D6A0DD5A83D009D83B2 /* StringSourceProvider.h */; }; + 65488D6B0DD5A83D009D83B2 /* StringSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D6A0DD5A83D009D83B2 /* StringSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6550B69D099DF0270090D781 /* CDATASection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B693099DF0270090D781 /* CDATASection.cpp */; }; 6550B69E099DF0270090D781 /* CDATASection.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B694099DF0270090D781 /* CDATASection.h */; }; 6550B69F099DF0270090D781 /* CharacterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B695099DF0270090D781 /* CharacterData.cpp */; }; @@ -2087,6 +2098,8 @@ 938E65F709F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */; }; 938E666009F09B81008A48EC /* JSHTMLCanvasElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938E665F09F09B81008A48EC /* JSHTMLCanvasElement.cpp */; }; 938E666209F09B87008A48EC /* JSHTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */; }; + 9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */; }; + 9392262F10321084006E7D5D /* JSCSSRuleListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */; }; 9392F1420AD185F400691BD4 /* RenderCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F1410AD185F400691BD4 /* RenderCounter.h */; }; 9392F1440AD185FE00691BD4 /* RenderCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */; }; 9392F14C0AD1861B00691BD4 /* CounterNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F14B0AD1861B00691BD4 /* CounterNode.h */; }; @@ -2136,7 +2149,6 @@ 93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */; }; 93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB169609F880C00091F8FF /* WebCoreSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */; }; - 93EEC1FA09C2877700C515D1 /* DocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EEC1E709C2877700C515D1 /* DocPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; 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 /* HTMLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* HTMLParser.h */; }; @@ -3851,6 +3863,8 @@ B5A684240FFABEAA00D24689 /* SQLiteFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */; }; B6D39711103AF29D00A83BC7 /* MockGeolocationService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D39710103AF29D00A83BC7 /* MockGeolocationService.cpp */; }; B6D39715103AF2BB00A83BC7 /* MockGeolocationService.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D39714103AF2BB00A83BC7 /* MockGeolocationService.h */; }; + B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */; }; + B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; }; BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; }; BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; }; BC00F0060E0A185500FD04E3 /* DOMFileInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */; }; @@ -4372,7 +4386,7 @@ C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; }; C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; }; C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; }; - CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; }; + CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; D05CED290A40BB2C00C5AF38 /* FormatBlockCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */; }; D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */; }; D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D06C0D8D0CFD11460065F43F /* RemoveFormatCommand.h */; }; @@ -4386,12 +4400,20 @@ D23CA55D0AB0EAAE005108A5 /* JSRangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */; }; D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */; }; D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA56B0AB0EB8D005108A5 /* RangeException.h */; }; + D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; }; DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; }; DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; }; DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DD763BB10992C2C900740B8E /* libxml2.dylib */; }; DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */; }; DDE63ED50B7D45A800226998 /* DOMTextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A14750B7D1BAF00A53FFD /* DOMTextEvent.h */; }; + E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B17C53EAC1C1FBEE /* EventSource.h */; }; + E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */; }; + E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */; }; + E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */; }; + E0FEF372B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */; }; + E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */; }; + E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */; }; E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; }; E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E107400C0E77BDC00033AF24 /* JSMessageChannel.h */; }; E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */; }; @@ -4521,6 +4543,13 @@ ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; }; EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; }; + F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */; }; + F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */; }; + F5C041E30FFCA96D00839D4A /* DOMHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */; }; + F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5C041DF0FFCA96D00839D4A /* DOMHTMLDataListElement.mm */; }; + F5C041E50FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041E00FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h */; }; + F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */; }; + F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */; }; F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */; }; F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; }; F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; }; @@ -5634,6 +5663,19 @@ 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEvent.h; sourceTree = "<group>"; }; 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitTransitionEvent.mm; sourceTree = "<group>"; }; 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; }; + 333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = notifications/Notification.idl; sourceTree = "<group>"; }; + 333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = notifications/Notification.h; sourceTree = "<group>"; }; + 33503C9910179A74003B47E1 /* NotificationPresenter.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = NotificationPresenter.h; path = notifications/NotificationPresenter.h; sourceTree = "<group>"; }; + 33503C9F10179AD7003B47E1 /* JSNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotification.cpp; sourceTree = "<group>"; }; + 33503CA010179AD7003B47E1 /* JSNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotification.h; sourceTree = "<group>"; }; + 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationCenter.cpp; sourceTree = "<group>"; }; + 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotificationCenter.h; sourceTree = "<group>"; }; + 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDesktopNotificationsCustom.cpp; sourceTree = "<group>"; }; + 33503CC61017A1B1003B47E1 /* Notification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Notification.cpp; path = notifications/Notification.cpp; sourceTree = "<group>"; }; + 3390CA510FFC157B00921962 /* NotificationCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotificationCenter.cpp; path = notifications/NotificationCenter.cpp; sourceTree = "<group>"; }; + 3390CA520FFC157B00921962 /* NotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationCenter.h; path = notifications/NotificationCenter.h; sourceTree = "<group>"; }; + 3390CA530FFC157B00921962 /* NotificationCenter.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NotificationCenter.idl; path = notifications/NotificationCenter.idl; sourceTree = "<group>"; }; + 3390CA540FFC157B00921962 /* NotificationContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationContents.h; path = notifications/NotificationContents.h; sourceTree = "<group>"; }; 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; }; 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; }; 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedFontData.h; sourceTree = "<group>"; }; @@ -5675,6 +5717,7 @@ 4162A4561011464700DFF3ED /* JSDedicatedWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorkerContext.h; sourceTree = "<group>"; }; 4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultSharedWorkerRepository.cpp; path = workers/DefaultSharedWorkerRepository.cpp; sourceTree = "<group>"; }; 4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultSharedWorkerRepository.h; path = workers/DefaultSharedWorkerRepository.h; sourceTree = "<group>"; }; + 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerReportingProxy.h; path = workers/WorkerReportingProxy.h; sourceTree = "<group>"; }; 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStack.h; sourceTree = "<group>"; }; 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStack.cpp; sourceTree = "<group>"; }; 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = "<group>"; }; @@ -7097,6 +7140,8 @@ 938E662509F09956008A48EC /* HTMLCanvasElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLCanvasElement.idl; sourceTree = "<group>"; }; 938E665F09F09B81008A48EC /* JSHTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLCanvasElement.cpp; sourceTree = "<group>"; }; 938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLCanvasElement.h; sourceTree = "<group>"; }; + 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLCanvasElementCustom.cpp; sourceTree = "<group>"; }; + 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSRuleListCustom.cpp; sourceTree = "<group>"; }; 9392F1410AD185F400691BD4 /* RenderCounter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderCounter.h; sourceTree = "<group>"; }; 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderCounter.cpp; sourceTree = "<group>"; }; 9392F14B0AD1861B00691BD4 /* CounterNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CounterNode.h; sourceTree = "<group>"; }; @@ -7158,7 +7203,6 @@ 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseEventWithHitTestResults.cpp; sourceTree = "<group>"; }; 93EEC1E509C2877700C515D1 /* Attr.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Attr.idl; sourceTree = "<group>"; }; 93EEC1E609C2877700C515D1 /* CharacterData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CharacterData.idl; sourceTree = "<group>"; }; - 93EEC1E709C2877700C515D1 /* DocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocPtr.h; sourceTree = "<group>"; }; 93EEC1E809C2877700C515D1 /* DocumentType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentType.idl; sourceTree = "<group>"; }; 93EEC1E909C2877700C515D1 /* DOMImplementation.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMImplementation.idl; sourceTree = "<group>"; }; 93EEC1EA09C2877700C515D1 /* Element.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Element.idl; sourceTree = "<group>"; }; @@ -8729,6 +8773,8 @@ B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteFileSystem.cpp; path = sql/SQLiteFileSystem.cpp; sourceTree = "<group>"; }; B6D39710103AF29D00A83BC7 /* MockGeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockGeolocationService.cpp; sourceTree = "<group>"; }; B6D39714103AF2BB00A83BC7 /* MockGeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockGeolocationService.h; sourceTree = "<group>"; }; + B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionCoordinator.cpp; sourceTree = "<group>"; }; + B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionCoordinator.h; sourceTree = "<group>"; }; BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; }; BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; }; BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileInternal.h; sourceTree = "<group>"; }; @@ -9301,10 +9347,19 @@ D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRangeException.h; sourceTree = "<group>"; }; D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeException.cpp; sourceTree = "<group>"; }; D23CA56B0AB0EB8D005108A5 /* RangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RangeException.h; sourceTree = "<group>"; }; + D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; }; DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; }; DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; }; DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreObjCExtras.h; sourceTree = "<group>"; }; DD763BB10992C2C900740B8E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; }; + E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventSource.idl; sourceTree = "<group>"; }; + E0FEF371B17C53EAC1C1FBEE /* EventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSource.h; sourceTree = "<group>"; }; + E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventSource.cpp; sourceTree = "<group>"; }; + E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSource.h; sourceTree = "<group>"; }; + E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSource.cpp; sourceTree = "<group>"; }; + E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceCustom.cpp; sourceTree = "<group>"; }; + E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSourceConstructor.h; sourceTree = "<group>"; }; + E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceConstructor.cpp; sourceTree = "<group>"; }; E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = "<group>"; }; E107400C0E77BDC00033AF24 /* JSMessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannel.h; sourceTree = "<group>"; }; E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelConstructor.cpp; sourceTree = "<group>"; }; @@ -9471,6 +9526,14 @@ F587868402DE3B8601EA4122 /* Cursor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Cursor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrList.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F58EF58E02DFDFB7018635CA /* WebCore.base.exp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.exports; path = WebCore.base.exp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; + F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataListElement.cpp; sourceTree = "<group>"; }; + F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDataListElement.h; sourceTree = "<group>"; }; + F5C041D90FFCA7CE00839D4A /* HTMLDataListElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLDataListElement.idl; sourceTree = "<group>"; }; + F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLDataListElement.h; sourceTree = "<group>"; }; + F5C041DF0FFCA96D00839D4A /* DOMHTMLDataListElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLDataListElement.mm; sourceTree = "<group>"; }; + F5C041E00FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLDataListElementInternal.h; sourceTree = "<group>"; }; + F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDataListElement.cpp; sourceTree = "<group>"; }; + F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDataListElement.h; sourceTree = "<group>"; }; F5C2869302846DCD018635CA /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; }; F5C2869402846DCD018635CA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; F5C2869502846DCD018635CA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; @@ -9559,6 +9622,7 @@ 93EEC1EC09C2877700C515D1 /* html */, 1C81B94D0E9732D900266E07 /* inspector */, BCB16BFB0979C38700467741 /* loader */, + 333F703D0FB49C16008E12A6 /* notifications */, 65BF02180974806300C43196 /* page */, BCF1A5BA097832090061A123 /* platform */, 5DCF83690D59157800953BC6 /* plugins */, @@ -9646,6 +9710,7 @@ A83B79120CCB003F000B0825 /* Events */, A83B79080CCAFF2B000B0825 /* HTML */, 1C5FAECA0DCFD8C900D58F78 /* Inspector */, + 33503C9C10179A9A003B47E1 /* Notifications */, 1AC226020DB69EA70089B669 /* Offline */, A9D247F90D757E4100FDF959 /* Plugins */, BC9854460CD3DA5F00069BC1 /* Ranges */, @@ -9812,6 +9877,8 @@ 1AE82EC90CAAE177002237AE /* storage */ = { isa = PBXGroup; children = ( + B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */, + B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */, 514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */, 514185EC0CD65F0400763C99 /* ChangeVersionWrapper.h */, 5196115E0CAC56570010A80C /* Database.cpp */, @@ -10030,6 +10097,7 @@ 2E43463D0F546A8200B0F1BA /* WorkerMessagingProxy.cpp */, 2E43463E0F546A8200B0F1BA /* WorkerMessagingProxy.h */, 2E43463F0F546A8200B0F1BA /* WorkerObjectProxy.h */, + 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */, 2E4346400F546A8200B0F1BA /* WorkerRunLoop.cpp */, 2E4346410F546A8200B0F1BA /* WorkerRunLoop.h */, A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */, @@ -10059,6 +10127,32 @@ name = animation; sourceTree = "<group>"; }; + 333F703D0FB49C16008E12A6 /* notifications */ = { + isa = PBXGroup; + children = ( + 33503CC61017A1B1003B47E1 /* Notification.cpp */, + 33503C9910179A74003B47E1 /* NotificationPresenter.h */, + 3390CA510FFC157B00921962 /* NotificationCenter.cpp */, + 3390CA520FFC157B00921962 /* NotificationCenter.h */, + 3390CA530FFC157B00921962 /* NotificationCenter.idl */, + 3390CA540FFC157B00921962 /* NotificationContents.h */, + 333F704E0FB49CA2008E12A6 /* Notification.idl */, + 333F704F0FB49CA2008E12A6 /* Notification.h */, + ); + name = notifications; + sourceTree = "<group>"; + }; + 33503C9C10179A9A003B47E1 /* Notifications */ = { + isa = PBXGroup; + children = ( + 33503C9F10179AD7003B47E1 /* JSNotification.cpp */, + 33503CA010179AD7003B47E1 /* JSNotification.h */, + 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */, + 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */, + ); + name = Notifications; + sourceTree = "<group>"; + }; 449195900FBE175B00D9F824 /* Exports */ = { isa = PBXGroup; children = ( @@ -10557,6 +10651,9 @@ 1AF326770D78B9440068F0C4 /* EditorClient.h */, 93C09A800B064F00005ABD4D /* EventHandler.cpp */, 93C09A520B064DB3005ABD4D /* EventHandler.h */, + E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */, + E0FEF371B17C53EAC1C1FBEE /* EventSource.h */, + E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */, 14993BE30B2F2B1C0050497F /* FocusController.cpp */, 14993BE40B2F2B1C0050497F /* FocusController.h */, 062287830B4DB322000C34DF /* FocusDirection.h */, @@ -11325,6 +11422,8 @@ 93F9B6540BA0F35E00854064 /* DOMHTMLCanvasElement.mm */, 85DF2F8C0AA3C88100AD64C5 /* DOMHTMLCollection.h */, 85DF2F8D0AA3C88100AD64C5 /* DOMHTMLCollection.mm */, + F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */, + F5C041DF0FFCA96D00839D4A /* DOMHTMLDataListElement.mm */, 85BA4CFD0AA688680088052D /* DOMHTMLDirectoryElement.h */, 85BA4CFE0AA688680088052D /* DOMHTMLDirectoryElement.mm */, 85BA4CFF0AA688680088052D /* DOMHTMLDivElement.h */, @@ -11479,6 +11578,7 @@ 85E711520AC5D5340053270F /* DOMHTMLButtonElementInternal.h */, 93F9B6550BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h */, 85E711530AC5D5340053270F /* DOMHTMLCollectionInternal.h */, + F5C041E00FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h */, 85E711540AC5D5340053270F /* DOMHTMLDirectoryElementInternal.h */, 85E711550AC5D5340053270F /* DOMHTMLDivElementInternal.h */, 85E711560AC5D5340053270F /* DOMHTMLDListElementInternal.h */, @@ -11906,6 +12006,9 @@ BC77CD410FEFE0C40070887B /* HTMLDataGridRowElement.cpp */, BC77CCED0FEFDE6C0070887B /* HTMLDataGridRowElement.h */, BC77CC6B0FEC3D5F0070887B /* HTMLDataGridRowElement.idl */, + F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */, + F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */, + F5C041D90FFCA7CE00839D4A /* HTMLDataListElement.idl */, A8EA79ED0A1916DF00A8EF5F /* HTMLDirectoryElement.cpp */, A8EA79EE0A1916DF00A8EF5F /* HTMLDirectoryElement.h */, 1A85B1D90A1B23A400D8C87C /* HTMLDirectoryElement.idl */, @@ -12188,6 +12291,8 @@ BC212A400FE83A1800EC3708 /* JSHTMLDataGridElement.h */, BC77CD4C0FEFE1610070887B /* JSHTMLDataGridRowElement.cpp */, BC77CD4D0FEFE1610070887B /* JSHTMLDataGridRowElement.h */, + F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */, + F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */, 1A85B1E00A1B240500D8C87C /* JSHTMLDirectoryElement.cpp */, 1A85B1E10A1B240500D8C87C /* JSHTMLDirectoryElement.h */, 1A85B2B40A1B2AC700D8C87C /* JSHTMLDivElement.cpp */, @@ -13608,6 +13713,8 @@ BCBFB53B0DCD29CF0019B3E5 /* JSDOMWindowShell.h */, 93B70D4D09EB0C7C009D8468 /* JSEventListener.cpp */, 93B70D4E09EB0C7C009D8468 /* JSEventListener.h */, + E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */, + E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */, BC60901E0E91B8EC000C68B5 /* JSEventTarget.cpp */, BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */, 9350E70C0E87500B00189FFF /* JSHTMLAllCollection.cpp */, @@ -13743,6 +13850,7 @@ C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */, FE700DD00F92D81A008E2BFE /* JSCoordinatesCustom.cpp */, BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */, + 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */, BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */, BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */, FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */, @@ -13763,6 +13871,7 @@ 1AE830420CAB0ED1002237AE /* JSDatabaseCustom.cpp */, BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */, 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */, + 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */, 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */, 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */, BC1DEA4E0E268EB60083A73F /* JSDocumentFragmentCustom.cpp */, @@ -13772,9 +13881,11 @@ 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, + E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */, FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */, BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */, + 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */, BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */, BCBCAE530FF1A29E000762AE /* JSHTMLDataGridElementCustom.cpp */, BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */, @@ -13905,6 +14016,8 @@ BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */, 1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */, 1403BA0E09EB18F800797C7F /* JSDOMWindow.h */, + E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */, + E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */, BC94D14C0C275C68006BC617 /* JSHistory.cpp */, BC94D14D0C275C68006BC617 /* JSHistory.h */, BCE1C4390D9830D3003B02F2 /* JSLocation.cpp */, @@ -14069,6 +14182,7 @@ 93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */, 93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */, 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */, + D8B6152E1032495100C8554A /* Cookie.h */, 9352088109BD45E900F2038D /* CookieJar.h */, 2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */, 2E4346570F546A9900B0F1BA /* CrossThreadCopier.h */, @@ -14708,7 +14822,6 @@ A81872110977D3C0005826D9 /* ContainerNode.h */, A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */, A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */, - 93EEC1E709C2877700C515D1 /* DocPtr.h */, A8185F3409765765005826D9 /* Document.cpp */, A8185F3809765765005826D9 /* Document.h */, 6548E24809E1E04D00AF8020 /* Document.idl */, @@ -15109,7 +15222,6 @@ 93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */, B2F34FE60E82F81400F627CD /* DNS.h in Headers */, BCB16C2A0979C3BD00467741 /* DocLoader.h in Headers */, - 93EEC1FA09C2877700C515D1 /* DocPtr.h in Headers */, A8185F4009765766005826D9 /* Document.h in Headers */, A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */, 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */, @@ -15215,6 +15327,8 @@ 93F9B6580BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h in Headers */, 85DF2F8E0AA3C88100AD64C5 /* DOMHTMLCollection.h in Headers */, 85E711A20AC5D5350053270F /* DOMHTMLCollectionInternal.h in Headers */, + F5C041E30FFCA96D00839D4A /* DOMHTMLDataListElement.h in Headers */, + F5C041E50FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h in Headers */, 85BA4D0B0AA688680088052D /* DOMHTMLDirectoryElement.h in Headers */, 85E711A30AC5D5350053270F /* DOMHTMLDirectoryElementInternal.h in Headers */, 85BA4D0D0AA688680088052D /* DOMHTMLDivElement.h in Headers */, @@ -15872,6 +15986,7 @@ 935FBC4509BA00B900E230B1 /* EventListener.h in Headers */, 1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */, 939885C408B7E3D100E707C4 /* EventNames.h in Headers */, + E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */, E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */, BC60D8F30D2A11E000B9918F /* ExceptionBase.h in Headers */, 935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */, @@ -15968,6 +16083,7 @@ BC77CB870FEBF5AF0070887B /* HTMLDataGridColElement.h in Headers */, BC212A1F0FE8333200EC3708 /* HTMLDataGridElement.h in Headers */, BC77CCEE0FEFDE6C0070887B /* HTMLDataGridRowElement.h in Headers */, + F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */, A8EA79FA0A1916DF00A8EF5F /* HTMLDirectoryElement.h in Headers */, A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */, A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */, @@ -16157,6 +16273,8 @@ 14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */, BC60D9C00D2A269A00B9918F /* JSEventException.h in Headers */, 93B70D6A09EB0C7C009D8468 /* JSEventListener.h in Headers */, + E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */, + E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */, BC60901F0E91B8EC000C68B5 /* JSEventTarget.h in Headers */, BC00F0150E0A189500FD04E3 /* JSFile.h in Headers */, BC00F0170E0A189500FD04E3 /* JSFileList.h in Headers */, @@ -16180,6 +16298,7 @@ BC77CBD40FEBF8310070887B /* JSHTMLDataGridColElement.h in Headers */, BC212A420FE83A1800EC3708 /* JSHTMLDataGridElement.h in Headers */, BC77CD4F0FEFE1610070887B /* JSHTMLDataGridRowElement.h in Headers */, + F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */, 1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */, 1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */, 1A85B1E90A1B240500D8C87C /* JSHTMLDListElement.h in Headers */, @@ -16261,6 +16380,8 @@ 1A750D8E0A90E521000FF215 /* JSNodeIterator.h in Headers */, BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */, 65DF31FE09D1CC60000BE325 /* JSNotation.h in Headers */, + 33503CA410179AD7003B47E1 /* JSNotification.h in Headers */, + 33503CA610179AD7003B47E1 /* JSNotificationCenter.h in Headers */, A826E8AE0A1A8F2300CD1BB6 /* JSOptionConstructor.h in Headers */, 1A0D57410A5C7867007EDD4C /* JSOverflowEvent.h in Headers */, A9D247FF0D757E6900FDF959 /* JSPlugin.h in Headers */, @@ -16533,6 +16654,9 @@ 63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */, 9382AAB40D8C386100F357A6 /* NodeWithIndex.h in Headers */, A8EA7EBE0A1945D000A8EF5F /* Notation.h in Headers */, + 3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */, + 3390CA580FFC157B00921962 /* NotificationContents.h in Headers */, + 33503C9A10179A74003B47E1 /* NotificationPresenter.h in Headers */, 1A569D0B0D7E2B82007C3983 /* NP_jsobject.h in Headers */, 1A569D0C0D7E2B82007C3983 /* npapi.h in Headers */, 1A219B3B0DCA87AB0040E3A0 /* npfunctions.h in Headers */, @@ -17192,6 +17316,9 @@ 49484FCB102CF23C00187DD3 /* CanvasRenderingContext2D.h in Headers */, 49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */, B6D39715103AF2BB00A83BC7 /* MockGeolocationService.h in Headers */, + 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */, + B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */, + D8B6152F1032495100C8554A /* Cookie.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -17681,6 +17808,7 @@ 85BA4CDE0AA6861B0088052D /* DOMHTMLButtonElement.mm in Sources */, 93F9B6570BA0F35E00854064 /* DOMHTMLCanvasElement.mm in Sources */, 85DF2F8F0AA3C88100AD64C5 /* DOMHTMLCollection.mm in Sources */, + F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */, 85BA4D0C0AA688680088052D /* DOMHTMLDirectoryElement.mm in Sources */, 85BA4D0E0AA688680088052D /* DOMHTMLDivElement.mm in Sources */, 85BA4D100AA688680088052D /* DOMHTMLDListElement.mm in Sources */, @@ -17927,6 +18055,7 @@ 93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */, 1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */, 939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */, + E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */, E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */, BC60D8F20D2A11E000B9918F /* ExceptionBase.cpp in Sources */, 93831B570D087D6000E5C984 /* ExceptionCode.cpp in Sources */, @@ -18023,6 +18152,7 @@ BC77CBAA0FEBF6C90070887B /* HTMLDataGridColElement.cpp in Sources */, BCF524600FEBEE5D0095BF26 /* HTMLDataGridElement.cpp in Sources */, BC77CD420FEFE0C40070887B /* HTMLDataGridRowElement.cpp in Sources */, + F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */, A8EA79F90A1916DF00A8EF5F /* HTMLDirectoryElement.cpp in Sources */, A8EA7CB10A192B9C00A8EF5F /* HTMLDivElement.cpp in Sources */, A8EA79F50A1916DF00A8EF5F /* HTMLDListElement.cpp in Sources */, @@ -18206,6 +18336,7 @@ BCBCAE3C0FF19399000762AE /* JSDataGridDataSource.cpp in Sources */, 4162A4571011464700DFF3ED /* JSDedicatedWorkerContext.cpp in Sources */, 4162A454101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp in Sources */, + 33503CC010179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp in Sources */, 659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */, 929264770B61FC7200B41D34 /* JSDocumentCustom.cpp in Sources */, 1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */, @@ -18232,6 +18363,9 @@ BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */, BC60D9BF0D2A269A00B9918F /* JSEventException.cpp in Sources */, 93B70D6909EB0C7C009D8468 /* JSEventListener.cpp in Sources */, + E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */, + E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */, + E0FEF372B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp in Sources */, BC6090200E91B8EC000C68B5 /* JSEventTarget.cpp in Sources */, BC00F0140E0A189500FD04E3 /* JSFile.cpp in Sources */, BC00F0160E0A189500FD04E3 /* JSFileList.cpp in Sources */, @@ -18260,6 +18394,7 @@ BC212A410FE83A1800EC3708 /* JSHTMLDataGridElement.cpp in Sources */, BCBCAE540FF1A29E000762AE /* JSHTMLDataGridElementCustom.cpp in Sources */, BC77CD4E0FEFE1610070887B /* JSHTMLDataGridRowElement.cpp in Sources */, + F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */, 1A85B1E60A1B240500D8C87C /* JSHTMLDirectoryElement.cpp in Sources */, 1A85B2B60A1B2AC700D8C87C /* JSHTMLDivElement.cpp in Sources */, 1A85B1E80A1B240500D8C87C /* JSHTMLDListElement.cpp in Sources */, @@ -18365,6 +18500,8 @@ BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */, BCD9C2650C17AA67005C90A2 /* JSNodeListCustom.cpp in Sources */, 65DF31FD09D1CC60000BE325 /* JSNotation.cpp in Sources */, + 33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */, + 33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */, A826EC480A1B0CBE00CD1BB6 /* JSOptionConstructor.cpp in Sources */, 1A0D57400A5C7867007EDD4C /* JSOverflowEvent.cpp in Sources */, A9D247FE0D757E6900FDF959 /* JSPlugin.cpp in Sources */, @@ -18654,6 +18791,8 @@ 854FE7320A2297BE0058D7AD /* NodeFilterCondition.cpp in Sources */, 854FE7340A2297BE0058D7AD /* NodeIterator.cpp in Sources */, A8EA7EBF0A1945D000A8EF5F /* Notation.cpp in Sources */, + 33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */, + 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */, 1A569D0A0D7E2B82007C3983 /* NP_jsobject.cpp in Sources */, 1A569D0D0D7E2B82007C3983 /* npruntime.cpp in Sources */, 1A569D130D7E2B82007C3983 /* objc_class.mm in Sources */, @@ -19244,6 +19383,9 @@ 49484FCA102CF23C00187DD3 /* CanvasRenderingContext2D.cpp in Sources */, 49484FCD102CF23C00187DD3 /* CanvasStyle.cpp in Sources */, B6D39711103AF29D00A83BC7 /* MockGeolocationService.cpp in Sources */, + 9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */, + 9392262F10321084006E7D5D /* JSCSSRuleListCustom.cpp in Sources */, + B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/WebCorePrefix.h b/WebCore/WebCorePrefix.h index c0d1e70..6c8e200 100644 --- a/WebCore/WebCorePrefix.h +++ b/WebCore/WebCorePrefix.h @@ -113,6 +113,13 @@ #include <stdio.h> #else #include <CoreServices/CoreServices.h> + +#if defined(WIN32) || defined(_WIN32) +/* Including CoreServices.h on Windows doesn't include CFNetwork.h, so we do + it explicitly here to make Windows more consistent with Mac. */ +#include <CFNetwork/CFNetwork.h> +#endif + #endif #endif @@ -125,8 +132,11 @@ #define delete ("if you use new/delete make sure to include config.h at the top of the file"()) #endif -/* Work around a bug with C++ library that screws up Objective-C++ when exception support is disabled. */ -#if defined(__APPLE__) +/* When C++ exceptions are disabled, the C++ library defines |try| and |catch| + * to allow C++ code that expects exceptions to build. These definitions + * interfere with Objective-C++ uses of Objective-C exception handlers, which + * use |@try| and |@catch|. As a workaround, undefine these macros. */ +#ifdef __OBJC__ #undef try #undef catch #endif diff --git a/WebCore/WebCoreSources.bkl b/WebCore/WebCoreSources.bkl index a9a1b42..a40c2b1 100644 --- a/WebCore/WebCoreSources.bkl +++ b/WebCore/WebCoreSources.bkl @@ -60,6 +60,7 @@ This file contains the list of files needed to build WebCore. bindings/js/JSClipboardCustom.cpp bindings/js/JSConsoleCustom.cpp bindings/js/JSCSSRuleCustom.cpp + bindings/js/JSCSSRuleListCustom.cpp bindings/js/JSCSSStyleDeclarationCustom.cpp bindings/js/JSCSSValueCustom.cpp bindings/js/JSCoordinatesCustom.cpp @@ -85,11 +86,14 @@ This file contains the list of files needed to build WebCore. bindings/js/JSDocumentFragmentCustom.cpp bindings/js/JSElementCustom.cpp bindings/js/JSEventCustom.cpp + bindings/js/JSEventSourceConstructor.cpp + bindings/js/JSEventSourceCustom.cpp bindings/js/JSEventTarget.cpp bindings/js/JSGeolocationCustom.cpp bindings/js/JSHTMLAllCollection.cpp bindings/js/JSHistoryCustom.cpp bindings/js/JSHTMLAppletElementCustom.cpp + bindings/js/JSHTMLCanvasElementCustom.cpp bindings/js/JSHTMLCollectionCustom.cpp bindings/js/JSHTMLDataGridElementCustom.cpp bindings/js/JSHTMLDocumentCustom.cpp @@ -283,6 +287,7 @@ This file contains the list of files needed to build WebCore. DerivedSources/WebCore/JSEntityReference.cpp DerivedSources/WebCore/JSErrorEvent.cpp DerivedSources/WebCore/JSEvent.cpp + DerivedSources/WebCore/JSEventSource.cpp DerivedSources/WebCore/JSEventException.cpp DerivedSources/WebCore/JSFile.cpp DerivedSources/WebCore/JSFileList.cpp @@ -303,6 +308,7 @@ This file contains the list of files needed to build WebCore. DerivedSources/WebCore/JSHTMLDataGridCellElement.cpp DerivedSources/WebCore/JSHTMLDataGridColElement.cpp DerivedSources/WebCore/JSHTMLDataGridRowElement.cpp + DerivedSources/WebCore/JSHTMLDataListElement.cpp DerivedSources/WebCore/JSHTMLDListElement.cpp DerivedSources/WebCore/JSHTMLDirectoryElement.cpp DerivedSources/WebCore/JSHTMLDivElement.cpp @@ -592,6 +598,7 @@ This file contains the list of files needed to build WebCore. html/HTMLDataGridCellElement.cpp html/HTMLDataGridColElement.cpp html/HTMLDataGridRowElement.cpp + html/HTMLDataListElement.cpp html/HTMLDListElement.cpp html/HTMLDirectoryElement.cpp html/HTMLDivElement.cpp @@ -747,6 +754,7 @@ This file contains the list of files needed to build WebCore. page/DOMWindow.cpp page/DragController.cpp page/EventHandler.cpp + page/EventSource.cpp page/FocusController.cpp page/Frame.cpp page/FrameTree.cpp @@ -835,6 +843,7 @@ This file contains the list of files needed to build WebCore. platform/graphics/GraphicsContext.cpp platform/graphics/GraphicsTypes.cpp platform/graphics/Image.cpp + platform/graphics/ImageSource.cpp platform/graphics/IntRect.cpp platform/graphics/Path.cpp platform/graphics/PathTraversalState.cpp diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cpp index 0b758e6..db57f3b 100644 --- a/WebCore/accessibility/AXObjectCache.cpp +++ b/WebCore/accessibility/AXObjectCache.cpp @@ -43,8 +43,11 @@ #include "AccessibilityTableColumn.h" #include "AccessibilityTableHeaderContainer.h" #include "AccessibilityTableRow.h" -#include "InputElement.h" +#include "FocusController.h" +#include "Frame.h" #include "HTMLNames.h" +#include "InputElement.h" +#include "Page.h" #include "RenderObject.h" #include "RenderView.h" @@ -57,8 +60,9 @@ using namespace HTMLNames; bool AXObjectCache::gAccessibilityEnabled = false; bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false; -AXObjectCache::AXObjectCache() +AXObjectCache::AXObjectCache(const Document* document) : m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired) + , m_document(document) { } @@ -73,6 +77,32 @@ AXObjectCache::~AXObjectCache() } } +AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page* page) +{ + // get the focused node in the page + Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document(); + Node* focusedNode = focusedDocument->focusedNode(); + if (!focusedNode) + focusedNode = focusedDocument; + + RenderObject* focusedNodeRenderer = focusedNode->renderer(); + if (!focusedNodeRenderer) + return 0; + + AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer); + + if (obj->shouldFocusActiveDescendant()) { + if (AccessibilityObject* descendant = obj->activeDescendant()) + obj = descendant; + } + + // the HTML element, for example, is focusable but has an AX object that is ignored + if (obj->accessibilityIsIgnored()) + obj = obj->parentObjectUnignored(); + + return obj; +} + AccessibilityObject* AXObjectCache::get(RenderObject* renderer) { if (!renderer) @@ -213,6 +243,23 @@ void AXObjectCache::remove(RenderObject* renderer) m_renderObjectMapping.remove(renderer); } +#if !PLATFORM(WIN) +AXID AXObjectCache::platformGenerateAXID() const +{ + static AXID lastUsedID = 0; + + // Generate a new ID. + AXID objID = lastUsedID; + do { + ++objID; + } while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); + + lastUsedID = objID; + + return objID; +} +#endif + AXID AXObjectCache::getAXID(AccessibilityObject* obj) { // check for already-assigned ID @@ -221,15 +268,10 @@ AXID AXObjectCache::getAXID(AccessibilityObject* obj) ASSERT(m_idsInUse.contains(objID)); return objID; } - - // generate a new ID - static AXID lastUsedID = 0; - objID = lastUsedID; - do - ++objID; - while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); + + objID = platformGenerateAXID(); + m_idsInUse.add(objID); - lastUsedID = objID; obj->setAXObjectID(objID); return objID; diff --git a/WebCore/accessibility/AXObjectCache.h b/WebCore/accessibility/AXObjectCache.h index 7a808dd..96ded44 100644 --- a/WebCore/accessibility/AXObjectCache.h +++ b/WebCore/accessibility/AXObjectCache.h @@ -42,13 +42,12 @@ class WebCoreTextMarker; namespace WebCore { + class Document; + class Node; + class Page; class RenderObject; class String; class VisiblePosition; - class AccessibilityObject; - class Node; - - typedef unsigned AXID; struct TextMarkerData { AXID axID; @@ -59,9 +58,11 @@ namespace WebCore { class AXObjectCache { public: - AXObjectCache(); + AXObjectCache(const Document*); ~AXObjectCache(); - + + static AccessibilityObject* focusedUIElementForPage(const Page*); + // to be used with render objects AccessibilityObject* getOrCreate(RenderObject*); @@ -94,11 +95,13 @@ namespace WebCore { void removeAXID(AccessibilityObject*); bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } + AXID platformGenerateAXID() const; + AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); } // Text marker utilities. static void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&); static VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&); - + private: HashMap<AXID, RefPtr<AccessibilityObject> > m_objects; HashMap<RenderObject*, AXID> m_renderObjectMapping; @@ -113,6 +116,8 @@ namespace WebCore { AXID getAXID(AccessibilityObject*); bool nodeIsAriaType(Node* node, String role); + + const Document* m_document; }; #if !HAVE(ACCESSIBILITY) diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp index d6fd969..4fb4e3a 100644 --- a/WebCore/accessibility/AccessibilityObject.cpp +++ b/WebCore/accessibility/AccessibilityObject.cpp @@ -41,6 +41,7 @@ #include "NotImplemented.h" #include "Page.h" #include "RenderImage.h" +#include "RenderListItem.h" #include "RenderListMarker.h" #include "RenderMenuList.h" #include "RenderTextControl.h" @@ -363,6 +364,49 @@ static bool replacedNodeNeedsCharacter(Node* replacedNode) return true; } +// Finds a RenderListItem parent give a node. +RenderListItem* AccessibilityObject::renderListItemContainerForNode(Node* node) const +{ + for (Node* stringNode = node; stringNode; stringNode = stringNode->parent()) { + RenderObject* renderObject = stringNode->renderer(); + if (!renderObject || !renderObject->isListItem()) + continue; + + return toRenderListItem(renderObject); + } + + return 0; +} + +// Returns the text associated with a list marker if this node is contained within a list item. +String AccessibilityObject::listMarkerTextForNodeAndPosition(Node* node, const VisiblePosition& visiblePositionStart) const +{ + // If the range does not contain the start of the line, the list marker text should not be included. + if (!isStartOfLine(visiblePositionStart)) + return String(); + + RenderListItem* listItem = renderListItemContainerForNode(node); + if (!listItem) + return String(); + + // If this is in a list item, we need to manually add the text for the list marker + // because a RenderListMarker does not have a Node equivalent and thus does not appear + // when iterating text. + const String& markerText = listItem->markerText(); + if (markerText.isEmpty()) + return String(); + + // Append text, plus the period that follows the text. + // FIXME: Not all list marker styles are followed by a period, but this + // sounds much better when there is a synthesized pause because of a period. + Vector<UChar> resultVector; + resultVector.append(markerText.characters(), markerText.length()); + resultVector.append('.'); + resultVector.append(' '); + + return String::adopt(resultVector); +} + String AccessibilityObject::stringForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const { if (visiblePositionRange.isNull()) @@ -373,6 +417,11 @@ String AccessibilityObject::stringForVisiblePositionRange(const VisiblePositionR for (TextIterator it(range.get()); !it.atEnd(); it.advance()) { // non-zero length means textual node, zero length means replaced node (AKA "attachments" in AX) if (it.length() != 0) { + // Add a textual representation for list marker text + String listMarkerText = listMarkerTextForNodeAndPosition(it.node(), visiblePositionRange.start); + if (!listMarkerText.isEmpty()) + resultVector.append(listMarkerText.characters(), listMarkerText.length()); + resultVector.append(it.characters(), it.length()); } else { // locate the node and starting offset for this replaced range diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h index 3f6c395..9173953 100644 --- a/WebCore/accessibility/AccessibilityObject.h +++ b/WebCore/accessibility/AccessibilityObject.h @@ -86,10 +86,13 @@ class IntPoint; class IntSize; class Node; class RenderObject; +class RenderListItem; class VisibleSelection; class String; class Widget; +typedef unsigned AXID; + enum AccessibilityRole { UnknownRole = 1, ButtonRole, @@ -304,8 +307,8 @@ public: virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const { return 0; } virtual AXObjectCache* axObjectCache() const { return 0; } - unsigned axObjectID() const { return m_id; } - void setAXObjectID(unsigned axObjectID) { m_id = axObjectID; } + AXID axObjectID() const { return m_id; } + void setAXObjectID(AXID axObjectID) { m_id = axObjectID; } static AccessibilityObject* anchorElementForNode(Node*); virtual Element* anchorElement() const { return 0; } @@ -408,6 +411,7 @@ public: virtual String doAXStringForRange(const PlainTextRange&) const { return String(); } virtual IntRect doAXBoundsForRange(const PlainTextRange&) const { return IntRect(); } + String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&) const; unsigned doAXLineForIndex(unsigned); @@ -436,14 +440,15 @@ public: virtual void updateBackingStore() { } protected: - unsigned m_id; + AXID m_id; AccessibilityChildrenVector m_children; mutable bool m_haveChildren; AccessibilityRole m_role; virtual void clearChildren(); virtual bool isDetached() const { return true; } - + RenderListItem* renderListItemContainerForNode(Node* node) const; + #if PLATFORM(MAC) RetainPtr<AccessibilityObjectWrapper> m_wrapper; #elif PLATFORM(WIN) && !PLATFORM(WINCE) diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index e0f9a91..b0b97fc 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -35,7 +35,6 @@ #include "CharacterNames.h" #include "EventNames.h" #include "FloatRect.h" -#include "FocusController.h" #include "Frame.h" #include "FrameLoader.h" #include "HTMLAreaElement.h" @@ -54,7 +53,6 @@ #include "HitTestResult.h" #include "LocalizedStrings.h" #include "NodeList.h" -#include "Page.h" #include "RenderButton.h" #include "RenderFieldset.h" #include "RenderFileUploadControl.h" @@ -1658,7 +1656,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(H // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning, // which has to be stripped off - String useMapName = static_cast<HTMLImageElement*>(curr)->useMap().substring(1).lower(); + String useMapName = static_cast<HTMLImageElement*>(curr)->getAttribute(usemapAttr).string().substring(1).lower(); if (useMapName == mapName) return axObjectCache()->getOrCreate(obj); } @@ -2102,32 +2100,11 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int AccessibilityObject* AccessibilityRenderObject::focusedUIElement() const { - // get the focused node in the page Page* page = m_renderer->document()->page(); if (!page) return 0; - - Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document(); - Node* focusedNode = focusedDocument->focusedNode(); - if (!focusedNode) - focusedNode = focusedDocument; - - RenderObject* focusedNodeRenderer = focusedNode->renderer(); - if (!focusedNodeRenderer) - return 0; - - AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer); - - if (obj->shouldFocusActiveDescendant()) { - if (AccessibilityObject* descendant = obj->activeDescendant()) - obj = descendant; - } - - // the HTML element, for example, is focusable but has an AX object that is ignored - if (obj->accessibilityIsIgnored()) - obj = obj->parentObjectUnignored(); - - return obj; + + return AXObjectCache::focusedUIElementForPage(page); } bool AccessibilityRenderObject::shouldFocusActiveDescendant() const diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 6d3729b..f346a81 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -60,7 +60,7 @@ using namespace WebCore; static AccessibilityObject* fallbackObject() { - static AXObjectCache* fallbackCache = new AXObjectCache(); + static AXObjectCache* fallbackCache = new AXObjectCache(0); static AccessibilityObject* object = 0; if (!object) { // FIXME: using fallbackCache->getOrCreate(ListBoxOptionRole) is a hack diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index d1e0599..75cefee 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -378,7 +378,7 @@ static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, // add misspelling attribute for the intersection of the marker and the range int rStart = range.location + (marker.startOffset - offset); - int rLength = MIN(marker.endOffset, endOffset) - marker.startOffset; + int rLength = min(marker.endOffset, endOffset) - marker.startOffset; NSRange spellRange = NSMakeRange(rStart, rLength); AXAttributeStringSetNumber(attrString, NSAccessibilityMisspelledTextAttribute, [NSNumber numberWithBool:YES], spellRange); @@ -478,6 +478,9 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) - (NSAttributedString*)doAXAttributedStringForTextMarkerRange:(WebCoreTextMarkerRange*)textMarkerRange { + if (!m_object) + return nil; + // extract the start and end VisiblePosition VisiblePosition startVisiblePosition = visiblePositionForStartOfTextMarkerRange(textMarkerRange); if (startVisiblePosition.isNull()) @@ -487,6 +490,7 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) if (endVisiblePosition.isNull()) return nil; + VisiblePositionRange visiblePositionRange(startVisiblePosition, endVisiblePosition); // iterate over the range to build the AX attributed string NSMutableAttributedString* attrString = [[NSMutableAttributedString alloc] init]; TextIterator it(makeRange(startVisiblePosition, endVisiblePosition).get()); @@ -499,6 +503,11 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) // non-zero length means textual node, zero length means replaced node (AKA "attachments" in AX) if (it.length() != 0) { + // Add the text of the list marker item if necessary. + String listMarkerText = m_object->listMarkerTextForNodeAndPosition(node, VisiblePosition(it.range()->startPosition())); + if (!listMarkerText.isEmpty()) + AXAttributedStringAppendText(attrString, node, offset, listMarkerText.characters(), listMarkerText.length()); + AXAttributedStringAppendText(attrString, node, offset, it.characters(), it.length()); } else { Node* replacedNode = node->childNode(offset); @@ -1581,6 +1590,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) @"AXStyleTextMarkerRangeForTextMarker", @"AXLengthForTextMarkerRange", NSAccessibilityBoundsForRangeParameterizedAttribute, + NSAccessibilityStringForRangeParameterizedAttribute, nil]; } @@ -1932,6 +1942,14 @@ static RenderObject* rendererForView(NSView* view) NSRect rect = m_object->boundsForVisiblePositionRange(VisiblePositionRange(start, end)); return [NSValue valueWithRect:rect]; } + + if ([attribute isEqualToString:NSAccessibilityStringForRangeParameterizedAttribute]) { + VisiblePosition start = m_object->visiblePositionForIndex(range.location); + VisiblePosition end = m_object->visiblePositionForIndex(range.location+range.length); + if (start.isNull() || end.isNull()) + return nil; + return m_object->stringForVisiblePositionRange(VisiblePositionRange(start, end)); + } if ([attribute isEqualToString: @"AXAttributedStringForTextMarkerRange"]) return [self doAXAttributedStringForTextMarkerRange:textMarkerRange]; diff --git a/WebCore/accessibility/win/AXObjectCacheWin.cpp b/WebCore/accessibility/win/AXObjectCacheWin.cpp index e39d5a5..f782ceb 100644 --- a/WebCore/accessibility/win/AXObjectCacheWin.cpp +++ b/WebCore/accessibility/win/AXObjectCacheWin.cpp @@ -28,6 +28,10 @@ #include "AXObjectCache.h" #include "AccessibilityObject.h" +#include "Document.h" +#include "Page.h" + +using namespace std; namespace WebCore { @@ -50,8 +54,43 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject*, const String& { } +AXID AXObjectCache::platformGenerateAXID() const +{ + static AXID lastUsedID = 0; + + // Generate a new ID. Windows accessibility relies on a positive AXID, + // ranging from 1 to LONG_MAX. + AXID objID = lastUsedID; + do { + ++objID; + objID %= std::numeric_limits<LONG>::max(); + } while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); + + ASSERT(objID >= 1 && objID <= std::numeric_limits<LONG>::max()); + + lastUsedID = objID; + + return objID; +} + void AXObjectCache::handleFocusedUIElementChanged() { + Page* page = m_document->page(); + if (!page || !page->chrome()->platformWindow()) + return; + + AccessibilityObject* focusedObject = focusedUIElementForPage(page); + if (!focusedObject) + return; + + ASSERT(!focusedObject->accessibilityIsIgnored()); + ASSERT(focusedObject->axObjectID() >= 1 && focusedObject->axObjectID() <= numeric_limits<LONG>::max()); + + // Windows will end up calling get_accChild() on the root accessible + // object for the WebView, passing the child ID that we specify below. We + // negate the AXID so we know that the caller is passing the ID of an + // element, not the index of a child element. + NotifyWinEvent(EVENT_OBJECT_FOCUS, page->chrome()->platformWindow(), OBJID_CLIENT, -static_cast<LONG>(focusedObject->axObjectID())); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSAudioConstructor.cpp b/WebCore/bindings/js/JSAudioConstructor.cpp index 87a3880..174cc11 100644 --- a/WebCore/bindings/js/JSAudioConstructor.cpp +++ b/WebCore/bindings/js/JSAudioConstructor.cpp @@ -34,6 +34,7 @@ #include "JSHTMLAudioElement.h" #include "ScriptExecutionContext.h" #include "Text.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSCSSRuleListCustom.cpp b/WebCore/bindings/js/JSCSSRuleListCustom.cpp new file mode 100644 index 0000000..be3a9a2 --- /dev/null +++ b/WebCore/bindings/js/JSCSSRuleListCustom.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Apple Inc. All right 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 "JSCSSRuleList.h" + +#include "CSSRuleList.h" + +using namespace JSC; + +namespace WebCore { + +void JSCSSRuleList::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + CSSRuleList* list = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + unsigned length = list->length(); + for (unsigned i = 0; i < length; ++i) + markDOMObjectWrapper(markStack, globalData, list->item(i)); +} + +} diff --git a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp index 280ec93..4a137d3 100644 --- a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp +++ b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,8 +27,8 @@ #include "JSCSSStyleDeclarationCustom.h" #include "AtomicString.h" +#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" -#include "CSSStyleDeclaration.h" #include "CSSValue.h" #include "PlatformString.h" #include <runtime/StringObjectThatMasqueradesAsUndefined.h> @@ -40,6 +40,21 @@ using namespace WTF; namespace WebCore { +void JSCSSStyleDeclaration::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + CSSStyleDeclaration* declaration = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + if (declaration->isMutableStyleDeclaration()) { + CSSMutableStyleDeclaration* mutableDeclaration = static_cast<CSSMutableStyleDeclaration*>(declaration); + CSSMutableStyleDeclaration::const_iterator end = mutableDeclaration->end(); + for (CSSMutableStyleDeclaration::const_iterator it = mutableDeclaration->begin(); it != end; ++it) + markDOMObjectWrapper(markStack, globalData, it->value()); + } +} + // Check for a CSS prefix. // Passed prefix is all lowercase. // First character of the prefix within the property name may be upper or lowercase. diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 566b986..06492f9 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -28,6 +28,7 @@ #include "ExceptionCode.h" #include "Frame.h" #include "HTMLAudioElement.h" +#include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "HTMLScriptElement.h" #include "HTMLNames.h" @@ -42,6 +43,7 @@ #include "RangeException.h" #include "ScriptController.h" #include "XMLHttpRequestException.h" +#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> #include <wtf/StdLibExtras.h> @@ -264,18 +266,48 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) Node* node = jsNode->impl(); if (node->inDocument()) { - // 1. If a node is in the document, and its wrapper has custom properties, + // If a node is in the document, and its wrapper has custom properties, // the wrapper is observable because future access to the node through the // DOM must reflect those properties. if (jsNode->hasCustomProperties()) return true; - // 2. If a node is in the document, and has event listeners, its wrapper is + // If a node is in the document, and has event listeners, its wrapper is // observable because its wrapper is responsible for marking those event listeners. if (node->eventListeners().size()) return true; // Technically, we may overzealously mark a wrapper for a node that has only non-JS event listeners. Oh well. + + // If a node owns another object with a wrapper with custom properties, + // the wrapper must be treated as observable, because future access to + // those objects through the DOM must reflect those properties. + // FIXME: It would be better if this logic could be in the node next to + // the custom markChildren functions rather than here. + if (node->isElementNode()) { + if (NamedNodeMap* attributes = static_cast<Element*>(node)->attributeMap()) { + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), attributes)) { + if (wrapper->hasCustomProperties()) + return true; + } + } + if (node->isStyledElement()) { + if (CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(node)->inlineStyleDecl()) { + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), style)) { + if (wrapper->hasCustomProperties()) + return true; + } + } + } + if (static_cast<Element*>(node)->hasTagName(canvasTag)) { + if (CanvasRenderingContext2D* context = static_cast<HTMLCanvasElement*>(node)->renderingContext2D()) { + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), context)) { + if (wrapper->hasCustomProperties()) + return true; + } + } + } + } } else { - // 3. If a wrapper is the last reference to an image or script element + // If a wrapper is the last reference to an image or script element // that is loading but not in the document, the wrapper is observable // because it is the only thing keeping the image element alive, and if // the image element is destroyed, its load event will not fire. @@ -348,6 +380,9 @@ void updateDOMNodeDocument(Node* node, Document* oldDocument, Document* newDocum void markDOMObjectWrapper(MarkStack& markStack, JSGlobalData& globalData, void* object) { + // FIXME: This could be changed to only mark wrappers that are "observable" + // as markDOMNodesForDocument does, allowing us to collect more wrappers, + // but doing this correctly would be challenging. if (!object) return; DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, object); diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h index 64cfc3a..5abd7a7 100644 --- a/WebCore/bindings/js/JSDOMBinding.h +++ b/WebCore/bindings/js/JSDOMBinding.h @@ -26,7 +26,6 @@ #include "Document.h" // For DOMConstructorWithDocument #include <runtime/Completion.h> #include <runtime/Lookup.h> -#include <runtime/JSFunction.h> #include <wtf/Noncopyable.h> namespace JSC { @@ -61,7 +60,7 @@ namespace WebCore { #endif }; - // FIXME: This class should colapse into DOMObject once all DOMObjects are + // FIXME: This class should collapse into DOMObject once all DOMObjects are // updated to store a globalObject pointer. class DOMObjectWithGlobalPointer : public DOMObject { public: diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 9798972..44a11e4 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -38,6 +38,7 @@ #include "JSDOMWindowShell.h" #include "JSEvent.h" #include "JSEventListener.h" +#include "JSEventSourceConstructor.h" #include "JSHTMLCollection.h" #include "JSHistory.h" #include "JSImageConstructor.h" @@ -54,6 +55,7 @@ #include "Location.h" #include "MediaPlayer.h" #include "MessagePort.h" +#include "NotificationCenter.h" #include "Page.h" #include "PlatformScreen.h" #include "RegisteredEventListener.h" @@ -61,6 +63,8 @@ #include "ScriptController.h" #include "Settings.h" #include "WindowFeatures.h" +#include <runtime/Error.h> +#include <runtime/JSFunction.h> #include <runtime/JSObject.h> #include <runtime/PrototypeFunction.h> @@ -424,6 +428,13 @@ JSValue JSDOMWindow::event(ExecState* exec) const return toJS(exec, event); } +#if ENABLE(EVENTSOURCE) +JSValue JSDOMWindow::eventSource(ExecState* exec) const +{ + return getDOMConstructor<JSEventSourceConstructor>(exec, this); +} +#endif + JSValue JSDOMWindow::image(ExecState* exec) const { return getDOMConstructor<JSImageConstructor>(exec, this); diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp new file mode 100644 index 0000000..fb34c7b --- /dev/null +++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(NOTIFICATIONS) + +#include "Document.h" +#include "JSCustomVoidCallback.h" +#include "JSEventListener.h" +#include "JSNotification.h" +#include "JSNotificationCenter.h" +#include "Notification.h" +#include "NotificationCenter.h" + +using namespace JSC; + +namespace WebCore { + +JSValue JSNotificationCenter::requestPermission(ExecState* exec, const ArgList& args) +{ + // Permission request is only valid from page context. + ScriptExecutionContext* context = impl()->context(); + if (context->isWorkerContext()) + return throwError(exec, SyntaxError); + + if (!args.at(0).isObject()) + return throwError(exec, TypeError); + + PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(args.at(0).getObject(), static_cast<Document*>(context)->frame()); + + impl()->requestPermission(callback); + return jsUndefined(); +} + +JSValue JSNotification::addEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + + if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1))) + impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec)); + + return jsUndefined(); +} + +JSValue JSNotification::removeEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + + if (JSEventListener* listener = globalObject->findJSEventListener(args.at(1))) + impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec)); + + return jsUndefined(); +} + + +} // namespace + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/bindings/js/JSDocumentCustom.cpp b/WebCore/bindings/js/JSDocumentCustom.cpp index 39a1fc5..25c0b00 100644 --- a/WebCore/bindings/js/JSDocumentCustom.cpp +++ b/WebCore/bindings/js/JSDocumentCustom.cpp @@ -42,8 +42,14 @@ namespace WebCore { void JSDocument::markChildren(MarkStack& markStack) { JSNode::markChildren(markStack); - markDOMNodesForDocument(markStack, impl()); - markActiveObjectsForContext(markStack, *Heap::heap(this)->globalData(), impl()); + + Document* document = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + markDOMNodesForDocument(markStack, document); + markActiveObjectsForContext(markStack, globalData, document); + markDOMObjectWrapper(markStack, globalData, document->implementation()); + markDOMObjectWrapper(markStack, globalData, document->styleSheets()); } JSValue JSDocument::location(ExecState* exec) const diff --git a/WebCore/bindings/js/JSElementCustom.cpp b/WebCore/bindings/js/JSElementCustom.cpp index 47793d0..c7b19e3 100644 --- a/WebCore/bindings/js/JSElementCustom.cpp +++ b/WebCore/bindings/js/JSElementCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -51,6 +51,18 @@ namespace WebCore { using namespace HTMLNames; +void JSElement::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + Element* element = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + markDOMObjectWrapper(markStack, globalData, element->attributeMap()); + if (element->isStyledElement()) + markDOMObjectWrapper(markStack, globalData, static_cast<StyledElement*>(element)->inlineStyleDecl()); +} + static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value) { if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIsJavaScript(deprecatedParseURL(value))) { @@ -59,7 +71,7 @@ static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* elem return false; } return true; -} +} JSValue JSElement::setAttribute(ExecState* exec, const ArgList& args) { diff --git a/WebCore/bindings/js/JSEventSourceConstructor.cpp b/WebCore/bindings/js/JSEventSourceConstructor.cpp new file mode 100644 index 0000000..c6e4825 --- /dev/null +++ b/WebCore/bindings/js/JSEventSourceConstructor.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Ericsson nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(EVENTSOURCE) + +#include "JSEventSourceConstructor.h" + +#include "EventSource.h" +#include "ExceptionCode.h" +#include "JSEventSource.h" +#include "ScriptExecutionContext.h" +#include <runtime/Error.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSEventSourceConstructor); + +const ClassInfo JSEventSourceConstructor::s_info = { "EventSourceContructor", 0, 0, 0 }; + +JSEventSourceConstructor::JSEventSourceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSEventSourceConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSEventSourcePrototype::self(exec, globalObject), None); + putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); +} + +static JSObject* constructEventSource(ExecState* exec, JSObject* constructor, const ArgList& args) +{ + if (args.size() < 1) + return throwError(exec, SyntaxError, "Not enough arguments"); + + UString url = args.at(0).toString(exec); + if (exec->hadException()) + return 0; + + JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(constructor); + ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); + if (!context) + return throwError(exec, ReferenceError, "EventSource constructor associated document is unavailable"); + + ExceptionCode ec = 0; + RefPtr<EventSource> eventSource = EventSource::create(url, context, ec); + if (ec) { + setDOMException(exec, ec); + return 0; + } + + return asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release())); +} + +ConstructType JSEventSourceConstructor::getConstructData(ConstructData& constructData) +{ + constructData.native.function = constructEventSource; + return ConstructTypeHost; +} + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSEventSourceConstructor.h b/WebCore/bindings/js/JSEventSourceConstructor.h new file mode 100644 index 0000000..b2f3cb5 --- /dev/null +++ b/WebCore/bindings/js/JSEventSourceConstructor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Ericsson nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JSEventSourceConstructor_h +#define JSEventSourceConstructor_h + +#if ENABLE(EVENTSOURCE) + +#include "JSDOMBinding.h" + +namespace WebCore { + + class JSEventSourceConstructor : public DOMConstructorObject { + public: + JSEventSourceConstructor(JSC::ExecState*, JSDOMGlobalObject*); + static const JSC::ClassInfo s_info; + + private: + virtual JSC::ConstructType getConstructData(JSC::ConstructData&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + }; + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) + +#endif // JSEventSourceConstructor_h diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp new file mode 100644 index 0000000..d20ccd6 --- /dev/null +++ b/WebCore/bindings/js/JSEventSourceCustom.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Ericsson nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(EVENTSOURCE) + +#include "JSEventSource.h" + +#include "EventSource.h" +#include "JSDOMGlobalObject.h" +#include "JSEventListener.h" + +using namespace JSC; + +namespace WebCore { + +void JSEventSource::markChildren(MarkStack& markStack) +{ + DOMObject::markChildren(markStack); + + markIfNotNull(markStack, m_impl->onopen()); + markIfNotNull(markStack, m_impl->onmessage()); + markIfNotNull(markStack, m_impl->onerror()); + + typedef EventSource::EventListenersMap EventListenersMap; + typedef EventSource::ListenerVector ListenerVector; + EventListenersMap& eventListeners = m_impl->eventListeners(); + for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { + for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) + (*vecIter)->markJSFunction(markStack); + } +} + +JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1)); + if (!listener) + return jsUndefined(); + impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec)); + return jsUndefined(); +} + +JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + JSEventListener* listener = globalObject->findJSEventListener(args.at(1)); + if (!listener) + return jsUndefined(); + impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec)); + return jsUndefined(); +} + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSEventTarget.cpp b/WebCore/bindings/js/JSEventTarget.cpp index c34e10e..5825ee5 100644 --- a/WebCore/bindings/js/JSEventTarget.cpp +++ b/WebCore/bindings/js/JSEventTarget.cpp @@ -43,6 +43,11 @@ #include "XMLHttpRequest.h" #include "XMLHttpRequestUpload.h" +#if ENABLE(EVENTSOURCE) +#include "EventSource.h" +#include "JSEventSource.h" +#endif + #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "DOMApplicationCache.h" #include "JSDOMApplicationCache.h" @@ -60,6 +65,11 @@ #include "Worker.h" #endif +#if ENABLE(NOTIFICATIONS) +#include "JSNotification.h" +#include "Notification.h" +#endif + using namespace JSC; namespace WebCore { @@ -69,6 +79,11 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ if (!target) return jsNull(); +#if ENABLE(EVENTSOURCE) + if (EventSource* eventSource = target->toEventSource()) + return toJS(exec, globalObject, eventSource); +#endif + #if ENABLE(SVG) // SVGElementInstance supports both toSVGElementInstance and toNode since so much mouse handling code depends on toNode returning a valid node. if (SVGElementInstance* instance = target->toSVGElementInstance()) @@ -111,6 +126,11 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ return toJSDOMGlobalObject(workerContext); #endif +#if ENABLE(NOTIFICATIONS) + if (Notification* notification = target->toNotification()) + return toJS(exec, notification); +#endif + ASSERT_NOT_REACHED(); return jsNull(); } @@ -118,7 +138,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ EventTarget* toEventTarget(JSC::JSValue value) { #define CONVERT_TO_EVENT_TARGET(type) \ - if (value.isObject(&JS##type::s_info)) \ + if (value.inherits(&JS##type::s_info)) \ return static_cast<JS##type*>(asObject(value))->impl(); CONVERT_TO_EVENT_TARGET(Node) @@ -126,9 +146,13 @@ EventTarget* toEventTarget(JSC::JSValue value) CONVERT_TO_EVENT_TARGET(XMLHttpRequestUpload) CONVERT_TO_EVENT_TARGET(MessagePort) - if (value.isObject(&JSDOMWindowShell::s_info)) + if (value.inherits(&JSDOMWindowShell::s_info)) return static_cast<JSDOMWindowShell*>(asObject(value))->impl(); +#if ENABLE(EVENTSOURCE) + CONVERT_TO_EVENT_TARGET(EventSource) +#endif + #if ENABLE(OFFLINE_WEB_APPLICATIONS) CONVERT_TO_EVENT_TARGET(DOMApplicationCache) #endif @@ -147,6 +171,10 @@ EventTarget* toEventTarget(JSC::JSValue value) CONVERT_TO_EVENT_TARGET(SharedWorkerContext) #endif +#if ENABLE(NOTIFICATIONS) + CONVERT_TO_EVENT_TARGET(Notification) +#endif + return 0; } diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index 6379a1c..cc0ba8b 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -34,6 +34,7 @@ #include "JSCustomPositionErrorCallback.h" #include "JSDOMWindow.h" #include "PositionOptions.h" +#include <runtime/InternalFunction.h> using namespace JSC; using namespace std; @@ -43,7 +44,7 @@ namespace WebCore { static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSValue value) { // The spec specifies 'FunctionOnly' for this object. - if (!value.isObject(&InternalFunction::info)) { + if (!value.inherits(&InternalFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -55,12 +56,12 @@ static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSVa static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(ExecState* exec, JSValue value) { - // Argument is optional (hence undefined is allowed), and null is allowed. + // Argument is optional (hence undefined is allowed), and null is allowed. if (value.isUndefinedOrNull()) return 0; // The spec specifies 'FunctionOnly' for this object. - if (!value.isObject(&InternalFunction::info)) { + if (!value.inherits(&InternalFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -91,7 +92,7 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu JSValue enableHighAccuracyValue = object->get(exec, Identifier(exec, "enableHighAccuracy")); if (exec->hadException()) return 0; - if(!enableHighAccuracyValue.isUndefined()) { + if (!enableHighAccuracyValue.isUndefined()) { options->setEnableHighAccuracy(enableHighAccuracyValue.toBoolean(exec)); if (exec->hadException()) return 0; diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp new file mode 100644 index 0000000..921e243 --- /dev/null +++ b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Apple Inc. All right 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 "JSHTMLCanvasElement.h" + +#include "HTMLCanvasElement.h" + +using namespace JSC; + +namespace WebCore { + +void JSHTMLCanvasElement::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + markDOMObjectWrapper(markStack, globalData, canvas->renderingContext2D()); +} + +} diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp index 6b47622..e5166ee 100644 --- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp @@ -29,6 +29,7 @@ #include "Document.h" #include "HTMLInputElement.h" #include "Settings.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSHistoryCustom.cpp b/WebCore/bindings/js/JSHistoryCustom.cpp index a3b15e1..a11266d 100644 --- a/WebCore/bindings/js/JSHistoryCustom.cpp +++ b/WebCore/bindings/js/JSHistoryCustom.cpp @@ -31,6 +31,7 @@ #include "Frame.h" #include "History.h" +#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSImageConstructor.cpp b/WebCore/bindings/js/JSImageConstructor.cpp index faaaf41..0f4a991 100644 --- a/WebCore/bindings/js/JSImageConstructor.cpp +++ b/WebCore/bindings/js/JSImageConstructor.cpp @@ -25,6 +25,7 @@ #include "JSHTMLImageElement.h" #include "JSNode.h" #include "ScriptExecutionContext.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSInspectorBackendCustom.cpp b/WebCore/bindings/js/JSInspectorBackendCustom.cpp index b2eb2d1..30e6dc2 100644 --- a/WebCore/bindings/js/JSInspectorBackendCustom.cpp +++ b/WebCore/bindings/js/JSInspectorBackendCustom.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009 Joseph Pecoraro * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +35,8 @@ #include "JSInspectorBackend.h" #include "Console.h" +#include "Cookie.h" +#include "CookieJar.h" #if ENABLE(DATABASE) #include "Database.h" #include "JSDatabase.h" @@ -51,6 +54,10 @@ #include "JSRange.h" #include "Node.h" #include "Page.h" +#if ENABLE(DOM_STORAGE) +#include "Storage.h" +#include "JSStorage.h" +#endif #include "TextIterator.h" #include "VisiblePosition.h" #include <runtime/JSArray.h> @@ -70,21 +77,12 @@ using namespace JSC; namespace WebCore { -JSValue JSInspectorBackend::highlightDOMNode(JSC::ExecState*, const JSC::ArgList& args) +JSValue JSInspectorBackend::highlightDOMNode(JSC::ExecState* exec, const JSC::ArgList& args) { if (args.size() < 1) return jsUndefined(); - JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); - if (!wrapper) - return jsUndefined(); - - Node* node = toNode(wrapper->unwrappedObject()); - if (!node) - return jsUndefined(); - - impl()->highlight(node); - + impl()->highlight(args.at(0).toInt32(exec)); return jsUndefined(); } @@ -158,6 +156,68 @@ JSValue JSInspectorBackend::inspectedWindow(ExecState*, const ArgList&) return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); } +JSValue JSInspectorBackend::cookies(ExecState* exec, const ArgList&) +{ + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + Document* document = ic->inspectedPage()->mainFrame()->document(); + Vector<Cookie> cookies; + bool isImplemented = getRawCookies(document, document->cookieURL(), cookies); + + if (!isImplemented) + return jsUndefined(); + + MarkedArgumentBuffer result; + Identifier nameIdentifier(exec, "name"); + Identifier valueIdentifier(exec, "value"); + Identifier domainIdentifier(exec, "domain"); + Identifier pathIdentifier(exec, "path"); + Identifier expiresIdentifier(exec, "expires"); + Identifier sizeIdentifier(exec, "size"); + Identifier httpOnlyIdentifier(exec, "httpOnly"); + Identifier secureIdentifier(exec, "secure"); + Identifier sessionIdentifier(exec, "session"); + + unsigned length = cookies.size(); + for (unsigned i = 0; i < length; ++i) { + const Cookie& cookie = cookies[i]; + JSObject* cookieObject = constructEmptyObject(exec); + cookieObject->putDirect(nameIdentifier, jsString(exec, cookie.name)); + cookieObject->putDirect(valueIdentifier, jsString(exec, cookie.value)); + cookieObject->putDirect(domainIdentifier, jsString(exec, cookie.domain)); + cookieObject->putDirect(pathIdentifier, jsString(exec, cookie.path)); + cookieObject->putDirect(expiresIdentifier, jsNumber(exec, cookie.expires)); + cookieObject->putDirect(sizeIdentifier, jsNumber(exec, cookie.name.length() + cookie.value.length())); + cookieObject->putDirect(httpOnlyIdentifier, jsBoolean(cookie.httpOnly)); + cookieObject->putDirect(secureIdentifier, jsBoolean(cookie.secure)); + cookieObject->putDirect(sessionIdentifier, jsBoolean(cookie.session)); + result.append(cookieObject); + } + + return constructArray(exec, result); +} + +JSValue JSInspectorBackend::deleteCookie(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + String cookieName = args.at(0).toString(exec); + if (exec->hadException()) + return jsUndefined(); + + Document* document = ic->inspectedPage()->mainFrame()->document(); + WebCore::deleteCookie(document, document->cookieURL(), cookieName); + + return jsUndefined(); +} + JSValue JSInspectorBackend::setting(ExecState* exec, const ArgList& args) { if (args.size() < 1) @@ -280,4 +340,107 @@ JSValue JSInspectorBackend::profiles(JSC::ExecState* exec, const JSC::ArgList&) #endif +JSValue JSInspectorBackend::nodeForId(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + Node* node = impl()->nodeForId(args.at(0).toInt32(exec)); + if (!node) + return jsUndefined(); + + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + JSLock lock(SilenceAssertionsOnly); + JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); + return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, deprecatedGlobalObjectForPrototype(inspectedWindow->globalExec()), node)); +} + +JSValue JSInspectorBackend::idForNode(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Node* node = toNode(wrapper->unwrappedObject()); + if (node) + return jsNumber(exec, impl()->idForNode(node)); + return jsUndefined(); +} + +JSValue JSInspectorBackend::wrapObject(ExecState*, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + return impl()->wrapObject(ScriptValue(args.at(0))).jsValue(); +} + +JSValue JSInspectorBackend::unwrapObject(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + return impl()->unwrapObject(args.at(0).toString(exec)).jsValue(); +} + +JSValue JSInspectorBackend::pushNodePathToFrontend(ExecState* exec, const ArgList& args) +{ + if (args.size() < 2) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Node* node = toNode(wrapper->unwrappedObject()); + if (!node) + return jsUndefined(); + + bool selectInUI = args.at(1).toBoolean(exec); + return jsNumber(exec, impl()->pushNodePathToFrontend(node, selectInUI)); +} + +#if ENABLE(DATABASE) +JSValue JSInspectorBackend::selectDatabase(ExecState*, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Database* database = toDatabase(wrapper->unwrappedObject()); + if (database) + impl()->selectDatabase(database); + return jsUndefined(); +} +#endif + +#if ENABLE(DOM_STORAGE) +JSValue JSInspectorBackend::selectDOMStorage(ExecState*, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Storage* storage = toStorage(wrapper->unwrappedObject()); + if (storage) + impl()->selectDOMStorage(storage); + return jsUndefined(); +} +#endif + } // namespace WebCore diff --git a/WebCore/bindings/js/JSLazyEventListener.cpp b/WebCore/bindings/js/JSLazyEventListener.cpp index 7caff2b..cf0ed44 100644 --- a/WebCore/bindings/js/JSLazyEventListener.cpp +++ b/WebCore/bindings/js/JSLazyEventListener.cpp @@ -23,6 +23,7 @@ #include "Frame.h" #include "JSNode.h" #include <runtime/FunctionConstructor.h> +#include <runtime/JSFunction.h> #include <runtime/JSLock.h> #include <wtf/RefCountedLeakCounter.h> diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp index d7d32f4..0289bc0 100644 --- a/WebCore/bindings/js/JSLocationCustom.cpp +++ b/WebCore/bindings/js/JSLocationCustom.cpp @@ -31,6 +31,7 @@ #include "KURL.h" #include "Location.h" #include "ScriptController.h" +#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp index 25a5cb2..9721ba3 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp +++ b/WebCore/bindings/js/JSMessageChannelConstructor.cpp @@ -30,6 +30,7 @@ #include "JSDocument.h" #include "JSMessageChannel.h" #include "MessageChannel.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSNodeFilterCustom.cpp b/WebCore/bindings/js/JSNodeFilterCustom.cpp index 09fd110..2a99a93 100644 --- a/WebCore/bindings/js/JSNodeFilterCustom.cpp +++ b/WebCore/bindings/js/JSNodeFilterCustom.cpp @@ -48,7 +48,7 @@ JSValue JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args) PassRefPtr<NodeFilter> toNodeFilter(JSValue value) { - if (value.isObject(&JSNodeFilter::s_info)) + if (value.inherits(&JSNodeFilter::s_info)) return static_cast<JSNodeFilter*>(asObject(value))->impl(); return NodeFilter::create(JSNodeFilterCondition::create(value)); diff --git a/WebCore/bindings/js/JSOptionConstructor.cpp b/WebCore/bindings/js/JSOptionConstructor.cpp index 2b8bd5d..7da0666 100644 --- a/WebCore/bindings/js/JSOptionConstructor.cpp +++ b/WebCore/bindings/js/JSOptionConstructor.cpp @@ -25,6 +25,7 @@ #include "JSHTMLOptionElement.h" #include "ScriptExecutionContext.h" #include "Text.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSStyleSheetCustom.cpp b/WebCore/bindings/js/JSStyleSheetCustom.cpp index 43249dc..d711b6f 100644 --- a/WebCore/bindings/js/JSStyleSheetCustom.cpp +++ b/WebCore/bindings/js/JSStyleSheetCustom.cpp @@ -56,12 +56,19 @@ void JSStyleSheet::markChildren(MarkStack& markStack) { Base::markChildren(markStack); + StyleSheet* sheet = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + unsigned length = sheet->length(); + for (unsigned i = 0; i < length; ++i) + markDOMObjectWrapper(markStack, globalData, sheet->item(i)); + // This prevents us from having a style sheet with a dangling ownerNode pointer. // A better solution would be to handle this on the DOM side -- if the style sheet // is kept around, then we want the node to stay around too. One possibility would // be to make ref/deref on the style sheet ref/deref the node instead, but there's // a lot of disentangling of the CSS DOM objects that would need to happen first. - if (Node* ownerNode = impl()->ownerNode()) { + if (Node* ownerNode = sheet->ownerNode()) { if (JSNode* ownerNodeWrapper = getCachedDOMNodeWrapper(ownerNode->document(), ownerNode)) markStack.append(ownerNodeWrapper); } diff --git a/WebCore/bindings/js/JSStyleSheetListCustom.cpp b/WebCore/bindings/js/JSStyleSheetListCustom.cpp index 1da6418..7bf9389 100644 --- a/WebCore/bindings/js/JSStyleSheetListCustom.cpp +++ b/WebCore/bindings/js/JSStyleSheetListCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,6 +35,18 @@ using namespace JSC; namespace WebCore { +void JSStyleSheetList::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + StyleSheetList* list = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + unsigned length = list->length(); + for (unsigned i = 0; i < length; ++i) + markDOMObjectWrapper(markStack, globalData, list->item(i)); +} + bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, const Identifier& propertyName) { return styleSheetList->getNamedItem(propertyName); diff --git a/WebCore/bindings/js/JSWebSocketConstructor.cpp b/WebCore/bindings/js/JSWebSocketConstructor.cpp index ca2e104..5b34765 100644 --- a/WebCore/bindings/js/JSWebSocketConstructor.cpp +++ b/WebCore/bindings/js/JSWebSocketConstructor.cpp @@ -37,6 +37,7 @@ #include "JSWebSocket.h" #include "ScriptExecutionContext.h" #include "WebSocket.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index 3aa4b8b..401b33d 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -38,6 +38,7 @@ #include "KURL.h" #include "WebSocket.h" #include "NotImplemented.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWorkerConstructor.cpp b/WebCore/bindings/js/JSWorkerConstructor.cpp index 9943cfb..69c05e7 100644 --- a/WebCore/bindings/js/JSWorkerConstructor.cpp +++ b/WebCore/bindings/js/JSWorkerConstructor.cpp @@ -34,6 +34,7 @@ #include "JSDOMWindowCustom.h" #include "JSWorker.h" #include "Worker.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 919c81f..7ece7a0 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -43,6 +43,10 @@ #include "WorkerNavigator.h" #include <interpreter/Interpreter.h> +#if ENABLE(EVENTSOURCE) +#include "JSEventSourceConstructor.h" +#endif + using namespace JSC; namespace WebCore { @@ -77,6 +81,13 @@ bool JSWorkerContext::getOwnPropertySlotDelegate(ExecState* exec, const Identifi return false; } +#if ENABLE(EVENTSOURCE) +JSValue JSWorkerContext::eventSource(ExecState* exec) const +{ + return getDOMConstructor<JSEventSourceConstructor>(exec, this); +} +#endif + JSValue JSWorkerContext::xmlHttpRequest(ExecState* exec) const { return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, this); diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp index a644c9e..91fff9a 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp @@ -23,6 +23,7 @@ #include "JSXMLHttpRequest.h" #include "ScriptExecutionContext.h" #include "XMLHttpRequest.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index a591fae..95bc16e 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -123,9 +123,9 @@ JSValue JSXMLHttpRequest::send(ExecState* exec, const ArgList& args) JSValue val = args.at(0); if (val.isUndefinedOrNull()) impl()->send(ec); - else if (val.isObject(&JSDocument::s_info)) + else if (val.inherits(&JSDocument::s_info)) impl()->send(toDocument(val), ec); - else if (val.isObject(&JSFile::s_info)) + else if (val.inherits(&JSFile::s_info)) impl()->send(toFile(val), ec); else impl()->send(val.toString(exec), ec); diff --git a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp index 01e53a6..441bbc9 100644 --- a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp +++ b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp @@ -49,7 +49,7 @@ namespace WebCore { JSValue JSXSLTProcessor::importStylesheet(ExecState*, const ArgList& args) { JSValue nodeVal = args.at(0); - if (nodeVal.isObject(&JSNode::s_info)) { + if (nodeVal.inherits(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); impl()->importStylesheet(node->impl()); return jsUndefined(); @@ -62,7 +62,7 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg { JSValue nodeVal = args.at(0); JSValue docVal = args.at(1); - if (nodeVal.isObject(&JSNode::s_info) && docVal.isObject(&JSDocument::s_info)) { + if (nodeVal.inherits(&JSNode::s_info) && docVal.inherits(&JSDocument::s_info)) { WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl(); Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl()); return toJS(exec, impl()->transformToFragment(node, doc).get()); @@ -74,7 +74,7 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg JSValue JSXSLTProcessor::transformToDocument(ExecState* exec, const ArgList& args) { JSValue nodeVal = args.at(0); - if (nodeVal.isObject(&JSNode::s_info)) { + if (nodeVal.inherits(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl()); if (resultDocument) diff --git a/WebCore/bindings/js/ScriptControllerHaiku.cpp b/WebCore/bindings/js/ScriptControllerHaiku.cpp index b573b97..3fe471d 100644 --- a/WebCore/bindings/js/ScriptControllerHaiku.cpp +++ b/WebCore/bindings/js/ScriptControllerHaiku.cpp @@ -28,8 +28,8 @@ #include "ScriptController.h" #include "PluginView.h" -#include "runtime_root.h" #include "runtime.h" +#include "runtime_root.h" namespace WebCore { diff --git a/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/WebCore/bindings/js/ScriptObjectQuarantine.cpp index 89553ef..f96f89e 100644 --- a/WebCore/bindings/js/ScriptObjectQuarantine.cpp +++ b/WebCore/bindings/js/ScriptObjectQuarantine.cpp @@ -38,6 +38,7 @@ #include "JSNode.h" #include "ScriptObject.h" #include "ScriptValue.h" +#include "Storage.h" #include <runtime/JSLock.h> @@ -80,10 +81,11 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj #endif #if ENABLE(DOM_STORAGE) -bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject) +bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) { - ASSERT(frame); ASSERT(storage); + Frame* frame = storage->frame(); + ASSERT(frame); JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); ExecState* exec = globalObject->globalExec(); diff --git a/WebCore/bindings/js/ScriptObjectQuarantine.h b/WebCore/bindings/js/ScriptObjectQuarantine.h index d70acd7..df52379 100644 --- a/WebCore/bindings/js/ScriptObjectQuarantine.h +++ b/WebCore/bindings/js/ScriptObjectQuarantine.h @@ -37,7 +37,6 @@ namespace WebCore { class Database; class DOMWindow; - class Frame; class Node; class ScriptObject; class ScriptValue; @@ -49,7 +48,7 @@ namespace WebCore { bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); #endif #if ENABLE(DOM_STORAGE) - bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject); + bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); #endif bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp index d427cee..6eac102 100644 --- a/WebCore/bindings/js/ScriptValue.cpp +++ b/WebCore/bindings/js/ScriptValue.cpp @@ -74,4 +74,11 @@ bool ScriptValue::isUndefined() const return m_value.get().isUndefined(); } +bool ScriptValue::isObject() const +{ + if (!m_value) + return false; + return m_value.get().isObject(); +} + } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h index 209ce06..19bb693 100644 --- a/WebCore/bindings/js/ScriptValue.h +++ b/WebCore/bindings/js/ScriptValue.h @@ -50,6 +50,7 @@ public: bool isEqual(ScriptState*, const ScriptValue&) const; bool isNull() const; bool isUndefined() const; + bool isObject() const; bool hasNoValue() const { return m_value == JSC::JSValue(); } private: diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 1918aef..f6de50e 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -667,6 +667,12 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . " {\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType" . ($dataNode->extendedAttributes->{"CustomMarkFunction"} ? "" : ", JSC::HasDefaultMark") . "));\n" . + " }\n"); + } elsif ($dataNode->extendedAttributes->{"CustomMarkFunction"}) { + push(@headerContent, + " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . + " {\n" . " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" . " }\n"); } @@ -1373,7 +1379,7 @@ sub GenerateImplementation push(@implContent, " if (!castedThisObj)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } else { - push(@implContent, " if (!thisValue.isObject(&${className}::s_info))\n"); + push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); push(@implContent, " return throwError(exec, TypeError);\n"); push(@implContent, " $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n"); } @@ -1537,7 +1543,7 @@ sub GenerateImplementation push(@implContent, "{\n"); - push(@implContent, " return value.isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : "); + push(@implContent, " return value.inherits(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : "); if ($podType and $podType ne "float") { push(@implContent, "$podType();\n}\n"); } else { diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 439f368..1eb3e85 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -975,51 +975,24 @@ sub GenerateBatchedAttributeData $setter = "V8Custom::v8${customAccessor}AccessorSetter"; } } + } else { + # Default Getter and Setter + $getter = "${interfaceName}Internal::${attrName}AttrGetter"; + $setter = "${interfaceName}Internal::${attrName}AttrSetter"; - # Custom Getter and Setter - } elsif ($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; - if ($interfaceName eq "WorkerContext" and $attrName eq "self") { - $setter = "0"; - $propAttr = "v8::ReadOnly"; - } else { + # Custom Setter + if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { $hasCustomSetter = 1; $setter = "V8Custom::v8${customAccessor}AccessorSetter"; } - # Custom Setter - } elsif ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"}) { - $hasCustomSetter = 1; - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "V8Custom::v8${customAccessor}AccessorSetter"; - - # Custom Getter - } elsif ($attrExt->{"CustomGetter"}) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; - $setter = "${interfaceName}Internal::${attrName}AttrSetter"; - - # Replaceable - } elsif ($attrExt->{"Replaceable"}) { - # Replaceable accessor is put on instance template with ReadOnly attribute. - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "0"; - - # Mark to avoid duplicate v8::ReadOnly flags in output. - $hasCustomSetter = 1; - - # Handle the special case of window.top being marked upstream as Replaceable. - # FIXME: Investigate why [Replaceable] is not marked as ReadOnly - # upstream and reach parity. - if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) { - $propAttr .= "|v8::ReadOnly"; + # Custom Getter + if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { + $getter = "V8Custom::v8${customAccessor}AccessorGetter"; } - - # Normal - } else { - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "${interfaceName}Internal::${attrName}AttrSetter"; } + # Replaceable if ($attrExt->{"Replaceable"} && !$hasCustomSetter) { $setter = "0"; $propAttr .= "|v8::ReadOnly"; @@ -1653,6 +1626,7 @@ sub IsRefPtrType return 1 if $type eq "Plugin"; return 1 if $type eq "ProcessingInstruction"; return 1 if $type eq "Range"; + return 1 if $type eq "RGBColor"; return 1 if $type eq "Text"; return 1 if $type eq "TextMetrics"; return 1 if $type eq "TimeRanges"; diff --git a/WebCore/bindings/v8/ScriptObjectQuarantine.cpp b/WebCore/bindings/v8/ScriptObjectQuarantine.cpp index 053cf68..c9f379b 100644 --- a/WebCore/bindings/v8/ScriptObjectQuarantine.cpp +++ b/WebCore/bindings/v8/ScriptObjectQuarantine.cpp @@ -38,6 +38,7 @@ #include "Page.h" #include "ScriptObject.h" #include "ScriptValue.h" +#include "Storage.h" #include "V8Binding.h" #include "V8Proxy.h" @@ -61,10 +62,11 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj return false; } -bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject) +bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) { - ASSERT(frame); ASSERT(storage); + Frame* frame = storage->frame(); + ASSERT(frame); #if ENABLE(DOM_STORAGE) v8::HandleScope handleScope; diff --git a/WebCore/bindings/v8/ScriptObjectQuarantine.h b/WebCore/bindings/v8/ScriptObjectQuarantine.h index 3b7ccff..712dd9b 100644 --- a/WebCore/bindings/v8/ScriptObjectQuarantine.h +++ b/WebCore/bindings/v8/ScriptObjectQuarantine.h @@ -42,7 +42,6 @@ namespace WebCore { class Database; class DOMWindow; - class Frame; class Node; class ScriptObject; class ScriptValue; @@ -51,7 +50,7 @@ namespace WebCore { ScriptValue quarantineValue(ScriptState*, const ScriptValue&); bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); - bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject); + bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h index 004851b..ddc3577 100644 --- a/WebCore/bindings/v8/ScriptValue.h +++ b/WebCore/bindings/v8/ScriptValue.h @@ -110,7 +110,12 @@ public: { return m_value->IsUndefined(); } - + + bool isObject() const + { + return m_value->IsObject(); + } + bool hasNoValue() const { return m_value.IsEmpty(); diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp index c5d580a..c0367d5 100644 --- a/WebCore/bindings/v8/V8Binding.cpp +++ b/WebCore/bindings/v8/V8Binding.cpp @@ -154,14 +154,12 @@ AtomicString v8StringToAtomicWebCoreString(v8::Handle<v8::String> v8String) { WebCoreStringResource* stringResource = WebCoreStringResource::toStringResource(v8String); if (!stringResource) { + if (!v8String->CanMakeExternal()) + return v8StringToWebCoreString(v8String, DoNotExternalize, AtomicStringType); // If this string hasn't been externalized, we force it now. - String plain = v8StringToWebCoreString(v8String, Externalize, AtomicStringType); - // If the string is empty there's no room to cache an atomic - // string so we bail out. - if (plain.isEmpty()) - return plain; + v8StringToWebCoreString(v8String, Externalize, AtomicStringType); stringResource = WebCoreStringResource::toStringResource(v8String); - ASSERT(stringResource != NULL); + ASSERT(stringResource); } return stringResource->atomicString(); } diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h index 80fed1d..945dcbb 100644 --- a/WebCore/bindings/v8/custom/V8CustomBinding.h +++ b/WebCore/bindings/v8/custom/V8CustomBinding.h @@ -218,7 +218,7 @@ namespace WebCore { DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle); DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle); - DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent); + DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent); DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto); DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation); DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener); @@ -402,12 +402,23 @@ namespace WebCore { DECLARE_CALLBACK(InspectorBackendSetting); DECLARE_CALLBACK(InspectorBackendInspectedWindow); DECLARE_CALLBACK(InspectorBackendSetSetting); + DECLARE_CALLBACK(InspectorBackendCookies); + DECLARE_CALLBACK(InspectorBackendDeleteCookie); DECLARE_CALLBACK(InspectorBackendCurrentCallFrame); DECLARE_CALLBACK(InspectorBackendDebuggerEnabled); DECLARE_CALLBACK(InspectorBackendPauseOnExceptions); DECLARE_CALLBACK(InspectorBackendProfilerEnabled); + DECLARE_CALLBACK(InspectorBackendNodeForId); + DECLARE_CALLBACK(InspectorBackendIdForNode); + DECLARE_CALLBACK(InspectorBackendWrapObject); + DECLARE_CALLBACK(InspectorBackendUnwrapObject); + DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend); #if ENABLE(DATABASE) DECLARE_CALLBACK(InspectorBackendDatabaseTableNames); + DECLARE_CALLBACK(InspectorBackendSelectDatabase); +#endif +#if ENABLE(DOM_STORAGE) + DECLARE_CALLBACK(InspectorBackendSelectDOMStorage); #endif DECLARE_CALLBACK(InspectorBackendWrapCallback); diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 7d0b9e6..13d40bc 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -145,14 +145,37 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode) ACCESSOR_GETTER(DOMWindowEvent) { + v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); + if (holder.IsEmpty()) + return v8::Undefined(); + + Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame(); + if (!frame || !V8Proxy::canAccessFrame(frame, true)) + return v8::Undefined(); + + v8::Local<v8::Context> context = V8Proxy::context(frame); v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); - v8::Local<v8::Context> context = v8::Context::GetCurrent(); v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol); if (jsEvent.IsEmpty()) return v8::Undefined(); return jsEvent; } +ACCESSOR_SETTER(DOMWindowEvent) +{ + v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); + if (holder.IsEmpty()) + return; + + Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame(); + if (!frame || !V8Proxy::canAccessFrame(frame, true)) + return; + + v8::Local<v8::Context> context = V8Proxy::context(frame); + v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); + context->Global()->SetHiddenValue(eventSymbol, value); +} + ACCESSOR_GETTER(DOMWindowCrypto) { // FIXME: Implement me. diff --git a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp index 2571df4..cb9b3a9 100644 --- a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp @@ -57,13 +57,8 @@ CALLBACK_FUNC_DECL(InspectorBackendHighlightDOMNode) if (args.Length() < 1) return v8::Undefined(); - Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); - if (!node) - return v8::Undefined(); - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - inspectorBackend->highlight(node); - + inspectorBackend->highlight(args[0]->ToInt32()->Value()); return v8::Undefined(); } @@ -209,10 +204,123 @@ CALLBACK_FUNC_DECL(InspectorBackendSetSetting) return v8::Undefined(); } +CALLBACK_FUNC_DECL(InspectorBackendCookies) +{ + INC_STATS("InspectorBackend.cookies()"); + // FIXME: Not yet implemented. + return v8::Undefined(); +} + +CALLBACK_FUNC_DECL(InspectorBackendDeleteCookie) +{ + INC_STATS("InspectorBackend.deleteCookie()"); + // FIXME: Not yet implemented. (see WebCore/bindings/js/JSInspectorBackendCustom.cpp#deleteCookie) + return v8::Undefined(); +} + CALLBACK_FUNC_DECL(InspectorBackendWrapCallback) { INC_STATS("InspectorBackend.wrapCallback()"); return args[0]; } +CALLBACK_FUNC_DECL(InspectorBackendNodeForId) +{ + INC_STATS("InspectorBackend.nodeForId()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + + Node* node = inspectorBackend->nodeForId(args[0]->ToInt32()->Value()); + if (!node) + return v8::Undefined(); + + InspectorController* ic = inspectorBackend->inspectorController(); + if (!ic) + return v8::Undefined(); + + return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); +} + +CALLBACK_FUNC_DECL(InspectorBackendIdForNode) +{ + INC_STATS("InspectorBackend.idForNode()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); + if (node) + return v8::Number::New(inspectorBackend->idForNode(node)); + return v8::Undefined(); +} + +CALLBACK_FUNC_DECL(InspectorBackendWrapObject) +{ + INC_STATS("InspectorBackend.wrapObject()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + return inspectorBackend->wrapObject(ScriptValue(args[0])).v8Value(); +} + +CALLBACK_FUNC_DECL(InspectorBackendUnwrapObject) +{ + INC_STATS("InspectorBackend.unwrapObject()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + return inspectorBackend->unwrapObject(toWebCoreStringWithNullCheck(args[0])).v8Value(); +} + +CALLBACK_FUNC_DECL(InspectorBackendPushNodePathToFrontend) +{ + INC_STATS("InspectorBackend.pushNodePathToFrontend()"); + if (args.Length() < 2) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); + bool selectInUI = args[1]->ToBoolean()->Value(); + if (node) + return v8::Number::New(inspectorBackend->pushNodePathToFrontend(node, selectInUI)); + + return v8::Undefined(); +} + +#if ENABLE(DATABASE) +CALLBACK_FUNC_DECL(InspectorBackendSelectDatabase) +{ + INC_STATS("InspectorBackend.selectDatabase()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, v8::Handle<v8::Object>::Cast(args[0])); + if (database) + inspectorBackend->selectDatabase(database); + + return v8::Undefined(); +} +#endif + +#if ENABLE(DOM_STORAGE) +CALLBACK_FUNC_DECL(InspectorBackendSelectDOMStorage) +{ + INC_STATS("InspectorBackend.selectDOMStorage()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, v8::Handle<v8::Object>::Cast(args[0])); + if (storage) + inspectorBackend->selectDOMStorage(storage); + + return v8::Undefined(); +} +#endif + } // namespace WebCore diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index c9af8b0..eb4a6bd 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -29,19 +29,18 @@ #if ENABLE(MAC_JAVA_BRIDGE) #include "Frame.h" +#include "ScriptController.h" +#include "StringSourceProvider.h" #include "WebCoreFrameView.h" #include "jni_runtime.h" #include "jni_utility.h" -#include "ScriptController.h" #include "runtime_object.h" #include "runtime_root.h" #include <interpreter/CallFrame.h> +#include <runtime/Completion.h> #include <runtime/JSGlobalObject.h> #include <runtime/JSLock.h> -#include <runtime/Completion.h> -#include <runtime/Completion.h> #include <wtf/Assertions.h> -#include <parser/SourceProvider.h> using WebCore::Frame; diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index 126d513..5991f5b 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -114,6 +114,14 @@ /* Definition of Basic Types */ /*----------------------------------------------------------------------*/ +/* QNX sets the _INT16 and friends defines, but does not typedef the types */ +#ifdef __QNXNTO__ +#undef _UINT16 +#undef _INT16 +#undef _UINT32 +#undef _INT32 +#endif + #ifndef _UINT16 #define _UINT16 typedef unsigned short uint16; diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index 2d69c1c..67bd2a3 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -209,7 +209,7 @@ void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValue, PutPrope static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&RuntimeObjectImp::s_info)) + if (!thisValue.inherits(&RuntimeObjectImp::s_info)) return throwError(exec, TypeError); JSValue result = jsUndefined(); diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp index 506697a..58280e3 100644 --- a/WebCore/bridge/qt/qt_instance.cpp +++ b/WebCore/bridge/qt/qt_instance.cpp @@ -56,12 +56,12 @@ public: static const ClassInfo s_info; - virtual void mark() + virtual void markChildren(MarkStack& markStack) { + RuntimeObjectImp::markChildren(markStack); QtInstance* instance = static_cast<QtInstance*>(getInternalInstance()); if (instance) - instance->mark(); - RuntimeObjectImp::mark(); + instance->markAggregate(markStack); } protected: @@ -202,13 +202,13 @@ RuntimeObjectImp* QtInstance::createRuntimeObject(ExecState* exec) return ret; } -void QtInstance::mark() +void QtInstance::markAggregate(MarkStack& markStack) { - if (m_defaultMethod && !m_defaultMethod->marked()) - m_defaultMethod->mark(); + if (m_defaultMethod) + markStack.append(m_defaultMethod); foreach(JSObject* val, m_methods.values()) { - if (val && !val->marked()) - val->mark(); + if (val) + markStack.append(val); } } diff --git a/WebCore/bridge/qt/qt_instance.h b/WebCore/bridge/qt/qt_instance.h index 23766b1..c276b29 100644 --- a/WebCore/bridge/qt/qt_instance.h +++ b/WebCore/bridge/qt/qt_instance.h @@ -48,7 +48,7 @@ public: virtual JSValue valueOf(ExecState*) const; virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; - virtual void mark(); // This isn't inherited + void markAggregate(MarkStack&); virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList&); diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 6be119c..1590417 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "qt_runtime.h" +#include "BooleanObject.h" #include "DateInstance.h" #include "DateMath.h" #include "DatePrototype.h" @@ -46,9 +47,9 @@ #include <JSFunction.h> #include <limits.h> #include <runtime.h> +#include <runtime/Error.h> #include <runtime_array.h> #include <runtime_object.h> -#include "BooleanObject.h" // QtScript has these Q_DECLARE_METATYPE(QObjectList); @@ -1328,14 +1329,14 @@ QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, const Identifier& iden d->m_allowPrivate = allowPrivate; } -void QtRuntimeMetaMethod::mark() +void QtRuntimeMetaMethod::markChildren(MarkStack& markStack) { - QtRuntimeMethod::mark(); + QtRuntimeMethod::markChildren(markStack); QW_D(QtRuntimeMetaMethod); if (d->m_connect) - d->m_connect->mark(); + markStack.append(d->m_connect); if (d->m_disconnect) - d->m_disconnect->mark(); + markStack.append(d->m_disconnect); } JSValue QtRuntimeMetaMethod::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) diff --git a/WebCore/bridge/qt/qt_runtime.h b/WebCore/bridge/qt/qt_runtime.h index 72d93eb..edb577c 100644 --- a/WebCore/bridge/qt/qt_runtime.h +++ b/WebCore/bridge/qt/qt_runtime.h @@ -167,7 +167,7 @@ public: virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); - virtual void mark(); + virtual void markChildren(MarkStack& markStack); protected: QtRuntimeMetaMethodData* d_func() const {return reinterpret_cast<QtRuntimeMetaMethodData*>(d_ptr);} diff --git a/WebCore/bridge/runtime_method.cpp b/WebCore/bridge/runtime_method.cpp index 0af0af5..15ea582 100644 --- a/WebCore/bridge/runtime_method.cpp +++ b/WebCore/bridge/runtime_method.cpp @@ -82,13 +82,13 @@ static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec, JSObject* functi RuntimeObjectImp* imp; - if (thisValue.isObject(&RuntimeObjectImp::s_info)) { + if (thisValue.inherits(&RuntimeObjectImp::s_info)) { imp = static_cast<RuntimeObjectImp*>(asObject(thisValue)); } else { // If thisObj is the DOM object for a plugin, get the corresponding // runtime object from the DOM object. JSValue value = thisValue.get(exec, Identifier(exec, "__apple_runtime_object")); - if (value.isObject(&RuntimeObjectImp::s_info)) + if (value.inherits(&RuntimeObjectImp::s_info)) imp = static_cast<RuntimeObjectImp*>(asObject(value)); else return throwError(exec, TypeError); diff --git a/WebCore/css/CSSCanvasValue.cpp b/WebCore/css/CSSCanvasValue.cpp index cf8cb42..0c1c3f9 100644 --- a/WebCore/css/CSSCanvasValue.cpp +++ b/WebCore/css/CSSCanvasValue.cpp @@ -47,15 +47,15 @@ String CSSCanvasValue::cssText() const void CSSCanvasValue::canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) { IntRect imageChangeRect = enclosingIntRect(changedRect); - HashMap<RenderObject*, IntSize>::const_iterator end = m_clients.end(); - for (HashMap<RenderObject*, IntSize>::const_iterator curr = m_clients.begin(); curr != end; ++curr) + RenderObjectSizeCountMap::const_iterator end = m_clients.end(); + for (RenderObjectSizeCountMap::const_iterator curr = m_clients.begin(); curr != end; ++curr) curr->first->imageChanged(static_cast<WrappedImagePtr>(this), &imageChangeRect); } void CSSCanvasValue::canvasResized(HTMLCanvasElement*) { - HashMap<RenderObject*, IntSize>::const_iterator end = m_clients.end(); - for (HashMap<RenderObject*, IntSize>::const_iterator curr = m_clients.begin(); curr != end; ++curr) + RenderObjectSizeCountMap::const_iterator end = m_clients.end(); + for (RenderObjectSizeCountMap::const_iterator curr = m_clients.begin(); curr != end; ++curr) curr->first->imageChanged(static_cast<WrappedImagePtr>(this)); } diff --git a/WebCore/css/CSSImageGeneratorValue.cpp b/WebCore/css/CSSImageGeneratorValue.cpp index 6e23d95..4cf0873 100644 --- a/WebCore/css/CSSImageGeneratorValue.cpp +++ b/WebCore/css/CSSImageGeneratorValue.cpp @@ -49,24 +49,42 @@ void CSSImageGeneratorValue::addClient(RenderObject* renderer, const IntSize& si ref(); if (!size.isEmpty()) m_sizes.add(size); - m_clients.add(renderer, size); + + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + if (it == m_clients.end()) + m_clients.add(renderer, SizeCountPair(size, 1)); + else { + SizeCountPair& sizeCount = it->second; + ++sizeCount.second; + } } void CSSImageGeneratorValue::removeClient(RenderObject* renderer) { - IntSize size = m_clients.get(renderer); + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + ASSERT(it != m_clients.end()); + + SizeCountPair& sizeCount = it->second; + IntSize size = sizeCount.first; if (!size.isEmpty()) { m_sizes.remove(size); if (!m_sizes.contains(size)) m_images.remove(size); } - m_clients.remove(renderer); + + if (!--sizeCount.second) + m_clients.remove(renderer); + deref(); } Image* CSSImageGeneratorValue::getImage(RenderObject* renderer, const IntSize& size) { - IntSize oldSize = m_clients.get(renderer); + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + ASSERT(it != m_clients.end()); + + SizeCountPair& sizeCount = it->second; + IntSize oldSize = sizeCount.first; if (oldSize != size) { removeClient(renderer); addClient(renderer, size); diff --git a/WebCore/css/CSSImageGeneratorValue.h b/WebCore/css/CSSImageGeneratorValue.h index 661fd37..c053bfe 100644 --- a/WebCore/css/CSSImageGeneratorValue.h +++ b/WebCore/css/CSSImageGeneratorValue.h @@ -57,8 +57,11 @@ protected: Image* getImage(RenderObject*, const IntSize&); void putImage(const IntSize&, PassRefPtr<Image>); + typedef pair<IntSize, int> SizeCountPair; + typedef HashMap<RenderObject*, SizeCountPair> RenderObjectSizeCountMap; + HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use. - HashMap<RenderObject*, IntSize> m_clients; // A map from RenderObjects to image sizes. + RenderObjectSizeCountMap m_clients; // A map from RenderObjects (with entry count) to image sizes. HashMap<IntSize, RefPtr<Image> > m_images; // A cache of Image objects by image size. RefPtr<StyleGeneratedImage> m_image; diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp index 50e60f4..adcfbb9 100644 --- a/WebCore/css/CSSImportRule.cpp +++ b/WebCore/css/CSSImportRule.cpp @@ -1,7 +1,7 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2002, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2002, 2005, 2006, 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 @@ -26,6 +26,8 @@ #include "DocLoader.h" #include "Document.h" #include "MediaList.h" +#include "Settings.h" +#include <wtf/StdLibExtras.h> namespace WebCore { @@ -60,7 +62,20 @@ void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, c CSSStyleSheet* parent = parentStyleSheet(); bool strict = !parent || parent->useStrictParsing(); - m_styleSheet->parseString(sheet->sheetText(strict), strict); + String sheetText = sheet->sheetText(strict); + m_styleSheet->parseString(sheetText, strict); + + if (strict && parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks()) { + // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>. + DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css")); + DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n")); + if (url.endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) { + ASSERT(m_styleSheet->length() == 1); + ExceptionCode ec; + m_styleSheet->deleteRule(0, ec); + } + } + m_loading = false; if (parent) diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index b79992f..b299fcf 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -747,7 +748,11 @@ bool CSSParser::parseValue(int propId, bool important) // inline | block | list-item | run-in | inline-block | table | // inline-table | table-row-group | table-header-group | table-footer-group | table-row | // table-column-group | table-column | table-cell | table-caption | box | inline-box | none | inherit +#if ENABLE(WCSS) + if ((id >= CSSValueInline && id <= CSSValueWapMarquee) || id == CSSValueNone) +#else if ((id >= CSSValueInline && id <= CSSValueWebkitInlineBox) || id == CSSValueNone) +#endif valid_primitive = true; break; @@ -1313,6 +1318,28 @@ bool CSSParser::parseValue(int propId, bool important) else valid_primitive = validUnit(value, FTime|FInteger|FNonNeg, m_strict); break; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeDir: + if (id == CSSValueLtr || id == CSSValueRtl) + valid_primitive = true; + break; + case CSSPropertyWapMarqueeStyle: + if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate) + valid_primitive = true; + break; + case CSSPropertyWapMarqueeLoop: + if (id == CSSValueInfinite) + valid_primitive = true; + else + valid_primitive = validUnit(value, FInteger | FNonNeg, m_strict); + break; + case CSSPropertyWapMarqueeSpeed: + if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) + valid_primitive = true; + else + valid_primitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict); + break; +#endif case CSSPropertyWebkitUserDrag: // auto | none | element if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement) valid_primitive = true; diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp index 6343dac..1f2c9ca 100644 --- a/WebCore/css/CSSPrimitiveValue.cpp +++ b/WebCore/css/CSSPrimitiveValue.cpp @@ -643,7 +643,7 @@ Rect* CSSPrimitiveValue::getRectValue(ExceptionCode& ec) const return m_value.rect; } -RGBColor* CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const +PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const { ec = 0; if (m_type != CSS_RGBCOLOR) { @@ -652,7 +652,7 @@ RGBColor* CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const } // FIMXE: This should not return a new object for each invocation. - return RGBColor::create(m_value.rgbcolor).releaseRef(); + return RGBColor::create(m_value.rgbcolor); } Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const diff --git a/WebCore/css/CSSPrimitiveValue.h b/WebCore/css/CSSPrimitiveValue.h index 85a0ba3..d417619 100644 --- a/WebCore/css/CSSPrimitiveValue.h +++ b/WebCore/css/CSSPrimitiveValue.h @@ -152,7 +152,7 @@ public: Rect* getRectValue(ExceptionCode&) const; Rect* getRectValue() const { return m_type != CSS_RECT ? 0 : m_value.rect; } - RGBColor* getRGBColorValue(ExceptionCode&) const; + PassRefPtr<RGBColor> getRGBColorValue(ExceptionCode&) const; RGBA32 getRGBA32Value() const { return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; } Pair* getPairValue(ExceptionCode&) const; diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 69cfbb1..be96407 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -522,6 +523,7 @@ template<> inline CSSPrimitiveValue::operator EBoxOrient() const case CSSValueInlineAxis: return HORIZONTAL; case CSSValueVertical: + case CSSValueBlockAxis: return VERTICAL; default: ASSERT_NOT_REACHED(); @@ -777,6 +779,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e) case TABLE_CAPTION: m_value.ident = CSSValueTableCaption; break; +#if ENABLE(WCSS) + case WAP_MARQUEE: + m_value.ident = CSSValueWapMarquee; + break; +#endif case BOX: m_value.ident = CSSValueWebkitBox; break; diff --git a/WebCore/css/CSSRuleList.idl b/WebCore/css/CSSRuleList.idl index 224d6a1..9add078 100644 --- a/WebCore/css/CSSRuleList.idl +++ b/WebCore/css/CSSRuleList.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,6 +27,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, HasIndexGetter, InterfaceUUID=64c346a0-1e34-49d3-9472-57ec8e0fdccb, diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 80910a7..25dbd87 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -77,6 +77,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, before, ("before")); DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked")); DEFINE_STATIC_LOCAL(AtomicString, fileUploadButton, ("-webkit-file-upload-button")); + DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default")); DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled")); DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only")); DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write")); @@ -170,7 +171,9 @@ void CSSSelector::extractPseudoType() const else if (m_value == fileUploadButton) { m_pseudoType = PseudoFileUploadButton; element = true; - } else if (m_value == disabled) + } else if (m_value == defaultString) + m_pseudoType = PseudoDefault; + else if (m_value == disabled) m_pseudoType = PseudoDisabled; else if (m_value == readOnly) m_pseudoType = PseudoReadOnly; diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index 18251fd..53de50d 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -126,6 +126,7 @@ namespace WebCore { PseudoChecked, PseudoEnabled, PseudoFullPageMedia, + PseudoDefault, PseudoDisabled, PseudoInputPlaceholder, PseudoOptional, diff --git a/WebCore/css/CSSStyleDeclaration.idl b/WebCore/css/CSSStyleDeclaration.idl index f7ce37f..3e37418 100644 --- a/WebCore/css/CSSStyleDeclaration.idl +++ b/WebCore/css/CSSStyleDeclaration.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, DelegatingPutFunction, HasNameGetter, diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 9074476..2f7d900 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -995,6 +995,9 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) if (s->isEnabledFormControl() != m_element->isEnabledFormControl()) return false; + + if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm()) + return false; } if (style->transitions() || style->animations()) @@ -2358,6 +2361,8 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoFullPageMedia: return e && e->document() && e->document()->isMediaDocument(); break; + case CSSSelector::PseudoDefault: + return e && e->isDefaultButtonForForm(); case CSSSelector::PseudoDisabled: if (e && e->isFormControlElement()) { InputElement* inputElement = toInputElement(e); @@ -2991,6 +2996,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; case CSSPropertyDisplay: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display) +#if ENABLE(WCSS) + if (primitiveValue) { + if (primitiveValue->getIdent() == CSSValueWapMarquee) { + // Initialize Wap Marquee style + m_style->setOverflowX(OMARQUEE); + m_style->setOverflowY(OMARQUEE); + m_style->setWhiteSpace(NOWRAP); + m_style->setMarqueeDirection(MLEFT); + m_style->setMarqueeSpeed(85); // Normal speed + m_style->setMarqueeLoopCount(1); + m_style->setMarqueeBehavior(MSCROLL); + + if (m_parentStyle) + m_style->setDisplay(m_parentStyle->display()); + else + m_style->setDisplay(*primitiveValue); + } else + m_style->setDisplay(*primitiveValue); + } +#endif return; case CSSPropertyEmptyCells: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells) @@ -3754,7 +3779,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) { FontDescription fontDescription = m_style->fontDescription(); fontDescription.setKeywordSize(0); - bool familyIsFixed = fontDescription.genericFamily() == FontDescription::MonospaceFamily; float oldSize = 0; float size = 0; @@ -3769,7 +3793,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_parentNode) fontDescription.setKeywordSize(m_parentStyle->fontDescription().keywordSize()); } else if (isInitial) { - size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), familyIsFixed); + size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); } else if (primitiveValue->getIdent()) { // Keywords are being used. @@ -3782,7 +3806,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSValueXLarge: case CSSValueXxLarge: case CSSValueWebkitXxxLarge: - size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), familyIsFixed); + size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1); break; case CSSValueLarger: @@ -4025,13 +4049,12 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_style->setFontDescription(fontDescription)) m_fontDirty = true; return; - } - else if (isInitial) { + } else if (isInitial) { FontDescription initialDesc = FontDescription(); FontDescription fontDescription = m_style->fontDescription(); // We need to adjust the size to account for the generic family change from monospace // to non-monospace. - if (fontDescription.keywordSize() && fontDescription.genericFamily() == FontDescription::MonospaceFamily) + if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize()) setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), false)); fontDescription.setGenericFamily(initialDesc.genericFamily()); if (!initialDesc.firstFamily().familyIsEmpty()) @@ -4041,21 +4064,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } - if (!value->isValueList()) return; + if (!value->isValueList()) + return; FontDescription fontDescription = m_style->fontDescription(); - CSSValueList *list = static_cast<CSSValueList*>(value); + CSSValueList* list = static_cast<CSSValueList*>(value); int len = list->length(); FontFamily& firstFamily = fontDescription.firstFamily(); - FontFamily *currFamily = 0; + FontFamily* currFamily = 0; // Before mapping in a new font-family property, we should reset the generic family. - bool oldFamilyIsMonospace = fontDescription.genericFamily() == FontDescription::MonospaceFamily; + bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize(); fontDescription.setGenericFamily(FontDescription::NoFamily); for (int i = 0; i < len; i++) { - CSSValue *item = list->itemWithoutBoundsCheck(i); - if (!item->isPrimitiveValue()) continue; - CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item); + CSSValue* item = list->itemWithoutBoundsCheck(i); + if (!item->isPrimitiveValue()) + continue; + CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item); AtomicString face; Settings* settings = m_checker.m_document->settings(); if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING) @@ -4087,28 +4112,32 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) break; } } - + if (!face.isEmpty()) { if (!currFamily) { // Filling in the first family. firstFamily.setFamily(face); + firstFamily.appendFamily(0); // Remove any inherited family-fallback list. currFamily = &firstFamily; - } - else { + } else { RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); newFamily->setFamily(face); currFamily->appendFamily(newFamily); currFamily = newFamily.get(); } - - if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace) - setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyIsMonospace)); - - if (m_style->setFontDescription(fontDescription)) - m_fontDirty = true; } } - return; + + // We can't call useFixedDefaultSize() until all new font families have been added + // If currFamily is non-zero then we set at least one family on this description. + if (currFamily) { + if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) + setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize)); + + if (m_style->setFontDescription(fontDescription)) + m_fontDirty = true; + } + return; } case CSSPropertyTextDecoration: { // list of ident @@ -4742,6 +4771,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setMarqueeLoopCount(m_parentStyle->marqueeLoopCount()); m_style->setMarqueeBehavior(m_parentStyle->marqueeBehavior()); return; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeLoop: +#endif case CSSPropertyWebkitMarqueeRepetition: { HANDLE_INHERIT_AND_INITIAL(marqueeLoopCount, MarqueeLoopCount) if (!primitiveValue) @@ -4752,6 +4784,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setMarqueeLoopCount(primitiveValue->getIntValue()); return; } +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeSpeed: +#endif case CSSPropertyWebkitMarqueeSpeed: { HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed) if (!primitiveValue) @@ -4802,9 +4837,30 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } return; } +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeStyle: +#endif case CSSPropertyWebkitMarqueeStyle: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior) return; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeDir: + HANDLE_INHERIT_AND_INITIAL(marqueeDirection, MarqueeDirection) + if (primitiveValue && primitiveValue->getIdent()) { + switch (primitiveValue->getIdent()) { + case CSSValueLtr: + m_style->setMarqueeDirection(MRIGHT); + break; + case CSSValueRtl: + m_style->setMarqueeDirection(MLEFT); + break; + default: + m_style->setMarqueeDirection(*primitiveValue); + break; + } + } + return; +#endif case CSSPropertyWebkitMarqueeDirection: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection) return; @@ -5587,8 +5643,7 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty return; const FontDescription& parentFont = parentStyle->fontDescription(); - - if (childFont.genericFamily() == parentFont.genericFamily()) + if (childFont.useFixedDefaultSize() == parentFont.useFixedDefaultSize()) return; // For now, lump all families but monospace together. @@ -5601,17 +5656,16 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty // If the font uses a keyword size, then we refetch from the table rather than // multiplying by our scale factor. float size; - if (childFont.keywordSize()) { - size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), - childFont.genericFamily() == FontDescription::MonospaceFamily); - } else { + if (childFont.keywordSize()) + size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize()); + else { Settings* settings = m_checker.m_document->settings(); float fixedScaleFactor = settings ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize() : 1; - size = (parentFont.genericFamily() == FontDescription::MonospaceFamily) ? - childFont.specifiedSize()/fixedScaleFactor : - childFont.specifiedSize()*fixedScaleFactor; + size = parentFont.useFixedDefaultSize() ? + childFont.specifiedSize() / fixedScaleFactor : + childFont.specifiedSize() * fixedScaleFactor; } FontDescription newFontDescription(childFont); diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index c0b52f2..621276b 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -260,6 +260,7 @@ table-cell table-caption -webkit-box -webkit-inline-box +-wap-marquee #none # # CSS_PROP_CURSOR: diff --git a/WebCore/css/StyleSheetList.idl b/WebCore/css/StyleSheetList.idl index 2abd22f..574d749 100644 --- a/WebCore/css/StyleSheetList.idl +++ b/WebCore/css/StyleSheetList.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ module stylesheets { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, HasIndexGetter, HasNameGetter, diff --git a/WebCore/css/WCSSPropertyNames.in b/WebCore/css/WCSSPropertyNames.in new file mode 100644 index 0000000..704209f --- /dev/null +++ b/WebCore/css/WCSSPropertyNames.in @@ -0,0 +1,4 @@ +-wap-marquee-dir +-wap-marquee-loop +-wap-marquee-speed +-wap-marquee-style diff --git a/WebCore/css/WCSSValueKeywords.in b/WebCore/css/WCSSValueKeywords.in new file mode 100644 index 0000000..00657ba --- /dev/null +++ b/WebCore/css/WCSSValueKeywords.in @@ -0,0 +1 @@ +# place holder for all WCSS specific CSS value keywords diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 6b03390..3d0b667 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -483,6 +483,10 @@ select[size="1"] { white-space: pre; } +datalist { + display: none; +} + optgroup { font-weight: bolder; } diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp index 435c1af..aa5916b 100644 --- a/WebCore/dom/Attr.cpp +++ b/WebCore/dom/Attr.cpp @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 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 @@ -30,10 +30,10 @@ namespace WebCore { -Attr::Attr(Element* element, Document* docPtr, PassRefPtr<Attribute> a) - : ContainerNode(docPtr) +inline Attr::Attr(Element* element, Document* document, PassRefPtr<Attribute> attribute) + : ContainerNode(document) , m_element(element) - , m_attribute(a) + , m_attribute(attribute) , m_ignoreChildrenChanged(0) , m_specified(true) { @@ -41,6 +41,13 @@ Attr::Attr(Element* element, Document* docPtr, PassRefPtr<Attribute> a) m_attribute->m_impl = this; } +PassRefPtr<Attr> Attr::create(Element* element, Document* document, PassRefPtr<Attribute> attribute) +{ + RefPtr<Attr> attr = adoptRef(new Attr(element, document, attribute)); + attr->createTextChild(); + return attr.release(); +} + Attr::~Attr() { ASSERT(m_attribute->attr() == this); @@ -86,14 +93,14 @@ const AtomicString& Attr::prefix() const return m_attribute->prefix(); } -void Attr::setPrefix(const AtomicString &_prefix, ExceptionCode& ec) +void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec) { ec = 0; - checkSetPrefix(_prefix, ec); + checkSetPrefix(prefix, ec); if (ec) return; - m_attribute->setPrefix(_prefix); + m_attribute->setPrefix(prefix); } String Attr::nodeValue() const @@ -101,11 +108,11 @@ String Attr::nodeValue() const return value(); } -void Attr::setValue(const String& v, ExceptionCode&) +void Attr::setValue(const AtomicString& value, ExceptionCode&) { m_ignoreChildrenChanged++; removeChildren(); - m_attribute->setValue(v.impl()); + m_attribute->setValue(value); createTextChild(); m_ignoreChildrenChanged--; @@ -120,7 +127,7 @@ void Attr::setNodeValue(const String& v, ExceptionCode& ec) PassRefPtr<Node> Attr::cloneNode(bool /*deep*/) { - RefPtr<Attr> clone = new Attr(0, document(), m_attribute->clone()); + RefPtr<Attr> clone = adoptRef(new Attr(0, document(), m_attribute->clone())); cloneChildNodes(clone.get()); return clone.release(); } diff --git a/WebCore/dom/Attr.h b/WebCore/dom/Attr.h index ed4dc07..e927a6e 100644 --- a/WebCore/dom/Attr.h +++ b/WebCore/dom/Attr.h @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -39,48 +39,47 @@ namespace WebCore { class Attr : public ContainerNode { friend class NamedNodeMap; public: - Attr(Element*, Document*, PassRefPtr<Attribute>); - ~Attr(); + static PassRefPtr<Attr> create(Element*, Document*, PassRefPtr<Attribute>); + virtual ~Attr(); - // Call this after calling the constructor so the - // Attr node isn't floating when we append the text node. - void createTextChild(); - - // DOM methods & attributes for Attr String name() const { return qualifiedName().toString(); } bool specified() const { return m_specified; } Element* ownerElement() const { return m_element; } - String value() const { return m_attribute->value(); } - void setValue(const String&, ExceptionCode&); + const AtomicString& value() const { return m_attribute->value(); } + void setValue(const AtomicString&, ExceptionCode&); + + Attribute* attr() const { return m_attribute.get(); } + const QualifiedName& qualifiedName() const { return m_attribute->name(); } + + // An extension to get presentational information for attributes. + CSSStyleDeclaration* style() { return m_attribute->style(); } + + void setSpecified(bool specified) { m_specified = specified; } + +private: + Attr(Element*, Document*, PassRefPtr<Attribute>); + + void createTextChild(); - // DOM methods overridden from parent classes virtual String nodeName() const; virtual NodeType nodeType() const; + const AtomicString& localName() const; const AtomicString& namespaceURI() const; const AtomicString& prefix() const; + virtual void setPrefix(const AtomicString&, ExceptionCode&); virtual String nodeValue() const; virtual void setNodeValue(const String&, ExceptionCode&); virtual PassRefPtr<Node> cloneNode(bool deep); - // Other methods (not part of DOM) virtual bool isAttributeNode() const { return true; } virtual bool childTypeAllowed(NodeType); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - Attribute* attr() const { return m_attribute.get(); } - const QualifiedName& qualifiedName() const { return m_attribute->name(); } - - // An extension to get presentational information for attributes. - CSSStyleDeclaration* style() { return m_attribute->style(); } - - void setSpecified(bool specified) { m_specified = specified; } - -private: virtual const AtomicString& virtualPrefix() const { return prefix(); } virtual const AtomicString& virtualLocalName() const { return localName(); } virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); } diff --git a/WebCore/dom/Attribute.cpp b/WebCore/dom/Attribute.cpp index 048ac6a..0ab0bb6 100644 --- a/WebCore/dom/Attribute.cpp +++ b/WebCore/dom/Attribute.cpp @@ -37,10 +37,8 @@ PassRefPtr<Attribute> Attribute::clone() const PassRefPtr<Attr> Attribute::createAttrIfNeeded(Element* e) { RefPtr<Attr> r = m_impl; - if (!r) { - r = new Attr(e, e->document(), this); - r->createTextChild(); - } + if (!r) + r = Attr::create(e, e->document(), this); return r.release(); } diff --git a/WebCore/dom/CDATASection.cpp b/WebCore/dom/CDATASection.cpp index 72faa70..d73054e 100644 --- a/WebCore/dom/CDATASection.cpp +++ b/WebCore/dom/CDATASection.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2008, 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 @@ -26,13 +26,14 @@ namespace WebCore { -CDATASection::CDATASection(Document* document, const String& text) - : Text(document, text) +inline CDATASection::CDATASection(Document* document, const String& data) + : Text(document, data) { } -CDATASection::~CDATASection() +PassRefPtr<CDATASection> CDATASection::create(Document* document, const String& data) { + return adoptRef(new CDATASection(document, data)); } String CDATASection::nodeName() const @@ -47,19 +48,17 @@ Node::NodeType CDATASection::nodeType() const PassRefPtr<Node> CDATASection::cloneNode(bool /*deep*/) { - return new CDATASection(document(), m_data); + return create(document(), data()); } -// DOM Section 1.1.1 bool CDATASection::childTypeAllowed(NodeType) { return false; } -PassRefPtr<Text> CDATASection::createNew(PassRefPtr<StringImpl> string) +PassRefPtr<Text> CDATASection::virtualCreate(const String& data) { - return new CDATASection(document(), string); + return create(document(), data); } - } // namespace WebCore diff --git a/WebCore/dom/CDATASection.h b/WebCore/dom/CDATASection.h index 8b7df9d..5cf07e1 100644 --- a/WebCore/dom/CDATASection.h +++ b/WebCore/dom/CDATASection.h @@ -1,9 +1,7 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -31,16 +29,16 @@ namespace WebCore { class CDATASection : public Text { public: + static PassRefPtr<CDATASection> create(Document*, const String&); + +private: CDATASection(Document*, const String&); - virtual ~CDATASection(); virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); virtual bool childTypeAllowed(NodeType); - -protected: - virtual PassRefPtr<Text> createNew(PassRefPtr<StringImpl>); + virtual PassRefPtr<Text> virtualCreate(const String&); }; } // namespace WebCore diff --git a/WebCore/dom/CharacterData.cpp b/WebCore/dom/CharacterData.cpp index 9a72de9..902b7ff 100644 --- a/WebCore/dom/CharacterData.cpp +++ b/WebCore/dom/CharacterData.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -30,20 +30,11 @@ namespace WebCore { -CharacterData::CharacterData(Document *doc, bool isText) - : Node(doc, false, false, isText) - , m_data(StringImpl::empty()) -{ -} - -CharacterData::CharacterData(Document* document, const String& text, bool isText) - : Node(document, false, false, isText) -{ - m_data = text.impl() ? text.impl() : StringImpl::empty(); -} - -CharacterData::~CharacterData() +CharacterData::CharacterData(Document* document, const String& text, ConstructionType type) + : Node(document, type) + , m_data(text.impl() ? text.impl() : StringImpl::empty()) { + ASSERT(type == CreateOther || type == CreateText); } void CharacterData::setData(const String& data, ExceptionCode&) diff --git a/WebCore/dom/CharacterData.h b/WebCore/dom/CharacterData.h index d9e55c0..6c31933 100644 --- a/WebCore/dom/CharacterData.h +++ b/WebCore/dom/CharacterData.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 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 @@ -29,12 +29,6 @@ namespace WebCore { class CharacterData : public Node { public: - CharacterData(Document*, const String& text, bool isText = false); - CharacterData(Document*, bool isText = false); - virtual ~CharacterData(); - - // DOM methods & attributes for CharacterData - String data() const { return m_data; } void setData(const String&, ExceptionCode&); unsigned length() const { return m_data->length(); } @@ -42,31 +36,30 @@ public: void appendData(const String&, ExceptionCode&); void insertData(unsigned offset, const String&, ExceptionCode&); void deleteData(unsigned offset, unsigned count, ExceptionCode&); - void replaceData(unsigned offset, unsigned count, const String &arg, ExceptionCode&); + void replaceData(unsigned offset, unsigned count, const String&, ExceptionCode&); bool containsOnlyWhitespace() const; - // DOM methods overridden from parent classes - - virtual String nodeValue() const; - virtual void setNodeValue(const String&, ExceptionCode&); - - // Other methods (not part of DOM) + StringImpl* dataImpl() { return m_data.get(); } - virtual bool isCharacterDataNode() const { return true; } - virtual int maxCharacterOffset() const; - StringImpl* string() { return m_data.get(); } +protected: + CharacterData(Document*, const String&, ConstructionType); - virtual bool offsetInCharacters() const; virtual bool rendererIsNeeded(RenderStyle*); -protected: - RefPtr<StringImpl> m_data; - + void setDataImpl(PassRefPtr<StringImpl> impl) { m_data = impl; } void dispatchModifiedEvent(StringImpl* oldValue); private: + virtual String nodeValue() const; + virtual void setNodeValue(const String&, ExceptionCode&); + virtual bool isCharacterDataNode() const { return true; } + virtual int maxCharacterOffset() const; + virtual bool offsetInCharacters() const; + void checkCharDataOperation(unsigned offset, ExceptionCode&); + + RefPtr<StringImpl> m_data; }; } // namespace WebCore diff --git a/WebCore/dom/Comment.cpp b/WebCore/dom/Comment.cpp index a36a491..3dcde38 100644 --- a/WebCore/dom/Comment.cpp +++ b/WebCore/dom/Comment.cpp @@ -1,9 +1,7 @@ -/** - * This file is part of the DOM implementation for KDE. - * +/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -24,22 +22,16 @@ #include "config.h" #include "Comment.h" -#include "Document.h" - namespace WebCore { -Comment::Comment(Document* doc, const String& text) - : CharacterData(doc, text) -{ -} - -Comment::Comment(Document* doc) - : CharacterData(doc) +inline Comment::Comment(Document* document, const String& text) + : CharacterData(document, text, CreateOther) { } -Comment::~Comment() +PassRefPtr<Comment> Comment::create(Document* document, const String& text) { + return adoptRef(new Comment(document, text)); } String Comment::nodeName() const @@ -54,10 +46,9 @@ Node::NodeType Comment::nodeType() const PassRefPtr<Node> Comment::cloneNode(bool /*deep*/) { - return document()->createComment(m_data); + return create(document(), data()); } -// DOM Section 1.1.1 bool Comment::childTypeAllowed(NodeType) { return false; diff --git a/WebCore/dom/Comment.h b/WebCore/dom/Comment.h index d00ba62..680ffae 100644 --- a/WebCore/dom/Comment.h +++ b/WebCore/dom/Comment.h @@ -1,9 +1,7 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -31,16 +29,14 @@ namespace WebCore { class Comment : public CharacterData { public: - Comment(Document*, const String &_text); - Comment(Document*); - virtual ~Comment(); + static PassRefPtr<Comment> create(Document*, const String&); + +private: + Comment(Document*, const String&); - // DOM methods overridden from parent classes virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); - - // Other methods (not part of DOM) virtual bool isCommentNode() const { return true; } virtual bool childTypeAllowed(NodeType); }; diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index 2d79156..569756c 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -869,16 +869,16 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec) ASSERT(!eventDispatchForbidden()); RefPtr<Node> c = child; - DocPtr<Document> doc = child->document(); + RefPtr<Document> document = child->document(); if (c->parentNode() && c->parentNode()->inDocument()) c->insertedIntoDocument(); else c->insertedIntoTree(true); - doc->incDOMTreeVersion(); + document->incDOMTreeVersion(); - if (c->parentNode() && doc->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) { + if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeInsertedEvent, true, c->parentNode(), String(), String(), ec); if (ec) @@ -886,27 +886,28 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec) } // dispatch the DOMNodeInsertedIntoDocument event to all descendants - if (c->inDocument() && doc->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) + if (c->inDocument() && document->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) { for (; c; c = c->traverseNextNode(child)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeInsertedIntoDocumentEvent, false, 0, String(), String(), ec); if (ec) return; } + } } static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec) { RefPtr<Node> c = child; - DocPtr<Document> doc = child->document(); + RefPtr<Document> document = child->document(); // update auxiliary doc info (e.g. iterators) to note that node is being removed - doc->nodeWillBeRemoved(child); + document->nodeWillBeRemoved(child); - doc->incDOMTreeVersion(); + document->incDOMTreeVersion(); // dispatch pre-removal mutation events - if (c->parentNode() && doc->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { + if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeRemovedEvent, true, c->parentNode(), String(), String(), ec); if (ec) @@ -914,7 +915,7 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec) } // dispatch the DOMNodeRemovedFromDocument event to all descendants - if (c->inDocument() && doc->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) + if (c->inDocument() && document->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) for (; c; c = c->traverseNextNode(child)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeRemovedFromDocumentEvent, false, 0, String(), String(), ec); diff --git a/WebCore/dom/ContainerNode.h b/WebCore/dom/ContainerNode.h index 3ad932c..aa480a7 100644 --- a/WebCore/dom/ContainerNode.h +++ b/WebCore/dom/ContainerNode.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 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 @@ -38,7 +38,6 @@ namespace Private { class ContainerNode : public Node { public: - ContainerNode(Document*, bool isElement = false); virtual ~ContainerNode(); Node* firstChild() const { return m_firstChild; } @@ -74,6 +73,8 @@ public: void cloneChildNodes(ContainerNode* clone); protected: + ContainerNode(Document*, ConstructionType = CreateContainer); + static void queuePostAttachCallback(NodeCallback, Node*); void suspendPostAttachCallbacks(); void resumePostAttachCallbacks(); @@ -97,8 +98,8 @@ private: Node* m_lastChild; }; -inline ContainerNode::ContainerNode(Document* document, bool isElement) - : Node(document, isElement, true) +inline ContainerNode::ContainerNode(Document* document, ConstructionType type) + : Node(document, type) , m_firstChild(0) , m_lastChild(0) { diff --git a/WebCore/dom/DocPtr.h b/WebCore/dom/DocPtr.h deleted file mode 100644 index 8b50e8d..0000000 --- a/WebCore/dom/DocPtr.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of the DOM implementation for KDE. - * Copyright (C) 2005, 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 DocPtr_h -#define DocPtr_h - -namespace WebCore { - -template <class T> class DocPtr { -public: - DocPtr() : m_ptr(0) {} - DocPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->selfOnlyRef(); } - DocPtr(const DocPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); } - ~DocPtr() { if (T *ptr = m_ptr) ptr->selfOnlyDeref(); } - - template <class U> DocPtr(const DocPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); } - - void resetSkippingRef(T *o) { m_ptr = o; } - - T *get() const { return m_ptr; } - - T &operator*() const { return *m_ptr; } - T *operator->() const { return m_ptr; } - - bool operator!() const { return !m_ptr; } - - // this type conversion operator allows implicit conversion to - // bool but not to other integer types - - typedef T * (DocPtr::*UnspecifiedBoolType)() const; - operator UnspecifiedBoolType() const - { - return m_ptr ? &DocPtr::get : 0; - } - - DocPtr &operator=(const DocPtr &); - DocPtr &operator=(T *); - - private: - T *m_ptr; -}; - -template <class T> DocPtr<T> &DocPtr<T>::operator=(const DocPtr<T> &o) -{ - T *optr = o.m_ptr; - if (optr) - optr->selfOnlyRef(); - if (T *ptr = m_ptr) - ptr->selfOnlyDeref(); - m_ptr = optr; - return *this; -} - -template <class T> inline DocPtr<T> &DocPtr<T>::operator=(T *optr) -{ - if (optr) - optr->selfOnlyRef(); - if (T *ptr = m_ptr) - ptr->selfOnlyDeref(); - m_ptr = optr; - return *this; -} - -template <class T> inline bool operator==(const DocPtr<T> &a, const DocPtr<T> &b) -{ - return a.get() == b.get(); -} - -template <class T> inline bool operator==(const DocPtr<T> &a, const T *b) -{ - return a.get() == b; -} - -template <class T> inline bool operator==(const T *a, const DocPtr<T> &b) -{ - return a == b.get(); -} - -template <class T> inline bool operator!=(const DocPtr<T> &a, const DocPtr<T> &b) -{ - return a.get() != b.get(); -} - -template <class T> inline bool operator!=(const DocPtr<T> &a, const T *b) -{ - return a.get() != b; -} - -template <class T> inline bool operator!=(const T *a, const DocPtr<T> &b) -{ - return a != b.get(); -} - -} // namespace WebCore - -#endif // DocPtr_h diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 066cf46..644eb61 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -107,6 +107,7 @@ #include "SegmentedString.h" #include "SelectionController.h" #include "Settings.h" +#include "SharedWorkerRepository.h" #include "StyleSheetList.h" #include "TextEvent.h" #include "TextIterator.h" @@ -361,7 +362,7 @@ Document::Document(Frame* frame, bool isXHTML) , m_containsWMLContent(false) #endif { - m_document.resetSkippingRef(this); + m_document = this; m_printing = false; @@ -431,8 +432,7 @@ void Document::removedLastRef() // want the document to be destructed until after // removeAllChildren returns, so we guard ourselves with an // extra self-only ref. - - DocPtr<Document> guard(this); + selfOnlyRef(); // We must make sure not to be retaining any of our children through // these extra pointers or we will create a reference cycle. @@ -456,6 +456,8 @@ void Document::removedLastRef() #ifndef NDEBUG m_inRemovedLastRefFunction = false; #endif + + selfOnlyDeref(); } else { #ifndef NDEBUG m_deletionHasBegun = true; @@ -482,7 +484,7 @@ Document::~Document() #endif delete m_tokenizer; - m_document.resetSkippingRef(0); + m_document = 0; delete m_styleSelector; delete m_docLoader; @@ -518,8 +520,6 @@ Document::~Document() if (m_styleSheets) m_styleSheets->documentDestroyed(); - - m_document = 0; } void Document::resetLinkColor() @@ -589,17 +589,17 @@ PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionC PassRefPtr<DocumentFragment> Document::createDocumentFragment() { - return new DocumentFragment(document()); + return DocumentFragment::create(document()); } PassRefPtr<Text> Document::createTextNode(const String& data) { - return new Text(this, data); + return Text::create(this, data); } PassRefPtr<Comment> Document::createComment(const String& data) { - return new Comment(this, data); + return Comment::create(this, data); } PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionCode& ec) @@ -608,7 +608,7 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except ec = NOT_SUPPORTED_ERR; return 0; } - return new CDATASection(this, data); + return CDATASection::create(this, data); } PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionCode& ec) @@ -621,7 +621,7 @@ PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St ec = NOT_SUPPORTED_ERR; return 0; } - return new ProcessingInstruction(this, target, data); + return ProcessingInstruction::create(this, target, data); } PassRefPtr<EntityReference> Document::createEntityReference(const String& name, ExceptionCode& ec) @@ -634,12 +634,12 @@ PassRefPtr<EntityReference> Document::createEntityReference(const String& name, ec = NOT_SUPPORTED_ERR; return 0; } - return new EntityReference(this, name); + return EntityReference::create(this, name); } PassRefPtr<EditingText> Document::createEditingTextNode(const String& text) { - return new EditingText(this, text); + return EditingText::create(this, text); } PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() @@ -704,11 +704,8 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCo return newElement.release(); } - case ATTRIBUTE_NODE: { - RefPtr<Attr> newAttr = new Attr(0, this, static_cast<Attr*>(importedNode)->attr()->clone()); - newAttr->createTextChild(); - return newAttr.release(); - } + case ATTRIBUTE_NODE: + return Attr::create(0, this, static_cast<Attr*>(importedNode)->attr()->clone()); case DOCUMENT_FRAGMENT_NODE: { DocumentFragment* oldFragment = static_cast<DocumentFragment*>(importedNode); RefPtr<DocumentFragment> newFragment = createDocumentFragment(); @@ -1379,7 +1376,11 @@ void Document::detach() // Send out documentWillBecomeInactive() notifications to registered elements, // in order to stop media elements documentWillBecomeInactive(); - + +#if ENABLE(SHARED_WORKERS) + SharedWorkerRepository::documentDetached(this); +#endif + if (m_frame) { FrameView* view = m_frame->view(); if (view) @@ -1500,7 +1501,7 @@ AXObjectCache* Document::axObjectCache() const return doc->axObjectCache(); // this is the top-level document, so install a new cache - m_axObjectCache = new AXObjectCache; + m_axObjectCache = new AXObjectCache(this); return m_axObjectCache; #endif // ANDROID } @@ -2660,10 +2661,10 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) focusChangeBlocked = true; newFocusedNode = 0; } - if ((oldFocusedNode.get() == this) && oldFocusedNode->hasOneRef()) + if (oldFocusedNode == this && oldFocusedNode->hasOneRef()) return true; - if (oldFocusedNode.get() == oldFocusedNode->rootEditableElement()) + if (oldFocusedNode == oldFocusedNode->rootEditableElement()) frame()->editor()->didEndEditing(); } @@ -2692,7 +2693,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) } m_focusedNode->setFocus(); - if (m_focusedNode.get() == m_focusedNode->rootEditableElement()) + if (m_focusedNode == m_focusedNode->rootEditableElement()) frame()->editor()->didBeginEditing(); // eww, I suck. set the qt focus correctly @@ -2714,7 +2715,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) } } -#if PLATFORM(MAC) && !PLATFORM(CHROMIUM) +#if (PLATFORM(MAC) || PLATFORM(WIN)) && !PLATFORM(CHROMIUM) if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled()) axObjectCache()->handleFocusedUIElementChanged(); #elif PLATFORM(GTK) @@ -2723,9 +2724,9 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) RenderObject* newFocusedRenderer = 0; if (oldFocusedNode) - oldFocusedRenderer = oldFocusedNode.get()->renderer(); + oldFocusedRenderer = oldFocusedNode->renderer(); if (newFocusedNode) - newFocusedRenderer = newFocusedNode.get()->renderer(); + newFocusedRenderer = newFocusedNode->renderer(); axObjectCache()->handleFocusedUIElementChangedWithRenderers(oldFocusedRenderer, newFocusedRenderer); } @@ -3925,7 +3926,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S // FIXME: Assume this is a mapped attribute, since createAttribute isn't namespace-aware. There's no harm to XML // documents if we're wrong. - return new Attr(0, this, MappedAttribute::create(qName, StringImpl::empty())); + return Attr::create(0, this, MappedAttribute::create(qName, StringImpl::empty())); } #if ENABLE(SVG) diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index fc4dc7e..c18a864 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -172,19 +172,16 @@ class Document : public ContainerNode, public ScriptExecutionContext { public: static PassRefPtr<Document> create(Frame* frame) { - return new Document(frame, false); + return adoptRef(new Document(frame, false)); } static PassRefPtr<Document> createXHTML(Frame* frame) { - return new Document(frame, true); + return adoptRef(new Document(frame, true)); } virtual ~Document(); - virtual bool isDocument() const { return true; } - using ContainerNode::ref; using ContainerNode::deref; - virtual void removedLastRef(); // Nodes belonging to this document hold "self-only" references - // these are enough to keep the document from being destroyed, but @@ -214,7 +211,6 @@ public: DocumentType* doctype() const { return m_docType.get(); } DOMImplementation* implementation() const; - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); Element* documentElement() const { @@ -299,11 +295,6 @@ public: CollectionCache* nameCollectionInfo(CollectionType, const AtomicString& name); - // DOM methods overridden from parent classes - - virtual String nodeName() const; - virtual NodeType nodeType() const; - // Other methods (not part of DOM) virtual bool isHTMLDocument() const { return false; } virtual bool isImageDocument() const { return false; } @@ -455,9 +446,6 @@ public: virtual String userAgent(const KURL&) const; - // from cachedObjectClient - virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); - #if FRAME_LOADS_USER_STYLESHEET void setUserStyleSheet(const String& sheet); #endif @@ -474,10 +462,6 @@ public: enum ParseMode { Compat, AlmostStrict, Strict }; -private: - virtual void determineParseMode() {} - -public: void setParseMode(ParseMode m) { m_parseMode = m; } ParseMode parseMode() const { return m_parseMode; } @@ -506,11 +490,6 @@ public: MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const IntPoint&, const PlatformMouseEvent&); - virtual bool childTypeAllowed(NodeType); - virtual PassRefPtr<Node> cloneNode(bool deep); - - virtual bool canReplaceChild(Node* newChild, Node* oldChild); - StyleSheetList* styleSheets(); /* Newly proposed CSS3 mechanism for selecting alternate @@ -751,8 +730,6 @@ public: void setDocType(PassRefPtr<DocumentType>); - virtual void finishedParsing(); - #if ENABLE(XPATH) // XPathEvaluator methods PassRefPtr<XPathExpression> createExpression(const String& expression, @@ -799,7 +776,6 @@ public: HTMLCanvasElement* getCSSCanvasElement(const String& name); bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; } - void initDNSPrefetch(); void parseDNSPrefetchControlHeader(const String&); virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); @@ -808,10 +784,95 @@ public: virtual void scriptImported(unsigned long, const String&); virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously. + typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache; + JSWrapperCache& wrapperCache() { return m_wrapperCache; } + + virtual void finishedParsing(); + + bool inPageCache() const { return m_inPageCache; } + void setInPageCache(bool flag); + + // Elements can register themselves for the "documentWillBecomeInactive()" and + // "documentDidBecomeActive()" callbacks + void registerForDocumentActivationCallbacks(Element*); + void unregisterForDocumentActivationCallbacks(Element*); + void documentWillBecomeInactive(); + void documentDidBecomeActive(); + + void registerForMediaVolumeCallbacks(Element*); + void unregisterForMediaVolumeCallbacks(Element*); + void mediaVolumeDidChange(); + + void setShouldCreateRenderers(bool); + bool shouldCreateRenderers(); + + void setDecoder(PassRefPtr<TextResourceDecoder>); + TextResourceDecoder* decoder() const { return m_decoder.get(); } + + String displayStringModifiedByEncoding(const String&) const; + PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const; + void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const; + + // Quirk for the benefit of Apple's Dictionary application. + void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; } + bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; } + +#if ENABLE(DASHBOARD_SUPPORT) + void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; } + bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; } + bool hasDashboardRegions () const { return m_hasDashboardRegions; } + void setHasDashboardRegions(bool f) { m_hasDashboardRegions = f; } + const Vector<DashboardRegionValue>& dashboardRegions() const; + void setDashboardRegions(const Vector<DashboardRegionValue>&); +#endif + + void removeAllEventListeners(); + + void registerDisconnectedNodeWithEventListeners(Node*); + void unregisterDisconnectedNodeWithEventListeners(Node*); + + CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } + +#if ENABLE(SVG) + const SVGDocumentExtensions* svgExtensions(); + SVGDocumentExtensions* accessSVGExtensions(); +#endif + + void initSecurityContext(); + + // Explicitly override the security origin for this document. + // Note: It is dangerous to change the security origin of a document + // that already contains content. + void setSecurityOrigin(SecurityOrigin*); + + bool processingLoadEvent() const { return m_processingLoadEvent; } + +#if ENABLE(DATABASE) + void addOpenDatabase(Database*); + void removeOpenDatabase(Database*); + DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. + void setHasOpenDatabases() { m_hasOpenDatabases = true; } + bool hasOpenDatabases() { return m_hasOpenDatabases; } + void stopDatabases(); +#endif + + void setUsingGeolocation(bool f) { m_usingGeolocation = f; } + bool usingGeolocation() const { return m_usingGeolocation; }; + +#if ENABLE(WML) + void setContainsWMLContent(bool value) { m_containsWMLContent = value; } + bool containsWMLContent() const { return m_containsWMLContent; } + + void resetWMLPageState(); + void initializeWMLPageState(); +#endif + protected: Document(Frame*, bool isXHTML); - void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; } + void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; } + + void clearXMLVersion() { m_xmlVersion = String(); } #if ENABLE(TOUCH_EVENTS) // Android public: @@ -826,16 +887,38 @@ private: #endif // ENABLE(TOUCH_EVENTS) private: + virtual bool isDocument() const { return true; } + virtual void removedLastRef(); + virtual void determineParseMode() { } + + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + + virtual String nodeName() const; + virtual NodeType nodeType() const; + virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); + virtual bool childTypeAllowed(NodeType); + virtual PassRefPtr<Node> cloneNode(bool deep); + virtual bool canReplaceChild(Node* newChild, Node* oldChild); + virtual void refScriptExecutionContext() { ref(); } virtual void derefScriptExecutionContext() { deref(); } virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls. virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above. + void initDNSPrefetch(); + String encoding() const; void executeScriptSoonTimerFired(Timer<Document>*); + void updateTitle(); + void removeAllDisconnectedNodeEventListeners(); + void updateFocusAppearanceTimerFired(Timer<Document>*); + void updateBaseURL(); + + void cacheDocumentElement() const; + CSSStyleSelector* m_styleSelector; bool m_didCalculateStyleSelector; @@ -988,96 +1071,6 @@ private: bool m_shouldProcessNoScriptElement; #endif -public: - bool inPageCache() const { return m_inPageCache; } - void setInPageCache(bool flag); - - // Elements can register themselves for the "documentWillBecomeInactive()" and - // "documentDidBecomeActive()" callbacks - void registerForDocumentActivationCallbacks(Element*); - void unregisterForDocumentActivationCallbacks(Element*); - void documentWillBecomeInactive(); - void documentDidBecomeActive(); - - void registerForMediaVolumeCallbacks(Element*); - void unregisterForMediaVolumeCallbacks(Element*); - void mediaVolumeDidChange(); - - void setShouldCreateRenderers(bool); - bool shouldCreateRenderers(); - - void setDecoder(PassRefPtr<TextResourceDecoder>); - TextResourceDecoder* decoder() const { return m_decoder.get(); } - - String displayStringModifiedByEncoding(const String&) const; - PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const; - void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const; - - // Quirk for the benefit of Apple's Dictionary application. - void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; } - bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; } - -#if ENABLE(DASHBOARD_SUPPORT) - void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; } - bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; } - bool hasDashboardRegions () const { return m_hasDashboardRegions; } - void setHasDashboardRegions(bool f) { m_hasDashboardRegions = f; } - const Vector<DashboardRegionValue>& dashboardRegions() const; - void setDashboardRegions(const Vector<DashboardRegionValue>&); -#endif - - void removeAllEventListeners(); - - void registerDisconnectedNodeWithEventListeners(Node*); - void unregisterDisconnectedNodeWithEventListeners(Node*); - - CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } - -#if ENABLE(SVG) - const SVGDocumentExtensions* svgExtensions(); - SVGDocumentExtensions* accessSVGExtensions(); -#endif - - void initSecurityContext(); - - // Explicitly override the security origin for this document. - // Note: It is dangerous to change the security origin of a document - // that already contains content. - void setSecurityOrigin(SecurityOrigin*); - - bool processingLoadEvent() const { return m_processingLoadEvent; } - -#if ENABLE(DATABASE) - void addOpenDatabase(Database*); - void removeOpenDatabase(Database*); - DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. - void setHasOpenDatabases() { m_hasOpenDatabases = true; } - bool hasOpenDatabases() { return m_hasOpenDatabases; } - void stopDatabases(); -#endif - - void setUsingGeolocation(bool f) { m_usingGeolocation = f; } - bool usingGeolocation() const { return m_usingGeolocation; }; - -#if ENABLE(WML) - void setContainsWMLContent(bool value) { m_containsWMLContent = value; } - bool containsWMLContent() const { return m_containsWMLContent; } - - void resetWMLPageState(); - void initializeWMLPageState(); -#endif - -protected: - void clearXMLVersion() { m_xmlVersion = String(); } - -private: - void updateTitle(); - void removeAllDisconnectedNodeEventListeners(); - void updateFocusAppearanceTimerFired(Timer<Document>*); - void updateBaseURL(); - - void cacheDocumentElement() const; - RenderObject* m_savedRenderer; int m_secureForms; @@ -1131,10 +1124,6 @@ private: unsigned m_numNodeListCaches; -public: - typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache; - JSWrapperCache& wrapperCache() { return m_wrapperCache; } -private: JSWrapperCache m_wrapperCache; #if ENABLE(DATABASE) @@ -1163,7 +1152,7 @@ inline bool Document::hasElementWithId(AtomicStringImpl* id) const inline bool Node::isDocumentNode() const { - return this == m_document.get(); + return this == m_document; } } // namespace WebCore diff --git a/WebCore/dom/DocumentFragment.cpp b/WebCore/dom/DocumentFragment.cpp index 7a6174f..3663e99 100644 --- a/WebCore/dom/DocumentFragment.cpp +++ b/WebCore/dom/DocumentFragment.cpp @@ -1,10 +1,8 @@ -/** - * This file is part of the DOM implementation for KDE. - * +/* * Copyright (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 Apple Computer, Inc. + * Copyright (C) 2004, 2005, 2006, 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 @@ -23,13 +21,18 @@ */ #include "config.h" - #include "DocumentFragment.h" namespace WebCore { -DocumentFragment::DocumentFragment(Document *doc) : ContainerNode(doc) +inline DocumentFragment::DocumentFragment(Document* document) + : ContainerNode(document) +{ +} + +PassRefPtr<DocumentFragment> DocumentFragment::create(Document* document) { + return adoptRef(new DocumentFragment(document)); } String DocumentFragment::nodeName() const @@ -42,7 +45,6 @@ Node::NodeType DocumentFragment::nodeType() const return DOCUMENT_FRAGMENT_NODE; } -// DOM Section 1.1.1 bool DocumentFragment::childTypeAllowed(NodeType type) { switch (type) { @@ -60,7 +62,7 @@ bool DocumentFragment::childTypeAllowed(NodeType type) PassRefPtr<Node> DocumentFragment::cloneNode(bool deep) { - RefPtr<DocumentFragment> clone = new DocumentFragment(document()); + RefPtr<DocumentFragment> clone = create(document()); if (deep) cloneChildNodes(clone.get()); return clone.release(); diff --git a/WebCore/dom/DocumentFragment.h b/WebCore/dom/DocumentFragment.h index 46d8ecd..e624ee4 100644 --- a/WebCore/dom/DocumentFragment.h +++ b/WebCore/dom/DocumentFragment.h @@ -1,10 +1,8 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (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 Apple Computer, Inc. + * Copyright (C) 2004, 2005, 2006, 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 @@ -32,6 +30,9 @@ namespace WebCore { class DocumentFragment : public ContainerNode { public: + static PassRefPtr<DocumentFragment> create(Document*); + +private: DocumentFragment(Document*); virtual String nodeName() const; diff --git a/WebCore/dom/DocumentType.cpp b/WebCore/dom/DocumentType.cpp index 885a65b..b8185e7 100644 --- a/WebCore/dom/DocumentType.cpp +++ b/WebCore/dom/DocumentType.cpp @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 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 @@ -29,11 +29,11 @@ namespace WebCore { -DocumentType::DocumentType(Document* document, const String& n, const String& p, const String& s) - : Node(document) - , m_name(n) - , m_publicId(p) - , m_systemId(s) +DocumentType::DocumentType(Document* document, const String& name, const String& publicId, const String& systemId) + : Node(document, CreateOther) + , m_name(name) + , m_publicId(publicId) + , m_systemId(systemId) { } @@ -54,7 +54,7 @@ Node::NodeType DocumentType::nodeType() const PassRefPtr<Node> DocumentType::cloneNode(bool /*deep*/) { - return new DocumentType(document(), m_name, m_publicId, m_systemId); + return create(document(), m_name, m_publicId, m_systemId); } void DocumentType::insertedIntoDocument() diff --git a/WebCore/dom/DocumentType.h b/WebCore/dom/DocumentType.h index 9fd3c6e..4f89d01 100644 --- a/WebCore/dom/DocumentType.h +++ b/WebCore/dom/DocumentType.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 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 @@ -34,7 +34,7 @@ class DocumentType : public Node { public: static PassRefPtr<DocumentType> create(Document* document, const String& name, const String& publicId, const String& systemId) { - return new DocumentType(document, name, publicId, systemId); + return adoptRef(new DocumentType(document, name, publicId, systemId)); } NamedNodeMap* entities() const { return m_entities.get(); } diff --git a/WebCore/dom/EditingText.cpp b/WebCore/dom/EditingText.cpp index 40cf97d..b36931a 100644 --- a/WebCore/dom/EditingText.cpp +++ b/WebCore/dom/EditingText.cpp @@ -1,9 +1,5 @@ -/** - * This file is part of the DOM implementation for KDE. - * - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. +/* + * Copyright (C) 2003, 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 @@ -24,24 +20,19 @@ #include "config.h" #include "EditingText.h" -// FIXME: does this really require a class? Perhaps any Text node -// inside an editable element should have the "always create a renderer" -// behavior. +// FIXME: Does this really require a class? Perhaps instead any text node +// inside an editable element could have the "always create a renderer" behavior. namespace WebCore { -EditingText::EditingText(Document *impl, const String &text) - : Text(impl, text) -{ -} - -EditingText::EditingText(Document *impl) - : Text(impl) +inline EditingText::EditingText(Document* document, const String& data) + : Text(document, data) { } -EditingText::~EditingText() +PassRefPtr<EditingText> EditingText::create(Document* document, const String& data) { + return adoptRef(new EditingText(document, data)); } bool EditingText::rendererIsNeeded(RenderStyle*) diff --git a/WebCore/dom/EditingText.h b/WebCore/dom/EditingText.h index e114786..08223c2 100644 --- a/WebCore/dom/EditingText.h +++ b/WebCore/dom/EditingText.h @@ -1,9 +1,5 @@ /* - * This file is part of the DOM implementation for KDE. - * - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -31,11 +27,12 @@ namespace WebCore { class EditingText : public Text { public: - EditingText(Document *impl, const String &text); - EditingText(Document *impl); - virtual ~EditingText(); + static PassRefPtr<EditingText> create(Document*, const String&); +private: virtual bool rendererIsNeeded(RenderStyle *); + + EditingText(Document*, const String&); }; } // namespace WebCore diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index 1956be4..7aee10c 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -57,8 +57,8 @@ namespace WebCore { using namespace HTMLNames; using namespace XMLNames; -Element::Element(const QualifiedName& tagName, Document* doc) - : ContainerNode(doc, true) +Element::Element(const QualifiedName& tagName, Document* document) + : ContainerNode(document, CreateElementZeroRefCount) , m_tagName(tagName) { } diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index 223c26a..6aa6312 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -42,7 +42,7 @@ class IntSize; class Element : public ContainerNode { public: Element(const QualifiedName&, Document*); - ~Element(); + virtual ~Element(); const AtomicString& getIDAttribute() const; bool hasAttribute(const QualifiedName&) const; @@ -64,7 +64,6 @@ public: void scrollIntoView(bool alignToTop = true); void scrollIntoViewIfNeeded(bool centerIfNeeded = true); - void scrollByUnits(int units, ScrollGranularity); void scrollByLines(int lines); void scrollByPages(int pages); @@ -108,17 +107,11 @@ public: const AtomicString& localName() const { return m_tagName.localName(); } const AtomicString& prefix() const { return m_tagName.prefix(); } - virtual void setPrefix(const AtomicString&, ExceptionCode&); const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); } virtual KURL baseURI() const; - // DOM methods overridden from parent classes - virtual NodeType nodeType() const; virtual String nodeName() const; - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); PassRefPtr<Element> cloneElementWithChildren(); PassRefPtr<Element> cloneElementWithoutChildren(); @@ -136,13 +129,9 @@ public: // This method is called whenever an attribute is added, changed or removed. virtual void attributeChanged(Attribute*, bool preserveDecls = false); - // The implementation of Element::attributeChanged() calls the following two functions. - // They are separated to allow a different flow of control in StyledElement::attributeChanged(). - void recalcStyleIfNeededAfterAttributeChanged(Attribute*); - void updateAfterAttributeChanged(Attribute*); - // not part of the DOM void setAttributeMap(PassRefPtr<NamedNodeMap>); + NamedNodeMap* attributeMap() const { return namedAttrMap.get(); } virtual void copyNonAttributeProperties(const Element* /*source*/) { } @@ -153,10 +142,6 @@ public: virtual RenderStyle* computedStyle(); - virtual bool childTypeAllowed(NodeType); - - virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); - void dispatchAttrRemovalEvent(Attribute*); void dispatchAttrAdditionEvent(Attribute*); @@ -170,12 +155,6 @@ public: virtual void updateFocusAppearance(bool restorePreviousSelection); void blur(); -#ifndef NDEBUG - virtual void formatForDebugger(char* buffer, unsigned length) const; -#endif - - bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle); - String innerText() const; String outerText() const; @@ -206,13 +185,13 @@ public: Element* nextElementSibling() const; unsigned childElementCount() const; - // FormControlElement API virtual bool isFormControlElement() const { return false; } virtual bool isEnabledFormControl() const { return true; } virtual bool isReadOnlyFormControl() const { return false; } virtual bool isTextFormControl() const { return false; } virtual bool isOptionalFormControl() const { return false; } virtual bool isRequiredFormControl() const { return false; } + virtual bool isDefaultButtonForForm() const { return false; } virtual bool formControlValueMatchesRenderer() const { return false; } virtual void setFormControlValueMatchesRenderer(bool) { } @@ -225,13 +204,37 @@ public: virtual void dispatchFormControlChangeEvent() { } +protected: + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + + // The implementation of Element::attributeChanged() calls the following two functions. + // They are separated to allow a different flow of control in StyledElement::attributeChanged(). + void recalcStyleIfNeededAfterAttributeChanged(Attribute*); + void updateAfterAttributeChanged(Attribute*); + private: + void scrollByUnits(int units, ScrollGranularity); + + virtual void setPrefix(const AtomicString&, ExceptionCode&); + virtual NodeType nodeType() const; + virtual bool childTypeAllowed(NodeType); + + virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); + +#ifndef NDEBUG + virtual void formatForDebugger(char* buffer, unsigned length) const; +#endif + + bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle); + virtual void createAttributeMap() const; - virtual void updateStyleAttribute() const {} + virtual void updateStyleAttribute() const { } #if ENABLE(SVG) - virtual void updateAnimatedSVGAttribute(const String&) const {} + virtual void updateAnimatedSVGAttribute(const String&) const { } #endif void updateFocusAppearanceSoonAfterAttach(); @@ -248,10 +251,10 @@ private: QualifiedName m_tagName; virtual NodeRareData* createRareData(); -protected: ElementRareData* rareData() const; ElementRareData* ensureRareData(); +protected: mutable RefPtr<NamedNodeMap> namedAttrMap; }; diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl index 53711e9..16aac84 100644 --- a/WebCore/dom/Element.idl +++ b/WebCore/dom/Element.idl @@ -21,6 +21,7 @@ module core { interface [ + CustomMarkFunction, GenerateConstructor, GenerateNativeConverter, InlineGetOwnPropertySlot, diff --git a/WebCore/dom/EntityReference.cpp b/WebCore/dom/EntityReference.cpp index 012605c..c4c292a 100644 --- a/WebCore/dom/EntityReference.cpp +++ b/WebCore/dom/EntityReference.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 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 @@ -23,12 +23,17 @@ namespace WebCore { -EntityReference::EntityReference(Document* document, const String& entityName) +inline EntityReference::EntityReference(Document* document, const String& entityName) : ContainerNode(document) , m_entityName(entityName) { } +PassRefPtr<EntityReference> EntityReference::create(Document* document, const String& entityName) +{ + return adoptRef(new EntityReference(document, entityName)); +} + String EntityReference::nodeName() const { return m_entityName; @@ -41,7 +46,7 @@ Node::NodeType EntityReference::nodeType() const PassRefPtr<Node> EntityReference::cloneNode(bool) { - return new EntityReference(document(), m_entityName); + return create(document(), m_entityName); } } // namespace diff --git a/WebCore/dom/EntityReference.h b/WebCore/dom/EntityReference.h index 4767a5e..7a6f6c3 100644 --- a/WebCore/dom/EntityReference.h +++ b/WebCore/dom/EntityReference.h @@ -28,13 +28,15 @@ namespace WebCore { class EntityReference : public ContainerNode { public: + static PassRefPtr<EntityReference> create(Document*, const String& entityName); + +private: EntityReference(Document*, const String& entityName); virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); -private: String m_entityName; }; diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h index d28b154..18c4240 100644 --- a/WebCore/dom/EventNames.h +++ b/WebCore/dom/EventNames.h @@ -73,6 +73,7 @@ namespace WebCore { macro(obsolete) \ macro(offline) \ macro(online) \ + macro(open) \ macro(overflowchanged) \ macro(paste) \ macro(readystatechange) \ diff --git a/WebCore/dom/EventTarget.cpp b/WebCore/dom/EventTarget.cpp index 7ba0584..2f13da8 100644 --- a/WebCore/dom/EventTarget.cpp +++ b/WebCore/dom/EventTarget.cpp @@ -44,6 +44,11 @@ EventTarget::~EventTarget() { } +EventSource* EventTarget::toEventSource() +{ + return 0; +} + Node* EventTarget::toNode() { return 0; @@ -106,6 +111,13 @@ SharedWorkerContext* EventTarget::toSharedWorkerContext() } #endif +#if ENABLE(NOTIFICATIONS) +Notification* EventTarget::toNotification() +{ + return 0; +} +#endif + #ifndef NDEBUG void forbidEventDispatch() { diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h index 2ededda..6d3cb7c 100644 --- a/WebCore/dom/EventTarget.h +++ b/WebCore/dom/EventTarget.h @@ -43,8 +43,10 @@ namespace WebCore { class DOMWindow; class Event; class EventListener; + class EventSource; class MessagePort; class Node; + class Notification; class SVGElementInstance; class ScriptExecutionContext; class SharedWorker; @@ -57,6 +59,7 @@ namespace WebCore { class EventTarget { public: + virtual EventSource* toEventSource(); virtual MessagePort* toMessagePort(); virtual Node* toNode(); virtual DOMWindow* toDOMWindow(); @@ -78,6 +81,10 @@ namespace WebCore { virtual SharedWorkerContext* toSharedWorkerContext(); #endif +#if ENABLE(NOTIFICATIONS) + virtual Notification* toNotification(); +#endif + virtual ScriptExecutionContext* scriptExecutionContext() const = 0; virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) = 0; diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 18655c6..819f908 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -337,8 +337,69 @@ Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2) return ch; } -Node::Node(Document* doc, bool isElement, bool isContainer, bool isText) - : m_document(doc) +inline bool Node::initialRefCount(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateElement: + case CreateOther: + case CreateText: + return 1; + case CreateElementZeroRefCount: + return 0; + } + ASSERT_NOT_REACHED(); + return 1; +} + +inline bool Node::isContainer(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateElement: + case CreateElementZeroRefCount: + return true; + case CreateOther: + case CreateText: + return false; + } + ASSERT_NOT_REACHED(); + return false; +} + +inline bool Node::isElement(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateOther: + case CreateText: + return false; + case CreateElement: + case CreateElementZeroRefCount: + return true; + } + ASSERT_NOT_REACHED(); + return false; +} + +inline bool Node::isText(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateElement: + case CreateElementZeroRefCount: + case CreateOther: + return false; + case CreateText: + return true; + } + ASSERT_NOT_REACHED(); + return false; +} + +Node::Node(Document* document, ConstructionType type) + : TreeShared<Node>(initialRefCount(type)) + , m_document(document) , m_previous(0) , m_next(0) , m_renderer(0) @@ -355,25 +416,27 @@ Node::Node(Document* doc, bool isElement, bool isContainer, bool isText) , m_inDetach(false) , m_inSubtreeMark(false) , m_hasRareData(false) - , m_isElement(isElement) - , m_isContainer(isContainer) - , m_isText(isText) + , m_isElement(isElement(type)) + , m_isContainer(isContainer(type)) + , m_isText(isText(type)) , m_parsingChildrenFinished(true) -#if ENABLE(SVG) - , m_areSVGAttributesValid(true) -#endif , m_isStyleAttributeValid(true) , m_synchronizingStyleAttribute(false) #if ENABLE(SVG) + , m_areSVGAttributesValid(true) , m_synchronizingSVGAttributes(false) #endif { + if (m_document) + m_document->selfOnlyRef(); + #ifndef NDEBUG if (shouldIgnoreLeaks) ignoreSet.add(this); else nodeCounter.increment(); #endif + #if DUMP_NODE_STATISTICS liveNodeSet.add(this); #endif @@ -416,6 +479,9 @@ Node::~Node() m_previous->setNextSibling(0); if (m_next) m_next->setPreviousSibling(0); + + if (m_document) + m_document->selfOnlyDeref(); } #ifdef NDEBUG @@ -450,14 +516,19 @@ void Node::setDocument(Document* document) if (inDocument() || m_document == document) return; + document->selfOnlyRef(); + setWillMoveToNewOwnerDocumentWasCalled(false); willMoveToNewOwnerDocument(); ASSERT(willMoveToNewOwnerDocumentWasCalled); #if USE(JSC) - updateDOMNodeDocument(this, m_document.get(), document); + updateDOMNodeDocument(this, m_document, document); #endif + if (m_document) + m_document->selfOnlyDeref(); + m_document = document; setDidMoveToNewOwnerDocumentWasCalled(false); @@ -1900,11 +1971,11 @@ void Node::appendTextContent(bool convertBRsToNewlines, StringBuilder& content) case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: - content.append(static_cast<const CharacterData*>(this)->CharacterData::nodeValue()); + content.append(static_cast<const CharacterData*>(this)->data()); break; case PROCESSING_INSTRUCTION_NODE: - content.append(static_cast<const ProcessingInstruction*>(this)->ProcessingInstruction::nodeValue()); + content.append(static_cast<const ProcessingInstruction*>(this)->data()); break; case ELEMENT_NODE: diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index f10e830..d1f58dc 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -25,7 +25,6 @@ #ifndef Node_h #define Node_h -#include "DocPtr.h" #include "EventTarget.h" #include "KURLHash.h" #include "PlatformString.h" @@ -108,7 +107,6 @@ public: enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force }; static StyleChange diff(const RenderStyle*, const RenderStyle*); - Node(Document*, bool isElement = false, bool isContainer = false, bool isText = false); virtual ~Node(); // DOM methods & attributes for Node @@ -316,7 +314,7 @@ public: { ASSERT(this); ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); - return m_document.get(); + return m_document; } void setDocument(Document*); @@ -673,14 +671,35 @@ public: using TreeShared<Node>::ref; using TreeShared<Node>::deref; - + +protected: + // CreateElementZeroRefCount is deprecated and can be removed once we convert all element + // classes to start with a reference count of 1. + enum ConstructionType { CreateContainer, CreateElement, CreateOther, CreateText, CreateElementZeroRefCount }; + Node(Document*, ConstructionType); + + virtual void willMoveToNewOwnerDocument(); + virtual void didMoveToNewOwnerDocument(); + + virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { } + void setTabIndexExplicitly(short); + + bool hasRareData() const { return m_hasRareData; } + + NodeRareData* rareData() const; + NodeRareData* ensureRareData(); + private: + static bool initialRefCount(ConstructionType); + static bool isContainer(ConstructionType); + static bool isElement(ConstructionType); + static bool isText(ConstructionType); + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } void removeAllEventListenersSlowCase(); -private: virtual NodeRareData* createRareData(); Node* containerChildNode(unsigned index) const; unsigned containerChildNodeCount() const; @@ -698,7 +717,7 @@ private: void appendTextContent(bool convertBRsToNewlines, StringBuilder&) const; - DocPtr<Document> m_document; + Document* m_document; Node* m_previous; Node* m_next; RenderObject* m_renderer; @@ -721,22 +740,16 @@ private: const bool m_isText : 1; protected: - // These bits are used by the Element derived class, pulled up here so they can + // These bits are used by derived classes, pulled up here so they can // be stored in the same memory word as the Node bits above. - bool m_parsingChildrenFinished : 1; -#if ENABLE(SVG) - mutable bool m_areSVGAttributesValid : 1; -#endif - // These bits are used by the StyledElement derived class, and live here for the - // same reason as above. - mutable bool m_isStyleAttributeValid : 1; - mutable bool m_synchronizingStyleAttribute : 1; + bool m_parsingChildrenFinished : 1; // Element + mutable bool m_isStyleAttributeValid : 1; // StyledElement + mutable bool m_synchronizingStyleAttribute : 1; // StyledElement #if ENABLE(SVG) - // This bit is used by the SVGElement derived class, and lives here for the same - // reason as above. - mutable bool m_synchronizingSVGAttributes : 1; + mutable bool m_areSVGAttributesValid : 1; // Element + mutable bool m_synchronizingSVGAttributes : 1; // SVGElement #endif // 11 bits remaining diff --git a/WebCore/dom/Notation.cpp b/WebCore/dom/Notation.cpp index 7081d98..cade384 100644 --- a/WebCore/dom/Notation.cpp +++ b/WebCore/dom/Notation.cpp @@ -1,8 +1,6 @@ -/** - * This file is part of the DOM implementation for KDE. - * +/* * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 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 @@ -19,17 +17,14 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ + #include "config.h" #include "Notation.h" namespace WebCore { -Notation::Notation(Document* doc) : ContainerNode(doc) -{ -} - -Notation::Notation(Document* doc, const String& name, const String& publicId, const String& systemId) - : ContainerNode(doc) +Notation::Notation(Document* document, const String& name, const String& publicId, const String& systemId) + : ContainerNode(document) , m_name(name) , m_publicId(publicId) , m_systemId(systemId) @@ -52,7 +47,6 @@ PassRefPtr<Node> Notation::cloneNode(bool /*deep*/) return 0; } -// DOM Section 1.1.1 bool Notation::childTypeAllowed(NodeType) { return false; diff --git a/WebCore/dom/Notation.h b/WebCore/dom/Notation.h index 2bd5363..547c9e7 100644 --- a/WebCore/dom/Notation.h +++ b/WebCore/dom/Notation.h @@ -1,8 +1,6 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 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 @@ -24,26 +22,25 @@ #ifndef Notation_h #define Notation_h -#include "CachedResourceClient.h" #include "ContainerNode.h" namespace WebCore { +// FIXME: This class is never instantiated. Maybe it should be removed. + class Notation : public ContainerNode { public: - Notation(Document*); - Notation(Document*, const String& name, const String& publicId, const String& systemId); + const String& publicId() const { return m_publicId; } + const String& systemId() const { return m_systemId; } - // DOM methods & attributes for Notation - String publicId() const { return m_publicId; } - String systemId() const { return m_systemId; } +private: + Notation(Document*, const String& name, const String& publicId, const String& systemId); virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); virtual bool childTypeAllowed(NodeType); -private: String m_name; String m_publicId; String m_systemId; diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp index 806bf92..8404481 100644 --- a/WebCore/dom/ProcessingInstruction.cpp +++ b/WebCore/dom/ProcessingInstruction.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 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 @@ -35,8 +35,10 @@ namespace WebCore { -ProcessingInstruction::ProcessingInstruction(Document* doc) - : ContainerNode(doc) +inline ProcessingInstruction::ProcessingInstruction(Document* document, const String& target, const String& data) + : ContainerNode(document) + , m_target(target) + , m_data(data) , m_cachedSheet(0) , m_loading(false) , m_alternate(false) @@ -46,17 +48,9 @@ ProcessingInstruction::ProcessingInstruction(Document* doc) { } -ProcessingInstruction::ProcessingInstruction(Document* doc, const String& target, const String& data) - : ContainerNode(doc) - , m_target(target) - , m_data(data) - , m_cachedSheet(0) - , m_loading(false) - , m_alternate(false) -#if ENABLE(XSLT) - , m_isXSL(false) -#endif +PassRefPtr<ProcessingInstruction> ProcessingInstruction::create(Document* document, const String& target, const String& data) { + return adoptRef(new ProcessingInstruction(document, target, data)); } ProcessingInstruction::~ProcessingInstruction() @@ -95,8 +89,9 @@ void ProcessingInstruction::setNodeValue(const String& nodeValue, ExceptionCode& PassRefPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/) { - // ### copy m_localHref - return new ProcessingInstruction(document(), m_target, m_data); + // FIXME: Is it a problem that this does not copy m_localHref? + // What about other data members? + return create(document(), m_target, m_data); } // DOM Section 1.1.1 diff --git a/WebCore/dom/ProcessingInstruction.h b/WebCore/dom/ProcessingInstruction.h index d133019..4b7dc86 100644 --- a/WebCore/dom/ProcessingInstruction.h +++ b/WebCore/dom/ProcessingInstruction.h @@ -1,8 +1,6 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006 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 @@ -35,15 +33,28 @@ class CSSStyleSheet; class ProcessingInstruction : public ContainerNode, private CachedResourceClient { public: - ProcessingInstruction(Document*); - ProcessingInstruction(Document*, const String& target, const String& data); + static PassRefPtr<ProcessingInstruction> create(Document*, const String& target, const String& data); virtual ~ProcessingInstruction(); - // DOM methods & attributes for Notation - String target() const { return m_target; } - String data() const { return m_data; } + const String& target() const { return m_target; } + const String& data() const { return m_data; } void setData(const String&, ExceptionCode&); + void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; } + + virtual void finishParsingChildren(); + + const String& localHref() const { return m_localHref; } + StyleSheet* sheet() const { return m_sheet.get(); } + void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>); + +#if ENABLE(XSLT) + bool isXSL() const { return m_isXSL; } +#endif + +private: + ProcessingInstruction(Document*, const String& target, const String& data); + virtual String nodeName() const; virtual NodeType nodeType() const; virtual String nodeValue() const; @@ -55,28 +66,18 @@ public: virtual void insertedIntoDocument(); virtual void removedFromDocument(); - void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; } - virtual void finishParsingChildren(); - // Other methods (not part of DOM) - String localHref() const { return m_localHref; } - StyleSheet* sheet() const { return m_sheet.get(); } void checkStyleSheet(); virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); #if ENABLE(XSLT) virtual void setXSLStyleSheet(const String& url, const String& sheet); #endif - void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>); + bool isLoading() const; virtual bool sheetLoaded(); -#if ENABLE(XSLT) - bool isXSL() const { return m_isXSL; } -#endif - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; -private: void parseStyleSheet(const String& sheet); String m_target; diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp index edee305..b9a531c 100644 --- a/WebCore/dom/Range.cpp +++ b/WebCore/dom/Range.cpp @@ -586,7 +586,7 @@ PassRefPtr<DocumentFragment> Range::processContents(ActionType action, Exception RefPtr<DocumentFragment> fragment; if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) - fragment = new DocumentFragment(m_ownerDocument.get()); + fragment = DocumentFragment::create(m_ownerDocument.get()); ec = 0; if (collapsed(ec)) diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp index 456cc52..13c23fb 100644 --- a/WebCore/dom/StyledElement.cpp +++ b/WebCore/dom/StyledElement.cpp @@ -280,14 +280,6 @@ CSSStyleDeclaration* StyledElement::style() return getInlineStyleDecl(); } -static inline int toHex(UChar c) -{ - return ((c >= '0' && c <= '9') ? (c - '0') - : ((c >= 'a' && c <= 'f') ? (c - 'a' + 10) - : ((c >= 'A' && c <= 'F') ? (c - 'A' + 10) - : -1))); -} - void StyledElement::addCSSProperty(MappedAttribute* attr, int id, const String &value) { if (!attr->decl()) createMappedDecl(attr); @@ -393,10 +385,9 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c) // search forward for digits in the string int numDigits = 0; while (pos < (int)color.length() && numDigits < basicLength) { - int hex = toHex(color[pos]); - colors[component] = (colors[component] << 4); - if (hex > 0) { - colors[component] += hex; + colors[component] <<= 4; + if (isASCIIHexDigit(color[pos])) { + colors[component] += toASCIIHexValue(color[pos]); maxDigit = min(maxDigit, numDigits); } numDigits++; @@ -410,10 +401,9 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c) // normalize to 00-ff. The highest filled digit counts, minimum is 2 digits maxDigit -= 2; - colors[0] >>= 4*maxDigit; - colors[1] >>= 4*maxDigit; - colors[2] >>= 4*maxDigit; - // ASSERT(colors[0] < 0x100 && colors[1] < 0x100 && colors[2] < 0x100); + colors[0] >>= 4 * maxDigit; + colors[1] >>= 4 * maxDigit; + colors[2] >>= 4 * maxDigit; color = String::format("#%02x%02x%02x", colors[0], colors[1], colors[2]); if (attr->decl()->setProperty(id, color, false)) diff --git a/WebCore/dom/Text.cpp b/WebCore/dom/Text.cpp index bbd926b..00db1c1 100644 --- a/WebCore/dom/Text.cpp +++ b/WebCore/dom/Text.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -37,22 +37,18 @@ #include "WMLVariables.h" #endif -namespace WebCore { - -// DOM Section 1.1.1 +using namespace std; -Text::Text(Document* document, const String& text) - : CharacterData(document, text, true) -{ -} +namespace WebCore { -Text::Text(Document* document) - : CharacterData(document, true) +Text::Text(Document* document, const String& data) + : CharacterData(document, data, CreateText) { } -Text::~Text() +PassRefPtr<Text> Text::create(Document* document, const String& data) { + return adoptRef(new Text(document, data)); } PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) @@ -61,14 +57,14 @@ PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) // INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than // the number of 16-bit units in data. - if (offset > m_data->length()) { + if (offset > length()) { ec = INDEX_SIZE_ERR; return 0; } - RefPtr<StringImpl> oldStr = m_data; - RefPtr<Text> newText = createNew(oldStr->substring(offset)); - m_data = oldStr->substring(0, offset); + RefPtr<StringImpl> oldStr = dataImpl(); + RefPtr<Text> newText = virtualCreate(oldStr->substring(offset)); + setDataImpl(oldStr->substring(0, offset)); dispatchModifiedEvent(oldStr.get()); @@ -81,7 +77,7 @@ PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) document()->textNodeSplit(this); if (renderer()) - toRenderText(renderer())->setText(m_data); + toRenderText(renderer())->setText(dataImpl()); return newText.release(); } @@ -199,7 +195,7 @@ Node::NodeType Text::nodeType() const PassRefPtr<Node> Text::cloneNode(bool /*deep*/) { - return document()->createTextNode(m_data); + return create(document(), data()); } bool Text::rendererIsNeeded(RenderStyle *style) @@ -244,7 +240,7 @@ bool Text::rendererIsNeeded(RenderStyle *style) return true; } -RenderObject *Text::createRenderer(RenderArena* arena, RenderStyle*) +RenderObject* Text::createRenderer(RenderArena* arena, RenderStyle*) { #if ENABLE(SVG) if (parentNode()->isSVGElement() @@ -252,17 +248,17 @@ RenderObject *Text::createRenderer(RenderArena* arena, RenderStyle*) && !parentNode()->hasTagName(SVGNames::foreignObjectTag) #endif ) - return new (arena) RenderSVGInlineText(this, m_data); + return new (arena) RenderSVGInlineText(this, dataImpl()); #endif - return new (arena) RenderText(this, m_data); + return new (arena) RenderText(this, dataImpl()); } void Text::attach() { #if ENABLE(WML) if (document()->isWMLDocument() && !containsOnlyWhitespace()) { - String text = m_data; + String text = data(); ASSERT(!text.isEmpty()); text = substituteVariableReferences(text, document()); @@ -286,7 +282,7 @@ void Text::recalcStyle(StyleChange change) if (needsStyleRecalc()) { if (renderer()) { if (renderer()->isText()) - toRenderText(renderer())->setText(m_data); + toRenderText(renderer())->setText(dataImpl()); } else { if (attached()) detach(); @@ -296,40 +292,42 @@ void Text::recalcStyle(StyleChange change) setNeedsStyleRecalc(NoStyleChange); } -// DOM Section 1.1.1 bool Text::childTypeAllowed(NodeType) { return false; } -PassRefPtr<Text> Text::createNew(PassRefPtr<StringImpl> string) +PassRefPtr<Text> Text::virtualCreate(const String& data) { - return new Text(document(), string); + return create(document(), data); } -PassRefPtr<Text> Text::createWithLengthLimit(Document* doc, const String& text, unsigned& charsLeft, unsigned maxChars) +PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& data, unsigned& charsLeft, unsigned maxChars) { - if (charsLeft == text.length() && charsLeft <= maxChars) { + unsigned dataLength = data.length(); + + if (charsLeft == dataLength && charsLeft <= maxChars) { charsLeft = 0; - return new Text(doc, text); + return create(document, data); } + + unsigned start = dataLength - charsLeft; + unsigned end = start + min(charsLeft, maxChars); - unsigned start = text.length() - charsLeft; - unsigned end = start + std::min(charsLeft, maxChars); - - // check we are not on an unbreakable boundary - TextBreakIterator* it = characterBreakIterator(text.characters(), text.length()); - if (end < text.length() && !isTextBreak(it, end)) + // Check we are not on an unbreakable boundary. + TextBreakIterator* it = characterBreakIterator(data.characters(), dataLength); + if (end < dataLength && !isTextBreak(it, end)) end = textBreakPreceding(it, end); - // maxChars of unbreakable characters could lead to infinite loop + // If we have maxChars of unbreakable characters the above could lead to + // an infinite loop. + // FIXME: It would be better to just have the old value of end before calling + // textBreakPreceding rather than this, because this exceeds the length limit. if (end <= start) - end = text.length(); + end = dataLength; - String nodeText = text.substring(start, end - start); - charsLeft = text.length() - end; - - return new Text(doc, nodeText); + charsLeft = dataLength - end; + return create(document, data.substring(start, end - start)); } #ifndef NDEBUG @@ -343,7 +341,7 @@ void Text::formatForDebugger(char *buffer, unsigned length) const result += s; } - s = nodeValue(); + s = data(); if (s.length() > 0) { if (result.length() > 0) result += "; "; diff --git a/WebCore/dom/Text.h b/WebCore/dom/Text.h index e5a6e69..4722736 100644 --- a/WebCore/dom/Text.h +++ b/WebCore/dom/Text.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -27,44 +27,39 @@ namespace WebCore { -const unsigned cTextNodeLengthLimit = 1 << 16; - class Text : public CharacterData { public: - Text(Document *impl, const String &_text); - Text(Document *impl); - virtual ~Text(); + static const unsigned defaultLengthLimit = 1 << 16; - // DOM methods & attributes for CharacterData + static PassRefPtr<Text> create(Document*, const String&); + static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned& charsLeft, unsigned lengthLimit = defaultLengthLimit); PassRefPtr<Text> splitText(unsigned offset, ExceptionCode&); // DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772 + String wholeText() const; PassRefPtr<Text> replaceWholeText(const String&, ExceptionCode&); - // DOM methods overridden from parent classes + virtual void attach(); + +protected: + Text(Document*, const String&); +private: virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); - - // Other methods (not part of DOM) - - virtual void attach(); virtual bool rendererIsNeeded(RenderStyle*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void recalcStyle(StyleChange = NoChange); virtual bool childTypeAllowed(NodeType); - static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned& charsLeft, unsigned maxChars = cTextNodeLengthLimit); + virtual PassRefPtr<Text> virtualCreate(const String&); #ifndef NDEBUG virtual void formatForDebugger(char* buffer, unsigned length) const; #endif - -protected: - virtual PassRefPtr<Text> createNew(PassRefPtr<StringImpl>); }; } // namespace WebCore diff --git a/WebCore/dom/XMLTokenizer.cpp b/WebCore/dom/XMLTokenizer.cpp index 1747c3c..4d06343 100644 --- a/WebCore/dom/XMLTokenizer.cpp +++ b/WebCore/dom/XMLTokenizer.cpp @@ -136,7 +136,7 @@ bool XMLTokenizer::enterText() #if !USE(QXMLSTREAM) ASSERT(m_bufferedText.size() == 0); #endif - RefPtr<Node> newNode = new Text(m_doc, ""); + RefPtr<Node> newNode = Text::create(m_doc, ""); if (!m_currentNode->addChild(newNode.get())) return false; setCurrentNode(newNode.get()); diff --git a/WebCore/dom/XMLTokenizerLibxml2.cpp b/WebCore/dom/XMLTokenizerLibxml2.cpp index 4387a66..da2f9b6 100644 --- a/WebCore/dom/XMLTokenizerLibxml2.cpp +++ b/WebCore/dom/XMLTokenizerLibxml2.cpp @@ -951,7 +951,7 @@ void XMLTokenizer::cdataBlock(const xmlChar* s, int len) exitText(); - RefPtr<Node> newNode = new CDATASection(m_doc, toString(s, len)); + RefPtr<Node> newNode = CDATASection::create(m_doc, toString(s, len)); if (!m_currentNode->addChild(newNode.get())) return; if (m_view && !newNode->attached()) @@ -970,7 +970,7 @@ void XMLTokenizer::comment(const xmlChar* s) exitText(); - RefPtr<Node> newNode = new Comment(m_doc, toString(s)); + RefPtr<Node> newNode = Comment::create(m_doc, toString(s)); m_currentNode->addChild(newNode.get()); if (m_view && !newNode->attached()) newNode->attach(); diff --git a/WebCore/dom/XMLTokenizerQt.cpp b/WebCore/dom/XMLTokenizerQt.cpp index 16c637f..799eef3 100644 --- a/WebCore/dom/XMLTokenizerQt.cpp +++ b/WebCore/dom/XMLTokenizerQt.cpp @@ -692,7 +692,7 @@ void XMLTokenizer::parseCdata() { exitText(); - RefPtr<Node> newNode = new CDATASection(m_doc, m_stream.text()); + RefPtr<Node> newNode = CDATASection::create(m_doc, m_stream.text()); if (!m_currentNode->addChild(newNode.get())) return; if (m_view && !newNode->attached()) @@ -703,7 +703,7 @@ void XMLTokenizer::parseComment() { exitText(); - RefPtr<Node> newNode = new Comment(m_doc, m_stream.text()); + RefPtr<Node> newNode = Comment::create(m_doc, m_stream.text()); m_currentNode->addChild(newNode.get()); if (m_view && !newNode->attached()) newNode->attach(); diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl index e6d59a0..4e6eb38 100755 --- a/WebCore/dom/make_names.pl +++ b/WebCore/dom/make_names.pl @@ -48,28 +48,30 @@ my %parameters = (); my $extraDefines = 0; my $preprocessor = "/usr/bin/gcc -E -P -x c++"; -GetOptions('tags=s' => \$tagsFile, +GetOptions( + 'tags=s' => \$tagsFile, 'attrs=s' => \$attrsFile, 'factory' => \$printFactory, 'outputDir=s' => \$outputDir, 'extraDefines=s' => \$extraDefines, 'preprocessor=s' => \$preprocessor, - 'wrapperFactory' => \$printWrapperFactory); + 'wrapperFactory' => \$printWrapperFactory +); die "You must specify at least one of --tags <file> or --attrs <file>" unless (length($tagsFile) || length($attrsFile)); readNames($tagsFile, "tags") if length($tagsFile); readNames($attrsFile, "attrs") if length($attrsFile); -die "You must specify a namespace (e.g. SVG) for <namespace>Names.h" unless $parameters{'namespace'}; -die "You must specify a namespaceURI (e.g. http://www.w3.org/2000/svg)" unless $parameters{'namespaceURI'}; +die "You must specify a namespace (e.g. SVG) for <namespace>Names.h" unless $parameters{namespace}; +die "You must specify a namespaceURI (e.g. http://www.w3.org/2000/svg)" unless $parameters{namespaceURI}; -$parameters{'namespacePrefix'} = $parameters{'namespace'} unless $parameters{'namespacePrefix'}; +$parameters{namespacePrefix} = $parameters{namespace} unless $parameters{namespacePrefix}; mkpath($outputDir); -my $namesBasePath = "$outputDir/$parameters{'namespace'}Names"; -my $factoryBasePath = "$outputDir/$parameters{'namespace'}ElementFactory"; -my $wrapperFactoryBasePath = "$outputDir/JS$parameters{'namespace'}ElementWrapperFactory"; +my $namesBasePath = "$outputDir/$parameters{namespace}Names"; +my $factoryBasePath = "$outputDir/$parameters{namespace}ElementFactory"; +my $wrapperFactoryBasePath = "$outputDir/JS$parameters{namespace}ElementWrapperFactory"; printNamesHeaderFile("$namesBasePath.h"); printNamesCppFile("$namesBasePath.cpp"); @@ -86,39 +88,44 @@ if ($printWrapperFactory) { ### Hash initialization -sub initializeTagPropertyHash +sub defaultTagPropertyHash { - return ('constructorNeedsCreatedByParser' => 0, - 'constructorNeedsFormElement' => 0, - 'exportString' => 0, - 'interfaceName' => defaultInterfaceName($_[0]), - # By default, the JSInterfaceName is the same as the interfaceName. - 'JSInterfaceName' => defaultInterfaceName($_[0]), - 'mapToTagName' => '', - 'wrapperOnlyIfMediaIsAvailable' => 0, - 'conditional' => 0); + return ( + 'constructorNeedsCreatedByParser' => 0, + 'constructorNeedsFormElement' => 0, + 'createWithNew' => 1, + 'exportString' => 0, + 'interfaceName' => defaultInterfaceName($_[0]), + # By default, the JSInterfaceName is the same as the interfaceName. + 'JSInterfaceName' => defaultInterfaceName($_[0]), + 'mapToTagName' => '', + 'wrapperOnlyIfMediaIsAvailable' => 0, + 'conditional' => 0 + ); } -sub initializeAttrPropertyHash +sub defaultAttrPropertyHash { return ('exportString' => 0); } -sub initializeParametersHash +sub defaultParametersHash { - return ('namespace' => '', - 'namespacePrefix' => '', - 'namespaceURI' => '', - 'guardFactoryWith' => '', - 'tagsNullNamespace' => 0, - 'attrsNullNamespace' => 0, - 'exportStrings' => 0); + return ( + 'namespace' => '', + 'namespacePrefix' => '', + 'namespaceURI' => '', + 'guardFactoryWith' => '', + 'tagsNullNamespace' => 0, + 'attrsNullNamespace' => 0, + 'exportStrings' => 0 + ); } sub defaultInterfaceName { - die "No namespace found" if !$parameters{'namespace'}; - return $parameters{'namespace'} . upperCaseName($_[0]) . "Element" + die "No namespace found" if !$parameters{namespace}; + return $parameters{namespace} . upperCaseName($_[0]) . "Element" } ### Parsing handlers @@ -129,16 +136,16 @@ sub tagsHandler $tag =~ s/-/_/g; - # Initialize default properties' values. - $tags{$tag} = { initializeTagPropertyHash($tag) } if !defined($tags{$tag}); + # Initialize default property values. + $tags{$tag} = { defaultTagPropertyHash($tag) } if !defined($tags{$tag}); if ($property) { die "Unknown property $property for tag $tag\n" if !defined($tags{$tag}{$property}); - # The code rely on JSInterfaceName deriving from interfaceName to check for custom JSInterfaceName. - # So just override JSInterfaceName if it was not already set. - if ($property eq "interfaceName" && $tags{$tag}{'JSInterfaceName'} eq $tags{$tag}{'interfaceName'}) { - $tags{$tag}{'JSInterfaceName'} = $value; - } + + # The code relies on JSInterfaceName deriving from interfaceName to check for custom JSInterfaceName. + # So override JSInterfaceName if it was not already set. + $tags{$tag}{JSInterfaceName} = $value if $property eq "interfaceName" && $tags{$tag}{JSInterfaceName} eq $tags{$tag}{interfaceName}; + $tags{$tag}{$property} = $value; } } @@ -150,7 +157,7 @@ sub attrsHandler $attr =~ s/-/_/g; # Initialize default properties' values. - $attrs{$attr} = { initializeAttrPropertyHash($attr) } if !defined($attrs{$attr}); + $attrs{$attr} = { defaultAttrPropertyHash($attr) } if !defined($attrs{$attr}); if ($property) { die "Unknown property $property for attribute $attr\n" if !defined($attrs{$attr}{$property}); @@ -163,7 +170,7 @@ sub parametersHandler my ($parameter, $value) = @_; # Initialize default properties' values. - %parameters = initializeParametersHash() if !(keys %parameters); + %parameters = defaultParametersHash() if !(keys %parameters); die "Unknown parameter $parameter for tags/attrs\n" if !defined($parameters{$parameter}); $parameters{$parameter} = $value; @@ -214,7 +221,7 @@ sub printMacros for my $name (sort keys %$namesRef) { print F "$macro $name","$suffix;\n"; - if ($parameters{'exportStrings'} or $names{$name}{"exportString"}) { + if ($parameters{exportStrings} or $names{$name}{exportString}) { print F "extern char $name", "${suffix}String[];\n"; } } @@ -223,7 +230,7 @@ sub printMacros sub usesDefaultWrapper { my $tagName = shift; - return $tagName eq $parameters{'namespace'} . "Element"; + return $tagName eq $parameters{namespace} . "Element"; } # Build a direct mapping from the tags to the Element to create, excluding @@ -232,16 +239,16 @@ sub buildConstructorMap { my %tagConstructorMap = (); for my $tagName (keys %tags) { - my $interfaceName = $tags{$tagName}{'interfaceName'}; + my $interfaceName = $tags{$tagName}{interfaceName}; next if (usesDefaultWrapper($interfaceName)); - if ($tags{$tagName}{'mapToTagName'}) { - die "Cannot handle multiple mapToTagName for $tagName\n" if $tags{$tags{$tagName}{'mapToTagName'}}{'mapToTagName'}; - $interfaceName = $tags{ $tags{$tagName}{'mapToTagName'} }{'interfaceName'}; + if ($tags{$tagName}{mapToTagName}) { + die "Cannot handle multiple mapToTagName for $tagName\n" if $tags{$tags{$tagName}{mapToTagName}}{mapToTagName}; + $interfaceName = $tags{ $tags{$tagName}{mapToTagName} }{interfaceName}; } # Chop the string to keep the interesting part. - $interfaceName =~ s/$parameters{'namespace'}(.*)Element/$1/; + $interfaceName =~ s/$parameters{namespace}(.*)Element/$1/; $tagConstructorMap{$tagName} = lc($interfaceName); } @@ -254,17 +261,13 @@ sub printConstructorSignature { my ($F, $tagName, $constructorName, $constructorTagName) = @_; - print F "static PassRefPtr<$parameters{'namespace'}Element> ${constructorName}Constructor(const QualifiedName& $constructorTagName, Document* doc"; - if ($parameters{'namespace'} eq "HTML") { + print F "static PassRefPtr<$parameters{namespace}Element> ${constructorName}Constructor(const QualifiedName& $constructorTagName, Document* document"; + if ($parameters{namespace} eq "HTML") { print F ", HTMLFormElement*"; - if ($tags{$tagName}{'constructorNeedsFormElement'}) { - print F " formElement"; - } + print F " formElement" if $tags{$tagName}{constructorNeedsFormElement}; } print F ", bool"; - if ($tags{$tagName}{'constructorNeedsCreatedByParser'}) { - print F " createdByParser"; - } + print F " createdByParser" if $tags{$tagName}{constructorNeedsCreatedByParser}; print F ")\n{\n"; } @@ -276,22 +279,26 @@ sub printConstructorInterior my ($F, $tagName, $interfaceName, $constructorTagName) = @_; # Handle media elements. - if ($tags{$tagName}{'wrapperOnlyIfMediaIsAvailable'}) { + if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { print F <<END if (!MediaPlayer::isAvailable()) - return new HTMLElement($constructorTagName, doc); + return new HTMLElement($constructorTagName, document); END ; } - # Now call the constructor with the right parameters. - print F " return new ${interfaceName}($constructorTagName, doc"; - if ($tags{$tagName}{'constructorNeedsFormElement'}) { - print F ", formElement"; - } - if ($tags{$tagName}{'constructorNeedsCreatedByParser'}) { - print F ", createdByParser"; + my $newPrefix = ""; + my $createSuffix = "::create"; + + if ($tags{$tagName}{createWithNew}) { + $newPrefix = "new "; + $createSuffix = ""; } + + # Call the constructor with the right parameters. + print F " return $newPrefix$interfaceName${createSuffix}($constructorTagName, document"; + print F ", formElement" if $tags{$tagName}{constructorNeedsFormElement}; + print F ", createdByParser" if $tags{$tagName}{constructorNeedsCreatedByParser}; print F ");\n}\n\n"; } @@ -300,20 +307,20 @@ sub printConstructors my ($F, $tagConstructorMapRef) = @_; my %tagConstructorMap = %$tagConstructorMapRef; - print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; + print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; # This is to avoid generating the same constructor several times. my %uniqueTags = (); for my $tagName (sort keys %tagConstructorMap) { - my $interfaceName = $tags{$tagName}{'interfaceName'}; + my $interfaceName = $tags{$tagName}{interfaceName}; # Ignore the mapped tag # FIXME: It could be moved inside this loop but was split for readibility. - next if (defined($uniqueTags{$interfaceName}) || $tags{$tagName}{'mapToTagName'}); + next if (defined($uniqueTags{$interfaceName}) || $tags{$tagName}{mapToTagName}); $uniqueTags{$interfaceName} = '1'; - my $conditional = $tags{$tagName}{"conditional"}; + my $conditional = $tags{$tagName}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n\n"; @@ -323,20 +330,20 @@ sub printConstructors printConstructorInterior($F, $tagName, $interfaceName, "tagName"); if ($conditional) { - print F "#endif\n\n"; + print F "#endif\n"; } } # Mapped tag name uses a special wrapper to keep their prefix and namespaceURI while using the mapped localname. for my $tagName (sort keys %tagConstructorMap) { - if ($tags{$tagName}{'mapToTagName'}) { - my $mappedName = $tags{$tagName}{'mapToTagName'}; + if ($tags{$tagName}{mapToTagName}) { + my $mappedName = $tags{$tagName}{mapToTagName}; printConstructorSignature($F, $mappedName, $mappedName . "To" . $tagName, "tagName"); - printConstructorInterior($F, $mappedName, $tags{$mappedName}{'interfaceName'}, "QualifiedName(tagName.prefix(), ${mappedName}Tag.localName(), tagName.namespaceURI())"); + printConstructorInterior($F, $mappedName, $tags{$mappedName}{interfaceName}, "QualifiedName(tagName.prefix(), ${mappedName}Tag.localName(), tagName.namespaceURI())"); } } - print F "#endif\n" if $parameters{'guardFactoryWith'}; + print F "#endif\n" if $parameters{guardFactoryWith}; } sub printFunctionInits @@ -346,14 +353,14 @@ sub printFunctionInits for my $tagName (sort keys %tagConstructorMap) { - my $conditional = $tags{$tagName}{"conditional"}; + my $conditional = $tags{$tagName}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n"; } - if ($tags{$tagName}{'mapToTagName'}) { - print F " addTag(${tagName}Tag, $tags{$tagName}{'mapToTagName'}To${tagName}Constructor);\n"; + if ($tags{$tagName}{mapToTagName}) { + print F " addTag(${tagName}Tag, $tags{$tagName}{mapToTagName}To${tagName}Constructor);\n"; } else { print F " addTag(${tagName}Tag, $tagConstructorMap{$tagName}Constructor);\n"; } @@ -368,9 +375,7 @@ sub svgCapitalizationHacks { my $name = shift; - if ($name =~ /^fe(.+)$/) { - $name = "FE" . ucfirst $1; - } + $name = "FE" . ucfirst $1 if $name =~ /^fe(.+)$/; return $name; } @@ -379,7 +384,7 @@ sub upperCaseName { my $name = shift; - $name = svgCapitalizationHacks($name) if ($parameters{'namespace'} eq "SVG"); + $name = svgCapitalizationHacks($name) if ($parameters{namespace} eq "SVG"); while ($name =~ /^(.*?)_(.*)/) { $name = $1 . ucfirst $2; @@ -392,10 +397,11 @@ sub printLicenseHeader { my $F = shift; print F "/* - * THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT. + * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. * + * This file was generated by the dom/make_names.pl script. * - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -416,10 +422,9 @@ sub printLicenseHeader * 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. */ - "; } @@ -428,16 +433,16 @@ sub printNamesHeaderFile my ($headerPath) = shift; my $F; open F, ">$headerPath"; - + printLicenseHeader($F); - print F "#ifndef DOM_$parameters{'namespace'}NAMES_H\n"; - print F "#define DOM_$parameters{'namespace'}NAMES_H\n\n"; + print F "#ifndef DOM_$parameters{namespace}NAMES_H\n"; + print F "#define DOM_$parameters{namespace}NAMES_H\n\n"; print F "#include \"QualifiedName.h\"\n\n"; - - print F "namespace WebCore {\n\n namespace $parameters{'namespace'}Names {\n\n"; - - my $lowerNamespace = lc($parameters{'namespacePrefix'}); - print F "#ifndef DOM_$parameters{'namespace'}NAMES_HIDE_GLOBALS\n"; + + print F "namespace WebCore {\n\n namespace $parameters{namespace}Names {\n\n"; + + my $lowerNamespace = lc($parameters{namespacePrefix}); + print F "#ifndef DOM_$parameters{namespace}NAMES_HIDE_GLOBALS\n"; print F "// Namespace\n"; print F "extern const WebCore::AtomicString ${lowerNamespace}NamespaceURI;\n\n"; @@ -451,19 +456,19 @@ sub printNamesHeaderFile printMacros($F, "extern const WebCore::QualifiedName", "Attr", \%attrs); } print F "#endif\n\n"; - + if (keys %tags) { - print F "WebCore::QualifiedName** get$parameters{'namespace'}Tags(size_t* size);\n"; + print F "WebCore::QualifiedName** get$parameters{namespace}Tags(size_t* size);\n"; } if (keys %attrs) { - print F "WebCore::QualifiedName** get$parameters{'namespace'}Attrs(size_t* size);\n"; + print F "WebCore::QualifiedName** get$parameters{namespace}Attrs(size_t* size);\n"; } - + print F "\nvoid init();\n\n"; print F "} }\n\n"; print F "#endif\n\n"; - + close F; } @@ -475,25 +480,25 @@ sub printNamesCppFile printLicenseHeader($F); - my $lowerNamespace = lc($parameters{'namespacePrefix'}); + my $lowerNamespace = lc($parameters{namespacePrefix}); print F "#include \"config.h\"\n"; print F "#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC\n"; -print F "#define DOM_$parameters{'namespace'}NAMES_HIDE_GLOBALS 1\n"; +print F "#define DOM_$parameters{namespace}NAMES_HIDE_GLOBALS 1\n"; print F "#else\n"; print F "#define QNAME_DEFAULT_CONSTRUCTOR 1\n"; print F "#endif\n\n"; -print F "#include \"$parameters{'namespace'}Names.h\"\n\n"; +print F "#include \"$parameters{namespace}Names.h\"\n\n"; print F "#include \"StaticConstructors.h\"\n"; -print F "namespace WebCore {\n\n namespace $parameters{'namespace'}Names { +print F "namespace WebCore {\n\n namespace $parameters{namespace}Names { using namespace WebCore; -DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{'namespaceURI'}\") +DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{namespaceURI}\") "; if (keys %tags) { @@ -502,14 +507,14 @@ DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{'namesp print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Tag, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI);\n"; } - print F "\n\nWebCore::QualifiedName** get$parameters{'namespace'}Tags(size_t* size)\n"; - print F "{\n static WebCore::QualifiedName* $parameters{'namespace'}Tags[] = {\n"; + print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Tags(size_t* size)\n"; + print F "{\n static WebCore::QualifiedName* $parameters{namespace}Tags[] = {\n"; for my $name (sort keys %tags) { print F " (WebCore::QualifiedName*)&${name}Tag,\n"; } print F " };\n"; print F " *size = ", scalar(keys %tags), ";\n"; - print F " return $parameters{'namespace'}Tags;\n"; + print F " return $parameters{namespace}Tags;\n"; print F "}\n"; } @@ -518,14 +523,14 @@ DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{'namesp for my $name (sort keys %attrs) { print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Attr, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI);\n"; } - print F "\n\nWebCore::QualifiedName** get$parameters{'namespace'}Attrs(size_t* size)\n"; - print F "{\n static WebCore::QualifiedName* $parameters{'namespace'}Attr[] = {\n"; + print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Attrs(size_t* size)\n"; + print F "{\n static WebCore::QualifiedName* $parameters{namespace}Attr[] = {\n"; for my $name (sort keys %attrs) { print F " (WebCore::QualifiedName*)&${name}Attr,\n"; } print F " };\n"; print F " *size = ", scalar(keys %attrs), ";\n"; - print F " return $parameters{'namespace'}Attr;\n"; + print F " return $parameters{namespace}Attr;\n"; print F "}\n"; } @@ -549,16 +554,16 @@ print F "\nvoid init() AtomicString::init(); "; - print(F " AtomicString ${lowerNamespace}NS(\"$parameters{'namespaceURI'}\");\n\n"); + print(F " AtomicString ${lowerNamespace}NS(\"$parameters{namespaceURI}\");\n\n"); print(F " // Namespace\n"); print(F " new ((void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n\n"); if (keys %tags) { - my $tagsNamespace = $parameters{'tagsNullNamespace'} ? "nullAtom" : "${lowerNamespace}NS"; + my $tagsNamespace = $parameters{tagsNullNamespace} ? "nullAtom" : "${lowerNamespace}NS"; printDefinitions($F, \%tags, "tags", $tagsNamespace); } if (keys %attrs) { - my $attrsNamespace = $parameters{'attrsNullNamespace'} ? "nullAtom" : "${lowerNamespace}NS"; + my $attrsNamespace = $parameters{attrsNullNamespace} ? "nullAtom" : "${lowerNamespace}NS"; printDefinitions($F, \%attrs, "attributes", $attrsNamespace); } @@ -572,7 +577,7 @@ sub printJSElementIncludes my %tagsSeen; for my $tagName (sort keys %tags) { - my $JSInterfaceName = $tags{$tagName}{"JSInterfaceName"}; + my $JSInterfaceName = $tags{$tagName}{JSInterfaceName}; next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($tagName); $tagsSeen{$JSInterfaceName} = 1; @@ -586,7 +591,7 @@ sub printElementIncludes my %tagsSeen; for my $tagName (sort keys %tags) { - my $interfaceName = $tags{$tagName}{"interfaceName"}; + my $interfaceName = $tags{$tagName}{interfaceName}; next if defined($tagsSeen{$interfaceName}); $tagsSeen{$interfaceName} = 1; @@ -604,7 +609,7 @@ sub printDefinitionStrings my %names = %$namesRef; for my $name (sort keys %$namesRef) { - next if (!$parameters{'exportStrings'} and !$names{$name}{"exportString"}); + next if (!$parameters{exportStrings} and !$names{$name}{exportString}); my $realName = $name; $realName =~ s/_/-/g; @@ -625,7 +630,7 @@ sub printDefinitions my %names = %$namesRef; for my $name (sort keys %$namesRef) { - next if ($parameters{'exportStrings'} or $names{$name}{"exportString"}); + next if ($parameters{exportStrings} or $names{$name}{exportString}); my $realName = $name; $realName =~ s/_/-/g; @@ -651,39 +656,31 @@ printLicenseHeader($F); print F <<END #include "config.h" -#include "$parameters{'namespace'}ElementFactory.h" - -#include "$parameters{'namespace'}Names.h" -#if ENABLE(DASHBOARD_SUPPORT) -#include "Document.h" -#include "Settings.h" -#endif +#include "$parameters{namespace}ElementFactory.h" +#include "$parameters{namespace}Names.h" END ; -if ($parameters{'namespace'} eq "HTML") { - print F "#include \"HTMLFormElement.h\"\n"; -} - printElementIncludes($F); print F <<END #include <wtf/HashMap.h> +#if ENABLE(DASHBOARD_SUPPORT) +#include "Document.h" +#include "Settings.h" +#endif + namespace WebCore { -using namespace $parameters{'namespace'}Names; +using namespace $parameters{namespace}Names; END ; -print F "typedef PassRefPtr<$parameters{'namespace'}Element> (*ConstructorFunction)(const QualifiedName&, Document*"; - -if ($parameters{'namespace'} eq "HTML") { - print F ", HTMLFormElement*"; -} - +print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction)(const QualifiedName&, Document*"; +print F ", HTMLFormElement*" if $parameters{namespace} eq "HTML"; print F ", bool createdByParser);\n"; print F <<END typedef HashMap<AtomicStringImpl*, ConstructorFunction> FunctionMap; @@ -697,7 +694,7 @@ my %tagConstructorMap = buildConstructorMap(); printConstructors($F, \%tagConstructorMap); -print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; +print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; print F <<END static void addTag(const QualifiedName& tag, ConstructorFunction func) @@ -705,10 +702,10 @@ static void addTag(const QualifiedName& tag, ConstructorFunction func) gFunctionMap->set(tag.localName().impl(), func); } -static inline void createFunctionMapIfNecessary() +static void createFunctionMap() { - if (gFunctionMap) - return; + ASSERT(!gFunctionMap); + // Create the table. gFunctionMap = new FunctionMap; @@ -719,30 +716,25 @@ END printFunctionInits($F, \%tagConstructorMap); print F "}\n"; -print F "#endif\n" if $parameters{'guardFactoryWith'}; - -print F "\nPassRefPtr<$parameters{'namespace'}Element> $parameters{'namespace'}ElementFactory::create$parameters{'namespace'}Element(const QualifiedName& qName, Document* doc"; - -if ($parameters{"namespace"} eq "HTML") { - print F ", HTMLFormElement* formElement"; -} +print F "#endif\n" if $parameters{guardFactoryWith}; +print F "\nPassRefPtr<$parameters{namespace}Element> $parameters{namespace}ElementFactory::create$parameters{namespace}Element(const QualifiedName& qName, Document* document"; +print F ", HTMLFormElement* formElement" if $parameters{namespace} eq "HTML"; print F ", bool createdByParser)\n{\n"; -print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; +print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; print F <<END - // Don't make elements without a document - if (!doc) + if (!document) return 0; END ; -if ($parameters{'namespace'} ne "HTML") { +if ($parameters{namespace} ne "HTML") { print F <<END #if ENABLE(DASHBOARD_SUPPORT) - Settings* settings = doc->settings(); + Settings* settings = document->settings(); if (settings && settings->usesDashboardBackwardCompatibilityMode()) return 0; #endif @@ -752,21 +744,21 @@ END } print F <<END - createFunctionMapIfNecessary(); - ConstructorFunction func = gFunctionMap->get(qName.localName().impl()); - if (func) + if (!gFunctionMap) + createFunctionMap(); + if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl())) END ; -if ($parameters{"namespace"} eq "HTML") { - print F " return func(qName, doc, formElement, createdByParser);\n"; +if ($parameters{namespace} eq "HTML") { + print F " return function(qName, document, formElement, createdByParser);\n"; } else { - print F " return func(qName, doc, createdByParser);\n"; + print F " return function(qName, document, createdByParser);\n"; } -print F " return new $parameters{'namespace'}Element(qName, doc);\n"; +print F " return new $parameters{namespace}Element(qName, document);\n"; -if ($parameters{'guardFactoryWith'}) { +if ($parameters{guardFactoryWith}) { print F <<END #else @@ -797,8 +789,8 @@ sub printFactoryHeaderFile printLicenseHeader($F); print F<<END -#ifndef $parameters{'namespace'}ElementFactory_h -#define $parameters{'namespace'}ElementFactory_h +#ifndef $parameters{namespace}ElementFactory_h +#define $parameters{namespace}ElementFactory_h #include <wtf/PassRefPtr.h> @@ -811,35 +803,29 @@ namespace WebCore { namespace WebCore { - class $parameters{'namespace'}Element; + class $parameters{namespace}Element; END ; -if ($parameters{'namespace'} eq "HTML") { - print F " class HTMLFormElement;\n"; -} +print F " class HTMLFormElement;\n" if $parameters{namespace} eq "HTML"; print F<<END // The idea behind this class is that there will eventually be a mapping from namespace URIs to ElementFactories that can dispense // elements. In a compound document world, the generic createElement function (will end up being virtual) will be called. - class $parameters{'namespace'}ElementFactory { + class $parameters{namespace}ElementFactory { public: PassRefPtr<Element> createElement(const WebCore::QualifiedName&, WebCore::Document*, bool createdByParser = true); END ; -print F " static PassRefPtr<$parameters{'namespace'}Element> create$parameters{'namespace'}Element(const WebCore::QualifiedName&, WebCore::Document*"; - -if ($parameters{'namespace'} eq "HTML") { - print F ", HTMLFormElement* = 0"; -} - +print F " static PassRefPtr<$parameters{namespace}Element> create$parameters{namespace}Element(const WebCore::QualifiedName&, WebCore::Document*"; +print F ", HTMLFormElement* = 0" if $parameters{namespace} eq "HTML"; print F ", bool /*createdByParser*/ = true);\n"; printf F<<END }; } -#endif // $parameters{'namespace'}ElementFactory_h +#endif // $parameters{namespace}ElementFactory_h END ; @@ -854,7 +840,7 @@ sub usesDefaultJSWrapper my $name = shift; # A tag reuses the default wrapper if its JSInterfaceName matches the default namespace Element. - return $tags{$name}{'JSInterfaceName'} eq $parameters{"namespace"} . "Element" || $tags{$name}{'JSInterfaceName'} eq "HTMLNoScriptElement"; + return $tags{$name}{JSInterfaceName} eq $parameters{namespace} . "Element" || $tags{$name}{JSInterfaceName} eq "HTMLNoScriptElement"; } sub printWrapperFunctions @@ -864,11 +850,11 @@ sub printWrapperFunctions my %tagsSeen; for my $tagName (sort keys %tags) { # Avoid defining the same wrapper method twice. - my $JSInterfaceName = $tags{$tagName}{"JSInterfaceName"}; + my $JSInterfaceName = $tags{$tagName}{JSInterfaceName}; next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($tagName); $tagsSeen{$JSInterfaceName} = 1; - my $conditional = $tags{$tagName}{"conditional"}; + my $conditional = $tags{$tagName}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n\n"; @@ -876,12 +862,12 @@ sub printWrapperFunctions # Hack for the media tags # FIXME: This should have been done via a CustomWrapper attribute and a separate *Custom file. - if ($tags{$tagName}{"wrapperOnlyIfMediaIsAvailable"}) { + if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { print F <<END -static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{'namespace'}Element> element) +static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { if (!MediaPlayer::isAvailable()) - return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{'namespace'}Element, element.get()); + return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace}Element, element.get()); return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, element.get()); } @@ -889,7 +875,7 @@ END ; } else { print F <<END -static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{'namespace'}Element> element) +static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, element.get()); } @@ -897,6 +883,7 @@ static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec END ; } + if ($conditional) { print F "#endif\n\n"; } @@ -913,13 +900,13 @@ sub printWrapperFactoryCppFile print F "#include \"config.h\"\n\n"; - print F "#if $parameters{'guardFactoryWith'}\n\n" if $parameters{'guardFactoryWith'}; + print F "#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; - print F "#include \"JS$parameters{'namespace'}ElementWrapperFactory.h\"\n"; + print F "#include \"JS$parameters{namespace}ElementWrapperFactory.h\"\n"; printJSElementIncludes($F); - print F "\n#include \"$parameters{'namespace'}Names.h\"\n\n"; + print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; printElementIncludes($F); @@ -930,9 +917,9 @@ using namespace JSC; namespace WebCore { -using namespace $parameters{'namespace'}Names; +using namespace $parameters{namespace}Names; -typedef JSNode* (*Create$parameters{'namespace'}ElementWrapperFunction)(ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{'namespace'}Element>); +typedef JSNode* (*Create$parameters{namespace}ElementWrapperFunction)(ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{namespace}Element>); END ; @@ -940,9 +927,9 @@ END printWrapperFunctions($F); print F <<END -JSNode* createJS$parameters{'namespace'}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{'namespace'}Element> element) +JSNode* createJS$parameters{namespace}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { - typedef HashMap<WebCore::AtomicStringImpl*, Create$parameters{'namespace'}ElementWrapperFunction> FunctionMap; + typedef HashMap<WebCore::AtomicStringImpl*, Create$parameters{namespace}ElementWrapperFunction> FunctionMap; DEFINE_STATIC_LOCAL(FunctionMap, map, ()); if (map.isEmpty()) { END @@ -952,13 +939,13 @@ END # Do not add the name to the map if it does not have a JS wrapper constructor or uses the default wrapper. next if usesDefaultJSWrapper($tag, \%tags); - my $conditional = $tags{$tag}{"conditional"}; + my $conditional = $tags{$tag}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n"; } - my $ucTag = $tags{$tag}{"JSInterfaceName"}; + my $ucTag = $tags{$tag}{JSInterfaceName}; print F " map.set(${tag}Tag.localName().impl(), create${ucTag}Wrapper);\n"; if ($conditional) { @@ -968,10 +955,10 @@ END print F <<END } - Create$parameters{'namespace'}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); + Create$parameters{namespace}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); if (createWrapperFunction) return createWrapperFunction(exec, globalObject, element); - return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{'namespace'}Element, element.get()); + return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace}Element, element.get()); } } @@ -979,7 +966,7 @@ END END ; - print F "#endif\n" if $parameters{'guardFactoryWith'}; + print F "#endif\n" if $parameters{guardFactoryWith}; close F; } @@ -992,10 +979,10 @@ sub printWrapperFactoryHeaderFile printLicenseHeader($F); - print F "#ifndef JS$parameters{'namespace'}ElementWrapperFactory_h\n"; - print F "#define JS$parameters{'namespace'}ElementWrapperFactory_h\n\n"; + print F "#ifndef JS$parameters{namespace}ElementWrapperFactory_h\n"; + print F "#define JS$parameters{namespace}ElementWrapperFactory_h\n\n"; - print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; + print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; print F <<END #include <wtf/Forward.h> @@ -1008,18 +995,18 @@ namespace WebCore { class JSNode; class JSDOMGlobalObject; - class $parameters{'namespace'}Element; + class $parameters{namespace}Element; - JSNode* createJS$parameters{'namespace'}Wrapper(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{'namespace'}Element>); + JSNode* createJS$parameters{namespace}Wrapper(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{namespace}Element>); } END ; - print F "#endif // $parameters{'guardFactoryWith'}\n\n" if $parameters{'guardFactoryWith'}; + print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; - print F "#endif // JS$parameters{'namespace'}ElementWrapperFactory_h\n"; + print F "#endif // JS$parameters{namespace}ElementWrapperFactory_h\n"; close F; } diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp index 25f167c..aa658b9 100644 --- a/WebCore/editing/CompositeEditCommand.cpp +++ b/WebCore/editing/CompositeEditCommand.cpp @@ -519,7 +519,7 @@ void CompositeEditCommand::deleteInsignificantText(PassRefPtr<Text> textNode, un gapStart = max(gapStart, start); gapEnd = min(gapEnd, end); if (str.isNull()) - str = textNode->string()->substring(start, end - start); + str = textNode->data().substring(start, end - start); // remove text in the gap str.remove(gapStart - start - removed, gapLen); removed += gapLen; diff --git a/WebCore/editing/CreateLinkCommand.cpp b/WebCore/editing/CreateLinkCommand.cpp index 263feab..98d6c6d 100644 --- a/WebCore/editing/CreateLinkCommand.cpp +++ b/WebCore/editing/CreateLinkCommand.cpp @@ -51,7 +51,7 @@ void CreateLinkCommand::doApply() applyStyledElement(anchorElement.get()); } else { insertNodeAt(anchorElement.get(), endingSelection().start()); - RefPtr<Text> textNode = new Text(document(), m_url); + RefPtr<Text> textNode = Text::create(document(), m_url); appendNode(textNode.get(), anchorElement.get()); setEndingSelection(VisibleSelection(positionBeforeNode(anchorElement.get()), positionAfterNode(anchorElement.get()), DOWNSTREAM)); } diff --git a/WebCore/editing/DeleteButtonController.cpp b/WebCore/editing/DeleteButtonController.cpp index 725c01d..c472552 100644 --- a/WebCore/editing/DeleteButtonController.cpp +++ b/WebCore/editing/DeleteButtonController.cpp @@ -187,7 +187,7 @@ void DeleteButtonController::respondToChangedSelection(const VisibleSelection& o void DeleteButtonController::createDeletionUI() { RefPtr<HTMLDivElement> container = new HTMLDivElement(divTag, m_target->document()); - container->setId(containerElementIdentifier); + container->setAttribute(idAttr, containerElementIdentifier); CSSMutableStyleDeclaration* style = container->getInlineStyleDecl(); style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone); @@ -202,7 +202,7 @@ void DeleteButtonController::createDeletionUI() style->setProperty(CSSPropertyLeft, "0"); RefPtr<HTMLDivElement> outline = new HTMLDivElement(divTag, m_target->document()); - outline->setId(outlineElementIdentifier); + outline->setAttribute(idAttr, outlineElementIdentifier); const int borderWidth = 4; const int borderRadius = 6; @@ -225,7 +225,7 @@ void DeleteButtonController::createDeletionUI() return; RefPtr<DeleteButton> button = new DeleteButton(m_target->document()); - button->setId(buttonElementIdentifier); + button->setAttribute(idAttr, buttonElementIdentifier); const int buttonWidth = 30; const int buttonHeight = 30; diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 55750ff..90070dd 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -40,6 +40,7 @@ #include "FormatBlockCommand.h" #include "Frame.h" #include "HTMLFontElement.h" +#include "HTMLHRElement.h" #include "HTMLImageElement.h" #include "IndentOutdentCommand.h" #include "InsertListCommand.h" @@ -198,7 +199,7 @@ static bool executeInsertFragment(Frame* frame, PassRefPtr<DocumentFragment> fra static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content) { - RefPtr<DocumentFragment> fragment = new DocumentFragment(frame->document()); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(frame->document()); ExceptionCode ec = 0; fragment->appendChild(content, ec); if (ec) @@ -467,9 +468,9 @@ static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value) { - RefPtr<HTMLElement> hr = new HTMLElement(hrTag, frame->document()); + RefPtr<HTMLHRElement> hr = new HTMLHRElement(hrTag, frame->document()); if (!value.isEmpty()) - hr->setId(value); + hr->setAttribute(idAttr, value); return executeInsertNode(frame, hr.release()); } diff --git a/WebCore/editing/SplitTextNodeCommand.cpp b/WebCore/editing/SplitTextNodeCommand.cpp index 07a54e3..3b04e01 100644 --- a/WebCore/editing/SplitTextNodeCommand.cpp +++ b/WebCore/editing/SplitTextNodeCommand.cpp @@ -55,7 +55,7 @@ void SplitTextNodeCommand::doApply() if (prefixText.isEmpty()) return; - RefPtr<Text> prefixTextNode = new Text(document(), prefixText); + RefPtr<Text> prefixTextNode = Text::create(document(), prefixText); ASSERT(prefixTextNode); document()->copyMarkers(m_text2.get(), 0, m_offset, prefixTextNode.get(), 0); diff --git a/WebCore/editing/haiku/EditorHaiku.cpp b/WebCore/editing/haiku/EditorHaiku.cpp index 17fde1f..723d4ff 100644 --- a/WebCore/editing/haiku/EditorHaiku.cpp +++ b/WebCore/editing/haiku/EditorHaiku.cpp @@ -28,9 +28,8 @@ #include "config.h" #include "Editor.h" -#include "ClipboardAccessPolicy.h" #include "Clipboard.h" - +#include "ClipboardAccessPolicy.h" #include "ClipboardHaiku.h" @@ -38,7 +37,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) { - return new ClipboardHaiku(policy, false); + return ClipboardHaiku::create(policy, false); } } // namespace WebCore diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index 14ce7f6..2b963ef 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -420,7 +420,7 @@ static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Ran case Node::COMMENT_NODE: // FIXME: Comment content is not escaped, but XMLSerializer (and possibly other callers) should raise an exception if it includes "-->". append(result, "<!--"); - append(result, static_cast<const Comment*>(node)->nodeValue()); + append(result, static_cast<const Comment*>(node)->data()); append(result, "-->"); break; case Node::DOCUMENT_NODE: diff --git a/WebCore/html/CollectionType.h b/WebCore/html/CollectionType.h index e5973a3..9d7bb54 100644 --- a/WebCore/html/CollectionType.h +++ b/WebCore/html/CollectionType.h @@ -51,6 +51,7 @@ enum CollectionType { TSectionRows, // all row elements in this table section TRCells, // all cells in this row SelectOptions, + DataListOptions, MapAreas, OtherCollection diff --git a/WebCore/html/HTMLAreaElement.cpp b/WebCore/html/HTMLAreaElement.cpp index b878a1a..b2e4129 100644 --- a/WebCore/html/HTMLAreaElement.cpp +++ b/WebCore/html/HTMLAreaElement.cpp @@ -36,7 +36,6 @@ using namespace HTMLNames; HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document* document) : HTMLAnchorElement(tagName, document) - , m_coords(0) , m_coordsLen(0) , m_lastSize(-1, -1) , m_shape(Unknown) @@ -46,7 +45,6 @@ HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document* documen HTMLAreaElement::~HTMLAreaElement() { - delete [] m_coords; } void HTMLAreaElement::parseMappedAttribute(MappedAttribute* attr) @@ -61,8 +59,7 @@ void HTMLAreaElement::parseMappedAttribute(MappedAttribute* attr) else if (equalIgnoringCase(attr->value(), "rect")) m_shape = Rect; } else if (attr->name() == coordsAttr) { - delete [] m_coords; - m_coords = newCoordsArray(attr->value().string(), m_coordsLen); + m_coords.set(newCoordsArray(attr->value().string(), m_coordsLen)); } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) { // Do nothing. } else diff --git a/WebCore/html/HTMLAreaElement.h b/WebCore/html/HTMLAreaElement.h index fffd45e..fd308b6 100644 --- a/WebCore/html/HTMLAreaElement.h +++ b/WebCore/html/HTMLAreaElement.h @@ -25,6 +25,7 @@ #include "HTMLAnchorElement.h" #include "IntSize.h" +#include <wtf/OwnArrayPtr.h> namespace WebCore { @@ -58,7 +59,7 @@ private: Path getRegion(const IntSize&) const; OwnPtr<Path> m_region; - Length* m_coords; + OwnArrayPtr<Length> m_coords; int m_coordsLen; IntSize m_lastSize; Shape m_shape; diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp index be6663f..df26d93 100644 --- a/WebCore/html/HTMLBodyElement.cpp +++ b/WebCore/html/HTMLBodyElement.cpp @@ -338,7 +338,7 @@ EventListener* HTMLBodyElement::onblur() const void HTMLBodyElement::setOnblur(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().blurEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().blurEvent, eventListener); } EventListener* HTMLBodyElement::onerror() const @@ -348,7 +348,7 @@ EventListener* HTMLBodyElement::onerror() const void HTMLBodyElement::setOnerror(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().errorEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().errorEvent, eventListener); } EventListener* HTMLBodyElement::onfocus() const @@ -358,7 +358,7 @@ EventListener* HTMLBodyElement::onfocus() const void HTMLBodyElement::setOnfocus(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().focusEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().focusEvent, eventListener); } EventListener* HTMLBodyElement::onload() const @@ -368,7 +368,7 @@ EventListener* HTMLBodyElement::onload() const void HTMLBodyElement::setOnload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().loadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().loadEvent, eventListener); } EventListener* HTMLBodyElement::onbeforeunload() const @@ -378,9 +378,19 @@ EventListener* HTMLBodyElement::onbeforeunload() const void HTMLBodyElement::setOnbeforeunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().beforeunloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, eventListener); } +EventListener* HTMLBodyElement::onhashchange() const +{ + return document()->getWindowAttributeEventListener(eventNames().hashchangeEvent); +} + +void HTMLBodyElement::setOnhashchange(PassRefPtr<EventListener> eventListener) +{ + document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, eventListener); +} + EventListener* HTMLBodyElement::onmessage() const { return document()->getWindowAttributeEventListener(eventNames().messageEvent); @@ -388,7 +398,7 @@ EventListener* HTMLBodyElement::onmessage() const void HTMLBodyElement::setOnmessage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().messageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().messageEvent, eventListener); } EventListener* HTMLBodyElement::onoffline() const @@ -398,7 +408,7 @@ EventListener* HTMLBodyElement::onoffline() const void HTMLBodyElement::setOnoffline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().offlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().offlineEvent, eventListener); } EventListener* HTMLBodyElement::ononline() const @@ -408,7 +418,7 @@ EventListener* HTMLBodyElement::ononline() const void HTMLBodyElement::setOnonline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().onlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener); } EventListener* HTMLBodyElement::onresize() const @@ -418,7 +428,7 @@ EventListener* HTMLBodyElement::onresize() const void HTMLBodyElement::setOnresize(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().resizeEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().resizeEvent, eventListener); } EventListener* HTMLBodyElement::onstorage() const @@ -428,7 +438,7 @@ EventListener* HTMLBodyElement::onstorage() const void HTMLBodyElement::setOnstorage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().storageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().storageEvent, eventListener); } EventListener* HTMLBodyElement::onunload() const @@ -438,7 +448,7 @@ EventListener* HTMLBodyElement::onunload() const void HTMLBodyElement::setOnunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().unloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().unloadEvent, eventListener); } } // namespace WebCore diff --git a/WebCore/html/HTMLBodyElement.h b/WebCore/html/HTMLBodyElement.h index 575d562..d5efab3 100644 --- a/WebCore/html/HTMLBodyElement.h +++ b/WebCore/html/HTMLBodyElement.h @@ -57,6 +57,8 @@ public: void setOnbeforeunload(PassRefPtr<EventListener>); EventListener* onmessage() const; void setOnmessage(PassRefPtr<EventListener>); + EventListener* onhashchange() const; + void setOnhashchange(PassRefPtr<EventListener>); EventListener* onoffline() const; void setOnoffline(PassRefPtr<EventListener>); EventListener* ononline() const; diff --git a/WebCore/html/HTMLBodyElement.idl b/WebCore/html/HTMLBodyElement.idl index 097b4ac..7be6803 100644 --- a/WebCore/html/HTMLBodyElement.idl +++ b/WebCore/html/HTMLBodyElement.idl @@ -36,6 +36,7 @@ module html { #if !defined(LANGUAGE_COM) || !LANGUAGE_COM // Event handler attributes attribute [DontEnum] EventListener onbeforeunload; + attribute [DontEnum] EventListener onhashchange; attribute [DontEnum] EventListener onmessage; attribute [DontEnum] EventListener onoffline; attribute [DontEnum] EventListener ononline; @@ -43,10 +44,15 @@ module html { attribute [DontEnum] EventListener onstorage; attribute [DontEnum] EventListener onunload; + // Overrides of Element attributes (left in for completeness). + // attribute [DontEnum] EventListener onblur; + // attribute [DontEnum] EventListener onerror; + // attribute [DontEnum] EventListener onfocus; + // attribute [DontEnum] EventListener onload; + // Not implemented yet. // attribute [DontEnum] EventListener onafterprint; // attribute [DontEnum] EventListener onbeforeprint; - // attribute [DontEnum] EventListener onhashchange; // attribute [DontEnum] EventListener onpopstate; // attribute [DontEnum] EventListener onredo; // attribute [DontEnum] EventListener onundo; diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h index bba1f2d..6961957 100644 --- a/WebCore/html/HTMLCanvasElement.h +++ b/WebCore/html/HTMLCanvasElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Alp Toker <alp@atoker.com> * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,6 @@ namespace WebCore { class CanvasRenderingContext2D; -typedef CanvasRenderingContext2D CanvasRenderingContext; class FloatPoint; class FloatRect; class FloatSize; @@ -45,9 +44,11 @@ class ImageBuffer; class IntPoint; class IntSize; +typedef CanvasRenderingContext2D CanvasRenderingContext; + class CanvasObserver { public: - virtual ~CanvasObserver() {}; + virtual ~CanvasObserver() { } virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0; virtual void canvasResized(HTMLCanvasElement*) = 0; @@ -59,11 +60,6 @@ public: HTMLCanvasElement(const QualifiedName&, Document*); virtual ~HTMLCanvasElement(); -#if ENABLE(DASHBOARD_SUPPORT) - virtual HTMLTagStatus endTagRequirement() const; - virtual int tagPriority() const; -#endif - int width() const { return m_size.width(); } int height() const { return m_size.height(); } void setWidth(int); @@ -73,10 +69,7 @@ public: CanvasRenderingContext* getContext(const String&); - virtual void parseMappedAttribute(MappedAttribute*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - - IntSize size() const { return m_size; } + const IntSize& size() const { return m_size; } void setSize(const IntSize& size) { if (size == m_size) @@ -103,15 +96,26 @@ public: void setOriginTainted() { m_originClean = false; } bool originClean() const { return m_originClean; } - static const float MaxCanvasArea; - - void setObserver(CanvasObserver* o) { m_observer = o; } + void setObserver(CanvasObserver* observer) { m_observer = observer; } TransformationMatrix baseTransform() const; + + CanvasRenderingContext2D* renderingContext2D() { return m_2DContext.get(); } + private: +#if ENABLE(DASHBOARD_SUPPORT) + virtual HTMLTagStatus endTagRequirement() const; + virtual int tagPriority() const; +#endif + + virtual void parseMappedAttribute(MappedAttribute*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + void createImageBuffer() const; void reset(); + static const float MaxCanvasArea; + bool m_rendererIsCanvas; OwnPtr<CanvasRenderingContext2D> m_2DContext; diff --git a/WebCore/html/HTMLCanvasElement.idl b/WebCore/html/HTMLCanvasElement.idl index 13fc623..4b1b057 100644 --- a/WebCore/html/HTMLCanvasElement.idl +++ b/WebCore/html/HTMLCanvasElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,7 @@ module html { interface [ + CustomMarkFunction, GenerateConstructor, InterfaceUUID=a14d88c8-c6af-4e34-ad17-659700c77a10, ImplementationUUID=7ae731bc-c264-4ee3-a4b4-5d4540af26c3 diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp index de4c424..76de60a 100644 --- a/WebCore/html/HTMLCollection.cpp +++ b/WebCore/html/HTMLCollection.cpp @@ -27,6 +27,7 @@ #include "HTMLElement.h" #include "HTMLNames.h" #include "HTMLObjectElement.h" +#include "HTMLOptionElement.h" #include "NodeList.h" #include <utility> @@ -104,6 +105,7 @@ Element* HTMLCollection::itemAfter(Element* previous) const case MapAreas: case OtherCollection: case SelectOptions: + case DataListOptions: case WindowNamedItems: break; case NodeChildren: @@ -153,6 +155,13 @@ Element* HTMLCollection::itemAfter(Element* previous) const if (e->hasLocalName(optionTag)) return e; break; + case DataListOptions: + if (e->hasLocalName(optionTag)) { + HTMLOptionElement* option = static_cast<HTMLOptionElement*>(e); + if (!option->disabled() && !option->value().isEmpty()) + return e; + } + break; case MapAreas: if (e->hasLocalName(areaTag)) return e; diff --git a/WebCore/html/HTMLDataListElement.cpp b/WebCore/html/HTMLDataListElement.cpp new file mode 100644 index 0000000..a6ca525 --- /dev/null +++ b/WebCore/html/HTMLDataListElement.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#if ENABLE(DATALIST) +#include "HTMLDataListElement.h" + +#include "HTMLNames.h" + +namespace WebCore { + +HTMLDataListElement::HTMLDataListElement(const QualifiedName& tagName, Document *doc) + : HTMLElement(tagName, doc) +{ +} + +HTMLDataListElement::~HTMLDataListElement() +{ +} + +bool HTMLDataListElement::checkDTD(const Node* newChild) +{ + return newChild->hasTagName(HTMLNames::optionTag) || HTMLElement::inInlineTagList(newChild); +} + +PassRefPtr<HTMLCollection> HTMLDataListElement::options() +{ + return HTMLCollection::create(this, DataListOptions); +} + +} // namespace WebCore + +#endif // ENABLE(DATALIST) diff --git a/WebCore/html/HTMLDataListElement.h b/WebCore/html/HTMLDataListElement.h new file mode 100644 index 0000000..8c4cfbc --- /dev/null +++ b/WebCore/html/HTMLDataListElement.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HTMLDataListElement_h +#define HTMLDataListElement_h + +#if ENABLE(DATALIST) + +#include "HTMLCollection.h" +#include "HTMLElement.h" + +namespace WebCore { + + class HTMLDataListElement : public HTMLElement { + public: + HTMLDataListElement(const QualifiedName&, Document*); + virtual ~HTMLDataListElement(); + PassRefPtr<HTMLCollection> options(); + + private: + virtual bool checkDTD(const Node*); + }; + +} // namespace WebCore + +#endif // ENABLE(DATALIST) + +#endif // HTMLDataListElement_h diff --git a/WebCore/html/HTMLDataListElement.idl b/WebCore/html/HTMLDataListElement.idl new file mode 100644 index 0000000..916c0a1 --- /dev/null +++ b/WebCore/html/HTMLDataListElement.idl @@ -0,0 +1,38 @@ +/* + * 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. + */ + +module html { + interface [ + GenerateConstructor, + Conditional=DATALIST + ] HTMLDataListElement : HTMLElement { + readonly attribute HTMLCollection options; + }; +} diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index 2457c4f..c995bbb 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -114,14 +114,14 @@ String HTMLDocument::dir() HTMLElement* b = body(); if (!b) return String(); - return b->dir(); + return b->getAttribute(dirAttr); } void HTMLDocument::setDir(const String& value) { HTMLElement* b = body(); if (b) - b->setDir(value); + b->setAttribute(dirAttr, value); } String HTMLDocument::designMode() const diff --git a/WebCore/html/HTMLDocument.h b/WebCore/html/HTMLDocument.h index eda7593..4b14d0c 100644 --- a/WebCore/html/HTMLDocument.h +++ b/WebCore/html/HTMLDocument.h @@ -37,7 +37,7 @@ class HTMLDocument : public Document, public CachedResourceClient { public: static PassRefPtr<HTMLDocument> create(Frame* frame) { - return new HTMLDocument(frame); + return adoptRef(new HTMLDocument(frame)); } virtual ~HTMLDocument(); @@ -71,10 +71,6 @@ public: void captureEvents(); void releaseEvents(); - virtual bool childAllowed(Node*); - - virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); - void addNamedItem(const AtomicString& name); void removeNamedItem(const AtomicString& name); bool hasNamedItem(AtomicStringImpl* name); @@ -87,6 +83,10 @@ protected: HTMLDocument(Frame*); private: + virtual bool childAllowed(Node*); + + virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); + virtual bool isHTMLDocument() const { return true; } virtual bool isFrameSet() const; virtual Tokenizer* createTokenizer(); diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index b310cad..7a23d94 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -257,7 +257,7 @@ PassRefPtr<DocumentFragment> HTMLElement::createContextualFragment(const String hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag)) return 0; - RefPtr<DocumentFragment> fragment = new DocumentFragment(document()); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); if (document()->isHTMLDocument()) parseHTMLDocumentFragment(html, fragment.get()); @@ -319,7 +319,7 @@ static void replaceChildrenWithFragment(HTMLElement* element, PassRefPtr<Documen } if (hasOneTextChild(element) && hasOneTextChild(fragment.get())) { - static_cast<Text*>(element->firstChild())->setData(static_cast<Text*>(fragment->firstChild())->string(), ec); + static_cast<Text*>(element->firstChild())->setData(static_cast<Text*>(fragment->firstChild())->data(), ec); return; } @@ -339,7 +339,7 @@ static void replaceChildrenWithText(HTMLElement* element, const String& text, Ex return; } - RefPtr<Text> textNode = new Text(element->document(), text); + RefPtr<Text> textNode = Text::create(element->document(), text); if (hasOneChild(element)) { element->replaceChild(textNode.release(), element->firstChild(), ec); @@ -425,7 +425,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) // Add text nodes and <br> elements. ec = 0; - RefPtr<DocumentFragment> fragment = new DocumentFragment(document()); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); int lineStart = 0; UChar prev = 0; int length = text.length(); @@ -433,7 +433,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) UChar c = text[i]; if (c == '\n' || c == '\r') { if (i > lineStart) { - fragment->appendChild(new Text(document(), text.substring(lineStart, i - lineStart)), ec); + fragment->appendChild(Text::create(document(), text.substring(lineStart, i - lineStart)), ec); if (ec) return; } @@ -447,7 +447,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) prev = c; } if (length > lineStart) - fragment->appendChild(new Text(document(), text.substring(lineStart, length - lineStart)), ec); + fragment->appendChild(Text::create(document(), text.substring(lineStart, length - lineStart)), ec); replaceChildrenWithFragment(this, fragment.release(), ec); } @@ -475,7 +475,7 @@ void HTMLElement::setOuterText(const String &text, ExceptionCode& ec) // FIXME: This creates a new text node even when the text is empty. // FIXME: This creates a single text node even when the text has CR and LF // characters in it. Instead it should create <br> elements. - RefPtr<Text> t = new Text(document(), text); + RefPtr<Text> t = Text::create(document(), text); ec = 0; parent->replaceChild(t, this, ec); if (ec) @@ -737,56 +737,11 @@ void HTMLElement::accessKeyAction(bool sendToAnyElement) dispatchSimulatedClick(0, true); } -String HTMLElement::id() const -{ - return getAttribute(idAttr); -} - -void HTMLElement::setId(const String& value) -{ - setAttribute(idAttr, value); -} - String HTMLElement::title() const { return getAttribute(titleAttr); } -void HTMLElement::setTitle(const String& value) -{ - setAttribute(titleAttr, value); -} - -String HTMLElement::lang() const -{ - return getAttribute(langAttr); -} - -void HTMLElement::setLang(const String& value) -{ - setAttribute(langAttr, value); -} - -String HTMLElement::dir() const -{ - return getAttribute(dirAttr); -} - -void HTMLElement::setDir(const String &value) -{ - setAttribute(dirAttr, value); -} - -String HTMLElement::className() const -{ - return getAttribute(classAttr); -} - -void HTMLElement::setClassName(const String &value) -{ - setAttribute(classAttr, value); -} - short HTMLElement::tabIndex() const { if (supportsFocus()) @@ -894,6 +849,7 @@ static HashSet<AtomicStringImpl*>* inlineTagList() tagList.add(textareaTag.localName().impl()); tagList.add(labelTag.localName().impl()); tagList.add(buttonTag.localName().impl()); + tagList.add(datalistTag.localName().impl()); tagList.add(insTag.localName().impl()); tagList.add(delTag.localName().impl()); tagList.add(nobrTag.localName().impl()); diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h index 21b3bb5..d7485e8 100644 --- a/WebCore/html/HTMLElement.h +++ b/WebCore/html/HTMLElement.h @@ -47,16 +47,7 @@ public: PassRefPtr<HTMLCollection> children(); - String id() const; - void setId(const String&); virtual String title() const; - void setTitle(const String&); - String lang() const; - void setLang(const String&); - String dir() const; - void setDir(const String&); - String className() const; - void setClassName(const String&); virtual short tabIndex() const; void setTabIndex(int); diff --git a/WebCore/html/HTMLEmbedElement.idl b/WebCore/html/HTMLEmbedElement.idl index a38402c..05c10db 100644 --- a/WebCore/html/HTMLEmbedElement.idl +++ b/WebCore/html/HTMLEmbedElement.idl @@ -29,17 +29,17 @@ module html { InterfaceUUID=18f9bd58-6bb3-4b5c-aa30-6da13adfc91e, ImplementationUUID=93e0407a-8380-4ff0-978d-f773f2dee6a3 ] HTMLEmbedElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; + attribute [ConvertNullToNullString, Reflect] DOMString align; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString] DOMString height; + attribute [ConvertNullToNullString, Reflect] DOMString height; #else attribute [ConvertFromString] long height; #endif - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString src; - attribute [ConvertNullToNullString] DOMString type; + attribute [ConvertNullToNullString, Reflect] DOMString name; + attribute [ConvertNullToNullString, Reflect] DOMString src; + attribute [ConvertNullToNullString, Reflect] DOMString type; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString] DOMString width; + attribute [ConvertNullToNullString, Reflect] DOMString width; #else attribute [ConvertFromString] long width; #endif diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index 09d91df..3d8bc78 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -294,6 +294,11 @@ HTMLFormElement* HTMLFormControlElement::virtualForm() const return m_form; } +bool HTMLFormControlElement::isDefaultButtonForForm() const +{ + return isSuccessfulSubmitButton() && m_form && m_form->defaultButton() == this; +} + void HTMLFormControlElement::removeFromForm() { if (!m_form) diff --git a/WebCore/html/HTMLFormControlElement.h b/WebCore/html/HTMLFormControlElement.h index a30f46c..902bbf3 100644 --- a/WebCore/html/HTMLFormControlElement.h +++ b/WebCore/html/HTMLFormControlElement.h @@ -117,6 +117,7 @@ protected: private: virtual HTMLFormElement* virtualForm() const; + virtual bool isDefaultButtonForForm() const; HTMLFormElement* m_form; RefPtr<ValidityState> m_validityState; diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index 54986b0..51fb35f 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -577,6 +577,17 @@ void HTMLFormElement::setTarget(const String &value) setAttribute(targetAttr, value); } +HTMLFormControlElement* HTMLFormElement::defaultButton() const +{ + for (unsigned i = 0; i < formElements.size(); ++i) { + HTMLFormControlElement* control = formElements[i]; + if (control->isSuccessfulSubmitButton()) + return control; + } + + return 0; +} + PassRefPtr<HTMLFormControlElement> HTMLFormElement::elementForAlias(const AtomicString& alias) { if (alias.isEmpty() || !m_elementAliases) diff --git a/WebCore/html/HTMLFormElement.h b/WebCore/html/HTMLFormElement.h index 6b7812a..afe1ff0 100644 --- a/WebCore/html/HTMLFormElement.h +++ b/WebCore/html/HTMLFormElement.h @@ -107,6 +107,8 @@ public: virtual String target() const; void setTarget(const String&); + + HTMLFormControlElement* defaultButton() const; PassRefPtr<HTMLFormControlElement> elementForAlias(const AtomicString&); void addElementAlias(HTMLFormControlElement*, const AtomicString& alias); diff --git a/WebCore/html/HTMLFrameElement.cpp b/WebCore/html/HTMLFrameElement.cpp index adc3ff1..d87386f 100644 --- a/WebCore/html/HTMLFrameElement.cpp +++ b/WebCore/html/HTMLFrameElement.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann (hausmann@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2006, 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 @@ -38,6 +38,7 @@ HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document* docum : HTMLFrameElementBase(tagName, document) , m_frameBorder(true) , m_frameBorderSet(false) + , m_noResize(false) { ASSERT(hasTagName(frameTag)); } @@ -45,7 +46,7 @@ HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document* docum bool HTMLFrameElement::rendererIsNeeded(RenderStyle*) { // For compatibility, frames render even when display: none is set. - return isURLAllowed(m_URL); + return isURLAllowed(); } RenderObject* HTMLFrameElement::createRenderer(RenderArena* arena, RenderStyle*) @@ -79,8 +80,20 @@ void HTMLFrameElement::parseMappedAttribute(MappedAttribute *attr) m_frameBorder = attr->value().toInt(); m_frameBorderSet = !attr->isNull(); // FIXME: If we are already attached, this has no effect. + } else if (attr->name() == noresizeAttr) { + m_noResize = true; + // FIXME: If we are already attached, this has no effect. + // FIXME: Since this does not check attr->isNull(), it can + // never reset m_noResize to false if the attribute is removed. + // FIXME: There seems to be no code that looks at this + // value and prevents resizing. } else HTMLFrameElementBase::parseMappedAttribute(attr); } +void HTMLFrameElement::setNoResize(bool noResize) +{ + setAttribute(noresizeAttr, noResize ? "" : 0); +} + } // namespace WebCore diff --git a/WebCore/html/HTMLFrameElement.h b/WebCore/html/HTMLFrameElement.h index ab602ee..23b5acb 100644 --- a/WebCore/html/HTMLFrameElement.h +++ b/WebCore/html/HTMLFrameElement.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann <hausmann@kde.org> - * Copyright (C) 2004, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2006, 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 @@ -49,9 +49,14 @@ public: bool hasFrameBorder() const { return m_frameBorder; } + bool noResize() const { return m_noResize; } + void setNoResize(bool); + private: bool m_frameBorder; bool m_frameBorderSet; + + bool m_noResize; }; } // namespace WebCore diff --git a/WebCore/html/HTMLFrameElement.idl b/WebCore/html/HTMLFrameElement.idl index 106e57e..d0076eb 100644 --- a/WebCore/html/HTMLFrameElement.idl +++ b/WebCore/html/HTMLFrameElement.idl @@ -26,14 +26,14 @@ module html { ImplementationUUID=38c9e3c8-3384-40b6-a484-cb845c48b67d ] HTMLFrameElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString frameBorder; - attribute [ConvertNullToNullString] DOMString longDesc; - attribute [ConvertNullToNullString] DOMString marginHeight; - attribute [ConvertNullToNullString] DOMString marginWidth; - attribute [ConvertNullToNullString] DOMString name; + attribute [ConvertNullToNullString, Reflect=frameborder] DOMString frameBorder; + attribute [ConvertNullToNullString, Reflect=longdesc] DOMString longDesc; + attribute [ConvertNullToNullString, Reflect=marginheight] DOMString marginHeight; + attribute [ConvertNullToNullString, Reflect=marginwidth] DOMString marginWidth; + attribute [ConvertNullToNullString, Reflect] DOMString name; attribute boolean noResize; - attribute [ConvertNullToNullString] DOMString scrolling; - attribute [ConvertNullToNullString, CustomSetter] DOMString src; + attribute [ConvertNullToNullString, Reflect] DOMString scrolling; + attribute [ConvertNullToNullString, CustomSetter, ReflectURL] DOMString src; // Introduced in DOM Level 2: readonly attribute [CheckFrameSecurity] Document contentDocument; diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp index a4f0a5e..282dee3 100644 --- a/WebCore/html/HTMLFrameElementBase.cpp +++ b/WebCore/html/HTMLFrameElementBase.cpp @@ -50,18 +50,17 @@ HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen , m_scrolling(ScrollbarAuto) , m_marginWidth(-1) , m_marginHeight(-1) - , m_noResize(false) , m_viewSource(false) , m_shouldOpenURLAfterAttach(false) { } -bool HTMLFrameElementBase::isURLAllowed(const AtomicString& URLString) const +bool HTMLFrameElementBase::isURLAllowed() const { - if (URLString.isEmpty()) + if (m_URL.isEmpty()) return true; - const KURL& completeURL = document()->completeURL(URLString); + const KURL& completeURL = document()->completeURL(m_URL); // Don't allow more than 200 total frames in a set. This seems // like a reasonable upper bound, and otherwise mutually recursive @@ -93,7 +92,7 @@ void HTMLFrameElementBase::openURL() { ASSERT(!m_frameName.isEmpty()); - if (!isURLAllowed(m_URL)) + if (!isURLAllowed()) return; if (m_URL.isEmpty()) @@ -127,9 +126,6 @@ void HTMLFrameElementBase::parseMappedAttribute(MappedAttribute *attr) } else if (attr->name() == marginheightAttr) { m_marginHeight = attr->value().toInt(); // FIXME: If we are already attached, this has no effect. - } else if (attr->name() == noresizeAttr) { - m_noResize = true; - // FIXME: If we are already attached, this has no effect. } else if (attr->name() == scrollingAttr) { // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling." if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes")) @@ -283,11 +279,6 @@ void HTMLFrameElementBase::setName(const String &value) setAttribute(nameAttr, value); } -void HTMLFrameElementBase::setNoResize(bool noResize) -{ - setAttribute(noresizeAttr, noResize ? "" : 0); -} - String HTMLFrameElementBase::scrolling() const { return getAttribute(scrollingAttr); diff --git a/WebCore/html/HTMLFrameElementBase.h b/WebCore/html/HTMLFrameElementBase.h index 4a24451..ad55ee1 100644 --- a/WebCore/html/HTMLFrameElementBase.h +++ b/WebCore/html/HTMLFrameElementBase.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann <hausmann@kde.org> - * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 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 @@ -67,9 +67,6 @@ public: String name() const; void setName(const String&); - bool noResize() const { return m_noResize; } - void setNoResize(bool); - String scrolling() const; void setScrolling(const String&); @@ -84,7 +81,7 @@ public: protected: HTMLFrameElementBase(const QualifiedName&, Document*); - bool isURLAllowed(const AtomicString&) const; + bool isURLAllowed() const; void setNameAndOpenURL(); void openURL(); @@ -98,7 +95,6 @@ protected: int m_marginWidth; int m_marginHeight; - bool m_noResize; bool m_viewSource; bool m_shouldOpenURLAfterAttach; diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp index a8f544b..235bb9f 100644 --- a/WebCore/html/HTMLFrameSetElement.cpp +++ b/WebCore/html/HTMLFrameSetElement.cpp @@ -240,7 +240,7 @@ EventListener* HTMLFrameSetElement::onblur() const void HTMLFrameSetElement::setOnblur(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().blurEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().blurEvent, eventListener); } EventListener* HTMLFrameSetElement::onerror() const @@ -250,7 +250,7 @@ EventListener* HTMLFrameSetElement::onerror() const void HTMLFrameSetElement::setOnerror(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().errorEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().errorEvent, eventListener); } EventListener* HTMLFrameSetElement::onfocus() const @@ -260,9 +260,19 @@ EventListener* HTMLFrameSetElement::onfocus() const void HTMLFrameSetElement::setOnfocus(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().focusEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().focusEvent, eventListener); } +EventListener* HTMLFrameSetElement::onhashchange() const +{ + return document()->getWindowAttributeEventListener(eventNames().hashchangeEvent); +} + +void HTMLFrameSetElement::setOnhashchange(PassRefPtr<EventListener> eventListener) +{ + document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, eventListener); +} + EventListener* HTMLFrameSetElement::onload() const { return document()->getWindowAttributeEventListener(eventNames().loadEvent); @@ -270,7 +280,7 @@ EventListener* HTMLFrameSetElement::onload() const void HTMLFrameSetElement::setOnload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().loadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().loadEvent, eventListener); } EventListener* HTMLFrameSetElement::onbeforeunload() const @@ -280,7 +290,7 @@ EventListener* HTMLFrameSetElement::onbeforeunload() const void HTMLFrameSetElement::setOnbeforeunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().beforeunloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, eventListener); } EventListener* HTMLFrameSetElement::onmessage() const @@ -290,7 +300,7 @@ EventListener* HTMLFrameSetElement::onmessage() const void HTMLFrameSetElement::setOnmessage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().messageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().messageEvent, eventListener); } EventListener* HTMLFrameSetElement::onoffline() const @@ -300,7 +310,7 @@ EventListener* HTMLFrameSetElement::onoffline() const void HTMLFrameSetElement::setOnoffline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().offlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().offlineEvent, eventListener); } EventListener* HTMLFrameSetElement::ononline() const @@ -310,7 +320,7 @@ EventListener* HTMLFrameSetElement::ononline() const void HTMLFrameSetElement::setOnonline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().onlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener); } EventListener* HTMLFrameSetElement::onresize() const @@ -320,7 +330,7 @@ EventListener* HTMLFrameSetElement::onresize() const void HTMLFrameSetElement::setOnresize(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().resizeEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().resizeEvent, eventListener); } EventListener* HTMLFrameSetElement::onstorage() const @@ -330,7 +340,7 @@ EventListener* HTMLFrameSetElement::onstorage() const void HTMLFrameSetElement::setOnstorage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().storageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().storageEvent, eventListener); } EventListener* HTMLFrameSetElement::onunload() const @@ -340,7 +350,7 @@ EventListener* HTMLFrameSetElement::onunload() const void HTMLFrameSetElement::setOnunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().unloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().unloadEvent, eventListener); } } // namespace WebCore diff --git a/WebCore/html/HTMLFrameSetElement.h b/WebCore/html/HTMLFrameSetElement.h index 4319c7a..b51e702 100644 --- a/WebCore/html/HTMLFrameSetElement.h +++ b/WebCore/html/HTMLFrameSetElement.h @@ -79,6 +79,8 @@ public: EventListener* onbeforeunload() const; void setOnbeforeunload(PassRefPtr<EventListener>); + EventListener* onhashchange() const; + void setOnhashchange(PassRefPtr<EventListener>); EventListener* onmessage() const; void setOnmessage(PassRefPtr<EventListener>); EventListener* onoffline() const; diff --git a/WebCore/html/HTMLFrameSetElement.idl b/WebCore/html/HTMLFrameSetElement.idl index 4050f2c..0375c0a 100644 --- a/WebCore/html/HTMLFrameSetElement.idl +++ b/WebCore/html/HTMLFrameSetElement.idl @@ -33,6 +33,7 @@ module html { #if !defined(LANGUAGE_COM) || !LANGUAGE_COM // Event handler attributes attribute [DontEnum] EventListener onbeforeunload; + attribute [DontEnum] EventListener onhashchange; attribute [DontEnum] EventListener onmessage; attribute [DontEnum] EventListener onoffline; attribute [DontEnum] EventListener ononline; @@ -40,7 +41,7 @@ module html { attribute [DontEnum] EventListener onstorage; attribute [DontEnum] EventListener onunload; - // Overrides of Element attributes. + // Overrides of Element attributes (left in for completeness). // attribute [DontEnum] EventListener onblur; // attribute [DontEnum] EventListener onerror; // attribute [DontEnum] EventListener onfocus; @@ -49,7 +50,6 @@ module html { // Not implemented yet. // attribute [DontEnum] EventListener onafterprint; // attribute [DontEnum] EventListener onbeforeprint; - // attribute [DontEnum] EventListener onhashchange; // attribute [DontEnum] EventListener onpopstate; // attribute [DontEnum] EventListener onredo; // attribute [DontEnum] EventListener onundo; diff --git a/WebCore/html/HTMLIFrameElement.cpp b/WebCore/html/HTMLIFrameElement.cpp index 478925a..123b134 100644 --- a/WebCore/html/HTMLIFrameElement.cpp +++ b/WebCore/html/HTMLIFrameElement.cpp @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann (hausmann@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 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 @@ -89,7 +89,7 @@ void HTMLIFrameElement::parseMappedAttribute(MappedAttribute* attr) bool HTMLIFrameElement::rendererIsNeeded(RenderStyle* style) { - return isURLAllowed(m_URL) && style->display() != NONE; + return isURLAllowed() && style->display() != NONE; } RenderObject* HTMLIFrameElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/html/HTMLIFrameElement.idl b/WebCore/html/HTMLIFrameElement.idl index b5684ca..e288b54 100644 --- a/WebCore/html/HTMLIFrameElement.idl +++ b/WebCore/html/HTMLIFrameElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -26,16 +26,16 @@ module html { ImplementationUUID=370c6318-f804-49f9-bc8a-46b99cd87399 ] HTMLIFrameElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString frameBorder; - attribute [ConvertNullToNullString] DOMString height; - attribute [ConvertNullToNullString] DOMString longDesc; - attribute [ConvertNullToNullString] DOMString marginHeight; - attribute [ConvertNullToNullString] DOMString marginWidth; - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString scrolling; - attribute [ConvertNullToNullString, CustomSetter] DOMString src; - attribute [ConvertNullToNullString] DOMString width; + attribute [ConvertNullToNullString, Reflect] DOMString align; + attribute [ConvertNullToNullString, Reflect=frameborder] DOMString frameBorder; + attribute [ConvertNullToNullString, Reflect] DOMString height; + attribute [ConvertNullToNullString, Reflect=longdesc] DOMString longDesc; + attribute [ConvertNullToNullString, Reflect=marginheight] DOMString marginHeight; + attribute [ConvertNullToNullString, Reflect=marginwidth] DOMString marginWidth; + attribute [ConvertNullToNullString, Reflect] DOMString name; + attribute [ConvertNullToNullString, Reflect] DOMString scrolling; + attribute [ConvertNullToNullString, CustomSetter, Reflect] DOMString src; + attribute [ConvertNullToNullString, Reflect] DOMString width; // Introduced in DOM Level 2: readonly attribute [CheckFrameSecurity] Document contentDocument; diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index 5173964..932e718 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -279,46 +279,11 @@ bool HTMLImageElement::isURLAttribute(Attribute* attr) const || (attr->name() == usemapAttr && attr->value().string()[0] != '#'); } -String HTMLImageElement::name() const -{ - return getAttribute(nameAttr); -} - -void HTMLImageElement::setName(const String& value) -{ - setAttribute(nameAttr, value); -} - -String HTMLImageElement::align() const -{ - return getAttribute(alignAttr); -} - -void HTMLImageElement::setAlign(const String& value) -{ - setAttribute(alignAttr, value); -} - -String HTMLImageElement::alt() const +const AtomicString& HTMLImageElement::alt() const { return getAttribute(altAttr); } -void HTMLImageElement::setAlt(const String& value) -{ - setAttribute(altAttr, value); -} - -String HTMLImageElement::border() const -{ - return getAttribute(borderAttr); -} - -void HTMLImageElement::setBorder(const String& value) -{ - setAttribute(borderAttr, value); -} - bool HTMLImageElement::draggable() const { // Image elements are draggable by default. @@ -381,16 +346,6 @@ void HTMLImageElement::setSrc(const String& value) setAttribute(srcAttr, value); } -String HTMLImageElement::useMap() const -{ - return getAttribute(usemapAttr); -} - -void HTMLImageElement::setUseMap(const String& value) -{ - setAttribute(usemapAttr, value); -} - int HTMLImageElement::vspace() const { // ### return actual vspace @@ -439,7 +394,8 @@ void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons HTMLElement::addSubresourceAttributeURLs(urls); addSubresourceURL(urls, src()); - addSubresourceURL(urls, document()->completeURL(useMap())); + // FIXME: What about when the usemap attribute begins with "#"? + addSubresourceURL(urls, document()->completeURL(getAttribute(usemapAttr))); } } diff --git a/WebCore/html/HTMLImageElement.h b/WebCore/html/HTMLImageElement.h index 5e82186..f58574d 100644 --- a/WebCore/html/HTMLImageElement.h +++ b/WebCore/html/HTMLImageElement.h @@ -69,17 +69,7 @@ public: void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); } - String name() const; - void setName(const String&); - - String align() const; - void setAlign(const String&); - - String alt() const; - void setAlt(const String&); - - String border() const; - void setBorder(const String&); + const AtomicString& alt() const; virtual bool draggable() const; @@ -100,9 +90,6 @@ public: KURL src() const; void setSrc(const String&); - String useMap() const; - void setUseMap(const String&); - int vspace() const; void setVspace(int); diff --git a/WebCore/html/HTMLKeygenElement.cpp b/WebCore/html/HTMLKeygenElement.cpp index b1b6238..6af088f 100644 --- a/WebCore/html/HTMLKeygenElement.cpp +++ b/WebCore/html/HTMLKeygenElement.cpp @@ -51,7 +51,7 @@ HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Document* doc for (Vector<String>::const_iterator it = keys.begin(); it != end; ++it) { HTMLOptionElement* o = new HTMLOptionElement(optionTag, doc, form()); addChild(o); - o->addChild(new Text(doc, *it)); + o->addChild(Text::create(doc, *it)); } } diff --git a/WebCore/html/HTMLObjectElement.idl b/WebCore/html/HTMLObjectElement.idl index 1880836..d3fb5c0 100644 --- a/WebCore/html/HTMLObjectElement.idl +++ b/WebCore/html/HTMLObjectElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -30,22 +30,22 @@ module html { ImplementationUUID=2dd24554-6784-4ef9-9713-179f3d37b2f9 ] HTMLObjectElement : HTMLElement { readonly attribute HTMLFormElement form; - attribute [ConvertNullToNullString] DOMString code; - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString archive; - attribute [ConvertNullToNullString] DOMString border; - attribute [ConvertNullToNullString] DOMString codeBase; - attribute [ConvertNullToNullString] DOMString codeType; - attribute [ConvertNullToNullString] DOMString data; + attribute [ConvertNullToNullString, Reflect] DOMString code; + attribute [ConvertNullToNullString, Reflect] DOMString align; + attribute [ConvertNullToNullString, Reflect] DOMString archive; + attribute [ConvertNullToNullString, Reflect] DOMString border; + attribute [ConvertNullToNullString, Reflect=codebase] DOMString codeBase; + attribute [ConvertNullToNullString, Reflect=codetype] DOMString codeType; + attribute [ConvertNullToNullString, ReflectURL] DOMString data; attribute boolean declare; - attribute [ConvertNullToNullString] DOMString height; + attribute [ConvertNullToNullString, Reflect] DOMString height; attribute long hspace; - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString standby; - attribute [ConvertNullToNullString] DOMString type; - attribute [ConvertNullToNullString] DOMString useMap; + attribute [ConvertNullToNullString, Reflect] DOMString name; + attribute [ConvertNullToNullString, Reflect] DOMString standby; + attribute [ConvertNullToNullString, Reflect] DOMString type; + attribute [ConvertNullToNullString, Reflect=usemap] DOMString useMap; attribute long vspace; - attribute [ConvertNullToNullString] DOMString width; + attribute [ConvertNullToNullString, Reflect] DOMString width; // Introduced in DOM Level 2: readonly attribute [CheckFrameSecurity] Document contentDocument; diff --git a/WebCore/html/HTMLOptionElement.cpp b/WebCore/html/HTMLOptionElement.cpp index 009db47..091b1a5 100644 --- a/WebCore/html/HTMLOptionElement.cpp +++ b/WebCore/html/HTMLOptionElement.cpp @@ -92,7 +92,7 @@ void HTMLOptionElement::setText(const String &text, ExceptionCode& ec) } removeChildren(); - appendChild(new Text(document(), text), ec); + appendChild(Text::create(document(), text), ec); } void HTMLOptionElement::accessKeyAction(bool) diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp index 722f4e2..b12c09b 100644 --- a/WebCore/html/HTMLParser.cpp +++ b/WebCore/html/HTMLParser.cpp @@ -692,13 +692,13 @@ typedef HashMap<AtomicStringImpl*, CreateErrorCheckFunc> FunctionMap; bool HTMLParser::textCreateErrorCheck(Token* t, RefPtr<Node>& result) { - result = new Text(m_document, t->text.get()); + result = Text::create(m_document, t->text.get()); return false; } bool HTMLParser::commentCreateErrorCheck(Token* t, RefPtr<Node>& result) { - result = new Comment(m_document, t->text.get()); + result = Comment::create(m_document, t->text.get()); return false; } @@ -1093,6 +1093,7 @@ bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName) unaffectedTags.add(selectTag.localName().impl()); unaffectedTags.add(objectTag.localName().impl()); unaffectedTags.add(datagridTag.localName().impl()); + unaffectedTags.add(datalistTag.localName().impl()); } return !unaffectedTags.contains(tagName.impl()); @@ -1598,7 +1599,7 @@ PassRefPtr<Node> HTMLParser::handleIsindex(Token* t) } n->addChild(new HTMLHRElement(hrTag, m_document)); - n->addChild(new Text(m_document, text)); + n->addChild(Text::create(m_document, text)); n->addChild(isIndex.release()); n->addChild(new HTMLHRElement(hrTag, m_document)); diff --git a/WebCore/html/HTMLTagNames.in b/WebCore/html/HTMLTagNames.in index c066e3c..ed75652 100644 --- a/WebCore/html/HTMLTagNames.in +++ b/WebCore/html/HTMLTagNames.in @@ -26,6 +26,7 @@ code interfaceName=HTMLElement col interfaceName=HTMLTableColElement colgroup interfaceName=HTMLTableColElement datagrid interfaceName=HTMLDataGridElement,conditional=DATAGRID +datalist interfaceName=HTMLDataListElement,conditional=DATALIST dcell interfaceName=HTMLDataGridCellElement,conditional=DATAGRID dcol interfaceName=HTMLDataGridColElement,conditional=DATAGRID drow interfaceName=HTMLDataGridRowElement,conditional=DATAGRID diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp index 13404cc..55c6df7 100644 --- a/WebCore/html/HTMLViewSourceDocument.cpp +++ b/WebCore/html/HTMLViewSourceDocument.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,9 +47,6 @@ using namespace HTMLNames; HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const String& mimeType) : HTMLDocument(frame) , m_type(mimeType) - , m_current(0) - , m_tbody(0) - , m_td(0) { setUsesBeforeAfterRules(true); } @@ -70,23 +67,23 @@ Tokenizer* HTMLViewSourceDocument::createTokenizer() void HTMLViewSourceDocument::createContainingTable() { - RefPtr<Element> html = new HTMLHtmlElement(htmlTag, this); + RefPtr<HTMLHtmlElement> html = new HTMLHtmlElement(htmlTag, this); addChild(html); html->attach(); - RefPtr<Element> body = new HTMLBodyElement(bodyTag, this); + RefPtr<HTMLBodyElement> body = new HTMLBodyElement(bodyTag, this); html->addChild(body); body->attach(); // Create a line gutter div that can be used to make sure the gutter extends down the height of the whole // document. - RefPtr<Element> div = new HTMLDivElement(divTag, this); + RefPtr<HTMLDivElement> div = new HTMLDivElement(divTag, this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-gutter-backdrop")); div->setAttributeMap(attrs.release()); body->addChild(div); div->attach(); - RefPtr<Element> table = new HTMLTableElement(tableTag, this); + RefPtr<HTMLTableElement> table = new HTMLTableElement(tableTag, this); body->addChild(table); table->attach(); m_tbody = new HTMLTableSectionElement(tbodyTag, this); @@ -205,31 +202,31 @@ void HTMLViewSourceDocument::addViewSourceDoctypeToken(DoctypeToken* doctypeToke addText(text, "webkit-html-doctype"); } -Element* HTMLViewSourceDocument::addSpanWithClassName(const String& className) +PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& className) { if (m_current == m_tbody) { addLine(className); return m_current; } - Element* span = new HTMLElement(spanTag, this); + RefPtr<HTMLElement> span = new HTMLElement(spanTag, this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); attrs->addAttribute(MappedAttribute::create(classAttr, className)); span->setAttributeMap(attrs.release()); m_current->addChild(span); span->attach(); - return span; + return span.release(); } void HTMLViewSourceDocument::addLine(const String& className) { // Create a table row. - RefPtr<Element> trow = new HTMLTableRowElement(trTag, this); + RefPtr<HTMLTableRowElement> trow = new HTMLTableRowElement(trTag, this); m_tbody->addChild(trow); trow->attach(); // Create a cell that will hold the line number (it is generated in the stylesheet using counters). - Element* td = new HTMLTableCellElement(tdTag, this); + RefPtr<HTMLTableCellElement> td = new HTMLTableCellElement(tdTag, this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-number")); td->setAttributeMap(attrs.release()); @@ -246,7 +243,7 @@ void HTMLViewSourceDocument::addLine(const String& className) m_current = m_td = td; #ifdef DEBUG_LINE_NUMBERS - RefPtr<Text> lineNumberText = new Text(this, String::number(tokenizer()->lineNumber() + 1) + " "); + RefPtr<Text> lineNumberText = Text::create(this, String::number(tokenizer()->lineNumber() + 1) + " "); td->addChild(lineNumberText); lineNumberText->attach(); #endif @@ -277,7 +274,7 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className } if (m_current == m_tbody) addLine(className); - RefPtr<Text> t = new Text(this, substring); + RefPtr<Text> t = Text::create(this, substring); m_current->addChild(t); t->attach(); if (i < size - 1) @@ -289,13 +286,13 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className m_current = m_tbody; } -Element* HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) +PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) { if (m_current == m_tbody) addLine("webkit-html-tag"); // Now create a link for the attribute value instead of a span. - Element* anchor = new HTMLAnchorElement(aTag, this); + RefPtr<HTMLAnchorElement> anchor = new HTMLAnchorElement(this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); const char* classValue; if (isAnchor) @@ -308,7 +305,7 @@ Element* HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) anchor->setAttributeMap(attrs.release()); m_current->addChild(anchor); anchor->attach(); - return anchor; + return anchor.release(); } } diff --git a/WebCore/html/HTMLViewSourceDocument.h b/WebCore/html/HTMLViewSourceDocument.h index 57a8f21..e4eadb0 100644 --- a/WebCore/html/HTMLViewSourceDocument.h +++ b/WebCore/html/HTMLViewSourceDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,18 +30,18 @@ namespace WebCore { class DoctypeToken; +class HTMLTableCellElement; +class HTMLTableSectionElement; + struct Token; class HTMLViewSourceDocument : public HTMLDocument { public: static PassRefPtr<HTMLViewSourceDocument> create(Frame* frame, const String& mimeType) { - return new HTMLViewSourceDocument(frame, mimeType); + return adoptRef(new HTMLViewSourceDocument(frame, mimeType)); } - // Returns HTMLTokenizer or TextTokenizer based on m_type. - virtual Tokenizer* createTokenizer(); - void addViewSourceToken(Token*); // Used by the HTML tokenizer. void addViewSourceText(const String&); // Used by the plaintext tokenizer. void addViewSourceDoctypeToken(DoctypeToken*); @@ -49,16 +49,19 @@ public: private: HTMLViewSourceDocument(Frame*, const String& mimeType); + // Returns HTMLTokenizer or TextTokenizer based on m_type. + virtual Tokenizer* createTokenizer(); + void createContainingTable(); - Element* addSpanWithClassName(const String&); + PassRefPtr<Element> addSpanWithClassName(const String&); void addLine(const String& className); void addText(const String& text, const String& className); - Element* addLink(const String& url, bool isAnchor); + PassRefPtr<Element> addLink(const String& url, bool isAnchor); String m_type; - Element* m_current; - Element* m_tbody; - Element* m_td; + RefPtr<Element> m_current; + RefPtr<HTMLTableSectionElement> m_tbody; + RefPtr<HTMLTableCellElement> m_td; }; } diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 20718e9..7203e12 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -1278,8 +1278,13 @@ static PassRefPtr<ImageData> createEmptyImageData(const IntSize& size) return data.get(); } -PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh) const +PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh, ExceptionCode& ec) const { + ec = 0; + if (!isfinite(sw) || !isfinite(sh)) { + ec = NOT_SUPPORTED_ERR; + return 0; + } FloatSize unscaledSize(sw, sh); IntSize scaledSize = m_canvas->convertLogicalToDevice(unscaledSize); if (scaledSize.width() < 1) @@ -1306,7 +1311,7 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, ImageBuffer* buffer = m_canvas ? m_canvas->buffer() : 0; if (!buffer) return createEmptyImageData(scaledRect.size()); - return buffer->getImageData(scaledRect); + return buffer->getUnmultipliedImageData(scaledRect); } void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionCode& ec) @@ -1357,7 +1362,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, sourceRect.move(-destOffset); IntPoint destPoint(destOffset.width(), destOffset.height()); - buffer->putImageData(data, sourceRect, destPoint); + buffer->putUnmultipliedImageData(data, sourceRect, destPoint); } String CanvasRenderingContext2D::font() const diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h index 9648ffc..7c47e55 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -178,7 +178,7 @@ namespace WebCore { PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&); PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&); - PassRefPtr<ImageData> createImageData(float width, float height) const; + PassRefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const; PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const; void putImageData(ImageData*, float dx, float dy, ExceptionCode&); void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&); diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.idl b/WebCore/html/canvas/CanvasRenderingContext2D.idl index a86b47d..0428054 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -113,7 +113,8 @@ module html { attribute [Custom] custom fillStyle; // pixel manipulation - ImageData createImageData(in float sw, in float sh); + ImageData createImageData(in float sw, in float sh) + raises (DOMException); ImageData getImageData(in float sx, in float sy, in float sw, in float sh) raises(DOMException); [Custom] void putImageData(/* in ImageData imagedata, in float dx, in float dy [, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight] */); diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 1eb10e8..ae2596a 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -30,6 +30,10 @@ #include "config.h" #include "InspectorBackend.h" +#if ENABLE(DATABASE) +#include "Database.h" +#endif + #include "Element.h" #include "Frame.h" #include "FrameLoader.h" @@ -37,8 +41,13 @@ #include "InspectorClient.h" #include "InspectorController.h" #include "InspectorDOMAgent.h" +#include "InspectorFrontend.h" #include "InspectorResource.h" +#if ENABLE(DOM_STORAGE) +#include "Storage.h" +#endif + #if ENABLE(JAVASCRIPT_DEBUGGER) #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" @@ -139,10 +148,10 @@ bool InspectorBackend::addSourceToFrame(const String& mimeType, const String& so return true; } -void InspectorBackend::clearMessages() +void InspectorBackend::clearMessages(bool clearUI) { if (m_inspectorController) - m_inspectorController->clearConsoleMessages(); + m_inspectorController->clearConsoleMessages(clearUI); } void InspectorBackend::toggleNodeSearch() @@ -182,10 +191,10 @@ bool InspectorBackend::searchingForNode() return false; } -void InspectorBackend::loaded(bool enableDOMAgent) +void InspectorBackend::loaded() { if (m_inspectorController) - m_inspectorController->scriptObjectReady(enableDOMAgent); + m_inspectorController->scriptObjectReady(); } void InspectorBackend::enableResourceTracking(bool always) @@ -355,10 +364,10 @@ void InspectorBackend::stepOutOfFunctionInDebugger() #endif -void InspectorBackend::getChildNodes(long callId, long elementId) +void InspectorBackend::getChildNodes(long callId, long nodeId) { if (m_inspectorController) - m_inspectorController->domAgent()->getChildNodes(callId, elementId); + m_inspectorController->domAgent()->getChildNodes(callId, nodeId); } void InspectorBackend::setAttribute(long callId, long elementId, const String& name, const String& value) @@ -373,16 +382,87 @@ void InspectorBackend::removeAttribute(long callId, long elementId, const String m_inspectorController->domAgent()->removeAttribute(callId, elementId, name); } -void InspectorBackend::setTextNodeValue(long callId, long elementId, const String& value) +void InspectorBackend::setTextNodeValue(long callId, long nodeId, const String& value) { if (m_inspectorController) - m_inspectorController->domAgent()->setTextNodeValue(callId, elementId, value); + m_inspectorController->domAgent()->setTextNodeValue(callId, nodeId, value); } -void InspectorBackend::highlight(Node* node) +void InspectorBackend::highlight(long nodeId) +{ + if (m_inspectorController) { + Node* node = m_inspectorController->domAgent()->nodeForId(nodeId); + if (node) + m_inspectorController->highlight(node); + } +} + +Node* InspectorBackend::nodeForId(long nodeId) { if (m_inspectorController) - m_inspectorController->highlight(node); + return m_inspectorController->domAgent()->nodeForId(nodeId); + return 0; } +long InspectorBackend::idForNode(Node* node) +{ + if (m_inspectorController) + return m_inspectorController->domAgent()->idForNode(node); + return -1; +} + +ScriptValue InspectorBackend::wrapObject(const ScriptValue& object) +{ + if (m_inspectorController) + return m_inspectorController->wrapObject(object); + return ScriptValue(); +} + +ScriptValue InspectorBackend::unwrapObject(const String& objectId) +{ + if (m_inspectorController) + return m_inspectorController->unwrapObject(objectId); + return ScriptValue(); +} + +long InspectorBackend::pushNodePathToFrontend(Node* node, bool selectInUI) +{ + if (!m_inspectorController) + return 0; + if (!m_inspectorController->m_domAgent || !m_inspectorController->m_frontend) + return 0; + long id = m_inspectorController->m_domAgent->pushNodePathToFrontend(node); + if (selectInUI) + m_inspectorController->m_frontend->updateFocusedNode(id); + return id; +} + +void InspectorBackend::addNodesToSearchResult(const String& nodeIds) +{ + if (m_inspectorController && m_inspectorController->m_frontend) + m_inspectorController->m_frontend->addNodesToSearchResult(nodeIds); +} + +#if ENABLE(DATABASE) +void InspectorBackend::selectDatabase(Database* database) +{ + if (!m_inspectorController) + return; + if (!m_inspectorController->m_frontend) + return; + m_inspectorController->m_frontend->selectDatabase(database); +} +#endif + +#if ENABLE(DOM_STORAGE) +void InspectorBackend::selectDOMStorage(Storage* storage) +{ + if (!m_inspectorController) + return; + if (!m_inspectorController->m_frontend) + return; + m_inspectorController->m_frontend->selectDOMStorage(storage); +} +#endif + } // namespace WebCore diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index daa16b4..c40e1b9 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -38,10 +38,12 @@ namespace WebCore { class CachedResource; +class Database; class InspectorClient; class InspectorDOMAgent; class JavaScriptCallFrame; class Node; +class Storage; class InspectorBackend : public RefCounted<InspectorBackend> { @@ -69,7 +71,7 @@ public: void addResourceSourceToFrame(long identifier, Node* frame); bool addSourceToFrame(const String& mimeType, const String& source, Node* frame); - void clearMessages(); + void clearMessages(bool clearUI); void toggleNodeSearch(); @@ -82,7 +84,7 @@ public: bool searchingForNode(); - void loaded(bool enableDOMAgent); + void loaded(); void enableResourceTracking(bool always); void disableResourceTracking(bool always); @@ -123,13 +125,25 @@ public: void stepOutOfFunctionInDebugger(); #endif - void getChildNodes(long callId, long elementId); + void getChildNodes(long callId, long nodeId); void setAttribute(long callId, long elementId, const String& name, const String& value); void removeAttribute(long callId, long elementId, const String& name); - void setTextNodeValue(long callId, long elementId, const String& value); + void setTextNodeValue(long callId, long nodeId, const String& value); // Generic code called from custom implementations. - void highlight(Node* node); + void highlight(long nodeId); + Node* nodeForId(long nodeId); + long idForNode(Node* node); + ScriptValue wrapObject(const ScriptValue& object); + ScriptValue unwrapObject(const String& objectId); + long pushNodePathToFrontend(Node* node, bool selectInUI); + void addNodesToSearchResult(const String& nodeIds); +#if ENABLE(DATABASE) + void selectDatabase(Database* database); +#endif +#if ENABLE(DOM_STORAGE) + void selectDOMStorage(Storage* storage); +#endif private: InspectorBackend(InspectorController* inspectorController, InspectorClient* client); diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl index bae1f26..942819e 100644 --- a/WebCore/inspector/InspectorBackend.idl +++ b/WebCore/inspector/InspectorBackend.idl @@ -35,14 +35,14 @@ module core { GenerateConstructor ] InspectorBackend { void hideDOMNodeHighlight(); - [Custom] void highlightDOMNode(in Node node); - void loaded(in boolean enableDOMAgent); + [Custom] void highlightDOMNode(in long nodeId); + void loaded(); void windowUnloading(); void attach(); void detach(); void closeWindow(); - void clearMessages(); + void clearMessages(in boolean clearUI); void toggleNodeSearch(); boolean isWindowVisible(); @@ -68,6 +68,9 @@ module core { void disableResourceTracking(in boolean always); void storeLastActivePanel(in DOMString panelName); + [Custom] Array cookies(); + [Custom] void deleteCookie(in DOMString cookieName); + #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER boolean debuggerEnabled(); void enableDebugger(in boolean always); @@ -97,9 +100,23 @@ module core { [Custom] Array profiles(); #endif - void getChildNodes(in long callId, in long elementId); + void getChildNodes(in long callId, in long nodeId); void setAttribute(in long callId, in long elementId, in DOMString name, in DOMString value); void removeAttribute(in long callId, in long elementId, in DOMString name); - void setTextNodeValue(in long callId, in long elementId, in DOMString value); + void setTextNodeValue(in long callId, in long nodeId, in DOMString value); + + // Called from InjectedScript. + [Custom] DOMObject nodeForId(in long nodeId); + [Custom] long idForNode(in DOMObject node); + [Custom] long wrapObject(in DOMObject object); + [Custom] DOMObject unwrapObject(in long objectId); + [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean selectInUI); + void addNodesToSearchResult(in DOMString nodeIds); +#if defined(ENABLE_DATABASE) && ENABLE_DATABASE + [Custom] void selectDatabase(in DOMObject database); +#endif +#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE + [Custom] void selectDOMStorage(in DOMObject storage); +#endif }; - } +} diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index c3351e5..3035d4e 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -61,7 +61,9 @@ #include "ResourceRequest.h" #include "ResourceResponse.h" #include "ScriptCallStack.h" +#include "ScriptFunctionCall.h" #include "ScriptObject.h" +#include "ScriptObjectQuarantine.h" #include "ScriptString.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -125,6 +127,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_resourceTrackingEnabled(false) , m_resourceTrackingSettingsLoaded(false) , m_inspectorBackend(InspectorBackend::create(this, client)) + , m_lastBoundObjectId(1) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_debuggerEnabled(false) , m_attachDebuggerWhenShown(false) @@ -270,7 +273,8 @@ void InspectorController::focusNode() ASSERT(m_frontend); ASSERT(m_nodeToFocus); - m_frontend->updateFocusedNode(m_nodeToFocus.get()); + long id = m_domAgent->pushNodePathToFrontend(m_nodeToFocus.get()); + m_frontend->updateFocusedNode(id); m_nodeToFocus = 0; } @@ -378,12 +382,15 @@ void InspectorController::addConsoleMessage(ScriptState* scriptState, ConsoleMes m_previousMessage->addToConsole(m_frontend.get()); } -void InspectorController::clearConsoleMessages() +void InspectorController::clearConsoleMessages(bool clearUI) { deleteAllValues(m_consoleMessages); m_consoleMessages.clear(); m_previousMessage = 0; m_groupLevel = 0; + m_idToConsoleObject.clear(); + if (clearUI && m_frontend) + m_frontend->clearConsoleMessages(); } void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack) @@ -492,14 +499,6 @@ void InspectorController::handleMousePressOnNode(Node* node) inspect(node); } -void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) -{ - if (!enabled() || !m_frontend) - return; - - m_frontend->inspectedWindowScriptObjectCleared(frame); -} - void InspectorController::windowScriptObjectAvailable() { if (!m_page || !enabled()) @@ -511,7 +510,7 @@ void InspectorController::windowScriptObjectAvailable() ScriptGlobalObject::set(m_scriptState, "InspectorController", m_inspectorBackend.get()); } -void InspectorController::scriptObjectReady(bool enableDOMAgent) +void InspectorController::scriptObjectReady() { ASSERT(m_scriptState); if (!m_scriptState) @@ -520,9 +519,10 @@ void InspectorController::scriptObjectReady(bool enableDOMAgent) ScriptObject webInspectorObj; if (!ScriptGlobalObject::get(m_scriptState, "WebInspector", webInspectorObj)) return; - setFrontendProxyObject(m_scriptState, webInspectorObj); - if (enableDOMAgent) - m_domAgent = new InspectorDOMAgent(m_frontend.get()); + ScriptObject injectedScriptObj; + if (!ScriptGlobalObject::get(m_scriptState, "InjectedScript", injectedScriptObj)) + return; + setFrontendProxyObject(m_scriptState, webInspectorObj, injectedScriptObj); #if ENABLE(JAVASCRIPT_DEBUGGER) Setting debuggerEnabled = setting(debuggerEnabledSettingName); @@ -539,9 +539,12 @@ void InspectorController::scriptObjectReady(bool enableDOMAgent) m_client->inspectorWindowObjectCleared(); } -void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj) +void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject injectedScriptObj) { - m_frontend.set(new InspectorFrontend(scriptState, webInspectorObj)); + m_scriptState = scriptState; + m_injectedScriptObj = injectedScriptObj; + m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj)); + m_domAgent = new InspectorDOMAgent(m_frontend.get()); } void InspectorController::show() @@ -595,10 +598,8 @@ void InspectorController::close() closeWindow(); m_frontend.set(0); - if (m_domAgent) { - m_domAgent->setDocument(0); - m_domAgent = 0; - } + m_injectedScriptObj = ScriptObject(); + m_domAgent = 0; m_scriptState = 0; } @@ -649,8 +650,8 @@ void InspectorController::populateScriptObjects() (*it)->bind(m_frontend.get()); #endif - if (m_domAgent) - m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); + if (m_domAgent->setDocument(m_inspectedPage->mainFrame()->document())) + resetInjectedScript(); m_frontend->populateInterface(); } @@ -706,7 +707,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) if (loader->frame() == m_inspectedPage->mainFrame()) { m_client->inspectedURLChanged(loader->url().string()); - clearConsoleMessages(); + clearConsoleMessages(false); m_times.clear(); m_counts.clear(); @@ -725,7 +726,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) if (windowVisible()) { resetScriptObjects(); - if (!loader->isLoadingFromCachedPage()) { + if (!loader->frameLoader()->isLoadingFromCachedPage()) { ASSERT(m_mainResource && m_mainResource->isSameLoader(loader)); // We don't add the main resource until its load is committed. This is // needed to keep the load for a user-entered URL from showing up in the @@ -740,8 +741,8 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) } } - if (m_domAgent) - m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); + if (m_domAgent && m_domAgent->setDocument(m_inspectedPage->mainFrame()->document())) + resetInjectedScript(); } for (Frame* frame = loader->frame(); frame; frame = frame->tree()->traverseNext(loader->frame())) @@ -859,7 +860,7 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier, addResource(resource.get()); - if (windowVisible() && loader->isLoadingFromCachedPage() && resource == m_mainResource) + if (windowVisible() && loader->frameLoader()->isLoadingFromCachedPage() && resource == m_mainResource) resource->createScriptObject(m_frontend.get()); } @@ -1478,4 +1479,34 @@ InspectorController::SpecialPanels InspectorController::specialPanelForJSName(co return ElementsPanel; } +ScriptValue InspectorController::wrapObject(const ScriptValue& quarantinedObject) +{ + if (quarantinedObject.isObject()) { + long id = m_lastBoundObjectId++; + String objectId = String::format("object#%ld", id); + m_idToConsoleObject.set(objectId, quarantinedObject); + + ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject"); + function.appendArgument(quarantinedObject); + function.appendArgument(objectId); + ScriptValue wrapper = function.call(); + return wrapper; + } + return quarantinedObject; +} + +ScriptValue InspectorController::unwrapObject(const String& objectId) +{ + HashMap<String, ScriptValue>::iterator it = m_idToConsoleObject.find(objectId); + if (it != m_idToConsoleObject.end()) + return it->second; + return ScriptValue(); +} + +void InspectorController::resetInjectedScript() +{ + ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "reset"); + function.call(); +} + } // namespace WebCore diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 632b0ce..6a31deb 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -31,7 +31,9 @@ #include "Console.h" #include "PlatformString.h" +#include "ScriptObject.h" #include "ScriptState.h" +#include "ScriptValue.h" #include "StringHash.h" #include "Timer.h" @@ -60,7 +62,6 @@ class HitTestResult; class InspectorClient; class InspectorDOMAgent; class JavaScriptCallFrame; -class StorageArea; class KURL; class Node; class Page; @@ -68,9 +69,9 @@ struct ResourceRequest; class ResourceResponse; class ResourceError; class ScriptCallStack; -class ScriptObject; class ScriptString; class SharedBuffer; +class StorageArea; class ConsoleMessage; class InspectorDatabaseResource; @@ -187,7 +188,7 @@ public: void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*); void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID); - void clearConsoleMessages(); + void clearConsoleMessages(bool clearUI); const Vector<ConsoleMessage*>& consoleMessages() const { return m_consoleMessages; } void attachWindow(); @@ -198,10 +199,9 @@ public: void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void handleMousePressOnNode(Node*); - void inspectedWindowScriptObjectCleared(Frame*); void windowScriptObjectAvailable(); - void setFrontendProxyObject(ScriptState* state, ScriptObject object); + void setFrontendProxyObject(ScriptState* state, ScriptObject webInspectorObj, ScriptObject injectedScriptObj = ScriptObject()); void populateScriptObjects(); void resetScriptObjects(); @@ -279,7 +279,7 @@ private: #endif // Following are used from InspectorBackend and internally. - void scriptObjectReady(bool enableDOMAgent); + void scriptObjectReady(); void moveWindowBy(float x, float y) const; void setAttachedWindow(bool); void setAttachedWindowHeight(unsigned height); @@ -287,6 +287,15 @@ private: void closeWindow(); InspectorDOMAgent* domAgent() { return m_domAgent.get(); } + friend class InspectorFrontend; + // Following are used from InspectorFrontend only. We don't want to expose them to the + // rest of the InspectorController clients. + // TODO: extract these into a separate interface. + ScriptValue wrapObject(const ScriptValue& object); + ScriptValue unwrapObject(const String& objectId); + + void resetInjectedScript(); + #if ENABLE(JAVASCRIPT_DEBUGGER) void startUserInitiatedProfilingSoon(); void toggleRecordButton(bool); @@ -314,6 +323,7 @@ private: InspectorClient* m_client; RefPtr<InspectorDOMAgent> m_domAgent; + ScriptObject m_injectedScriptObj; Page* m_page; RefPtr<Node> m_nodeToFocus; RefPtr<InspectorResource> m_mainResource; @@ -343,6 +353,8 @@ private: OwnPtr<InspectorFrontend> m_frontend; RefPtr<InspectorBackend> m_inspectorBackend; #endif + HashMap<String, ScriptValue> m_idToConsoleObject; + long m_lastBoundObjectId; #if ENABLE(JAVASCRIPT_DEBUGGER) bool m_debuggerEnabled; bool m_attachDebuggerWhenShown; diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index f222239..8a081f7 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -31,6 +31,7 @@ #include "InspectorDOMAgent.h" #include "AtomicString.h" +#include "ContainerNode.h" #include "DOMWindow.h" #include "Document.h" #include "Event.h" @@ -63,10 +64,11 @@ InspectorDOMAgent::~InspectorDOMAgent() setDocument(0); } -void InspectorDOMAgent::setDocument(Document* doc) +bool InspectorDOMAgent::setDocument(Document* doc) { if (doc == mainFrameDocument()) - return; + return false; + discardBindings(); ListHashSet<RefPtr<Document> > copy = m_documents; for (ListHashSet<RefPtr<Document> >::iterator it = copy.begin(); it != copy.end(); ++it) @@ -77,11 +79,10 @@ void InspectorDOMAgent::setDocument(Document* doc) if (doc) { startListening(doc); if (doc->documentElement()) { - pushDocumentElementToFrontend(); + pushDocumentToFrontend(); } - } else { - discardBindings(); } + return true; } void InspectorDOMAgent::startListening(Document* doc) @@ -94,6 +95,7 @@ void InspectorDOMAgent::startListening(Document* doc) doc->addEventListener(eventNames().DOMNodeRemovedEvent, this, false); doc->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, true); doc->addEventListener(eventNames().DOMAttrModifiedEvent, this, false); + doc->addEventListener(eventNames().loadEvent, this, true); m_documents.add(doc); } @@ -107,6 +109,7 @@ void InspectorDOMAgent::stopListening(Document* doc) doc->removeEventListener(eventNames().DOMNodeRemovedEvent, this, false); doc->removeEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, true); doc->removeEventListener(eventNames().DOMAttrModifiedEvent, this, false); + doc->removeEventListener(eventNames().loadEvent, this, true); m_documents.remove(doc); } @@ -169,7 +172,25 @@ void InspectorDOMAgent::handleEvent(Event* event, bool) } else if (type == eventNames().DOMContentLoadedEvent) { // Re-push document once it is loaded. discardBindings(); - pushDocumentElementToFrontend(); + pushDocumentToFrontend(); + } else if (type == eventNames().loadEvent) { + long frameOwnerId = idForNode(node); + if (!frameOwnerId) + return; + + if (!m_childrenRequested.contains(frameOwnerId)) { + // No children are mapped yet -> only notify on changes of hasChildren. + m_frontend->hasChildrenUpdated(frameOwnerId, true); + } else { + // Re-add frame owner element together with its new children. + long parentId = idForNode(innerParentNode(node)); + m_frontend->childNodeRemoved(parentId, frameOwnerId); + long prevId = idForNode(innerPreviousSibling(node)); + ScriptObject value = buildObjectForNode(node, 0); + m_frontend->childNodeInserted(parentId, prevId, value); + // Invalidate children requested flag for the element. + m_childrenRequested.remove(m_childrenRequested.find(frameOwnerId)); + } } } @@ -199,25 +220,24 @@ void InspectorDOMAgent::unbind(Node* node) } } -void InspectorDOMAgent::pushDocumentElementToFrontend() +void InspectorDOMAgent::pushDocumentToFrontend() { - Element* docElem = mainFrameDocument()->documentElement(); - if (!m_nodeToId.contains(docElem)) - m_frontend->setDocumentElement(buildObjectForNode(docElem, 0)); + Document* document = mainFrameDocument(); + if (!m_nodeToId.contains(document)) + m_frontend->setDocument(buildObjectForNode(document, 2)); } -void InspectorDOMAgent::pushChildNodesToFrontend(long elementId) +void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId) { - Node* node = nodeForId(elementId); - if (!node || (node->nodeType() != Node::ELEMENT_NODE)) + Node* node = nodeForId(nodeId); + if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)) return; - if (m_childrenRequested.contains(elementId)) + if (m_childrenRequested.contains(nodeId)) return; - Element* element = static_cast<Element*>(node); - ScriptArray children = buildArrayForElementChildren(element, 1); - m_childrenRequested.add(elementId); - m_frontend->setChildNodes(elementId, children); + ScriptArray children = buildArrayForContainerChildren(node, 1); + m_childrenRequested.add(nodeId); + m_frontend->setChildNodes(nodeId, children); } void InspectorDOMAgent::discardBindings() @@ -229,6 +249,9 @@ void InspectorDOMAgent::discardBindings() Node* InspectorDOMAgent::nodeForId(long id) { + if (!id) + return 0; + HashMap<long, Node*>::iterator it = m_idToNode.find(id); if (it != m_idToNode.end()) return it->second; @@ -245,9 +268,9 @@ long InspectorDOMAgent::idForNode(Node* node) return 0; } -void InspectorDOMAgent::getChildNodes(long callId, long elementId) +void InspectorDOMAgent::getChildNodes(long callId, long nodeId) { - pushChildNodesToFrontend(elementId); + pushChildNodesToFrontend(nodeId); m_frontend->didGetChildNodes(callId); } @@ -256,25 +279,25 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush) ASSERT(nodeToPush); // Invalid input // If we are sending information to the client that is currently being created. Send root node first. - pushDocumentElementToFrontend(); + pushDocumentToFrontend(); // Return id in case the node is known. long result = idForNode(nodeToPush); if (result) return result; - Element* element = innerParentElement(nodeToPush); - ASSERT(element); // Node is detached or is a document itself + Node* node = innerParentNode(nodeToPush); + ASSERT(node); // Node is detached or is a document itself - Vector<Element*> path; - while (element && !idForNode(element)) { - path.append(element); - element = innerParentElement(element); + Vector<Node*> path; + while (node && !idForNode(node)) { + path.append(node); + node = innerParentNode(node); } // element is known to the client - ASSERT(element); - path.append(element); + ASSERT(node); + path.append(node); for (int i = path.size() - 1; i >= 0; --i) { long nodeId = idForNode(path.at(i)); ASSERT(nodeId); @@ -309,9 +332,9 @@ void InspectorDOMAgent::removeAttribute(long callId, long elementId, const Strin } } -void InspectorDOMAgent::setTextNodeValue(long callId, long elementId, const String& value) +void InspectorDOMAgent::setTextNodeValue(long callId, long nodeId, const String& value) { - Node* node = nodeForId(elementId); + Node* node = nodeForId(nodeId); if (node && (node->nodeType() == Node::TEXT_NODE)) { Text* text_node = static_cast<Text*>(node); ExceptionCode ec = 0; @@ -336,9 +359,9 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth) nodeValue = node->nodeValue(); break; case Node::ATTRIBUTE_NODE: - case Node::DOCUMENT_NODE: case Node::DOCUMENT_FRAGMENT_NODE: break; + case Node::DOCUMENT_NODE: case Node::ELEMENT_NODE: default: nodeName = node->nodeName(); @@ -353,10 +376,11 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth) if (node->nodeType() == Node::ELEMENT_NODE) { Element* element = static_cast<Element*>(node); value.set("attributes", buildArrayForElementAttributes(element)); - int nodeCount = innerChildNodeCount(element); + } + if (node->nodeType() == Node::ELEMENT_NODE || node->nodeType() == Node::DOCUMENT_NODE) { + int nodeCount = innerChildNodeCount(node); value.set("childNodeCount", nodeCount); - - ScriptArray children = buildArrayForElementChildren(element, depth); + ScriptArray children = buildArrayForContainerChildren(node, depth); if (children.length() > 0) value.set("children", children); } @@ -381,14 +405,14 @@ ScriptArray InspectorDOMAgent::buildArrayForElementAttributes(Element* element) return attributesValue; } -ScriptArray InspectorDOMAgent::buildArrayForElementChildren(Element* element, int depth) +ScriptArray InspectorDOMAgent::buildArrayForContainerChildren(Node* container, int depth) { ScriptArray children = m_frontend->newScriptArray(); if (depth == 0) { int index = 0; // Special case the_only text child. - if (innerChildNodeCount(element) == 1) { - Node *child = innerFirstChild(element); + if (innerChildNodeCount(container) == 1) { + Node *child = innerFirstChild(container); if (child->nodeType() == Node::TEXT_NODE) children.set(index++, buildObjectForNode(child, 0)); } @@ -398,7 +422,7 @@ ScriptArray InspectorDOMAgent::buildArrayForElementChildren(Element* element, in } int index = 0; - for (Node *child = innerFirstChild(element); child; child = innerNextSibling(child)) + for (Node *child = innerFirstChild(container); child; child = innerNextSibling(child)) children.set(index++, buildObjectForNode(child, depth)); return children; } @@ -446,12 +470,12 @@ int InspectorDOMAgent::innerChildNodeCount(Node* node) return count; } -Element* InspectorDOMAgent::innerParentElement(Node* node) +Node* InspectorDOMAgent::innerParentNode(Node* node) { - Element* element = node->parentElement(); - if (!element) - return node->ownerDocument()->ownerElement(); - return element; + Node* parent = node->parentNode(); + if (parent && parent->nodeType() == Node::DOCUMENT_NODE) + return static_cast<Document*>(parent)->ownerElement(); + return parent; } bool InspectorDOMAgent::isWhitespace(Node* node) diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index 28c3a22..67b2be8 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -42,6 +42,7 @@ #include <wtf/RefPtr.h> namespace WebCore { + class ContainerNode; class Element; class Event; class Document; @@ -56,13 +57,13 @@ namespace WebCore { ~InspectorDOMAgent(); // Methods called from the frontend. - void getChildNodes(long callId, long elementId); + void getChildNodes(long callId, long nodeId); void setAttribute(long callId, long elementId, const String& name, const String& value); void removeAttribute(long callId, long elementId, const String& name); - void setTextNodeValue(long callId, long elementId, const String& value); + void setTextNodeValue(long callId, long nodeId, const String& value); // Methods called from the InspectorController. - void setDocument(Document* document); + bool setDocument(Document* document); Node* nodeForId(long nodeId); long idForNode(Node* node); @@ -77,12 +78,12 @@ namespace WebCore { long bind(Node* node); void unbind(Node* node); - void pushDocumentElementToFrontend(); - void pushChildNodesToFrontend(long elementId); + void pushDocumentToFrontend(); + void pushChildNodesToFrontend(long nodeId); ScriptObject buildObjectForNode(Node* node, int depth); - ScriptArray buildArrayForElementAttributes(Element* elemen); - ScriptArray buildArrayForElementChildren(Element* element, int depth); + ScriptArray buildArrayForElementAttributes(Element* element); + ScriptArray buildArrayForContainerChildren(Node* container, int depth); // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. // We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics. @@ -90,7 +91,7 @@ namespace WebCore { Node* innerNextSibling(Node* node); Node* innerPreviousSibling(Node* node); int innerChildNodeCount(Node* node); - Element* innerParentElement(Node* node); + Node* innerParentNode(Node* node); bool isWhitespace(Node* node); Document* mainFrameDocument(); diff --git a/WebCore/inspector/InspectorDOMStorageResource.cpp b/WebCore/inspector/InspectorDOMStorageResource.cpp index 03db649..1e56742 100644 --- a/WebCore/inspector/InspectorDOMStorageResource.cpp +++ b/WebCore/inspector/InspectorDOMStorageResource.cpp @@ -64,7 +64,7 @@ void InspectorDOMStorageResource::bind(InspectorFrontend* frontend) ScriptObject jsonObject = frontend->newScriptObject(); ScriptObject domStorage; - if (!getQuarantinedScriptObject(m_frame.get(), m_domStorage.get(), domStorage)) + if (!getQuarantinedScriptObject(m_domStorage.get(), domStorage)) return; jsonObject.set("domStorage", domStorage); jsonObject.set("host", m_frame->document()->securityOrigin()->host()); diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index af65fb4..f745ae3 100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp @@ -32,7 +32,7 @@ #include "ConsoleMessage.h" #include "Frame.h" -#include "InspectorController.h" // TODO(pfeldman): Extract SpecialPanels to remove include. +#include "InspectorController.h" #include "Node.h" #include "ScriptFunctionCall.h" #include "ScriptObject.h" @@ -49,8 +49,9 @@ namespace WebCore { -InspectorFrontend::InspectorFrontend(ScriptState* scriptState, ScriptObject webInspector) - : m_scriptState(scriptState) +InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptState* scriptState, ScriptObject webInspector) + : m_inspectorController(inspectorController) + , m_scriptState(scriptState) , m_webInspector(webInspector) { } @@ -79,12 +80,17 @@ void InspectorFrontend::addMessageToConsole(const ScriptObject& messageObj, cons function->appendArgument(frames[i]); } else if (!wrappedArguments.isEmpty()) { for (unsigned i = 0; i < wrappedArguments.size(); ++i) - function->appendArgument(wrappedArguments[i]); + function->appendArgument(m_inspectorController->wrapObject(wrappedArguments[i])); } else function->appendArgument(message); function->call(); } +void InspectorFrontend::clearConsoleMessages() +{ + callSimpleFunction("clearConsoleMessages"); +} + bool InspectorFrontend::addResource(long long identifier, const ScriptObject& resourceObj) { OwnPtr<ScriptFunctionCall> function(newFunctionCall("addResource")); @@ -112,14 +118,10 @@ void InspectorFrontend::removeResource(long long identifier) function->call(); } -void InspectorFrontend::updateFocusedNode(Node* node) +void InspectorFrontend::updateFocusedNode(long long nodeId) { - ScriptObject quarantinedNode; - if (!getQuarantinedScriptObject(node, quarantinedNode)) - return; - OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateFocusedNode")); - function->appendArgument(quarantinedNode); + function->appendArgument(nodeId); function->call(); } @@ -130,17 +132,6 @@ void InspectorFrontend::setAttachedWindow(bool attached) function->call(); } -void InspectorFrontend::inspectedWindowScriptObjectCleared(Frame* frame) -{ - ScriptObject domWindow; - if (!getQuarantinedScriptObject(frame->domWindow(), domWindow)) - return; - - OwnPtr<ScriptFunctionCall> function(newFunctionCall("inspectedWindowCleared")); - function->appendArgument(domWindow); - function->call(); -} - void InspectorFrontend::showPanel(int panel) { const char* showFunctionName; @@ -286,9 +277,9 @@ bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj) } #endif -void InspectorFrontend::setDocumentElement(const ScriptObject& root) +void InspectorFrontend::setDocument(const ScriptObject& root) { - OwnPtr<ScriptFunctionCall> function(newFunctionCall("setDocumentElement")); + OwnPtr<ScriptFunctionCall> function(newFunctionCall("setDocument")); function->appendArgument(root); function->call(); } @@ -349,6 +340,37 @@ void InspectorFrontend::didApplyDomChange(int callId, bool success) function->call(); } +#if ENABLE(DATABASE) +void InspectorFrontend::selectDatabase(Database* database) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDatabase")); + ScriptObject quarantinedObject; + if (!getQuarantinedScriptObject(database, quarantinedObject)) + return; + function->appendArgument(quarantinedObject); + function->call(); +} +#endif + +#if ENABLE(DOM_STORAGE) +void InspectorFrontend::selectDOMStorage(Storage* storage) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDOMStorage")); + ScriptObject quarantinedObject; + if (!getQuarantinedScriptObject(storage, quarantinedObject)) + return; + function->appendArgument(quarantinedObject); + function->call(); +} +#endif + +void InspectorFrontend::addNodesToSearchResult(const String& nodeIds) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("addNodesToSearchResult")); + function->appendArgument(nodeIds); + function->call(); +} + PassOwnPtr<ScriptFunctionCall> InspectorFrontend::newFunctionCall(const String& functionName) { ScriptFunctionCall* function = new ScriptFunctionCall(m_scriptState, m_webInspector, "dispatch"); diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h index 7a48b62..600f50a 100644 --- a/WebCore/inspector/InspectorFrontend.h +++ b/WebCore/inspector/InspectorFrontend.h @@ -45,28 +45,32 @@ namespace JSC { namespace WebCore { class ConsoleMessage; + class Database; + class Frame; + class InspectorController; class InspectorResource; class Node; class ScriptFunctionCall; class ScriptString; + class Storage; class InspectorFrontend { public: - InspectorFrontend(ScriptState*, ScriptObject webInspector); + InspectorFrontend(InspectorController* inspectorController, ScriptState*, ScriptObject webInspector); ~InspectorFrontend(); ScriptArray newScriptArray(); ScriptObject newScriptObject(); void addMessageToConsole(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message); - + void clearConsoleMessages(); + bool addResource(long long identifier, const ScriptObject& resourceObj); bool updateResource(long long identifier, const ScriptObject& resourceObj); void removeResource(long long identifier); - void updateFocusedNode(Node* node); + void updateFocusedNode(long long nodeId); void setAttachedWindow(bool attached); - void inspectedWindowScriptObjectCleared(Frame* frame); void showPanel(int panel); void populateInterface(); void reset(); @@ -90,13 +94,15 @@ namespace WebCore { #if ENABLE(DATABASE) bool addDatabase(const ScriptObject& dbObj); + void selectDatabase(Database* database); #endif #if ENABLE(DOM_STORAGE) bool addDOMStorage(const ScriptObject& domStorageObj); + void selectDOMStorage(Storage* storage); #endif - void setDocumentElement(const ScriptObject& root); + void setDocument(const ScriptObject& root); void setChildNodes(int parentId, const ScriptArray& nodes); void hasChildrenUpdated(int id, bool newValue); void childNodeInserted(int parentId, int prevId, const ScriptObject& node); @@ -105,9 +111,12 @@ namespace WebCore { void didGetChildNodes(int callId); void didApplyDomChange(int callId, bool success); + void addNodesToSearchResult(const String& nodeIds); + private: PassOwnPtr<ScriptFunctionCall> newFunctionCall(const String& functionName); void callSimpleFunction(const String& functionName); + InspectorController* m_inspectorController; ScriptState* m_scriptState; ScriptObject m_webInspector; }; diff --git a/WebCore/inspector/JavaScriptDebugServer.cpp b/WebCore/inspector/JavaScriptDebugServer.cpp index 10eff26..008ddd3 100644 --- a/WebCore/inspector/JavaScriptDebugServer.cpp +++ b/WebCore/inspector/JavaScriptDebugServer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,10 +45,8 @@ #include "ScrollView.h" #include "Widget.h" #include "ScriptController.h" -#include <runtime/CollectorHeapIterator.h> #include <debugger/DebuggerCallFrame.h> #include <runtime/JSLock.h> -#include <parser/Parser.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> #include <wtf/UnusedParam.h> @@ -299,8 +297,6 @@ void JavaScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& sour m_callingListeners = true; - ASSERT(hasListeners()); - bool isError = errorLine != -1; if (hasGlobalListeners()) { @@ -555,60 +551,7 @@ void JavaScriptDebugServer::recompileAllJSFunctionsSoon() void JavaScriptDebugServer::recompileAllJSFunctions(Timer<JavaScriptDebugServer>*) { JSLock lock(SilenceAssertionsOnly); - JSGlobalData* globalData = JSDOMWindow::commonJSGlobalData(); - - // If JavaScript is running, it's not safe to recompile, since we'll end - // up throwing away code that is live on the stack. - ASSERT(!globalData->dynamicGlobalObject); - if (globalData->dynamicGlobalObject) - return; - - Vector<ProtectedPtr<JSFunction> > functions; - Heap::iterator heapEnd = globalData->heap.primaryHeapEnd(); - for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) { - if ((*it)->isObject(&JSFunction::info)) { - JSFunction* function = static_cast<JSFunction*>(*it); - if (!function->isHostFunction()) - functions.append(function); - } - } - - typedef HashMap<RefPtr<FunctionBodyNode>, RefPtr<FunctionBodyNode> > FunctionBodyMap; - typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap; - - FunctionBodyMap functionBodies; - SourceProviderMap sourceProviders; - - size_t size = functions.size(); - for (size_t i = 0; i < size; ++i) { - JSFunction* function = functions[i]; - - FunctionBodyNode* oldBody = function->body(); - pair<FunctionBodyMap::iterator, bool> result = functionBodies.add(oldBody, 0); - if (!result.second) { - function->setBody(result.first->second.get()); - continue; - } - - ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec(); - const SourceCode& sourceCode = oldBody->source(); - - RefPtr<FunctionBodyNode> newBody = globalData->parser->parse<FunctionBodyNode>(exec, 0, sourceCode); - ASSERT(newBody); - newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount()); - - result.first->second = newBody; - function->setBody(newBody.release()); - - if (hasListeners() && function->scope().globalObject()->debugger() == this) - sourceProviders.add(sourceCode.provider(), exec); - } - - // Call sourceParsed() after reparsing all functions because it will execute - // JavaScript in the inspector. - SourceProviderMap::const_iterator end = sourceProviders.end(); - for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter) - sourceParsed((*iter).second, SourceCode((*iter).first), -1, 0); + Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData()); } void JavaScriptDebugServer::didAddListener(Page* page) diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js index 6851eea..d4693b7 100644 --- a/WebCore/inspector/front-end/ConsoleView.js +++ b/WebCore/inspector/front-end/ConsoleView.js @@ -175,7 +175,7 @@ WebInspector.ConsoleView.prototype = { clearMessages: function(clearInspectorController) { if (clearInspectorController) - InspectorController.clearMessages(); + InspectorController.clearMessages(false); if (WebInspector.panels.resources) WebInspector.panels.resources.clearMessages(); @@ -212,10 +212,42 @@ WebInspector.ConsoleView.prototype = { return; var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix); - this._evalInInspectedWindow(expressionString, reportCompletions); + // Collect comma separated object properties for the completion. + + if (!expressionString) { + if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { + // Evaluate into properties in scope of the selected call frame. + reportCompletions(WebInspector.panels.scripts.variablesInSelectedCallFrame()); + return; + } else { + expressionString = "this"; + } + } + + function parsingCallback(result, isException) + { + if (!isException) + result = JSON.parse(result); + reportCompletions(result, isException); + } + + this._evalInInspectedWindow( + "(function() {" + + "var props = {};" + + "for (var prop in (" + expressionString + ")) props[prop] = true;" + + ((!dotNotation && !bracketNotation) ? + "for (var prop in window._inspectorCommandLineAPI)" + + "if (prop.charAt(0) !== '_') props[prop] = true;" + : "") + + "return JSON.stringify(props);" + + "})()", + parsingCallback); }, - _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result) { + _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) { + if (isException) + return; + if (bracketNotation) { if (prefix.length && prefix[0] === "'") var quoteUsed = "'"; @@ -224,16 +256,7 @@ WebInspector.ConsoleView.prototype = { } var results = []; - var properties = Object.properties(result); - if (!dotNotation && !bracketNotation && result._inspectorCommandLineAPI) { - var commandLineAPI = Object.properties(result._inspectorCommandLineAPI); - for (var i = 0; i < commandLineAPI.length; ++i) { - var property = commandLineAPI[i]; - if (property.charAt(0) !== "_") - properties.push(property); - } - } - properties.sort(); + var properties = Object.sortedProperties(result); for (var i = 0; i < properties.length; ++i) { var property = properties[i]; @@ -288,7 +311,7 @@ WebInspector.ConsoleView.prototype = { if (!link || !link.representedNode) return; - WebInspector.updateFocusedNode(link.representedNode); + WebInspector.updateFocusedNode(link.representedNode.id); event.stopPropagation(); event.preventDefault(); }, @@ -313,74 +336,6 @@ WebInspector.ConsoleView.prototype = { this.doEvalInWindow(expression, callback); }, - _ensureCommandLineAPIInstalled: function(inspectedWindow) - { - if (!inspectedWindow._inspectorCommandLineAPI) { - inspectedWindow.eval("window._inspectorCommandLineAPI = { \ - $: function() { return document.getElementById.apply(document, arguments) }, \ - $$: function() { return document.querySelectorAll.apply(document, arguments) }, \ - $x: function(xpath, context) { \ - var nodes = []; \ - try { \ - var doc = context || document; \ - var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); \ - var node; \ - while (node = results.iterateNext()) nodes.push(node); \ - } catch (e) {} \ - return nodes; \ - }, \ - dir: function() { return console.dir.apply(console, arguments) }, \ - dirxml: function() { return console.dirxml.apply(console, arguments) }, \ - keys: function(o) { var a = []; for (var k in o) a.push(k); return a; }, \ - values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \ - profile: function() { return console.profile.apply(console, arguments) }, \ - profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \ - _inspectedNodes: [], \ - get $0() { return _inspectorCommandLineAPI._inspectedNodes[0] }, \ - get $1() { return _inspectorCommandLineAPI._inspectedNodes[1] }, \ - get $2() { return _inspectorCommandLineAPI._inspectedNodes[2] }, \ - get $3() { return _inspectorCommandLineAPI._inspectedNodes[3] }, \ - get $4() { return _inspectorCommandLineAPI._inspectedNodes[4] } \ - };"); - - inspectedWindow._inspectorCommandLineAPI.clear = InspectorController.wrapCallback(this.clearMessages.bind(this)); - inspectedWindow._inspectorCommandLineAPI.inspect = InspectorController.wrapCallback(inspectObject.bind(this)); - - function inspectObject(o) - { - if (arguments.length === 0) - return; - - InspectorController.inspectedWindow().console.log(o); - if (Object.type(o, InspectorController.inspectedWindow()) === "node") { - WebInspector.showElementsPanel(); - WebInspector.panels.elements.treeOutline.revealAndSelectNode(o); - } else { - switch (Object.describe(o)) { - case "Database": - WebInspector.showDatabasesPanel(); - WebInspector.panels.databases.selectDatabase(o); - break; - case "Storage": - WebInspector.showDatabasesPanel(); - WebInspector.panels.databases.selectDOMStorage(o); - break; - } - } - } - } - }, - - addInspectedNode: function(node) - { - var inspectedWindow = InspectorController.inspectedWindow(); - this._ensureCommandLineAPIInstalled(inspectedWindow); - var inspectedNodes = inspectedWindow._inspectorCommandLineAPI._inspectedNodes; - inspectedNodes.unshift(node); - if (inspectedNodes.length >= 5) - inspectedNodes.pop(); - }, - doEvalInWindow: function(expression, callback) { if (!expression) { @@ -388,22 +343,15 @@ WebInspector.ConsoleView.prototype = { expression = "this"; } - // 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. - expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; - var self = this; - function delayedEvaluation() + function evalCallback(result) { - var inspectedWindow = InspectorController.inspectedWindow(); - self._ensureCommandLineAPIInstalled(inspectedWindow); - try { - callback(inspectedWindow.eval(expression)); - } catch (e) { - callback(e, true); - } - } - setTimeout(delayedEvaluation, 0); + if (result.exception) + callback(result.exception, true); + else + callback(result.value, false); + }; + InspectorController.evaluate(expression, evalCallback); }, _enterKeyPressed: function(event) @@ -436,13 +384,10 @@ WebInspector.ConsoleView.prototype = { _format: function(output, forceObjectFormat) { - var inspectedWindow = InspectorController.inspectedWindow(); if (forceObjectFormat) var type = "object"; - else if (output instanceof inspectedWindow.NodeList) - var type = "array"; else - var type = Object.type(output, inspectedWindow); + var type = Object.proxyType(output); // We don't perform any special formatting on these types, so we just // pass them through the simple _formatvalue function. @@ -451,8 +396,6 @@ WebInspector.ConsoleView.prototype = { "null": 1, "boolean": 1, "number": 1, - "date": 1, - "function": 1, }; var formatter; @@ -479,6 +422,16 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(document.createTextNode(val)); }, + _formatfunction: function(func, elem) + { + elem.appendChild(document.createTextNode(func.description)); + }, + + _formatdate: function(date, elem) + { + elem.appendChild(document.createTextNode(date.description)); + }, + _formatstring: function(str, elem) { elem.appendChild(document.createTextNode("\"" + str + "\"")); @@ -486,7 +439,7 @@ WebInspector.ConsoleView.prototype = { _formatregexp: function(re, elem) { - var formatted = String(re).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); + var formatted = String(re.description).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); elem.appendChild(document.createTextNode(formatted)); }, @@ -501,10 +454,10 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(document.createTextNode("]")); }, - _formatnode: function(node, elem) + _formatnode: function(object, elem) { var treeOutline = new WebInspector.ElementsTreeOutline(); - treeOutline.rootDOMNode = node; + treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(object.nodeId); treeOutline.element.addStyleClass("outline-disclosure"); if (!treeOutline.children[0].hasChildren) treeOutline.element.addStyleClass("single-node"); @@ -513,7 +466,7 @@ WebInspector.ConsoleView.prototype = { _formatobject: function(obj, elem) { - elem.appendChild(new WebInspector.ObjectPropertiesSection(new WebInspector.ObjectProxy(obj), Object.describe(obj, true), null, null, true).element); + elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element); }, _formaterror: function(obj, elem) diff --git a/WebCore/inspector/front-end/CookieItemsView.js b/WebCore/inspector/front-end/CookieItemsView.js new file mode 100644 index 0000000..2d69e7d --- /dev/null +++ b/WebCore/inspector/front-end/CookieItemsView.js @@ -0,0 +1,329 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Joseph Pecoraro + * + * 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. + */ + +WebInspector.CookieItemsView = function() +{ + WebInspector.View.call(this); + + // Some Platforms have not yet implemented access to raw cookies + // Those platforms will return undefined instead of an Array + // For these platforms we: + // - resort to document.cookie + // - do not show the delete cookie status bar button + this._useFallback = typeof InspectorController.cookies() === "undefined"; + + this.element.addStyleClass("storage-view"); + this.element.addStyleClass("table"); + + this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item"); + this.deleteButton.visible = false; + this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false); + + this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); + this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false); +} + +WebInspector.CookieItemsView.prototype = { + get statusBarItems() + { + if (this._useFallback) + return [this.refreshButton.element]; + else + return [this.refreshButton.element, this.deleteButton.element]; + }, + + show: function(parentElement) + { + WebInspector.View.prototype.show.call(this, parentElement); + this.update(); + }, + + hide: function() + { + WebInspector.View.prototype.hide.call(this); + this.deleteButton.visible = false; + }, + + update: function() + { + if (this._useFallback) { + this.fallbackUpdate(); + return; + } + + this.element.removeChildren(); + var dataGrid = this.dataGridForCookies(); + if (dataGrid) { + this._dataGrid = dataGrid; + this.element.appendChild(dataGrid.element); + this.deleteButton.visible = true; + } else { + var emptyMsgElement = document.createElement("div"); + emptyMsgElement.className = "storage-table-empty"; + emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); + this.element.appendChild(emptyMsgElement); + this._dataGrid = null; + this.deleteButton.visible = false; + } + }, + + buildCookies: function() + { + var rawCookies = InspectorController.cookies(); + var cookies = []; + for (var i = 0; i < rawCookies.length; ++i) { + var cookie = rawCookies[i]; + cookie.expires = new Date(cookie.expires); + cookies.push(cookie); + } + + return cookies; + }, + + dataGridForCookies: function() + { + var cookies = this.buildCookies(); + if (!cookies.length) + return null; + + var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} }; + columns[0].title = WebInspector.UIString("Name"); + columns[0].width = columns[0].title.length; + columns[1].title = WebInspector.UIString("Value"); + columns[1].width = columns[1].title.length; + columns[2].title = WebInspector.UIString("Domain"); + columns[2].width = columns[2].title.length; + columns[3].title = WebInspector.UIString("Path"); + columns[3].width = columns[3].title.length; + columns[4].title = WebInspector.UIString("Expires"); + columns[4].width = columns[4].title.length; + columns[5].title = WebInspector.UIString("Size"); + columns[5].width = columns[5].title.length; + columns[5].aligned = "right"; + columns[6].title = WebInspector.UIString("HTTP"); + columns[6].width = columns[6].title.length; + columns[6].aligned = "centered"; + columns[7].title = WebInspector.UIString("Secure"); + columns[7].width = columns[7].title.length; + columns[7].aligned = "centered"; + + function updateDataAndColumn(index, value) { + data[index] = value; + if (value.length > columns[index].width) + columns[index].width = value.length; + } + + var data; + var nodes = []; + for (var i = 0; i < cookies.length; ++i) { + var cookie = cookies[i]; + data = {}; + + updateDataAndColumn(0, cookie.name); + updateDataAndColumn(1, cookie.value); + updateDataAndColumn(2, cookie.domain); + updateDataAndColumn(3, cookie.path); + updateDataAndColumn(4, (cookie.session ? "Session" : cookie.expires.toGMTString())); + updateDataAndColumn(5, Number.bytesToString(cookie.size, WebInspector.UIString)); + updateDataAndColumn(6, (cookie.httpOnly ? "\u2713" : "")); // Checkmark + updateDataAndColumn(7, (cookie.secure ? "\u2713" : "")); // Checkmark + + var node = new WebInspector.DataGridNode(data, false); + node.cookie = cookie; + node.selectable = true; + nodes.push(node); + } + + var totalColumnWidths = 0; + for (var columnIdentifier in columns) + totalColumnWidths += columns[columnIdentifier].width; + + // Enforce the Value column (the 2nd column) to be a max of 33% + // tweaking the raw total width because may massively outshadow the others + var valueColumnWidth = columns[1].width; + if (valueColumnWidth / totalColumnWidths > 0.33) { + totalColumnWidths -= valueColumnWidth; + totalColumnWidths *= 1.33; + columns[1].width = totalColumnWidths * 0.33; + } + + // Calculate the percentage width for the columns. + const minimumPrecent = 6; + var recoupPercent = 0; + for (var columnIdentifier in columns) { + var width = columns[columnIdentifier].width; + width = Math.round((width / totalColumnWidths) * 100); + if (width < minimumPrecent) { + recoupPercent += (minimumPrecent - width); + width = minimumPrecent; + } + columns[columnIdentifier].width = width; + } + + // Enforce the minimum percentage width. (need to narrow total percentage due to earlier additions) + while (recoupPercent > 0) { + for (var columnIdentifier in columns) { + if (columns[columnIdentifier].width > minimumPrecent) { + --columns[columnIdentifier].width; + --recoupPercent; + if (!recoupPercent) + break; + } + } + } + + for (var columnIdentifier in columns) + columns[columnIdentifier].width += "%"; + + var dataGrid = new WebInspector.DataGrid(columns); + var length = nodes.length; + for (var i = 0; i < length; ++i) + dataGrid.appendChild(nodes[i]); + if (length > 0) + nodes[0].selected = true; + + return dataGrid; + }, + + fallbackUpdate: function() + { + this.element.removeChildren(); + + var self = this; + function callback(rawCookieString) { + var cookies = self.fallbackBuildCookiesFromString(rawCookieString); + var dataGrid = self.fallbackDataGridForCookies(cookies); + if (dataGrid) { + self._dataGrid = dataGrid; + self.element.appendChild(dataGrid.element); + self.deleteButton.visible = true; + } else { + var emptyMsgElement = document.createElement("div"); + emptyMsgElement.className = "storage-table-empty"; + emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); + self.element.appendChild(emptyMsgElement); + self._dataGrid = null; + self.deleteButton.visible = false; + } + } + + InspectorController.getCookies(callback); + }, + + fallbackBuildCookiesFromString: function(rawCookieString) + { + var rawCookies = rawCookieString.split(/;\s*/); + var cookies = []; + + if (!(/^\s*$/.test(rawCookieString))) { + for (var i = 0; i < rawCookies.length; ++i) { + var cookie = rawCookies[i]; + var delimIndex = cookie.indexOf("="); + var name = cookie.substring(0, delimIndex); + var value = cookie.substring(delimIndex + 1); + var size = name.length + value.length; + cookies.push({ name: name, value: value, size: size }); + } + } + + return cookies; + }, + + fallbackDataGridForCookies: function(cookies) + { + if (!cookies.length) + return null; + + var columns = {}; + columns[0] = {}; + columns[1] = {}; + columns[0].title = WebInspector.UIString("Name"); + columns[0].width = columns[0].title.length; + columns[1].title = WebInspector.UIString("Value"); + columns[1].width = columns[1].title.length; + + var nodes = []; + for (var i = 0; i < cookies.length; ++i) { + var cookie = cookies[i]; + var data = {}; + + var name = cookie.name; + data[0] = name; + if (name.length > columns[0].width) + columns[0].width = name.length; + + var value = cookie.value; + data[1] = value; + if (value.length > columns[1].width) + columns[1].width = value.length; + + var node = new WebInspector.DataGridNode(data, false); + node.selectable = true; + nodes.push(node); + } + + var totalColumnWidths = columns[0].width + columns[1].width; + var width = Math.round((columns[0].width * 100) / totalColumnWidths); + const minimumPrecent = 20; + if (width < minimumPrecent) + width = minimumPrecent; + if (width > 100 - minimumPrecent) + width = 100 - minimumPrecent; + columns[0].width = width; + columns[1].width = 100 - width; + columns[0].width += "%"; + columns[1].width += "%"; + + var dataGrid = new WebInspector.DataGrid(columns); + var length = nodes.length; + for (var i = 0; i < length; ++i) + dataGrid.appendChild(nodes[i]); + if (length > 0) + nodes[0].selected = true; + + return dataGrid; + }, + + _deleteButtonClicked: function(event) + { + if (!this._dataGrid || this._useFallback) + return; + + var cookie = this._dataGrid.selectedNode.cookie; + InspectorController.deleteCookie(cookie.name); + this.update(); + }, + + _refreshButtonClicked: function(event) + { + this.update(); + } +} + +WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js index 5aacd41..7942f0a 100644 --- a/WebCore/inspector/front-end/DOMAgent.js +++ b/WebCore/inspector/front-end/DOMAgent.js @@ -31,7 +31,7 @@ WebInspector.DOMNode = function(doc, payload) { this.ownerDocument = doc; - this._id = payload.id; + this.id = payload.id; this.nodeType = payload.nodeType; this.nodeName = payload.nodeName; this._nodeValue = payload.nodeValue; @@ -48,14 +48,22 @@ WebInspector.DOMNode = function(doc, payload) { this.nextSibling = null; this.prevSibling = null; this.firstChild = null; + this.lastChild = null; this.parentNode = null; - if (payload.childNodes) - this._setChildrenPayload(payload.childNodes); + if (payload.children) + this._setChildrenPayload(payload.children); this._computedStyle = null; this.style = null; this._matchedCSSRules = []; + + if (this.nodeType == Node.ELEMENT_NODE) { + if (this.nodeName == "HTML") + this.ownerDocument.documentElement = this; + if (this.nodeName == "BODY") + this.ownerDocument.body = this; + } } WebInspector.DOMNode.prototype = { @@ -161,9 +169,11 @@ WebInspector.DOMNode.prototype = { this._childNodeCount = this.children.length; if (this._childNodeCount == 0) { this.firstChild = null; + this.lastChild = null; return; } this.firstChild = this.children[0]; + this.lastChild = this.children[this._childNodeCount - 1]; for (var i = 0; i < this._childNodeCount; ++i) { var child = this.children[i]; child.nextSibling = i + 1 < this._childNodeCount ? this.children[i + 1] : null; @@ -208,17 +218,9 @@ WebInspector.DOMNode.prototype = { } } -WebInspector.DOMDocument = function(domAgent, defaultView) +WebInspector.DOMDocument = function(domAgent, defaultView, payload) { - WebInspector.DOMNode.call(this, null, - { - id: 0, - nodeType: Node.DOCUMENT_NODE, - nodeName: "", - nodeValue: "", - attributes: [], - childNodeCount: 0 - }); + WebInspector.DOMNode.call(this, this, payload); this._listeners = {}; this._domAgent = domAgent; this.defaultView = defaultView; @@ -226,7 +228,7 @@ WebInspector.DOMDocument = function(domAgent, defaultView) WebInspector.DOMDocument.prototype = { - addEventListener: function(name, callback, useCapture) + addEventListener: function(name, callback) { var listeners = this._listeners[name]; if (!listeners) { @@ -236,7 +238,7 @@ WebInspector.DOMDocument.prototype = { listeners.push(callback); }, - removeEventListener: function(name, callback, useCapture) + removeEventListener: function(name, callback) { var listeners = this._listeners[name]; if (!listeners) @@ -251,10 +253,12 @@ WebInspector.DOMDocument.prototype = { { var listeners = this._listeners[name]; if (!listeners) - return; + return; - for (var i = 0; i < listeners.length; ++i) - listeners[i](event); + for (var i = 0; i < listeners.length; ++i) { + var listener = listeners[i]; + listener.call(this, event); + } } } @@ -302,23 +306,8 @@ WebInspector.DOMAgent = function() { this._idToDOMNode = null; this.document = null; - // Install onpopulate handler. This is a temporary measure. - // TODO: add this code into the original updateChildren once domAgent - // becomes primary source of DOM information. - // TODO2: update ElementsPanel to not track embedded iframes - it is already being handled + // TODO: update ElementsPanel to not track embedded iframes - it is already being handled // in the agent backend. - var domAgent = this; - var originalUpdateChildren = WebInspector.ElementsTreeElement.prototype.updateChildren; - WebInspector.ElementsTreeElement.prototype.updateChildren = function() - { - domAgent.getChildNodesAsync(this.representedObject, originalUpdateChildren.bind(this)); - }; - - // Mute console handle to avoid crash on selection change. - // TODO: Re-implement inspectorConsoleAPI to work in a serialized way and remove this workaround. - WebInspector.Console.prototype.addInspectedNode = function() - { - }; // Whitespace is ignored in InspectorDOMAgent already -> no need to filter. // TODO: Either remove all of its usages or push value into the agent backend. @@ -331,38 +320,36 @@ WebInspector.DOMAgent.prototype = { return this._window; }, - getChildNodesAsync: function(parent, opt_callback) + getChildNodesAsync: function(parent, callback) { var children = parent.children; - if (children && opt_callback) { - opt_callback(children); - return; + if (children) { + callback(children); + return; + } + function mycallback() { + callback(parent.children); } - var mycallback = function() { - if (opt_callback) { - opt_callback(parent.children); - } - }; var callId = WebInspector.Callback.wrap(mycallback); - InspectorController.getChildNodes(callId, parent._id); + InspectorController.getChildNodes(callId, parent.id); }, setAttributeAsync: function(node, name, value, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.setAttribute(WebInspector.Callback.wrap(mycallback), node._id, name, value); + InspectorController.setAttribute(WebInspector.Callback.wrap(mycallback), node.id, name, value); }, removeAttributeAsync: function(node, name, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.removeAttribute(WebInspector.Callback.wrap(mycallback), node._id, name); + InspectorController.removeAttribute(WebInspector.Callback.wrap(mycallback), node.id, name); }, setTextNodeValueAsync: function(node, text, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node._id, text); + InspectorController.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node.id, text); }, _didApplyDomChange: function(node, callback, success) @@ -383,26 +370,22 @@ WebInspector.DOMAgent.prototype = { node._setAttributesPayload(attrsArray); }, - getNodeForId: function(nodeId) { + nodeForId: function(nodeId) { return this._idToDOMNode[nodeId]; }, - _setDocumentElement: function(payload) + _setDocument: function(payload) { - this.document = new WebInspector.DOMDocument(this, this._window); - this._idToDOMNode = { 0 : this.document }; - this._setChildNodes(0, [payload]); - this.document.documentElement = this.document.firstChild; - this.document.documentElement.ownerDocument = this.document; + this.document = new WebInspector.DOMDocument(this, this._window, payload); + this._idToDOMNode = {}; + this._idToDOMNode[payload.id] = this.document; + this._bindNodes(this.document.children); WebInspector.panels.elements.reset(); }, _setChildNodes: function(parentId, payloads) { var parent = this._idToDOMNode[parentId]; - if (parent.children) { - return; - } parent._setChildrenPayload(payloads); this._bindNodes(parent.children); }, @@ -411,7 +394,7 @@ WebInspector.DOMAgent.prototype = { { for (var i = 0; i < children.length; ++i) { var child = children[i]; - this._idToDOMNode[child._id] = child; + this._idToDOMNode[child.id] = child; if (child.children) this._bindNodes(child.children); } @@ -433,7 +416,7 @@ WebInspector.DOMAgent.prototype = { var parent = this._idToDOMNode[parentId]; var prev = this._idToDOMNode[prevId]; var node = parent._insertChild(prev, payload); - this._idToDOMNode[node._id] = node; + this._idToDOMNode[node.id] = node; var event = { target : node, relatedNode : parent }; this.document._fireDomEvent("DOMNodeInserted", event); }, @@ -450,7 +433,7 @@ WebInspector.DOMAgent.prototype = { } WebInspector.CSSStyleDeclaration = function(payload) { - this._id = payload.id; + this.id = payload.id; this.width = payload.width; this.height = payload.height; this.__disabledProperties = payload.__disabledProperties; @@ -492,12 +475,13 @@ WebInspector.CSSStyleDeclaration.parseStyle = function(payload) WebInspector.CSSStyleDeclaration.parseRule = function(payload) { var rule = {}; - rule._id = payload.id; + rule.id = payload.id; rule.selectorText = payload.selectorText; rule.style = new WebInspector.CSSStyleDeclaration(payload.style); rule.style.parentRule = rule; rule.isUserAgent = payload.isUserAgent; rule.isUser = payload.isUser; + rule.isViaInspector = payload.isViaInspector; if (payload.parentStyleSheet) rule.parentStyleSheet = { href: payload.parentStyleSheet.href }; @@ -586,9 +570,9 @@ WebInspector.attributesUpdated = function() this.domAgent._attributesUpdated.apply(this.domAgent, arguments); } -WebInspector.setDocumentElement = function() +WebInspector.setDocument = function() { - this.domAgent._setDocumentElement.apply(this.domAgent, arguments); + this.domAgent._setDocument.apply(this.domAgent, arguments); } WebInspector.setChildNodes = function() @@ -604,13 +588,11 @@ WebInspector.hasChildrenUpdated = function() WebInspector.childNodeInserted = function() { this.domAgent._childNodeInserted.apply(this.domAgent, arguments); - this._childNodeInserted.bind(this); } WebInspector.childNodeRemoved = function() { this.domAgent._childNodeRemoved.apply(this.domAgent, arguments); - this._childNodeRemoved.bind(this); } WebInspector.didGetChildNodes = WebInspector.Callback.processCallback; @@ -619,106 +601,122 @@ WebInspector.didApplyDomChange = WebInspector.Callback.processCallback; WebInspector.didRemoveAttribute = WebInspector.Callback.processCallback; WebInspector.didSetTextNodeValue = WebInspector.Callback.processCallback; -// Temporary methods for DOMAgent migration. -WebInspector.wrapNodeWithStyles = function(node, styles) -{ - var windowStub = new WebInspector.DOMWindow(null); - var docStub = new WebInspector.DOMDocument(null, windowStub); - var payload = {}; - payload.nodeType = node.nodeType; - payload.nodeName = node.nodeName; - payload.nodeValue = node.nodeValue; - payload.attributes = []; - payload.childNodeCount = 0; - - for (var i = 0; i < node.attributes.length; ++i) { - var attr = node.attributes[i]; - payload.attributes.push(attr.name); - payload.attributes.push(attr.value); - } - var nodeStub = new WebInspector.DOMNode(docStub, payload); - nodeStub._setStyles(styles.computedStyle, styles.inlineStyle, styles.styleAttributes, styles.matchedCSSRules); - return nodeStub; -} - // Temporary methods that will be dispatched via InspectorController into the injected context. InspectorController.getStyles = function(nodeId, authorOnly, callback) { setTimeout(function() { callback(InjectedScript.getStyles(nodeId, authorOnly)); - }, 0) + }, 0); } InspectorController.getComputedStyle = function(nodeId, callback) { setTimeout(function() { callback(InjectedScript.getComputedStyle(nodeId)); - }, 0) + }, 0); } InspectorController.getInlineStyle = function(nodeId, callback) { setTimeout(function() { callback(InjectedScript.getInlineStyle(nodeId)); - }, 0) + }, 0); } InspectorController.applyStyleText = function(styleId, styleText, propertyName, callback) { setTimeout(function() { callback(InjectedScript.applyStyleText(styleId, styleText, propertyName)); - }, 0) + }, 0); } InspectorController.setStyleText = function(style, cssText, callback) { setTimeout(function() { callback(InjectedScript.setStyleText(style, cssText)); - }, 0) + }, 0); } InspectorController.toggleStyleEnabled = function(styleId, propertyName, disabled, callback) { setTimeout(function() { callback(InjectedScript.toggleStyleEnabled(styleId, propertyName, disabled)); - }, 0) + }, 0); } -InspectorController.applyStyleRuleText = function(ruleId, newContent, selectedNode, callback) +InspectorController.applyStyleRuleText = function(ruleId, newContent, selectedNodeId, callback) { setTimeout(function() { - callback(InjectedScript.applyStyleRuleText(ruleId, newContent, selectedNode)); - }, 0) + callback(InjectedScript.applyStyleRuleText(ruleId, newContent, selectedNodeId)); + }, 0); } -InspectorController.addStyleSelector = function(newContent, callback) +InspectorController.addStyleSelector = function(newContent, selectedNodeId, callback) { setTimeout(function() { - callback(InjectedScript.addStyleSelector(newContent)); - }, 0) + callback(InjectedScript.addStyleSelector(newContent, selectedNodeId)); + }, 0); } -InspectorController.setStyleProperty = function(styleId, name, value, callback) { +InspectorController.setStyleProperty = function(styleId, name, value, callback) +{ setTimeout(function() { callback(InjectedScript.setStyleProperty(styleId, name, value)); - }, 0) + }, 0); } -InspectorController.getPrototypes = function(objectProxy, callback) { +InspectorController.getPrototypes = function(nodeId, callback) +{ setTimeout(function() { - callback(InjectedScript.getPrototypes(objectProxy)); - }, 0) + callback(InjectedScript.getPrototypes(nodeId)); + }, 0); } -InspectorController.getProperties = function(objectProxy, ignoreHasOwnProperty, callback) { +InspectorController.getProperties = function(objectProxy, ignoreHasOwnProperty, callback) +{ setTimeout(function() { callback(InjectedScript.getProperties(objectProxy, ignoreHasOwnProperty)); - }, 0) + }, 0); } -InspectorController.setPropertyValue = function(objectProxy, propertyName, expression, callback) { +InspectorController.setPropertyValue = function(objectProxy, propertyName, expression, callback) +{ setTimeout(function() { callback(InjectedScript.setPropertyValue(objectProxy, propertyName, expression)); - }, 0) + }, 0); +} + +InspectorController.evaluate = function(expression, callback) +{ + setTimeout(function() { + callback(InjectedScript.evaluate(expression)); + }, 0); +} + +InspectorController.addInspectedNode = function(nodeId, callback) +{ + setTimeout(function() { + callback(InjectedScript.addInspectedNode(nodeId)); + }, 0); +} + +InspectorController.performSearch = function(whitespaceTrimmedQuery, callback) +{ + setTimeout(function() { + callback(InjectedScript.performSearch(whitespaceTrimmedQuery)); + }, 0); +} + +InspectorController.searchCanceled = function(callback) +{ + setTimeout(function() { + callback(InjectedScript.searchCanceled()); + }, 0); } +InspectorController.getCookies = function(callback) +{ + setTimeout(function() { + callback(InjectedScript.getCookies()); + }, 0); +} diff --git a/WebCore/inspector/front-end/DOMStorageItemsView.js b/WebCore/inspector/front-end/DOMStorageItemsView.js index fad6e3c..514883f 100644 --- a/WebCore/inspector/front-end/DOMStorageItemsView.js +++ b/WebCore/inspector/front-end/DOMStorageItemsView.js @@ -32,21 +32,18 @@ WebInspector.DOMStorageItemsView = function(domStorage) this.element.addStyleClass("storage-view"); this.element.addStyleClass("table"); - this.deleteButton = document.createElement("button"); - this.deleteButton.title = WebInspector.UIString("Delete"); - this.deleteButton.className = "delete-storage-status-bar-item status-bar-item hidden"; + this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item"); + this.deleteButton.visible = false; this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false); - this.refreshButton = document.createElement("button"); - this.refreshButton.title = WebInspector.UIString("Refresh"); - this.refreshButton.className = "refresh-storage-status-bar-item status-bar-item"; + this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false); } WebInspector.DOMStorageItemsView.prototype = { get statusBarItems() { - return [this.refreshButton, this.deleteButton]; + return [this.refreshButton.element, this.deleteButton.element]; }, show: function(parentElement) @@ -58,7 +55,7 @@ WebInspector.DOMStorageItemsView.prototype = { hide: function() { WebInspector.View.prototype.hide.call(this); - this.deleteButton.addStyleClass("hidden"); + this.deleteButton.visible = false; }, update: function() @@ -76,7 +73,7 @@ WebInspector.DOMStorageItemsView.prototype = { this._dataGrid = dataGrid; this.element.appendChild(dataGrid.element); this._dataGrid.updateWidths(); - this.deleteButton.removeStyleClass("hidden"); + this.deleteButton.visible = true; } } @@ -87,7 +84,7 @@ WebInspector.DOMStorageItemsView.prototype = { emptyMsgElement.textContent = WebInspector.UIString("This storage is empty."); this.element.appendChild(emptyMsgElement); this._dataGrid = null; - this.deleteButton.addStyleClass("hidden"); + this.deleteButton.visible = false; } }, diff --git a/WebCore/inspector/front-end/DataGrid.js b/WebCore/inspector/front-end/DataGrid.js index 42e001c..ce61548 100644 --- a/WebCore/inspector/front-end/DataGrid.js +++ b/WebCore/inspector/front-end/DataGrid.js @@ -39,6 +39,8 @@ WebInspector.DataGrid = function(columns) this._dataTable.addEventListener("mousedown", this._mouseDownInDataTable.bind(this), true); this._dataTable.addEventListener("click", this._clickInDataTable.bind(this), true); + this.aligned = {}; + var scrollContainer = document.createElement("div"); scrollContainer.className = "data-container"; scrollContainer.appendChild(this._dataTable); @@ -78,6 +80,11 @@ WebInspector.DataGrid = function(columns) cell.addStyleClass("sortable"); } + if (column.aligned) { + cell.addStyleClass(column.aligned); + this.aligned[columnIdentifier] = column.aligned; + } + headerRow.appendChild(cell); ++columnCount; @@ -752,6 +759,10 @@ WebInspector.DataGridNode.prototype = { var cell = document.createElement("td"); cell.className = columnIdentifier + "-column"; + var alignment = this.dataGrid.aligned[columnIdentifier]; + if (alignment) + cell.addStyleClass(alignment); + var div = document.createElement("div"); div.textContent = this.data[columnIdentifier]; cell.appendChild(div); diff --git a/WebCore/inspector/front-end/DatabasesPanel.js b/WebCore/inspector/front-end/DatabasesPanel.js index a31e3ff..acbbe28 100644 --- a/WebCore/inspector/front-end/DatabasesPanel.js +++ b/WebCore/inspector/front-end/DatabasesPanel.js @@ -59,6 +59,10 @@ WebInspector.DatabasesPanel = function(database) this.sidebarTree.appendChild(this.sessionStorageListTreeElement); this.sessionStorageListTreeElement.expand(); + this.cookieListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("COOKIES"), {}, true); + this.sidebarTree.appendChild(this.cookieListTreeElement); + this.cookieListTreeElement.expand(); + this.storageViews = document.createElement("div"); this.storageViews.id = "storage-views"; this.element.appendChild(this.storageViews); @@ -87,6 +91,12 @@ WebInspector.DatabasesPanel.prototype = { WebInspector.Panel.prototype.show.call(this); this._updateSidebarWidth(); this._registerStorageEventListener(); + this.populateInterface(); + }, + + populateInterface: function() + { + this.addCookies(); }, reset: function() @@ -116,11 +126,15 @@ WebInspector.DatabasesPanel.prototype = { this._domStorage = []; + delete this.cookieTreeElement; + delete this._cookieView; + this.databasesListTreeElement.removeChildren(); this.localStorageListTreeElement.removeChildren(); this.sessionStorageListTreeElement.removeChildren(); - this.storageViews.removeChildren(); - + this.cookieListTreeElement.removeChildren(); + this.storageViews.removeChildren(); + this.storageViewStatusBarItemsContainer.removeChildren(); }, @@ -149,6 +163,14 @@ WebInspector.DatabasesPanel.prototype = { this.sessionStorageListTreeElement.appendChild(domStorageTreeElement); }, + addCookies: function() + { + if (!this.cookieTreeElement) { + this.cookieTreeElement = new WebInspector.CookieSidebarTreeElement(); + this.cookieListTreeElement.appendChild(this.cookieTreeElement); + } + }, + selectDatabase: function(db) { var database; @@ -235,6 +257,27 @@ WebInspector.DatabasesPanel.prototype = { this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]); }, + showCookies: function() + { + if (this.visibleView) + this.visibleView.hide(); + + var view = this._cookieView; + if (!view) { + view = new WebInspector.CookieItemsView(); + this._cookieView = view; + } + + view.show(this.storageViews); + + this.visibleView = view; + + this.storageViewStatusBarItemsContainer.removeChildren(); + var statusBarItems = view.statusBarItems; + for (var i = 0; i < statusBarItems.length; ++i) + this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]); + }, + closeVisibleView: function() { if (this.visibleView) @@ -357,7 +400,7 @@ WebInspector.DatabasesPanel.prototype = { columns[0].title = WebInspector.UIString("Key"); columns[0].width = columns[0].title.length; columns[1].title = WebInspector.UIString("Value"); - columns[1].width = columns[0].title.length; + columns[1].width = columns[1].title.length; var nodes = []; @@ -380,7 +423,7 @@ WebInspector.DatabasesPanel.prototype = { } var totalColumnWidths = columns[0].width + columns[1].width; - width = Math.round((columns[0].width * 100) / totalColumnWidths); + var width = Math.round((columns[0].width * 100) / totalColumnWidths); const minimumPrecent = 10; if (width < minimumPrecent) width = minimumPrecent; @@ -400,7 +443,7 @@ WebInspector.DatabasesPanel.prototype = { nodes[0].selected = true; return dataGrid; }, - + resize: function() { var visibleView = this.visibleView; @@ -606,3 +649,39 @@ WebInspector.DOMStorageSidebarTreeElement.prototype = { } WebInspector.DOMStorageSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + +WebInspector.CookieSidebarTreeElement = function() +{ + WebInspector.SidebarTreeElement.call(this, "cookie-sidebar-tree-item", null, "", null, false); + + this.refreshTitles(); +} + +WebInspector.CookieSidebarTreeElement.prototype = { + onselect: function() + { + WebInspector.panels.databases.showCookies(); + }, + + get mainTitle() + { + return WebInspector.UIString("Cookies"); + }, + + set mainTitle(x) + { + // Do nothing. + }, + + get subtitle() + { + return ""; + }, + + set subtitle(x) + { + // Do nothing. + } +} + +WebInspector.CookieSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; diff --git a/WebCore/inspector/front-end/Drawer.js b/WebCore/inspector/front-end/Drawer.js index 23dc483..1b50f91 100644 --- a/WebCore/inspector/front-end/Drawer.js +++ b/WebCore/inspector/front-end/Drawer.js @@ -64,6 +64,12 @@ WebInspector.Drawer.prototype = { } }, + showView: function(view) + { + if (!this.visible || this.visibleView !== view) + this.visibleView = view; + }, + show: function() { if (this._animating || this.visible) diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index ffa0000..1748159 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -61,7 +61,8 @@ WebInspector.ElementsPanel = function() InspectorController.toggleNodeSearch(); this.panel.nodeSearchButton.removeStyleClass("toggled-on"); } - WebInspector.console.addInspectedNode(this._focusedDOMNode); + if (this._focusedDOMNode) + InspectorController.addInspectedNode(this._focusedDOMNode.id, function() {}); }; this.contentElement.appendChild(this.treeOutline.element); @@ -97,10 +98,7 @@ WebInspector.ElementsPanel = function() this.sidebarResizeElement.className = "sidebar-resizer-vertical"; this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false); - this.nodeSearchButton = this.createStatusBarButton(); - this.nodeSearchButton.title = WebInspector.UIString("Select an element in the page to inspect it."); - this.nodeSearchButton.id = "node-search-status-bar-item"; - this.nodeSearchButton.className = "status-bar-item"; + this.nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item"); this.nodeSearchButton.addEventListener("click", this._nodeSearchButtonClicked.bind(this), false); this.searchingForNode = false; @@ -109,13 +107,7 @@ WebInspector.ElementsPanel = function() this.element.appendChild(this.sidebarElement); this.element.appendChild(this.sidebarResizeElement); - this._mutationMonitoredWindows = []; - this._nodeInsertedEventListener = InspectorController.wrapCallback(this._nodeInserted.bind(this)); - this._nodeRemovedEventListener = InspectorController.wrapCallback(this._nodeRemoved.bind(this)); - this._contentLoadedEventListener = InspectorController.wrapCallback(this._contentLoaded.bind(this)); - - this.stylesheet = null; - this.styles = {}; + this._changedStyles = {}; this.reset(); } @@ -130,7 +122,7 @@ WebInspector.ElementsPanel.prototype = { get statusBarItems() { - return [this.nodeSearchButton, this.crumbsElement]; + return [this.nodeSearchButton.element, this.crumbsElement]; }, updateStatusBarItems: function() @@ -156,7 +148,7 @@ WebInspector.ElementsPanel.prototype = { if (InspectorController.searchingForNode()) { InspectorController.toggleNodeSearch(); - this.nodeSearchButton.removeStyleClass("toggled-on"); + this.nodeSearchButton.toggled = false; } }, @@ -175,40 +167,27 @@ WebInspector.ElementsPanel.prototype = { if (InspectorController.searchingForNode()) { InspectorController.toggleNodeSearch(); - this.nodeSearchButton.removeStyleClass("toggled-on"); + this.nodeSearchButton.toggled = false; } this.recentlyModifiedNodes = []; - this.unregisterAllMutationEventListeners(); delete this.currentQuery; this.searchCanceled(); - var inspectedWindow = Preferences.useDOMAgent ? WebInspector.domAgent.inspectedWindow : InspectorController.inspectedWindow(); - if (!inspectedWindow || !inspectedWindow.document) + var inspectedWindow = WebInspector.domAgent.inspectedWindow; + if (!inspectedWindow || !inspectedWindow.document || !inspectedWindow.document.firstChild) return; - if (!inspectedWindow.document.firstChild) { - function contentLoaded() - { - inspectedWindow.document.removeEventListener("DOMContentLoaded", contentLoadedCallback, false); - - this.reset(); - } - - var contentLoadedCallback = InspectorController.wrapCallback(contentLoaded.bind(this)); - inspectedWindow.document.addEventListener("DOMContentLoaded", contentLoadedCallback, false); - return; - } - // If the window isn't visible, return early so the DOM tree isn't built // and mutation event listeners are not added. if (!InspectorController.isWindowVisible()) return; - this.registerMutationEventListeners(inspectedWindow); - var inspectedRootDocument = inspectedWindow.document; + inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this)); + inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this)); + this.rootDOMNode = inspectedRootDocument; var canidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement; @@ -222,19 +201,11 @@ WebInspector.ElementsPanel.prototype = { } }, - includedInSearchResultsPropertyName: "__includedInInspectorSearchResults", - searchCanceled: function() { if (this._searchResults) { - const searchResultsProperty = this.includedInSearchResultsPropertyName; for (var i = 0; i < this._searchResults.length; ++i) { - var node = this._searchResults[i]; - - // Remove the searchResultsProperty since there might be an unfinished search. - delete node[searchResultsProperty]; - - var treeElement = this.treeOutline.findTreeElement(node); + var treeElement = this.treeOutline.findTreeElement(this._searchResults[i]); if (treeElement) treeElement.highlighted = false; } @@ -242,13 +213,9 @@ WebInspector.ElementsPanel.prototype = { WebInspector.updateSearchMatchesCount(0, this); - if (this._currentSearchChunkIntervalIdentifier) { - clearInterval(this._currentSearchChunkIntervalIdentifier); - delete this._currentSearchChunkIntervalIdentifier; - } - this._currentSearchResultIndex = 0; this._searchResults = []; + InspectorController.searchCanceled(function() {}); }, performSearch: function(query) @@ -260,241 +227,56 @@ WebInspector.ElementsPanel.prototype = { if (!whitespaceTrimmedQuery.length) return; - var tagNameQuery = whitespaceTrimmedQuery; - var attributeNameQuery = whitespaceTrimmedQuery; - var startTagFound = (tagNameQuery.indexOf("<") === 0); - var endTagFound = (tagNameQuery.lastIndexOf(">") === (tagNameQuery.length - 1)); - - if (startTagFound || endTagFound) { - var tagNameQueryLength = tagNameQuery.length; - tagNameQuery = tagNameQuery.substring((startTagFound ? 1 : 0), (endTagFound ? (tagNameQueryLength - 1) : tagNameQueryLength)); - } - - // Check the tagNameQuery is it is a possibly valid tag name. - if (!/^[a-zA-Z0-9\-_:]+$/.test(tagNameQuery)) - tagNameQuery = null; - - // Check the attributeNameQuery is it is a possibly valid tag name. - if (!/^[a-zA-Z0-9\-_:]+$/.test(attributeNameQuery)) - attributeNameQuery = null; - - const escapedQuery = query.escapeCharacters("'"); - const escapedTagNameQuery = (tagNameQuery ? tagNameQuery.escapeCharacters("'") : null); - const escapedWhitespaceTrimmedQuery = whitespaceTrimmedQuery.escapeCharacters("'"); - const searchResultsProperty = this.includedInSearchResultsPropertyName; - - var updatedMatchCountOnce = false; - var matchesCountUpdateTimeout = null; - - function updateMatchesCount() - { - WebInspector.updateSearchMatchesCount(this._searchResults.length, this); - matchesCountUpdateTimeout = null; - updatedMatchCountOnce = true; - } - - function updateMatchesCountSoon() - { - if (!updatedMatchCountOnce) - return updateMatchesCount.call(this); - if (matchesCountUpdateTimeout) - return; - // Update the matches count every half-second so it doesn't feel twitchy. - matchesCountUpdateTimeout = setTimeout(updateMatchesCount.bind(this), 500); - } - - function addNodesToResults(nodes, length, getItem) - { - if (!length) - return; - - for (var i = 0; i < length; ++i) { - var node = getItem.call(nodes, i); - // Skip this node if it already has the property. - if (searchResultsProperty in node) - continue; - - if (!this._searchResults.length) { - this._currentSearchResultIndex = 0; - this.focusedDOMNode = node; - } - - node[searchResultsProperty] = true; - this._searchResults.push(node); - - // Highlight the tree element to show it matched the search. - // FIXME: highlight the substrings in text nodes and attributes. - var treeElement = this.treeOutline.findTreeElement(node); - if (treeElement) - treeElement.highlighted = true; - } - - updateMatchesCountSoon.call(this); - } - - function matchExactItems(doc) - { - matchExactId.call(this, doc); - matchExactClassNames.call(this, doc); - matchExactTagNames.call(this, doc); - matchExactAttributeNames.call(this, doc); - } - - function matchExactId(doc) - { - const result = doc.__proto__.getElementById.call(doc, whitespaceTrimmedQuery); - addNodesToResults.call(this, result, (result ? 1 : 0), function() { return this }); - } - - function matchExactClassNames(doc) - { - const result = doc.__proto__.getElementsByClassName.call(doc, whitespaceTrimmedQuery); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchExactTagNames(doc) - { - if (!tagNameQuery) - return; - const result = doc.__proto__.getElementsByTagName.call(doc, tagNameQuery); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchExactAttributeNames(doc) - { - if (!attributeNameQuery) - return; - const result = doc.__proto__.querySelectorAll.call(doc, "[" + attributeNameQuery + "]"); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchPartialTagNames(doc) - { - if (!tagNameQuery) - return; - const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchStartOfTagNames(doc) - { - if (!tagNameQuery) - return; - const result = doc.__proto__.evaluate.call(doc, "//*[starts-with(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } + this._updatedMatchCountOnce = false; + this._matchesCountUpdateTimeout = null; - function matchPartialTagNamesAndAttributeValues(doc) - { - if (!tagNameQuery) { - matchPartialAttributeValues.call(this, doc); - return; - } - - const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "') or contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchPartialAttributeValues(doc) - { - const result = doc.__proto__.evaluate.call(doc, "//*[contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchStyleSelector(doc) - { - const result = doc.__proto__.querySelectorAll.call(doc, whitespaceTrimmedQuery); - addNodesToResults.call(this, result, result.length, result.item); - } - - function matchPlainText(doc) - { - const result = doc.__proto__.evaluate.call(doc, "//text()[contains(., '" + escapedQuery + "')] | //comment()[contains(., '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function matchXPathQuery(doc) - { - const result = doc.__proto__.evaluate.call(doc, whitespaceTrimmedQuery, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); - } - - function finishedSearching() - { - // Remove the searchResultsProperty now that the search is finished. - for (var i = 0; i < this._searchResults.length; ++i) - delete this._searchResults[i][searchResultsProperty]; - } + InspectorController.performSearch(whitespaceTrimmedQuery, function() {}); + }, - const mainFrameDocument = InspectorController.inspectedWindow().document; - const searchDocuments = [mainFrameDocument]; - - if (tagNameQuery && startTagFound && endTagFound) - const searchFunctions = [matchExactTagNames, matchPlainText]; - else if (tagNameQuery && startTagFound) - const searchFunctions = [matchStartOfTagNames, matchPlainText]; - else if (tagNameQuery && endTagFound) { - // FIXME: we should have a matchEndOfTagNames search function if endTagFound is true but not startTagFound. - // This requires ends-with() support in XPath, WebKit only supports starts-with() and contains(). - const searchFunctions = [matchPartialTagNames, matchPlainText]; - } else if (whitespaceTrimmedQuery === "//*" || whitespaceTrimmedQuery === "*") { - // These queries will match every node. Matching everything isn't useful and can be slow for large pages, - // so limit the search functions list to plain text and attribute matching. - const searchFunctions = [matchPartialAttributeValues, matchPlainText]; - } else - const searchFunctions = [matchExactItems, matchStyleSelector, matchPartialTagNamesAndAttributeValues, matchPlainText, matchXPathQuery]; - - // Find all frames, iframes and object elements to search their documents. - const querySelectorAllFunction = InspectorController.inspectedWindow().Document.prototype.querySelectorAll; - const subdocumentResult = querySelectorAllFunction.call(mainFrameDocument, "iframe, frame, object"); - - for (var i = 0; i < subdocumentResult.length; ++i) { - var element = subdocumentResult.item(i); - if (element.contentDocument) - searchDocuments.push(element.contentDocument); - } + _updateMatchesCount: function() + { + WebInspector.updateSearchMatchesCount(this._searchResults.length, this); + this._matchesCountUpdateTimeout = null; + this._updatedMatchCountOnce = true; + }, - const panel = this; - var documentIndex = 0; - var searchFunctionIndex = 0; - var chunkIntervalIdentifier = null; + _updateMatchesCountSoon: function() + { + if (!this._updatedMatchCountOnce) + return this._updateMatchesCount(); + if (this._matchesCountUpdateTimeout) + return; + // Update the matches count every half-second so it doesn't feel twitchy. + this._matchesCountUpdateTimeout = setTimeout(this._updateMatchesCount.bind(this), 500); + }, - // Split up the work into chunks so we don't block the UI thread while processing. + addNodesToSearchResult: function(nodeIds) + { + if (!nodeIds) + return; - function processChunk() - { - var searchDocument = searchDocuments[documentIndex]; - var searchFunction = searchFunctions[searchFunctionIndex]; - - if (++searchFunctionIndex > searchFunctions.length) { - searchFunction = searchFunctions[0]; - searchFunctionIndex = 0; - - if (++documentIndex > searchDocuments.length) { - if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier) - delete panel._currentSearchChunkIntervalIdentifier; - clearInterval(chunkIntervalIdentifier); - finishedSearching.call(panel); - return; - } + var nodeIdsArray = nodeIds.split(","); + for (var i = 0; i < nodeIdsArray.length; ++i) { + var nodeId = nodeIdsArray[i]; + var node = WebInspector.domAgent.nodeForId(nodeId); + if (!node) + continue; - searchDocument = searchDocuments[documentIndex]; + if (!this._searchResults.length) { + this._currentSearchResultIndex = 0; + this.focusedDOMNode = node; } - if (!searchDocument || !searchFunction) - return; + this._searchResults.push(node); - try { - searchFunction.call(panel, searchDocument); - } catch(err) { - // ignore any exceptions. the query might be malformed, but we allow that. - } + // Highlight the tree element to show it matched the search. + // FIXME: highlight the substrings in text nodes and attributes. + var treeElement = this.treeOutline.findTreeElement(node); + if (treeElement) + treeElement.highlighted = true; } - processChunk(); - - chunkIntervalIdentifier = setInterval(processChunk, 25); - this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; + this._updateMatchesCountSoon(); }, jumpToNextSearchResult: function() @@ -515,12 +297,6 @@ WebInspector.ElementsPanel.prototype = { this.focusedDOMNode = this._searchResults[this._currentSearchResultIndex]; }, - inspectedWindowCleared: function(window) - { - if (InspectorController.isWindowVisible()) - this.updateMutationEventListeners(window); - }, - renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector) { // TODO: Implement Shifting the oldSelector, and its contents to a newSelector @@ -532,16 +308,16 @@ WebInspector.ElementsPanel.prototype = { return; var selector = style.parentRule.selectorText; - if (!this.styles[identifier]) - this.styles[identifier] = {}; + if (!this._changedStyles[identifier]) + this._changedStyles[identifier] = {}; - if (!this.styles[identifier][selector]) - this.styles[identifier][selector] = {}; + if (!this._changedStyles[identifier][selector]) + this._changedStyles[identifier][selector] = {}; - if (!this.styles[identifier][selector][property]) + if (!this._changedStyles[identifier][selector][property]) WebInspector.styleChanges += 1; - this.styles[identifier][selector][property] = style.getPropertyValue(property); + this._changedStyles[identifier][selector][property] = style.getPropertyValue(property); }, removeStyleChange: function(identifier, style, property) @@ -550,11 +326,11 @@ WebInspector.ElementsPanel.prototype = { return; var selector = style.parentRule.selectorText; - if (!this.styles[identifier] || !this.styles[identifier][selector]) + if (!this._changedStyles[identifier] || !this._changedStyles[identifier][selector]) return; - if (this.styles[identifier][selector][property]) { - delete this.styles[identifier][selector][property]; + if (this._changedStyles[identifier][selector][property]) { + delete this._changedStyles[identifier][selector][property]; WebInspector.styleChanges -= 1; } }, @@ -566,20 +342,20 @@ WebInspector.ElementsPanel.prototype = { // Merge Down to Just Selectors var mergedSelectors = {}; - for (var identifier in this.styles) { - for (var selector in this.styles[identifier]) { + for (var identifier in this._changedStyles) { + for (var selector in this._changedStyles[identifier]) { if (!mergedSelectors[selector]) - mergedSelectors[selector] = this.styles[identifier][selector]; + mergedSelectors[selector] = this._changedStyles[identifier][selector]; else { // merge on selector var merge = {}; for (var property in mergedSelectors[selector]) merge[property] = mergedSelectors[selector][property]; - for (var property in this.styles[identifier][selector]) { + for (var property in this._changedStyles[identifier][selector]) { if (!merge[property]) - merge[property] = this.styles[identifier][selector][property]; + merge[property] = this._changedStyles[identifier][selector][property]; else { // merge on property within a selector, include comment to notify user var value1 = merge[property]; - var value2 = this.styles[identifier][selector][property]; + var value2 = this._changedStyles[identifier][selector][property]; if (value1 === value2) merge[property] = [value1]; @@ -636,53 +412,6 @@ WebInspector.ElementsPanel.prototype = { InspectorController.inspectedWindow().console.log(result); }, - _addMutationEventListeners: function(monitoredWindow) - { - monitoredWindow.document.addEventListener("DOMNodeInserted", this._nodeInsertedEventListener, true); - monitoredWindow.document.addEventListener("DOMNodeRemoved", this._nodeRemovedEventListener, true); - if (monitoredWindow.frameElement) - monitoredWindow.addEventListener("DOMContentLoaded", this._contentLoadedEventListener, true); - }, - - _removeMutationEventListeners: function(monitoredWindow) - { - if (monitoredWindow.frameElement) - monitoredWindow.removeEventListener("DOMContentLoaded", this._contentLoadedEventListener, true); - if (!monitoredWindow.document) - return; - monitoredWindow.document.removeEventListener("DOMNodeInserted", this._nodeInsertedEventListener, true); - monitoredWindow.document.removeEventListener("DOMNodeRemoved", this._nodeRemovedEventListener, true); - }, - - updateMutationEventListeners: function(monitoredWindow) - { - this._addMutationEventListeners(monitoredWindow); - }, - - registerMutationEventListeners: function(monitoredWindow) - { - if (!monitoredWindow || this._mutationMonitoredWindows.indexOf(monitoredWindow) !== -1) - return; - this._mutationMonitoredWindows.push(monitoredWindow); - if (InspectorController.isWindowVisible()) - this._addMutationEventListeners(monitoredWindow); - }, - - unregisterMutationEventListeners: function(monitoredWindow) - { - if (!monitoredWindow || this._mutationMonitoredWindows.indexOf(monitoredWindow) === -1) - return; - this._mutationMonitoredWindows.remove(monitoredWindow); - this._removeMutationEventListeners(monitoredWindow); - }, - - unregisterAllMutationEventListeners: function() - { - for (var i = 0; i < this._mutationMonitoredWindows.length; ++i) - this._removeMutationEventListeners(this._mutationMonitoredWindows[i]); - this._mutationMonitoredWindows = []; - }, - get rootDOMNode() { return this.treeOutline.rootDOMNode; @@ -703,13 +432,6 @@ WebInspector.ElementsPanel.prototype = { this.treeOutline.focusedDOMNode = x; }, - _contentLoaded: function(event) - { - this.recentlyModifiedNodes.push({node: event.target, parent: event.target.defaultView.frameElement, replaced: true}); - if (this.visible) - this._updateModifiedNodesSoon(); - }, - _nodeInserted: function(event) { this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true}); @@ -747,14 +469,14 @@ WebInspector.ElementsPanel.prototype = { if (!parent) continue; - var parentNodeItem = this.treeOutline.findTreeElement(parent, null, null, objectsAreSame); + var parentNodeItem = this.treeOutline.findTreeElement(parent); if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) { parentNodeItem.updateChildren(replaced); parentNodeItem.alreadyUpdatedChildren = true; updatedParentTreeElements.push(parentNodeItem); } - if (!updateBreadcrumbs && (objectsAreSame(this.focusedDOMNode, parent) || isAncestorIncludingParentFrames(this.focusedDOMNode, parent))) + if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestorIncludingParentFrames(this.focusedDOMNode, parent))) updateBreadcrumbs = true; } @@ -814,7 +536,7 @@ WebInspector.ElementsPanel.prototype = { var foundRoot = false; var crumb = crumbs.firstChild; while (crumb) { - if (objectsAreSame(crumb.representedObject, this.rootDOMNode)) + if (crumb.representedObject === this.rootDOMNode) foundRoot = true; if (foundRoot) @@ -822,7 +544,7 @@ WebInspector.ElementsPanel.prototype = { else crumb.removeStyleClass("dimmed"); - if (objectsAreSame(crumb.representedObject, this.focusedDOMNode)) { + if (crumb.representedObject === this.focusedDOMNode) { crumb.addStyleClass("selected"); handled = true; } else { @@ -879,7 +601,7 @@ WebInspector.ElementsPanel.prototype = { if (current.nodeType === Node.DOCUMENT_NODE) continue; - if (objectsAreSame(current, this.rootDOMNode)) + if (current === this.rootDOMNode) foundRoot = true; var crumb = document.createElement("span"); @@ -962,7 +684,7 @@ WebInspector.ElementsPanel.prototype = { if (foundRoot) crumb.addStyleClass("dimmed"); - if (objectsAreSame(current, this.focusedDOMNode)) + if (current === this.focusedDOMNode) crumb.addStyleClass("selected"); if (!crumbs.childNodes.length) crumb.addStyleClass("end"); @@ -1269,7 +991,8 @@ WebInspector.ElementsPanel.prototype = { switch (this.focusedDOMNode.nodeType) { case Node.ELEMENT_NODE: - var data = this.focusedDOMNode.outerHTML; + // TODO: Introduce InspectorController.copyEvent that pushes appropriate markup into the clipboard. + var data = null; break; case Node.COMMENT_NODE: @@ -1316,10 +1039,7 @@ WebInspector.ElementsPanel.prototype = { { InspectorController.toggleNodeSearch(); - if (InspectorController.searchingForNode()) - this.nodeSearchButton.addStyleClass("toggled-on"); - else - this.nodeSearchButton.removeStyleClass("toggled-on"); + this.nodeSearchButton.toggled = InspectorController.searchingForNode(); } } diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index ef53209..345a084 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -51,7 +51,7 @@ WebInspector.ElementsTreeOutline.prototype = { set rootDOMNode(x) { - if (objectsAreSame(this._rootDOMNode, x)) + if (this._rootDOMNode === x) return; this._rootDOMNode = x; @@ -66,7 +66,7 @@ WebInspector.ElementsTreeOutline.prototype = { set focusedDOMNode(x) { - if (objectsAreSame(this._focusedDOMNode, x)) { + if (this._focusedDOMNode === x) { this.revealAndSelectNode(x); return; } @@ -79,11 +79,11 @@ WebInspector.ElementsTreeOutline.prototype = { // and the select() call would change the focusedDOMNode and reenter this setter. So to // avoid calling focusedNodeChanged() twice, first check if _focusedDOMNode is the same // node as the one passed in. - if (objectsAreSame(this._focusedDOMNode, x)) { + if (this._focusedDOMNode === x) { this.focusedNodeChanged(); if (x && !this.suppressSelectHighlight) { - InspectorController.highlightDOMNode(x); + InspectorController.highlightDOMNode(x.id); if ("_restorePreviousHighlightNodeTimeout" in this) clearTimeout(this._restorePreviousHighlightNodeTimeout); @@ -92,7 +92,7 @@ WebInspector.ElementsTreeOutline.prototype = { { var hoveredNode = WebInspector.hoveredDOMNode; if (hoveredNode) - InspectorController.highlightDOMNode(hoveredNode); + InspectorController.highlightDOMNode(hoveredNode.id); else InspectorController.hideDOMNodeHighlight(); } @@ -138,19 +138,17 @@ WebInspector.ElementsTreeOutline.prototype = { focusedNodeChanged: function(forceUpdate) {}, - findTreeElement: function(node, isAncestor, getParent, equal) + findTreeElement: function(node, isAncestor, getParent) { if (typeof isAncestor === "undefined") isAncestor = isAncestorIncludingParentFrames; if (typeof getParent === "undefined") getParent = parentNodeOrFrameElement; - if (typeof equal === "undefined") - equal = objectsAreSame; - var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestor, getParent, equal); + var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestor, getParent); if (!treeElement && node.nodeType === Node.TEXT_NODE) { // The text node might have been inlined if it was short, so try to find the parent element. - treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestor, getParent, equal); + treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestor, getParent); } return treeElement; @@ -248,7 +246,7 @@ WebInspector.ElementsTreeOutline.prototype.__proto__ = TreeOutline.prototype; WebInspector.ElementsTreeElement = function(node) { - var hasChildren = node.contentDocument || (Preferences.ignoreWhitespace ? (firstChildSkippingWhitespace.call(node) ? true : false) : node.hasChildNodes()); + var hasChildren = Preferences.ignoreWhitespace ? (firstChildSkippingWhitespace.call(node) ? true : false) : node.hasChildNodes(); var titleInfo = nodeTitleInfo.call(node, hasChildren, WebInspector.linkifyURL); if (titleInfo.hasChildren) @@ -387,9 +385,14 @@ WebInspector.ElementsTreeElement.prototype = { this.updateChildren(); }, - + updateChildren: function(fullRefresh) { + WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh)); + }, + + _updateChildren: function(fullRefresh) + { if (fullRefresh) { var selectedTreeElement = this.treeOutline.selectedTreeElement; if (selectedTreeElement && selectedTreeElement.hasAncestor(this)) @@ -406,11 +409,11 @@ WebInspector.ElementsTreeElement.prototype = { var child = (Preferences.ignoreWhitespace ? firstChildSkippingWhitespace.call(node) : node.firstChild); while (child) { var currentTreeElement = treeElement.children[treeChildIndex]; - if (!currentTreeElement || !objectsAreSame(currentTreeElement.representedObject, child)) { + if (!currentTreeElement || currentTreeElement.representedObject !== child) { // Find any existing element that is later in the children list. var existingTreeElement = null; for (var i = (treeChildIndex + 1); i < treeElement.children.length; ++i) { - if (objectsAreSame(treeElement.children[i].representedObject, child)) { + if (treeElement.children[i].representedObject === child) { existingTreeElement = treeElement.children[i]; break; } @@ -445,9 +448,7 @@ WebInspector.ElementsTreeElement.prototype = { var currentNode = currentChild.representedObject; var currentParentNode = currentNode.parentNode; - if (objectsAreSame(currentParentNode, this.representedObject)) - continue; - if (this.representedObject.contentDocument && objectsAreSame(currentParentNode, this.representedObject.contentDocument)) + if (currentParentNode === this.representedObject) continue; var selectedTreeElement = this.treeOutline.selectedTreeElement; @@ -455,13 +456,8 @@ WebInspector.ElementsTreeElement.prototype = { this.select(); this.removeChildAtIndex(i); - - if (this.treeOutline.panel && currentNode.contentDocument) - this.treeOutline.panel.unregisterMutationEventListeners(currentNode.contentDocument.defaultView); } - if (this.representedObject.contentDocument) - updateChildrenOfNode(this.representedObject.contentDocument); updateChildrenOfNode(this.representedObject); var lastChild = this.children[this.children.length - 1]; @@ -477,9 +473,6 @@ WebInspector.ElementsTreeElement.prototype = { onexpand: function() { this.treeOutline.updateSelection(); - - if (this.treeOutline.panel && this.representedObject.contentDocument) - this.treeOutline.panel.registerMutationEventListeners(this.representedObject.contentDocument.defaultView); }, oncollapse: function() @@ -693,7 +686,7 @@ WebInspector.ElementsTreeElement.prototype = { } if (!parseElement.hasAttributes()) { - InspectorController.inspectedWindow().Element.prototype.removeAttribute.call(this.representedObject, attributeName); + this.representedObject.removeAttribute(attributeName); this._updateTitle(); moveToNextAttributeIfNeeded.call(this); return; @@ -704,12 +697,12 @@ WebInspector.ElementsTreeElement.prototype = { var attr = parseElement.attributes[i]; foundOriginalAttribute = foundOriginalAttribute || attr.name === attributeName; try { - InspectorController.inspectedWindow().Element.prototype.setAttribute.call(this.representedObject, attr.name, attr.value); + this.representedObject.setAttribute(attr.name, attr.value); } catch(e) {} // ignore invalid attribute (innerHTML doesn't throw errors, but this can) } if (!foundOriginalAttribute) - InspectorController.inspectedWindow().Element.prototype.removeAttribute.call(this.representedObject, attributeName); + this.representedObject.removeAttribute(attributeName); this._updateTitle(); diff --git a/WebCore/inspector/front-end/Images/cookie.png b/WebCore/inspector/front-end/Images/cookie.png Binary files differnew file mode 100644 index 0000000..386d52b --- /dev/null +++ b/WebCore/inspector/front-end/Images/cookie.png diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index 4611b48..4144826 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -27,12 +27,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var InjectedScript = { - _styles: {}, - _styleRules: {}, - _lastStyleId: 0, - _lastStyleRuleId: 0 -}; +var InjectedScript = {}; + +// Called from within InspectorController on the 'inspected page' side. +InjectedScript.reset = function() +{ + InjectedScript._styles = {}; + InjectedScript._styleRules = {}; + InjectedScript._lastStyleId = 0; + InjectedScript._lastStyleRuleId = 0; + InjectedScript._searchResults = []; + InjectedScript._includedInSearchResultsPropertyName = "__includedInInspectorSearchResults"; +} + +InjectedScript.reset(); InjectedScript.getStyles = function(nodeId, authorOnly) { @@ -174,12 +182,14 @@ InjectedScript.toggleStyleEnabled = function(styleId, propertyName, disabled) return InjectedScript._serializeStyle(style, true); } -InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNode) +InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNodeId) { var rule = InjectedScript._styleRules[ruleId]; if (!rule) return false; + var selectedNode = InjectedScript._nodeForId(selectedNodeId); + try { var stylesheet = rule.parentStyleSheet; stylesheet.addRule(newContent); @@ -194,20 +204,14 @@ InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNode) } } - var nodes = selectedNode.ownerDocument.querySelectorAll(newContent); - for (var i = 0; i < nodes.length; ++i) { - if (nodes[i] === selectedNode) { - return [InjectedScript._serializeRule(newRule), true]; - } - } - return [InjectedScript._serializeRule(newRule), false]; + return [InjectedScript._serializeRule(newRule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode)]; } catch(e) { // Report invalid syntax. return false; } } -InjectedScript.addStyleSelector = function(newContent) +InjectedScript.addStyleSelector = function(newContent, selectedNodeId) { var stylesheet = InjectedScript.stylesheet; if (!stylesheet) { @@ -227,10 +231,28 @@ InjectedScript.addStyleSelector = function(newContent) return false; } - return InjectedScript._serializeRule(stylesheet.cssRules[stylesheet.cssRules.length - 1]); + var selectedNode = InjectedScript._nodeForId(selectedNodeId); + var rule = stylesheet.cssRules[stylesheet.cssRules.length - 1]; + rule.__isViaInspector = true; + + return [ InjectedScript._serializeRule(rule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode) ]; +} + +InjectedScript._doesSelectorAffectNode = function(selectorText, node) +{ + if (!node) + return false; + var nodes = node.ownerDocument.querySelectorAll(selectorText); + for (var i = 0; i < nodes.length; ++i) { + if (nodes[i] === node) { + return true; + } + } + return false; } -InjectedScript.setStyleProperty = function(styleId, name, value) { +InjectedScript.setStyleProperty = function(styleId, name, value) +{ var style = InjectedScript._styles[styleId]; if (!style) return false; @@ -251,17 +273,18 @@ InjectedScript._serializeRule = function(rule) } ruleValue.isUserAgent = parentStyleSheet && !parentStyleSheet.ownerNode && !parentStyleSheet.href; ruleValue.isUser = parentStyleSheet && parentStyleSheet.ownerNode && parentStyleSheet.ownerNode.nodeName == "#document"; + ruleValue.isViaInspector = !!rule.__isViaInspector; // Bind editable scripts only. var doBind = !ruleValue.isUserAgent && !ruleValue.isUser; ruleValue.style = InjectedScript._serializeStyle(rule.style, doBind); if (doBind) { - if (!rule._id) { - rule._id = InjectedScript._lastStyleRuleId++; - InjectedScript._styleRules[rule._id] = rule; + if (!rule.id) { + rule.id = InjectedScript._lastStyleRuleId++; + InjectedScript._styleRules[rule.id] = rule; } - ruleValue.id = rule._id; + ruleValue.id = rule.id; } return ruleValue; } @@ -295,11 +318,11 @@ InjectedScript._serializeStyle = function(style, doBind) result.uniqueStyleProperties = InjectedScript._getUniqueStyleProperties(style); if (doBind) { - if (!style._id) { - style._id = InjectedScript._lastStyleId++; - InjectedScript._styles[style._id] = style; + if (!style.id) { + style.id = InjectedScript._lastStyleId++; + InjectedScript._styles[style.id] = style; } - result.id = style._id; + result.id = style.id; } return result; } @@ -405,6 +428,7 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty) return false; var properties = []; + // Go over properties, prepare results. for (var propertyName in object) { if (!ignoreHasOwnProperty && "hasOwnProperty" in object && !object.hasOwnProperty(propertyName)) @@ -415,29 +439,31 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty) continue; var property = {}; property.name = propertyName; + property.parentObjectProxy = objectProxy; var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName); if (!property.isGetter) { var childObject = object[propertyName]; - property.type = typeof childObject; - property.textContent = Object.describe(childObject, true); - property.parentObjectProxy = objectProxy; - var parentPath = objectProxy.path.slice(); - property.childObjectProxy = { - objectId : objectProxy.objectId, - path : parentPath.splice(parentPath.length, 0, propertyName), - protoDepth : objectProxy.protoDepth - }; - if (childObject && (property.type === "object" || property.type === "function")) { + var childObjectProxy = {}; + childObjectProxy.objectId = objectProxy.objectId; + childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : []; + childObjectProxy.path.push(propertyName); + + childObjectProxy.protoDepth = objectProxy.protoDepth || 0; + childObjectProxy.description = Object.describe(childObject, true); + property.value = childObjectProxy; + + var type = typeof childObject; + if (type === "object" || type === "function") { for (var subPropertyName in childObject) { if (propertyName === "__treeElementIdentifier") continue; - property.hasChildren = true; + childObjectProxy.hasChildren = true; break; } } } else { // FIXME: this should show something like "getter" (bug 16734). - property.textContent = "\u2014"; // em dash + property.value = { description: "\u2014" }; // em dash property.isGetter = true; } properties.push(property); @@ -479,6 +505,338 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression } } +InjectedScript.evaluate = function(expression) +{ + InjectedScript._ensureCommandLineAPIInstalled(); + // 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. + expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; + + var result = {}; + try { + var value = InjectedScript._window().eval(expression); + var wrapper = InspectorController.wrapObject(value); + if (typeof wrapper === "object" && wrapper.exception) + result.exception = wrapper.exception; + else + result.value = wrapper; + } catch (e) { + result.exception = e.toString(); + } + return result; +} + +InjectedScript.addInspectedNode = function(nodeId) +{ + var node = InjectedScript._nodeForId(nodeId); + if (!node) + return false; + + InjectedScript._ensureCommandLineAPIInstalled(); + var inspectedNodes = InjectedScript._window()._inspectorCommandLineAPI._inspectedNodes; + inspectedNodes.unshift(node); + if (inspectedNodes.length >= 5) + inspectedNodes.pop(); + return true; +} + +InjectedScript.performSearch = function(whitespaceTrimmedQuery, searchResultsProperty) +{ + var tagNameQuery = whitespaceTrimmedQuery; + var attributeNameQuery = whitespaceTrimmedQuery; + var startTagFound = (tagNameQuery.indexOf("<") === 0); + var endTagFound = (tagNameQuery.lastIndexOf(">") === (tagNameQuery.length - 1)); + + if (startTagFound || endTagFound) { + var tagNameQueryLength = tagNameQuery.length; + tagNameQuery = tagNameQuery.substring((startTagFound ? 1 : 0), (endTagFound ? (tagNameQueryLength - 1) : tagNameQueryLength)); + } + + // Check the tagNameQuery is it is a possibly valid tag name. + if (!/^[a-zA-Z0-9\-_:]+$/.test(tagNameQuery)) + tagNameQuery = null; + + // Check the attributeNameQuery is it is a possibly valid tag name. + if (!/^[a-zA-Z0-9\-_:]+$/.test(attributeNameQuery)) + attributeNameQuery = null; + + const escapedQuery = whitespaceTrimmedQuery.escapeCharacters("'"); + const escapedTagNameQuery = (tagNameQuery ? tagNameQuery.escapeCharacters("'") : null); + const escapedWhitespaceTrimmedQuery = whitespaceTrimmedQuery.escapeCharacters("'"); + const searchResultsProperty = InjectedScript._includedInSearchResultsPropertyName; + + function addNodesToResults(nodes, length, getItem) + { + if (!length) + return; + + var nodeIds = []; + for (var i = 0; i < length; ++i) { + var node = getItem.call(nodes, i); + // Skip this node if it already has the property. + if (searchResultsProperty in node) + continue; + + if (!InjectedScript._searchResults.length) { + InjectedScript._currentSearchResultIndex = 0; + } + + node[searchResultsProperty] = true; + InjectedScript._searchResults.push(node); + var nodeId = InspectorController.pushNodePathToFrontend(node, false); + nodeIds.push(nodeId); + } + InspectorController.addNodesToSearchResult(nodeIds.join(",")); + } + + function matchExactItems(doc) + { + matchExactId.call(this, doc); + matchExactClassNames.call(this, doc); + matchExactTagNames.call(this, doc); + matchExactAttributeNames.call(this, doc); + } + + function matchExactId(doc) + { + const result = doc.__proto__.getElementById.call(doc, whitespaceTrimmedQuery); + addNodesToResults.call(this, result, (result ? 1 : 0), function() { return this }); + } + + function matchExactClassNames(doc) + { + const result = doc.__proto__.getElementsByClassName.call(doc, whitespaceTrimmedQuery); + addNodesToResults.call(this, result, result.length, result.item); + } + + function matchExactTagNames(doc) + { + if (!tagNameQuery) + return; + const result = doc.__proto__.getElementsByTagName.call(doc, tagNameQuery); + addNodesToResults.call(this, result, result.length, result.item); + } + + function matchExactAttributeNames(doc) + { + if (!attributeNameQuery) + return; + const result = doc.__proto__.querySelectorAll.call(doc, "[" + attributeNameQuery + "]"); + addNodesToResults.call(this, result, result.length, result.item); + } + + function matchPartialTagNames(doc) + { + if (!tagNameQuery) + return; + const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); + addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); + } + + function matchStartOfTagNames(doc) + { + if (!tagNameQuery) + return; + const result = doc.__proto__.evaluate.call(doc, "//*[starts-with(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); + addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); + } + + function matchPartialTagNamesAndAttributeValues(doc) + { + if (!tagNameQuery) { + matchPartialAttributeValues.call(this, doc); + return; + } + + const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "') or contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); + addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); + } + + function matchPartialAttributeValues(doc) + { + const result = doc.__proto__.evaluate.call(doc, "//*[contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); + addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); + } + + function matchStyleSelector(doc) + { + const result = doc.__proto__.querySelectorAll.call(doc, whitespaceTrimmedQuery); + addNodesToResults.call(this, result, result.length, result.item); + } + + function matchPlainText(doc) + { + const result = doc.__proto__.evaluate.call(doc, "//text()[contains(., '" + escapedQuery + "')] | //comment()[contains(., '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); + addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); + } + + function matchXPathQuery(doc) + { + const result = doc.__proto__.evaluate.call(doc, whitespaceTrimmedQuery, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); + addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); + } + + function finishedSearching() + { + // Remove the searchResultsProperty now that the search is finished. + for (var i = 0; i < InjectedScript._searchResults.length; ++i) + delete InjectedScript._searchResults[i][searchResultsProperty]; + } + + const mainFrameDocument = InjectedScript._window().document; + const searchDocuments = [mainFrameDocument]; + var searchFunctions; + if (tagNameQuery && startTagFound && endTagFound) + searchFunctions = [matchExactTagNames, matchPlainText]; + else if (tagNameQuery && startTagFound) + searchFunctions = [matchStartOfTagNames, matchPlainText]; + else if (tagNameQuery && endTagFound) { + // FIXME: we should have a matchEndOfTagNames search function if endTagFound is true but not startTagFound. + // This requires ends-with() support in XPath, WebKit only supports starts-with() and contains(). + searchFunctions = [matchPartialTagNames, matchPlainText]; + } else if (whitespaceTrimmedQuery === "//*" || whitespaceTrimmedQuery === "*") { + // These queries will match every node. Matching everything isn't useful and can be slow for large pages, + // so limit the search functions list to plain text and attribute matching. + searchFunctions = [matchPartialAttributeValues, matchPlainText]; + } else + searchFunctions = [matchExactItems, matchStyleSelector, matchPartialTagNamesAndAttributeValues, matchPlainText, matchXPathQuery]; + + // Find all frames, iframes and object elements to search their documents. + const querySelectorAllFunction = InjectedScript._window().Document.prototype.querySelectorAll; + const subdocumentResult = querySelectorAllFunction.call(mainFrameDocument, "iframe, frame, object"); + + for (var i = 0; i < subdocumentResult.length; ++i) { + var element = subdocumentResult.item(i); + if (element.contentDocument) + searchDocuments.push(element.contentDocument); + } + + const panel = InjectedScript; + var documentIndex = 0; + var searchFunctionIndex = 0; + var chunkIntervalIdentifier = null; + + // Split up the work into chunks so we don't block the UI thread while processing. + + function processChunk() + { + var searchDocument = searchDocuments[documentIndex]; + var searchFunction = searchFunctions[searchFunctionIndex]; + + if (++searchFunctionIndex > searchFunctions.length) { + searchFunction = searchFunctions[0]; + searchFunctionIndex = 0; + + if (++documentIndex > searchDocuments.length) { + if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier) + delete panel._currentSearchChunkIntervalIdentifier; + clearInterval(chunkIntervalIdentifier); + finishedSearching.call(panel); + return; + } + + searchDocument = searchDocuments[documentIndex]; + } + + if (!searchDocument || !searchFunction) + return; + + try { + searchFunction.call(panel, searchDocument); + } catch(err) { + // ignore any exceptions. the query might be malformed, but we allow that. + } + } + + processChunk(); + + chunkIntervalIdentifier = setInterval(processChunk, 25); + InjectedScript._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; + return true; +} + +InjectedScript.searchCanceled = function() +{ + if (InjectedScript._searchResults) { + const searchResultsProperty = InjectedScript._includedInSearchResultsPropertyName; + for (var i = 0; i < this._searchResults.length; ++i) { + var node = this._searchResults[i]; + + // Remove the searchResultsProperty since there might be an unfinished search. + delete node[searchResultsProperty]; + } + } + + if (InjectedScript._currentSearchChunkIntervalIdentifier) { + clearInterval(InjectedScript._currentSearchChunkIntervalIdentifier); + delete InjectedScript._currentSearchChunkIntervalIdentifier; + } + InjectedScript._searchResults = []; + return true; +} + +InjectedScript.getCookies = function() +{ + return InjectedScript._window().document.cookie; +} + +InjectedScript._ensureCommandLineAPIInstalled = function(inspectedWindow) +{ + var inspectedWindow = InjectedScript._window(); + if (inspectedWindow._inspectorCommandLineAPI) + return; + + inspectedWindow.eval("window._inspectorCommandLineAPI = { \ + $: function() { return document.getElementById.apply(document, arguments) }, \ + $$: function() { return document.querySelectorAll.apply(document, arguments) }, \ + $x: function(xpath, context) { \ + var nodes = []; \ + try { \ + var doc = context || document; \ + var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); \ + var node; \ + while (node = results.iterateNext()) nodes.push(node); \ + } catch (e) {} \ + return nodes; \ + }, \ + dir: function() { return console.dir.apply(console, arguments) }, \ + dirxml: function() { return console.dirxml.apply(console, arguments) }, \ + keys: function(o) { var a = []; for (var k in o) a.push(k); return a; }, \ + values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \ + profile: function() { return console.profile.apply(console, arguments) }, \ + profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \ + _inspectedNodes: [], \ + get $0() { return _inspectorCommandLineAPI._inspectedNodes[0] }, \ + get $1() { return _inspectorCommandLineAPI._inspectedNodes[1] }, \ + get $2() { return _inspectorCommandLineAPI._inspectedNodes[2] }, \ + get $3() { return _inspectorCommandLineAPI._inspectedNodes[3] }, \ + get $4() { return _inspectorCommandLineAPI._inspectedNodes[4] } \ + };"); + + inspectedWindow._inspectorCommandLineAPI.clear = InspectorController.wrapCallback(InspectorController.clearMessages.bind(InspectorController, true)); + inspectedWindow._inspectorCommandLineAPI.inspect = InspectorController.wrapCallback(inspectObject.bind(this)); + + function inspectObject(o) + { + if (arguments.length === 0) + return; + + inspectedWindow.console.log(o); + if (Object.type(o, inspectedWindow) === "node") { + InspectorController.pushNodePathToFrontend(o, true); + } else { + switch (Object.describe(o)) { + case "Database": + InspectorController.selectDatabase(o); + break; + case "Storage": + InspectorController.selectDOMStorage(o); + break; + } + } + } +} + InjectedScript._resolveObject = function(objectProxy) { var object = InjectedScript._objectForId(objectProxy.objectId); @@ -486,11 +844,11 @@ InjectedScript._resolveObject = function(objectProxy) var protoDepth = objectProxy.protoDepth; // Follow the property path. - for (var i = 0; object && i < path.length; ++i) + for (var i = 0; object && path && i < path.length; ++i) object = object[path[i]]; // Get to the necessary proto layer. - for (var i = 0; object && i < protoDepth; ++i) + for (var i = 0; object && protoDepth && i < protoDepth; ++i) object = object.__proto__; return object; @@ -505,12 +863,34 @@ InjectedScript._window = function() InjectedScript._nodeForId = function(nodeId) { - // TODO: replace with node lookup in the InspectorDOMAgent once DOMAgent nodes are used. - return nodeId; + if (!nodeId) + return null; + return InspectorController.nodeForId(nodeId); } InjectedScript._objectForId = function(objectId) { - // TODO: replace with node lookups for node ids and evaluation result lookups for the rest of ids. + if (typeof objectId === "number") + return InjectedScript._nodeForId(objectId); + else if (typeof objectId === "string") + return InspectorController.unwrapObject(objectId); + + // TODO: move scope chain objects to proxy-based schema. return objectId; } + +// Called from within InspectorController on the 'inspected page' side. +InjectedScript.createProxyObject = function(object, objectId) +{ + var result = {}; + result.objectId = objectId; + result.type = Object.type(object, InjectedScript._window()); + if (result.type === "node") + result.nodeId = InspectorController.pushNodePathToFrontend(object, false); + try { + result.description = Object.describe(object, true, InjectedScript._window()); + } catch (e) { + result.exception = e.toString(); + } + return result; +} diff --git a/WebCore/inspector/front-end/ObjectPropertiesSection.js b/WebCore/inspector/front-end/ObjectPropertiesSection.js index 9b03940..f0b877d 100644 --- a/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -124,13 +124,6 @@ WebInspector.ObjectPropertyTreeElement = function(property) } WebInspector.ObjectPropertyTreeElement.prototype = { - safePropertyValue: function(object, propertyName) - { - if (object["__lookupGetter__"] && object.__lookupGetter__(propertyName)) - return; - return object[propertyName]; - }, - onpopulate: function() { if (this.children.length && !this.shouldRefreshChildren) @@ -147,7 +140,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { self.appendChild(new self.treeOutline.section.treeElementConstructor(properties[i])); } }; - InspectorController.getProperties(this.property.childObjectProxy, false, callback); + InspectorController.getProperties(this.property.value, false, callback); }, ondblclick: function(element, event) @@ -168,7 +161,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.valueElement = document.createElement("span"); this.valueElement.className = "value"; - this.valueElement.textContent = this.property.textContent; + this.valueElement.textContent = this.property.value.description; if (this.property.isGetter) this.valueElement.addStyleClass("dimmed"); @@ -177,7 +170,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.listItemElement.appendChild(nameElement); this.listItemElement.appendChild(document.createTextNode(": ")); this.listItemElement.appendChild(this.valueElement); - this.hasChildren = this.property.hasChildren; + this.hasChildren = this.property.value.hasChildren; }, updateSiblings: function() diff --git a/WebCore/inspector/front-end/ObjectProxy.js b/WebCore/inspector/front-end/ObjectProxy.js index fa7816e..dbb9e48 100644 --- a/WebCore/inspector/front-end/ObjectProxy.js +++ b/WebCore/inspector/front-end/ObjectProxy.js @@ -28,18 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.ObjectProxy = function(objectId, path, protoDepth) +WebInspector.ObjectProxy = function(objectId, path, protoDepth, description, hasChildren) { this.objectId = objectId; this.path = path || []; this.protoDepth = protoDepth || 0; + this.description = description; + this.hasChildren = hasChildren; } WebInspector.ObjectPropertyProxy = function(name, object) { this.name = name; - this.type = "object"; - this.hasChildren = true; - this.textContent = Object.describe(object, true); - this.childObjectProxy = new WebInspector.ObjectProxy(object); + this.value = new WebInspector.ObjectProxy(object, [], 0, Object.describe(object, true), true); } diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js index 3e2212c..5046f6b 100644 --- a/WebCore/inspector/front-end/Panel.js +++ b/WebCore/inspector/front-end/Panel.js @@ -66,18 +66,6 @@ WebInspector.Panel.prototype = { return this._toolbarItem; }, - createStatusBarButton: function() - { - var button = document.createElement("button"); - var glyph = document.createElement("div"); - glyph.className = "glyph"; - button.appendChild(glyph); - var glyphShadow = document.createElement("div"); - glyphShadow.className = "glyph shadow"; - button.appendChild(glyphShadow); - return button; - }, - show: function() { WebInspector.View.prototype.show.call(this); diff --git a/WebCore/inspector/front-end/ProfileView.js b/WebCore/inspector/front-end/ProfileView.js index 2517bd2..5c9fcda 100644 --- a/WebCore/inspector/front-end/ProfileView.js +++ b/WebCore/inspector/front-end/ProfileView.js @@ -56,25 +56,19 @@ WebInspector.ProfileView = function(profile) this.viewSelectElement.appendChild(heavyViewOption); this.viewSelectElement.appendChild(treeViewOption); - this.percentButton = document.createElement("button"); - this.percentButton.className = "percent-time-status-bar-item status-bar-item"; + this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item"); this.percentButton.addEventListener("click", this._percentClicked.bind(this), false); - this.focusButton = document.createElement("button"); - this.focusButton.title = WebInspector.UIString("Focus selected function."); - this.focusButton.className = "focus-profile-node-status-bar-item status-bar-item"; + this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("Focus selected function."), "focus-profile-node-status-bar-item"); this.focusButton.disabled = true; this.focusButton.addEventListener("click", this._focusClicked.bind(this), false); - this.excludeButton = document.createElement("button"); - this.excludeButton.title = WebInspector.UIString("Exclude selected function."); - this.excludeButton.className = "exclude-profile-node-status-bar-item status-bar-item"; + this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."), "exclude-profile-node-status-bar-item"); this.excludeButton.disabled = true; this.excludeButton.addEventListener("click", this._excludeClicked.bind(this), false); - this.resetButton = document.createElement("button"); - this.resetButton.title = WebInspector.UIString("Restore all functions."); - this.resetButton.className = "reset-profile-status-bar-item status-bar-item hidden"; + this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("Restore all functions."), "reset-profile-status-bar-item"); + this.resetButton.visible = false; this.resetButton.addEventListener("click", this._resetClicked.bind(this), false); this.profile = profile; @@ -90,7 +84,7 @@ WebInspector.ProfileView = function(profile) WebInspector.ProfileView.prototype = { get statusBarItems() { - return [this.viewSelectElement, this.percentButton, this.focusButton, this.excludeButton, this.resetButton]; + return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element]; }, get profile() @@ -439,10 +433,10 @@ WebInspector.ProfileView.prototype = { { if (this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent) { this.percentButton.title = WebInspector.UIString("Show absolute total and self times."); - this.percentButton.addStyleClass("toggled-on"); + this.percentButton.toggled = true; } else { this.percentButton.title = WebInspector.UIString("Show total and self times as percentages."); - this.percentButton.removeStyleClass("toggled-on"); + this.percentButton.toggled = false; } }, @@ -451,7 +445,7 @@ WebInspector.ProfileView.prototype = { if (!this.dataGrid.selectedNode) return; - this.resetButton.removeStyleClass("hidden"); + this.resetButton.visible = true; this.profileDataGridTree.focus(this.dataGrid.selectedNode); this.refresh(); this.refreshVisibleData(); @@ -466,7 +460,7 @@ WebInspector.ProfileView.prototype = { selectedNode.deselect(); - this.resetButton.removeStyleClass("hidden"); + this.resetButton.visible = true; this.profileDataGridTree.exclude(selectedNode); this.refresh(); this.refreshVisibleData(); @@ -474,7 +468,7 @@ WebInspector.ProfileView.prototype = { _resetClicked: function(event) { - this.resetButton.addStyleClass("hidden"); + this.resetButton.visible = false; this.profileDataGridTree.restore(); this.refresh(); this.refreshVisibleData(); diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js index c8b948a..e7ee064 100644 --- a/WebCore/inspector/front-end/ProfilesPanel.js +++ b/WebCore/inspector/front-end/ProfilesPanel.js @@ -59,14 +59,10 @@ WebInspector.ProfilesPanel = function() this.profileViews.id = "profile-views"; this.element.appendChild(this.profileViews); - this.enableToggleButton = this.createStatusBarButton(); - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false); - this.recordButton = this.createStatusBarButton(); - this.recordButton.title = WebInspector.UIString("Start profiling."); - this.recordButton.id = "record-profile-status-bar-item"; - this.recordButton.className = "status-bar-item"; + this.recordButton = new WebInspector.StatusBarButton(WebInspector.UIString("Start profiling."), "record-profile-status-bar-item"); this.recordButton.addEventListener("click", this._recordClicked.bind(this), false); this.recording = false; @@ -87,7 +83,7 @@ WebInspector.ProfilesPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton, this.recordButton, this.profileViewStatusBarItemsContainer]; + return [this.enableToggleButton.element, this.recordButton.element, this.profileViewStatusBarItemsContainer]; }, show: function() @@ -317,10 +313,10 @@ WebInspector.ProfilesPanel.prototype = { this.recording = isProfiling; if (isProfiling) { - this.recordButton.addStyleClass("toggled-on"); + this.recordButton.toggled = true; this.recordButton.title = WebInspector.UIString("Stop profiling."); } else { - this.recordButton.removeStyleClass("toggled-on"); + this.recordButton.toggled = false; this.recordButton.title = WebInspector.UIString("Start profiling."); } }, @@ -336,14 +332,14 @@ WebInspector.ProfilesPanel.prototype = { { if (InspectorController.profilerEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable."); - this.enableToggleButton.addStyleClass("toggled-on"); - this.recordButton.removeStyleClass("hidden"); + this.enableToggleButton.toggled = true; + this.recordButton.visible = true; this.profileViewStatusBarItemsContainer.removeStyleClass("hidden"); this.panelEnablerView.visible = false; } else { this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable."); - this.enableToggleButton.removeStyleClass("toggled-on"); - this.recordButton.addStyleClass("hidden"); + this.enableToggleButton.toggled = false; + this.recordButton.visible = false; this.profileViewStatusBarItemsContainer.addStyleClass("hidden"); this.panelEnablerView.visible = true; } diff --git a/WebCore/inspector/front-end/PropertiesSidebarPane.js b/WebCore/inspector/front-end/PropertiesSidebarPane.js index 2d32137..4e55761 100644 --- a/WebCore/inspector/front-end/PropertiesSidebarPane.js +++ b/WebCore/inspector/front-end/PropertiesSidebarPane.js @@ -32,7 +32,7 @@ WebInspector.PropertiesSidebarPane = function() } WebInspector.PropertiesSidebarPane.prototype = { - update: function(object) + update: function(node) { var body = this.bodyElement; @@ -40,7 +40,7 @@ WebInspector.PropertiesSidebarPane.prototype = { this.sections = []; - if (!object) + if (!node) return; var self = this; @@ -51,13 +51,13 @@ WebInspector.PropertiesSidebarPane.prototype = { // Get array of prototype user-friendly names. for (var i = 0; i < prototypes.length; ++i) { - var prototype = new WebInspector.ObjectProxy(object, [], i); + var prototype = new WebInspector.ObjectProxy(node.id, [], i); var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype")); self.sections.push(section); body.appendChild(section.element); } }; - InspectorController.getPrototypes(object, callback); + InspectorController.getPrototypes(node.id, callback); } } diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index fb43551..bb7faa6 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -139,14 +139,11 @@ WebInspector.ResourcesPanel = function() this.element.appendChild(this.panelEnablerView.element); - this.enableToggleButton = this.createStatusBarButton(); - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); this.enableToggleButton.addEventListener("click", this._toggleResourceTracking.bind(this), false); - this.largerResourcesButton = this.createStatusBarButton(); - this.largerResourcesButton.id = "resources-larger-resources-status-bar-item"; - this.largerResourcesButton.className = "status-bar-item toggled-on"; - this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); + this.largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "resources-larger-resources-status-bar-item"); + this.largerResourcesButton.toggled = true; this.largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false); this.sortingSelectElement = document.createElement("select"); @@ -211,7 +208,7 @@ WebInspector.ResourcesPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton, this.largerResourcesButton, this.sortingSelectElement]; + return [this.enableToggleButton.element, this.largerResourcesButton.element, this.sortingSelectElement]; }, show: function() @@ -467,14 +464,14 @@ WebInspector.ResourcesPanel.prototype = { if (InspectorController.resourceTrackingEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Resource tracking enabled. Click to disable."); - this.enableToggleButton.addStyleClass("toggled-on"); - this.largerResourcesButton.removeStyleClass("hidden"); + this.enableToggleButton.toggled = true; + this.largerResourcesButton.visible = true; this.sortingSelectElement.removeStyleClass("hidden"); this.panelEnablerView.visible = false; } else { this.enableToggleButton.title = WebInspector.UIString("Resource tracking disabled. Click to enable."); - this.enableToggleButton.removeStyleClass("toggled-on"); - this.largerResourcesButton.addStyleClass("hidden"); + this.enableToggleButton.toggled = false; + this.largerResourcesButton.visible = false; this.sortingSelectElement.addStyleClass("hidden"); this.panelEnablerView.visible = true; } @@ -1076,12 +1073,12 @@ WebInspector.ResourcesPanel.prototype = { if (this.resourcesTreeElement.smallChildren) { this.resourcesGraphsElement.addStyleClass("small"); this.largerResourcesButton.title = WebInspector.UIString("Use large resource rows."); - this.largerResourcesButton.removeStyleClass("toggled-on"); + this.largerResourcesButton.toggled = false; this._adjustScrollPosition(); } else { this.resourcesGraphsElement.removeStyleClass("small"); this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); - this.largerResourcesButton.addStyleClass("toggled-on"); + this.largerResourcesButton.toggled = true; } }, @@ -1546,6 +1543,11 @@ WebInspector.ResourceSidebarTreeElement.prototype = { // Do nothing. }, + get selectable() + { + return WebInspector.panels.resources._filterCategory == "all" || WebInspector.panels.resources._filterCategory == this.resource.category.name; + }, + createIconElement: function() { var previousIconElement = this.iconElement; diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 0058374..a97d5cf 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -151,13 +151,10 @@ WebInspector.ScriptsPanel = function() this.element.appendChild(this.sidebarElement); this.element.appendChild(this.sidebarResizeElement); - this.enableToggleButton = this.createStatusBarButton(); - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false); - this.pauseOnExceptionButton = this.createStatusBarButton(); - this.pauseOnExceptionButton.id = "scripts-pause-on-exceptions-status-bar-item"; - this.pauseOnExceptionButton.className = "status-bar-item"; + this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item"); this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); this._breakpointsURLMap = {}; @@ -208,7 +205,7 @@ WebInspector.ScriptsPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton, this.pauseOnExceptionButton]; + return [this.enableToggleButton.element, this.pauseOnExceptionButton.element]; }, get paused() @@ -377,13 +374,8 @@ WebInspector.ScriptsPanel.prototype = { var panel = this; function delayedEvaluation() { - if (!code) { - // Evaluate into properties in scope of the selected call frame. - callback(panel._variablesInScope(callFrame)); - return; - } try { - callback(callFrame.evaluate(code)); + callback(InspectorController.wrapObject(callFrame.evaluate(code))); } catch (e) { callback(e, true); } @@ -391,10 +383,14 @@ WebInspector.ScriptsPanel.prototype = { setTimeout(delayedEvaluation, 0); }, - _variablesInScope: function(callFrame) + variablesInSelectedCallFrame: function() { + var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; + if (!this._paused || !selectedCallFrame) + return {}; + var result = {}; - var scopeChain = callFrame.scopeChain; + var scopeChain = selectedCallFrame.scopeChain; for (var i = 0; i < scopeChain.length; ++i) { var scopeObject = scopeChain[i]; for (var property in scopeObject) @@ -764,10 +760,10 @@ WebInspector.ScriptsPanel.prototype = { { if (InspectorController.pauseOnExceptions()) { this.pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions."); - this.pauseOnExceptionButton.addStyleClass("toggled-on"); + this.pauseOnExceptionButton.toggled = true; } else { this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on exceptions."); - this.pauseOnExceptionButton.removeStyleClass("toggled-on"); + this.pauseOnExceptionButton.toggled = false; } }, @@ -775,13 +771,13 @@ WebInspector.ScriptsPanel.prototype = { { if (InspectorController.debuggerEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable."); - this.enableToggleButton.addStyleClass("toggled-on"); - this.pauseOnExceptionButton.removeStyleClass("hidden"); + this.enableToggleButton.toggled = true; + this.pauseOnExceptionButton.visible = true; this.panelEnablerView.visible = false; } else { this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable."); - this.enableToggleButton.removeStyleClass("toggled-on"); - this.pauseOnExceptionButton.addStyleClass("hidden"); + this.enableToggleButton.toggled = false; + this.pauseOnExceptionButton.visible = false; this.panelEnablerView.visible = true; } diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 930eb16..9c0f7e0 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -289,8 +289,10 @@ WebInspector.SourceFrame.prototype = { return; var sourceRow = event.target.enclosingNodeOrSelfWithNodeName("tr"); - if (sourceRow._breakpointObject) - sourceRow._breakpointObject.enabled = !sourceRow._breakpointObject.enabled; + if (sourceRow._breakpointObject && sourceRow._breakpointObject.enabled) + sourceRow._breakpointObject.enabled = false; + else if (sourceRow._breakpointObject) + WebInspector.panels.scripts.removeBreakpoint(sourceRow._breakpointObject); else if (this.addBreakpointDelegate) this.addBreakpointDelegate(this.lineNumberForSourceRow(sourceRow)); }, diff --git a/WebCore/inspector/front-end/StatusBarButton.js b/WebCore/inspector/front-end/StatusBarButton.js new file mode 100644 index 0000000..5c69ed5 --- /dev/null +++ b/WebCore/inspector/front-end/StatusBarButton.js @@ -0,0 +1,118 @@ +/* + * 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.StatusBarButton = function(title, className) +{ + this.element = document.createElement("button"); + this.element.className = className + " status-bar-item"; + this.element.addEventListener("click", this._clicked.bind(this), false); + + this.glyph = document.createElement("div"); + this.glyph.className = "glyph"; + this.element.appendChild(this.glyph); + + this.glyphShadow = document.createElement("div"); + this.glyphShadow.className = "glyph shadow"; + this.element.appendChild(this.glyphShadow); + + this.title = title; + this.disabled = false; + this._toggled = false; + this._visible = true; +} + +WebInspector.StatusBarButton.prototype = { + _clicked: function() + { + this.dispatchEventToListeners("click"); + }, + + get disabled() + { + return this._disabled; + }, + + set disabled(x) + { + if (this._disabled === x) + return; + this._disabled = x; + this.element.disabled = x; + }, + + get title() + { + return this._title; + }, + + set title(x) + { + if (this._title === x) + return; + this._title = x; + this.element.title = x; + }, + + get toggled() + { + return this._toggled; + }, + + set toggled(x) + { + if (this._toggled === x) + return; + + if (x) + this.element.addStyleClass("toggled-on"); + else + this.element.removeStyleClass("toggled-on"); + this._toggled = x; + }, + + get visible() + { + return this._visible; + }, + + set visible(x) + { + if (this._visible === x) + return; + + if (x) + this.element.removeStyleClass("hidden"); + else + this.element.addStyleClass("hidden"); + this._visible = x; + } +} + +WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js index 8a3a67f..db585e0 100644 --- a/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/WebCore/inspector/front-end/StylesSidebarPane.js @@ -67,10 +67,10 @@ WebInspector.StylesSidebarPane.prototype = { var callback = function(styles) { if (!styles) return; - var nodeWrapper = WebInspector.wrapNodeWithStyles(node, styles); - self._update(refresh, body, nodeWrapper, editedSection, forceUpdate); + node._setStyles(styles.computedStyle, styles.inlineStyle, styles.styleAttributes, styles.matchedCSSRules); + self._update(refresh, body, node, editedSection, forceUpdate); }; - InspectorController.getStyles(node, !Preferences.showUserAgentStyles, callback); + InspectorController.getStyles(node.id, !Preferences.showUserAgentStyles, callback); }, _update: function(refresh, body, node, editedSection, forceUpdate) @@ -322,8 +322,9 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl this.editable = (editable && !computedStyle); // Prevent editing the user agent and user rules. - var isUserAgent = this.styleRule.isUserAgent; - var isUser = this.styleRule.isUser; + var isUserAgent = this.rule && this.rule.isUserAgent; + var isUser = this.rule && this.rule.isUser; + var isViaInspector = this.rule && this.rule.isViaInspector; if (isUserAgent || isUser) this.editable = false; @@ -366,7 +367,7 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl subtitle = WebInspector.UIString("user agent stylesheet"); else if (isUser) subtitle = WebInspector.UIString("user stylesheet"); - else if (this.styleRule.parentStyleSheet === WebInspector.panels.elements.stylesheet) + else if (isViaInspector) subtitle = WebInspector.UIString("via inspector"); else subtitle = WebInspector.UIString("inline stylesheet"); @@ -611,24 +612,12 @@ WebInspector.StylePropertiesSection.prototype = { moveToNextIfNeeded.call(self); }; - InspectorController.applyStyleRuleText(this.rule._id, newContent, this.pane.node, callback); + InspectorController.applyStyleRuleText(this.rule.id, newContent, this.pane.node.id, callback); }, editingSelectorCancelled: function(element, context) { element.textContent = context; - }, - - _doesSelectorAffectSelectedNode: function(selector) - { - var selectedNode = this.pane.node; - var nodes = selectedNode.ownerDocument.querySelectorAll(selector); - for (var i = 0; i < nodes.length; ++i) { - if (nodes[i] === selectedNode) - return true; - } - - return false; } } @@ -673,15 +662,17 @@ WebInspector.BlankStylePropertiesSection.prototype = { editingCommitted: function(element, newContent, oldContent, context) { var self = this; - var callback = function(styleRule) { - if (!styleRule) { + var callback = function(result) { + if (!result) { // Invalid Syntax for a Selector self.editingCancelled(); return; } + var styleRule = result[0]; + var doesSelectorAffectSelectedNode = result[1]; self.makeNormal(WebInspector.CSSStyleDeclaration.parseRule(styleRule)); - if (!self._doesSelectorAffectSelectedNode(newContent)) { + if (!doesSelectorAffectSelectedNode) { self.noAffect = true; self.element.addStyleClass("no-affect"); } @@ -692,7 +683,7 @@ WebInspector.BlankStylePropertiesSection.prototype = { self.pane.addBlankSection(); self.addNewBlankProperty().startEditing(); }; - InspectorController.addStyleSelector(newContent, callback); + InspectorController.addStyleSelector(newContent, this.pane.node.id, callback); }, makeNormal: function(styleRule) @@ -896,63 +887,70 @@ WebInspector.StylePropertyTreeElement.prototype = { // Simple: rgb -> hsl -> nickname? -> shorthex? -> hex -> ... // Advanced: rgba -> hsla -> nickname? -> ... if (colors && colors.length === 1) { - var color = new WebInspector.Color(htmlValue); - swatch.addEventListener("click", changeColorDisplay, false); - swatch.addEventListener("dblclick", function(event) { - event.stopPropagation(); - }, false); - - var mode = color.mode; - var valueElement = this.valueElement; - function changeColorDisplay(event) { - - function changeTo(newMode, content) { - mode = newMode; - valueElement.textContent = content; - } + try { + var color = new WebInspector.Color(htmlValue); + } catch(e) { + var color = null; + } + + if (color) { + swatch.addEventListener("click", changeColorDisplay, false); + swatch.addEventListener("dblclick", function(event) { + event.stopPropagation(); + }, false); - switch (mode) { - case "rgb": - changeTo("hsl", color.toHsl()); - break; + var mode = color.mode; + var valueElement = this.valueElement; + function changeColorDisplay(event) { - case "shorthex": - changeTo("hex", color.toHex()); - break; + function changeTo(newMode, content) { + mode = newMode; + valueElement.textContent = content; + } - case "hex": - changeTo("rgb", color.toRgb()); - break; + switch (mode) { + case "rgb": + changeTo("hsl", color.toHsl()); + break; - case "nickname": - if (color.simple) { - if (color.hasShortHex()) + case "shorthex": + changeTo("hex", color.toHex()); + break; + + case "hex": + changeTo("rgb", color.toRgb()); + break; + + case "nickname": + if (color.simple) { + if (color.hasShortHex()) + changeTo("shorthex", color.toShortHex()); + else + changeTo("hex", color.toHex()); + } else + changeTo("rgba", color.toRgba()); + break; + + case "hsl": + if (color.nickname) + changeTo("nickname", color.toNickname()); + else if (color.hasShortHex()) changeTo("shorthex", color.toShortHex()); else changeTo("hex", color.toHex()); - } else - changeTo("rgba", color.toRgba()); - break; - - case "hsl": - if (color.nickname) - changeTo("nickname", color.toNickname()); - else if (color.hasShortHex()) - changeTo("shorthex", color.toShortHex()); - else - changeTo("hex", color.toHex()); - break; - - case "rgba": - changeTo("hsla", color.toHsla()); - break; - - case "hsla": - if (color.nickname) - changeTo("nickname", color.toNickname()); - else - changeTo("rgba", color.toRgba()); - break; + break; + + case "rgba": + changeTo("hsla", color.toHsla()); + break; + + case "hsla": + if (color.nickname) + changeTo("nickname", color.toNickname()); + else + changeTo("rgba", color.toRgba()); + break; + } } } } @@ -992,7 +990,7 @@ WebInspector.StylePropertyTreeElement.prototype = { self.updateAll(true); }; - InspectorController.toggleStyleEnabled(this.style._id, this.name, disabled, callback); + InspectorController.toggleStyleEnabled(this.style.id, this.name, disabled, callback); }, updateState: function() @@ -1155,7 +1153,7 @@ WebInspector.StylePropertyTreeElement.prototype = { } else { // Restore the original CSS text before applying user changes. This is needed to prevent // new properties from sticking around if the user adds one, then removes it. - InspectorController.setStyleText(this.style, this.originalCSSText); + InspectorController.setStyleText(this.style.id, this.originalCSSText); } this.applyStyleText(this.listItemElement.textContent); @@ -1175,7 +1173,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (this._newProperty) this.treeOutline.removeChild(this); else if (this.originalCSSText) { - InspectorController.setStyleText(this.style, this.originalCSSText); + InspectorController.setStyleText(this.style.id, this.originalCSSText); if (this.treeOutline.section && this.treeOutline.section.pane) this.treeOutline.section.pane.dispatchEventToListeners("style edited"); @@ -1294,7 +1292,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (!self.rule) WebInspector.panels.elements.treeOutline.update(); }; - InspectorController.applyStyleText(this.style._id, styleText.trimWhitespace(), this.name, callback); + InspectorController.applyStyleText(this.style.id, styleText.trimWhitespace(), this.name, callback); } } diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index c39c95b..c82de61 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -9,6 +9,7 @@ <file>ChangesView.js</file> <file>Color.js</file> <file>ConsoleView.js</file> + <file>CookieItemsView.js</file> <file>Database.js</file> <file>DatabaseQueryView.js</file> <file>DatabasesPanel.js</file> @@ -50,6 +51,7 @@ <file>SidebarTreeElement.js</file> <file>SourceFrame.js</file> <file>SourceView.js</file> + <file>StatusBarButton.js</file> <file>StylesSidebarPane.js</file> <file>TextPrompt.js</file> <file>TopDownProfileDataGridTree.js</file> @@ -62,6 +64,7 @@ <file>Images/clearConsoleButtonGlyph.png</file> <file>Images/closeButtons.png</file> <file>Images/consoleButtonGlyph.png</file> + <file>Images/cookie.png</file> <file>Images/database.png</file> <file>Images/databasesIcon.png</file> <file>Images/databaseTable.png</file> diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index 51d626a..3292d8d 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -1626,6 +1626,10 @@ body.inactive .sidebar { content: url(Images/domStorage.png); } +.cookie-sidebar-tree-item .icon { + content: url(Images/cookie.png); +} + #storage-views { position: absolute; top: 0; @@ -1785,6 +1789,14 @@ body.inactive .sidebar { overflow: hidden; } +.data-grid .centered div { + text-align: center; +} + +.data-grid .right div { + text-align: right; +} + .data-grid th.sortable div { position: relative; } @@ -2091,7 +2103,7 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { -webkit-mask-image: url(Images/enableSolidButtonGlyph.png); } -#scripts-pause-on-exceptions-status-bar-item .glyph { +.scripts-pause-on-exceptions-status-bar-item .glyph { -webkit-mask-image: url(Images/pauseOnExceptionButtonGlyph.png); } @@ -2209,7 +2221,7 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { overflow: auto; } -#resources-larger-resources-status-bar-item .glyph { +.resources-larger-resources-status-bar-item .glyph { -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png); } @@ -3093,16 +3105,16 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { button.enable-toggle-status-bar-item .glyph { } -#record-profile-status-bar-item .glyph { +.record-profile-status-bar-item .glyph { -webkit-mask-image: url(Images/recordButtonGlyph.png); } -#record-profile-status-bar-item.toggled-on .glyph { +.record-profile-status-bar-item.toggled-on .glyph { -webkit-mask-image: url(Images/recordToggledButtonGlyph.png); - background-color: rgb(216, 0, 0); + background-color: rgb(216, 0, 0) !important; } -#node-search-status-bar-item .glyph { +.node-search-status-bar-item .glyph { -webkit-mask-image: url(Images/nodeSearchButtonGlyph.png); } @@ -3136,12 +3148,8 @@ button.enable-toggle-status-bar-item .glyph { margin-left: -1px; } -.refresh-storage-status-bar-item { - background-image: url(Images/reloadButtons.png) !important; -} - -.refresh-storage-status-bar-item:active { - background-position: 32px 0; +.refresh-storage-status-bar-item .glyph { + -webkit-mask-image: url(Images/reloadButtonGlyph.png); } #storage-view-status-bar-items { diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index a3dc407..4857c7a 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -49,6 +49,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="DOMStorageItemsView.js"></script> <script type="text/javascript" src="DataGrid.js"></script> <script type="text/javascript" src="DOMStorageDataGrid.js"></script> + <script type="text/javascript" src="CookieItemsView.js"></script> <script type="text/javascript" src="Script.js"></script> <script type="text/javascript" src="Breakpoint.js"></script> <script type="text/javascript" src="SidebarPane.js"></script> @@ -66,6 +67,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StylesSidebarPane.js"></script> <script type="text/javascript" src="Panel.js"></script> <script type="text/javascript" src="PanelEnablerView.js"></script> + <script type="text/javascript" src="StatusBarButton.js"></script> <script type="text/javascript" src="ElementsPanel.js"></script> <script type="text/javascript" src="ResourcesPanel.js"></script> <script type="text/javascript" src="ScriptsPanel.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index aa21a86..f6377c2 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -39,7 +39,6 @@ var Preferences = { showInheritedComputedStyleProperties: false, styleRulesExpandedState: {}, showMissingLocalizedStrings: false, - useDOMAgent: false } var WebInspector = { @@ -307,7 +306,7 @@ var WebInspector = { set hoveredDOMNode(x) { - if (objectsAreSame(this._hoveredDOMNode, x)) + if (this._hoveredDOMNode === x) return; this._hoveredDOMNode = x; @@ -333,7 +332,7 @@ var WebInspector = { } if (this._hoveredDOMNode) { - InspectorController.highlightDOMNode(this._hoveredDOMNode); + InspectorController.highlightDOMNode(this._hoveredDOMNode.id); this.showingDOMNodeHighlight = true; } else { InspectorController.hideDOMNodeHighlight(); @@ -353,9 +352,7 @@ WebInspector.loaded = function() // this.changes = new WebInspector.ChangesView(this.drawer); // TODO: Remove class="hidden" from inspector.html on button#changes-status-bar-item this.drawer.visibleView = this.console; - - if (Preferences.useDOMAgent) - this.domAgent = new WebInspector.DOMAgent(); + this.domAgent = new WebInspector.DOMAgent(); this.resourceCategories = { documents: new WebInspector.ResourceCategory(WebInspector.UIString("Documents"), "documents"), @@ -441,7 +438,7 @@ WebInspector.loaded = function() document.getElementById("toolbar").addEventListener("mousedown", this.toolbarDragStart, true); document.getElementById("close-button").addEventListener("click", this.close, true); - InspectorController.loaded(Preferences.useDOMAgent); + InspectorController.loaded(); } var windowLoaded = function() @@ -853,12 +850,12 @@ WebInspector.elementDragEnd = function(event) WebInspector.showConsole = function() { - this.drawer.visibleView = this.console; + this.drawer.showView(this.console); } WebInspector.showChanges = function() { - this.drawer.visibleView = this.changes; + this.drawer.showView(this.changes); } WebInspector.showElementsPanel = function() @@ -909,6 +906,23 @@ WebInspector.addResource = function(identifier, payload) this.panels.resources.addResource(resource); } +WebInspector.clearConsoleMessages = function() +{ + WebInspector.console.clearMessages(false); +} + +WebInspector.selectDatabase = function(o) +{ + WebInspector.showDatabasesPanel(); + WebInspector.panels.databases.selectDatabase(o); +} + +WebInspector.selectDOMStorage = function(o) +{ + WebInspector.showDatabasesPanel(); + WebInspector.panels.databases.selectDOMStorage(o); +} + WebInspector.updateResource = function(identifier, payload) { var resource = this.resources[identifier]; @@ -1073,11 +1087,6 @@ WebInspector.reset = function() this.console.clearMessages(); } -WebInspector.inspectedWindowCleared = function(inspectedWindow) -{ - this.panels.elements.inspectedWindowCleared(inspectedWindow); -} - WebInspector.resourceURLChanged = function(resource, oldURL) { delete this.resourceURLMap[oldURL]; @@ -1138,8 +1147,9 @@ WebInspector.drawLoadingPieChart = function(canvas, percent) { g.fill(); } -WebInspector.updateFocusedNode = function(node) +WebInspector.updateFocusedNode = function(nodeId) { + var node = WebInspector.domAgent.nodeForId(nodeId); if (!node) // FIXME: Should we deselect if null is passed in? return; @@ -1329,6 +1339,11 @@ WebInspector.performSearch = function(event) this.currentPanel.performSearch(query); } +WebInspector.addNodesToSearchResult = function(nodeIds) +{ + WebInspector.panels.elements.addNodesToSearchResult(nodeIds); +} + WebInspector.updateSearchMatchesCount = function(matches, panel) { if (!panel) diff --git a/WebCore/inspector/front-end/treeoutline.js b/WebCore/inspector/front-end/treeoutline.js index 579e7fb..67f35c2 100644 --- a/WebCore/inspector/front-end/treeoutline.js +++ b/WebCore/inspector/front-end/treeoutline.js @@ -249,21 +249,18 @@ TreeOutline.prototype._forgetChildrenRecursive = function(parentElement) } } -TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent, equal) +TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent) { if (!representedObject) return null; - if (!equal) - equal = function(a, b) { return a === b }; - if ("__treeElementIdentifier" in representedObject) { // If this representedObject has a tree element identifier, and it is a known TreeElement // in our tree we can just return that tree element. var elements = this._knownTreeElements[representedObject.__treeElementIdentifier]; if (elements) { for (var i = 0; i < elements.length; ++i) - if (equal(elements[i].representedObject, representedObject)) + if (elements[i].representedObject === representedObject) return elements[i]; } } @@ -277,7 +274,7 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, var found = false; for (var i = 0; i < this.children.length; ++i) { item = this.children[i]; - if (equal(item.representedObject, representedObject) || isAncestor(item.representedObject, representedObject)) { + if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) { found = true; break; } @@ -292,7 +289,7 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, var currentObject = representedObject; while (currentObject) { ancestors.unshift(currentObject); - if (equal(currentObject, item.representedObject)) + if (currentObject === item.representedObject) break; currentObject = getParent(currentObject); } @@ -301,18 +298,18 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, for (var i = 0; i < ancestors.length; ++i) { // Make sure we don't call findTreeElement with the same representedObject // again, to prevent infinite recursion. - if (equal(ancestors[i], representedObject)) + if (ancestors[i] === representedObject) continue; // FIXME: we could do something faster than findTreeElement since we will know the next // ancestor exists in the tree. - item = this.findTreeElement(ancestors[i], isAncestor, getParent, equal); + item = this.findTreeElement(ancestors[i], isAncestor, getParent); if (item && item.onpopulate) item.onpopulate(item); } // Now that all the ancestors are populated, try to find the representedObject again. This time // without the isAncestor and getParent functions to prevent an infinite recursion if it isn't found. - return this.findTreeElement(representedObject, null, null, equal); + return this.findTreeElement(representedObject); } TreeOutline.prototype.treeElementFromPoint = function(x, y) diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js index eec0b87..e60af42 100644 --- a/WebCore/inspector/front-end/utilities.js +++ b/WebCore/inspector/front-end/utilities.js @@ -56,6 +56,18 @@ Object.type = function(obj, win) return type; } +Object.proxyType = function(objectProxy) +{ + if (objectProxy === null) + return "null"; + + var type = typeof objectProxy; + if (type !== "object" && type !== "function") + return type; + + return objectProxy.type; +} + Object.hasProperties = function(obj) { if (typeof obj === "undefined" || typeof obj === "null") @@ -65,9 +77,9 @@ Object.hasProperties = function(obj) return false; } -Object.describe = function(obj, abbreviated) +Object.describe = function(obj, abbreviated, win) { - var type1 = Object.type(obj); + var type1 = Object.type(obj, win); var type2 = Object.prototype.toString.call(obj).replace(/^\[object (.*)\]$/i, "$1"); switch (type1) { @@ -238,7 +250,7 @@ Element.prototype.hasStyleClass = function(className) Node.prototype.enclosingNodeOrSelfWithNodeNameInArray = function(nameArray) { - for (var node = this; node && !objectsAreSame(node, this.ownerDocument); node = node.parentNode) + for (var node = this; node && node !== this.ownerDocument; node = node.parentNode) for (var i = 0; i < nameArray.length; ++i) if (node.nodeName.toLowerCase() === nameArray[i].toLowerCase()) return node; @@ -252,7 +264,7 @@ Node.prototype.enclosingNodeOrSelfWithNodeName = function(nodeName) Node.prototype.enclosingNodeOrSelfWithClass = function(className) { - for (var node = this; node && !objectsAreSame(node, this.ownerDocument); node = node.parentNode) + for (var node = this; node && node !== this.ownerDocument; node = node.parentNode) if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className)) return node; return null; @@ -518,21 +530,6 @@ function nodeContentPreview() return preview.collapseWhitespace(); } -function objectsAreSame(a, b) -{ - // FIXME: Make this more generic so is works with any wrapped object, not just nodes. - // This function is used to compare nodes that might be JSInspectedObjectWrappers, since - // JavaScript equality is not true for JSInspectedObjectWrappers of the same node wrapped - // with different global ExecStates, we use isSameNode to compare them. - if (a === b) - return true; - if (!a || !b) - return false; - if (a.isSameNode && b.isSameNode) - return a.isSameNode(b); - return false; -} - function isAncestorNode(ancestor) { if (!this || !ancestor) @@ -540,7 +537,7 @@ function isAncestorNode(ancestor) var currentNode = ancestor.parentNode; while (currentNode) { - if (objectsAreSame(this, currentNode)) + if (this === currentNode) return true; currentNode = currentNode.parentNode; } @@ -561,13 +558,13 @@ function firstCommonNodeAncestor(node) var node1 = this.parentNode; var node2 = node.parentNode; - if ((!node1 || !node2) || !objectsAreSame(node1, node2)) + if ((!node1 || !node2) || node1 !== node2) return null; while (node1 && node2) { if (!node1.parentNode || !node2.parentNode) break; - if (!objectsAreSame(node1, node2)) + if (node1 !== node2) break; node1 = node1.parentNode; @@ -626,7 +623,7 @@ function traverseNextNode(skipWhitespace, stayWithin) if (node) return node; - if (stayWithin && objectsAreSame(this, stayWithin)) + if (stayWithin && this === stayWithin) return null; node = skipWhitespace ? nextSiblingSkippingWhitespace.call(this) : this.nextSibling; @@ -634,7 +631,7 @@ function traverseNextNode(skipWhitespace, stayWithin) return node; node = this; - while (node && !(skipWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling) && (!stayWithin || !node.parentNode || !objectsAreSame(node.parentNode, stayWithin))) + while (node && !(skipWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling) && (!stayWithin || !node.parentNode || node.parentNode !== stayWithin)) node = node.parentNode; if (!node) return null; @@ -646,7 +643,7 @@ function traversePreviousNode(skipWhitespace, stayWithin) { if (!this) return; - if (stayWithin && objectsAreSame(this, stayWithin)) + if (stayWithin && this === stayWithin) return null; var node = skipWhitespace ? previousSiblingSkippingWhitespace.call(this) : this.previousSibling; while (node && (skipWhitespace ? lastChildSkippingWhitespace.call(node) : node.lastChild) ) @@ -756,10 +753,10 @@ function parentNodeOrFrameElement(node) { } function isAncestorIncludingParentFrames(a, b) { - if (objectsAreSame(a, b)) + if (a === b) return false; for (var node = b; node; node = getDocumentForNode(node).defaultView.frameElement) - if (objectsAreSame(a, node) || isAncestorNode.call(a, node)) + if (a === node || isAncestorNode.call(a, node)) return true; return false; } @@ -790,20 +787,27 @@ Number.secondsToString = function(seconds, formatterFunction, higherResolution) return formatterFunction("%.1f days", days); } -Number.bytesToString = function(bytes, formatterFunction) +Number.bytesToString = function(bytes, formatterFunction, higherResolution) { if (!formatterFunction) formatterFunction = String.sprintf; + if (typeof higherResolution === "undefined") + higherResolution = true; if (bytes < 1024) return formatterFunction("%.0fB", bytes); var kilobytes = bytes / 1024; - if (kilobytes < 1024) + if (higherResolution && kilobytes < 1024) return formatterFunction("%.2fKB", kilobytes); + else if (kilobytes < 1024) + return formatterFunction("%.0fKB", kilobytes); var megabytes = kilobytes / 1024; - return formatterFunction("%.3fMB", megabytes); + if (higherResolution) + return formatterFunction("%.3fMB", megabytes); + else + return formatterFunction("%.0fMB", megabytes); } Number.constrain = function(num, min, max) diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp index dfb9dd8..8da746c 100644 --- a/WebCore/loader/CachedFont.cpp +++ b/WebCore/loader/CachedFont.cpp @@ -31,7 +31,7 @@ #include "CachedResourceClientWalker.h" #include "DOMImplementation.h" #include "FontPlatformData.h" -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) #include "FontCustomPlatformData.h" #endif #include "TextResourceDecoder.h" @@ -60,7 +60,7 @@ CachedFont::CachedFont(const String &url) CachedFont::~CachedFont() { -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) delete m_fontData; #endif } @@ -98,7 +98,7 @@ void CachedFont::beginLoadIfNeeded(DocLoader* dl) bool CachedFont::ensureCustomFontData() { -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) #if ENABLE(SVG_FONTS) ASSERT(!m_isSVGFont); #endif @@ -117,7 +117,7 @@ FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, b if (m_externalSVGDocument) return FontPlatformData(size, bold, italic); #endif -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) ASSERT(m_fontData); return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, renderingMode); #else @@ -173,7 +173,7 @@ SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const void CachedFont::allClientsRemoved() { -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) if (m_fontData) { delete m_fontData; m_fontData = 0; diff --git a/WebCore/loader/DocumentLoader.cpp b/WebCore/loader/DocumentLoader.cpp index 4ec69a7..2c170d0 100644 --- a/WebCore/loader/DocumentLoader.cpp +++ b/WebCore/loader/DocumentLoader.cpp @@ -148,7 +148,6 @@ DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& , m_gotFirstByte(false) , m_primaryLoadComplete(false) , m_isClientRedirect(false) - , m_loadingFromCachedPage(false) , m_stopRecordingResponses(false) , m_substituteResourceDeliveryTimer(this, &DocumentLoader::substituteResourceDeliveryTimerFired) , m_didCreateGlobalHistoryEntry(false) @@ -697,16 +696,6 @@ bool DocumentLoader::urlForHistoryReflectsFailure() const return m_substituteData.isValid() || m_response.httpStatusCode() >= 400; } -void DocumentLoader::loadFromCachedPage(PassRefPtr<CachedPage> cachedPage) -{ - LOG(PageCache, "WebCorePageCache: DocumentLoader %p loading from cached page %p", this, cachedPage.get()); - - prepareForLoadStart(); - setLoadingFromCachedPage(true); - setCommitted(true); - frameLoader()->commitProvisionalLoad(cachedPage); -} - const KURL& DocumentLoader::originalURL() const { return m_originalRequestCopy.url(); diff --git a/WebCore/loader/DocumentLoader.h b/WebCore/loader/DocumentLoader.h index 134d954..cd28e06 100644 --- a/WebCore/loader/DocumentLoader.h +++ b/WebCore/loader/DocumentLoader.h @@ -174,10 +174,6 @@ namespace WebCore { bool didCreateGlobalHistoryEntry() const { return m_didCreateGlobalHistoryEntry; } void setDidCreateGlobalHistoryEntry(bool didCreateGlobalHistoryEntry) { m_didCreateGlobalHistoryEntry = didCreateGlobalHistoryEntry; } - void loadFromCachedPage(PassRefPtr<CachedPage>); - void setLoadingFromCachedPage(bool loading) { m_loadingFromCachedPage = loading; } - bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } - void setDefersLoading(bool); bool startLoadingMainResource(unsigned long identifier); @@ -264,7 +260,6 @@ namespace WebCore { bool m_gotFirstByte; bool m_primaryLoadComplete; bool m_isClientRedirect; - bool m_loadingFromCachedPage; String m_pageTitle; diff --git a/WebCore/loader/DocumentThreadableLoader.cpp b/WebCore/loader/DocumentThreadableLoader.cpp index dd5ca76..0d8dc18 100644 --- a/WebCore/loader/DocumentThreadableLoader.cpp +++ b/WebCore/loader/DocumentThreadableLoader.cpp @@ -32,8 +32,9 @@ #include "DocumentThreadableLoader.h" #include "AuthenticationChallenge.h" +#include "CrossOriginAccessControl.h" +#include "CrossOriginPreflightResultCache.h" #include "Document.h" -#include "DocumentThreadableLoader.h" #include "Frame.h" #include "FrameLoader.h" #include "ResourceRequest.h" @@ -43,61 +44,107 @@ namespace WebCore { -void DocumentThreadableLoader::loadResourceSynchronously(Document* document, const ResourceRequest& request, ThreadableLoaderClient& client, StoredCredentials storedCredentials) +void DocumentThreadableLoader::loadResourceSynchronously(Document* document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) { - bool sameOriginRequest = document->securityOrigin()->canRequest(request.url()); - - Vector<char> data; - ResourceError error; - ResourceResponse response; - unsigned long identifier = std::numeric_limits<unsigned long>::max(); - if (document->frame()) - identifier = document->frame()->loader()->loadResourceSynchronously(request, storedCredentials, error, response, data); - - // No exception for file:/// resources, see <rdar://problem/4962298>. - // Also, if we have an HTTP response, then it wasn't a network error in fact. - if (!error.isNull() && !request.url().isLocalFile() && response.httpStatusCode() <= 0) { - client.didFail(error); - return; - } - - // FIXME: This check along with the one in willSendRequest is specific to xhr and - // should be made more generic. - if (sameOriginRequest && !document->securityOrigin()->canRequest(response.url())) { - client.didFailRedirectCheck(); - return; - } - - client.didReceiveResponse(response); - - const char* bytes = static_cast<const char*>(data.data()); - int len = static_cast<int>(data.size()); - client.didReceiveData(bytes, len); - - client.didFinishLoading(identifier); + // The loader will be deleted as soon as this function exits. + RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, &client, LoadSynchronously, request, options)); + ASSERT(loader->hasOneRef()); } -PassRefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +PassRefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options) { - ASSERT(document); - RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy)); + RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options)); if (!loader->m_loader) loader = 0; return loader.release(); } -DocumentThreadableLoader::DocumentThreadableLoader(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +DocumentThreadableLoader::DocumentThreadableLoader(Document* document, ThreadableLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options) : m_client(client) , m_document(document) - , m_allowStoredCredentials(storedCredentials == AllowStoredCredentials) + , m_options(options) , m_sameOriginRequest(document->securityOrigin()->canRequest(request.url())) - , m_denyCrossOriginRedirect(crossOriginRedirectPolicy == DenyCrossOriginRedirect) + , m_async(blockingBehavior == LoadAsynchronously) { ASSERT(document); ASSERT(client); - ASSERT(storedCredentials == AllowStoredCredentials || storedCredentials == DoNotAllowStoredCredentials); - ASSERT(crossOriginRedirectPolicy == DenyCrossOriginRedirect || crossOriginRedirectPolicy == AllowCrossOriginRedirect); - m_loader = SubresourceLoader::create(document->frame(), this, request, false, callbacksSetting == SendLoadCallbacks, contentSniff == SniffContent); + + if (m_sameOriginRequest || m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) { + bool skipCanLoadCheck = false; + loadRequest(request, skipCanLoadCheck); + return; + } + + if (m_options.crossOriginRequestPolicy == DenyCrossOriginRequests) { + m_client->didFail(ResourceError()); + return; + } + + ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); + + if (!m_options.forcePreflight && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) + makeSimpleCrossOriginAccessRequest(request); + else { + m_actualRequest.set(new ResourceRequest(request)); + m_actualRequest->setAllowHTTPCookies(m_options.allowCredentials); + + if (CrossOriginPreflightResultCache::shared().canSkipPreflight(document->securityOrigin()->toString(), request.url(), m_options.allowCredentials, request.httpMethod(), request.httpHeaderFields())) + preflightSuccess(); + else + makeCrossOriginAccessRequestWithPreflight(request); + } +} + +void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const ResourceRequest& request) +{ + ASSERT(isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())); + + // Cross-origin requests are only defined for HTTP. We would catch this when checking response headers later, but there is no reason to send a request that's guaranteed to be denied. + if (!request.url().protocolInHTTPFamily()) { + m_client->didFail(ResourceError()); + return; + } + + // Make a copy of the passed request so that we can modify some details. + ResourceRequest crossOriginRequest(request); + crossOriginRequest.removeCredentials(); + crossOriginRequest.setAllowHTTPCookies(m_options.allowCredentials); + crossOriginRequest.setHTTPOrigin(m_document->securityOrigin()->toString()); + + bool skipCanLoadCheck = false; + loadRequest(crossOriginRequest, skipCanLoadCheck); +} + +void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request) +{ + ResourceRequest preflightRequest(request.url()); + preflightRequest.removeCredentials(); + preflightRequest.setHTTPOrigin(m_document->securityOrigin()->toString()); + preflightRequest.setAllowHTTPCookies(m_options.allowCredentials); + preflightRequest.setHTTPMethod("OPTIONS"); + preflightRequest.setHTTPHeaderField("Access-Control-Request-Method", request.httpMethod()); + + const HTTPHeaderMap& requestHeaderFields = request.httpHeaderFields(); + + if (requestHeaderFields.size() > 0) { + Vector<UChar> headerBuffer; + HTTPHeaderMap::const_iterator it = requestHeaderFields.begin(); + append(headerBuffer, it->first); + ++it; + + HTTPHeaderMap::const_iterator end = requestHeaderFields.end(); + for (; it != end; ++it) { + headerBuffer.append(','); + headerBuffer.append(' '); + append(headerBuffer, it->first); + } + + preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer)); + preflightRequest.addHTTPHeaderFields(requestHeaderFields); + } + + bool skipCanLoadCheck = false; + loadRequest(preflightRequest, skipCanLoadCheck); } DocumentThreadableLoader::~DocumentThreadableLoader() @@ -122,8 +169,7 @@ void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, Resour ASSERT(m_client); ASSERT_UNUSED(loader, loader == m_loader); - // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests. - if (m_denyCrossOriginRedirect && !m_document->securityOrigin()->canRequest(request.url())) { + if (!isAllowedRedirect(request.url())) { RefPtr<DocumentThreadableLoader> protect(this); m_client->didFailRedirectCheck(); request = ResourceRequest(); @@ -143,7 +189,31 @@ void DocumentThreadableLoader::didReceiveResponse(SubresourceLoader* loader, con ASSERT(m_client); ASSERT_UNUSED(loader, loader == m_loader); - m_client->didReceiveResponse(response); + if (m_actualRequest) { + if (!passesAccessControlCheck(response, m_options.allowCredentials, m_document->securityOrigin())) { + preflightFailure(); + return; + } + + OwnPtr<CrossOriginPreflightResultCacheItem> preflightResult(new CrossOriginPreflightResultCacheItem(m_options.allowCredentials)); + if (!preflightResult->parse(response) + || !preflightResult->allowsCrossOriginMethod(m_actualRequest->httpMethod()) + || !preflightResult->allowsCrossOriginHeaders(m_actualRequest->httpHeaderFields())) { + preflightFailure(); + return; + } + + CrossOriginPreflightResultCache::shared().appendEntry(m_document->securityOrigin()->toString(), m_actualRequest->url(), preflightResult.release()); + } else { + if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessControl) { + if (!passesAccessControlCheck(response, m_options.allowCredentials, m_document->securityOrigin())) { + m_client->didFail(ResourceError()); + return; + } + } + + m_client->didReceiveResponse(response); + } } void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const char* data, int lengthReceived) @@ -158,7 +228,17 @@ void DocumentThreadableLoader::didFinishLoading(SubresourceLoader* loader) { ASSERT(loader == m_loader); ASSERT(m_client); - m_client->didFinishLoading(loader->identifier()); + didFinishLoading(loader->identifier()); +} + +void DocumentThreadableLoader::didFinishLoading(unsigned long identifier) +{ + if (m_actualRequest) { + ASSERT(!m_sameOriginRequest); + ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); + preflightSuccess(); + } else + m_client->didFinishLoading(identifier); } void DocumentThreadableLoader::didFail(SubresourceLoader* loader, const ResourceError& error) @@ -174,7 +254,7 @@ bool DocumentThreadableLoader::getShouldUseCredentialStorage(SubresourceLoader* { ASSERT_UNUSED(loader, loader == m_loader); - if (!m_allowStoredCredentials) { + if (!m_options.allowCredentials) { shouldUseCredentialStorage = false; return true; } @@ -200,4 +280,73 @@ void DocumentThreadableLoader::receivedCancellation(SubresourceLoader* loader, c m_client->didReceiveAuthenticationCancellation(challenge.failureResponse()); } +void DocumentThreadableLoader::preflightSuccess() +{ + OwnPtr<ResourceRequest> actualRequest; + actualRequest.swap(m_actualRequest); + + bool skipCanLoadCheck = true; // ok to skip load check since we already asked about the preflight request + loadRequest(*actualRequest, skipCanLoadCheck); +} + +void DocumentThreadableLoader::preflightFailure() +{ + m_client->didFail(ResourceError()); +} + +void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, bool skipCanLoadCheck) +{ + if (m_async) { + // Don't sniff content or send load callbacks for the preflight request. + bool sendLoadCallbacks = m_options.sendLoadCallbacks && !m_actualRequest; + bool sniffContent = m_options.sniffContent && !m_actualRequest; + m_loader = SubresourceLoader::create(m_document->frame(), this, request, skipCanLoadCheck, sendLoadCallbacks, sniffContent); + return; + } + + // FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchronous requests. + StoredCredentials storedCredentials = m_options.allowCredentials ? AllowStoredCredentials : DoNotAllowStoredCredentials; + + Vector<char> data; + ResourceError error; + ResourceResponse response; + unsigned long identifier = std::numeric_limits<unsigned long>::max(); + if (m_document->frame()) + identifier = m_document->frame()->loader()->loadResourceSynchronously(request, storedCredentials, error, response, data); + + // No exception for file:/// resources, see <rdar://problem/4962298>. + // Also, if we have an HTTP response, then it wasn't a network error in fact. + if (!error.isNull() && !request.url().isLocalFile() && response.httpStatusCode() <= 0) { + m_client->didFail(error); + return; + } + + // FIXME: FrameLoader::loadSynchronously() does not tell us whether a redirect happened or not, so we guess by comparing the + // request and response URLs. This isn't a perfect test though, since a server can serve a redirect to the same URL that was + // requested. + if (request.url() != response.url() && !isAllowedRedirect(response.url())) { + m_client->didFailRedirectCheck(); + return; + } + + didReceiveResponse(0, response); + + const char* bytes = static_cast<const char*>(data.data()); + int len = static_cast<int>(data.size()); + didReceiveData(0, bytes, len); + + didFinishLoading(identifier); +} + +bool DocumentThreadableLoader::isAllowedRedirect(const KURL& url) +{ + if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) + return true; + + // FIXME: We need to implement access control for each redirect. This will require some refactoring though, because the code + // that processes redirects doesn't know about access control and expects a synchronous answer from its client about whether + // a redirect should proceed. + return m_sameOriginRequest && m_document->securityOrigin()->canRequest(url); +} + } // namespace WebCore diff --git a/WebCore/loader/DocumentThreadableLoader.h b/WebCore/loader/DocumentThreadableLoader.h index 465475f..64b1a22 100644 --- a/WebCore/loader/DocumentThreadableLoader.h +++ b/WebCore/loader/DocumentThreadableLoader.h @@ -33,19 +33,21 @@ #include "SubresourceLoaderClient.h" #include "ThreadableLoader.h" +#include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> namespace WebCore { class Document; + class KURL; struct ResourceRequest; class ThreadableLoaderClient; class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private SubresourceLoaderClient { public: - static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, StoredCredentials); - static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); virtual ~DocumentThreadableLoader(); virtual void cancel(); @@ -58,7 +60,13 @@ namespace WebCore { virtual void derefThreadableLoader() { deref(); } private: - DocumentThreadableLoader(Document*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + enum BlockingBehavior { + LoadSynchronously, + LoadAsynchronously + }; + + DocumentThreadableLoader(Document*, ThreadableLoaderClient*, BlockingBehavior blockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions& options); + virtual void willSendRequest(SubresourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); virtual void didSendData(SubresourceLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); @@ -71,12 +79,22 @@ namespace WebCore { virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&); virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&); + void didFinishLoading(unsigned long identifier); + void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request); + void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request); + void preflightSuccess(); + void preflightFailure(); + + void loadRequest(const ResourceRequest&, bool skipCanLoadCheck); + bool isAllowedRedirect(const KURL&); + RefPtr<SubresourceLoader> m_loader; ThreadableLoaderClient* m_client; Document* m_document; - bool m_allowStoredCredentials; + ThreadableLoaderOptions m_options; bool m_sameOriginRequest; - bool m_denyCrossOriginRedirect; + bool m_async; + OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Control preflight checks }; } // namespace WebCore diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index 3f70c43..8d748a7 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -137,6 +137,10 @@ public: virtual void reachedMaxAppCacheSize(int64_t) { } #endif +#if ENABLE(NOTIFICATIONS) + virtual NotificationPresenter* notificationPresenter() const { return 0; } +#endif + virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { } virtual void formStateDidChange(const Node*) { } diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index ace4cfe..ee0f4ca 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -118,7 +118,7 @@ void FTPDirectoryTokenizer::appendEntry(const String& filename, const String& si rowElement->setAttribute("class", "ftpDirectoryEntryRow", ec); RefPtr<Element> element = m_doc->createElement(tdTag, false); - element->appendChild(new Text(m_doc, String(&noBreakSpace, 1)), ec); + element->appendChild(Text::create(m_doc, String(&noBreakSpace, 1)), ec); if (isDirectory) element->setAttribute("class", "ftpDirectoryIcon ftpDirectoryTypeDirectory", ec); else @@ -130,12 +130,12 @@ void FTPDirectoryTokenizer::appendEntry(const String& filename, const String& si rowElement->appendChild(element, ec); element = m_doc->createElement(tdTag, false); - element->appendChild(new Text(m_doc, date), ec); + element->appendChild(Text::create(m_doc, date), ec); element->setAttribute("class", "ftpDirectoryFileDate", ec); rowElement->appendChild(element, ec); element = m_doc->createElement(tdTag, false); - element->appendChild(new Text(m_doc, size), ec); + element->appendChild(Text::create(m_doc, size), ec); element->setAttribute("class", "ftpDirectoryFileSize", ec); rowElement->appendChild(element, ec); } @@ -152,7 +152,7 @@ PassRefPtr<Element> FTPDirectoryTokenizer::createTDForFilename(const String& fil RefPtr<Element> anchorElement = m_doc->createElement(aTag, false); anchorElement->setAttribute("href", fullURL, ec); - anchorElement->appendChild(new Text(m_doc, filename), ec); + anchorElement->appendChild(Text::create(m_doc, filename), ec); RefPtr<Element> tdElement = m_doc->createElement(tdTag, false); tdElement->appendChild(anchorElement, ec); diff --git a/WebCore/loader/FTPDirectoryDocument.h b/WebCore/loader/FTPDirectoryDocument.h index ecc6f73..b208c4e 100644 --- a/WebCore/loader/FTPDirectoryDocument.h +++ b/WebCore/loader/FTPDirectoryDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,7 +35,7 @@ class FTPDirectoryDocument : public HTMLDocument { public: static PassRefPtr<FTPDirectoryDocument> create(Frame* frame) { - return new FTPDirectoryDocument(frame); + return adoptRef(new FTPDirectoryDocument(frame)); } private: diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 256c82d..dd584ca 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -89,6 +89,7 @@ #include "SecurityOrigin.h" #include "SegmentedString.h" #include "Settings.h" +#include "SharedWorkerRepository.h" #include "TextResourceDecoder.h" #include "WindowFeatures.h" #include "XMLHttpRequest.h" @@ -277,6 +278,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_isDisplayingInitialEmptyDocument(false) , m_committedFirstRealDocumentLoad(false) , m_didPerformFirstNavigation(false) + , m_loadingFromCachedPage(false) #ifndef NDEBUG , m_didDispatchDidCommitLoad(false) #endif @@ -929,9 +931,6 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->setDocument(document); - if (dispatch) - dispatchWindowObjectAvailable(); - document->setURL(m_URL); if (m_decoder) document->setDecoder(m_decoder.get()); @@ -941,6 +940,9 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->domWindow()->setURL(document->url()); m_frame->domWindow()->setSecurityOrigin(document->securityOrigin()); + if (dispatch) + dispatchWindowObjectAvailable(); + updateFirstPartyForCookies(); Settings* settings = document->settings(); @@ -1843,6 +1845,9 @@ bool FrameLoader::canCachePageContainingThisFrame() #if ENABLE(DATABASE) && !m_frame->document()->hasOpenDatabases() #endif +#if ENABLE(SHARED_WORKERS) + && !SharedWorkerRepository::hasSharedWorkers(m_frame->document()) +#endif && !m_frame->document()->usingGeolocation() && m_currentHistoryItem && !m_quickRedirectComing @@ -1989,6 +1994,10 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel) if (m_frame->document()->hasOpenDatabases()) { PCLOG(" -Frame has open database handles"); cannotCache = true; } #endif +#if ENABLE(SHARED_WORKERS) + if (SharedWorkerRepository::hasSharedWorkers(m_frame->document())) + { PCLOG(" -Frame has associated SharedWorkers"); cannotCache = true; } +#endif if (m_frame->document()->usingGeolocation()) { PCLOG(" -Frame uses Geolocation"); cannotCache = true; } if (!m_currentHistoryItem) @@ -2833,7 +2842,8 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) RefPtr<CachedPage> cachedPage = prpCachedPage; RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; - LOG(Loading, "WebCoreLoading %s: About to commit provisional load from previous URL %s", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data()); + LOG(PageCache, "WebCoreLoading %s: About to commit provisional load from previous URL '%s' to new URL '%s'", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data(), + pdl ? pdl->url().string().utf8().data() : "<no provisional DocumentLoader>"); // Check to see if we need to cache the page we are navigating away from into the back/forward cache. // We are doing this here because we know for sure that a new page is about to be loaded. @@ -2874,7 +2884,7 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect()) updateHistoryForClientRedirect(); - if (m_documentLoader->isLoadingFromCachedPage()) { + if (m_loadingFromCachedPage) { m_frame->document()->documentDidBecomeActive(); // Force a layout to update view size and thereby update scrollbars. @@ -3451,7 +3461,7 @@ void FrameLoader::continueLoadAfterWillSubmitForm(PolicyAction) if (activeDocLoader && activeDocLoader->isLoadingMainResource()) return; - m_provisionalDocumentLoader->setLoadingFromCachedPage(false); + m_loadingFromCachedPage = false; unsigned long identifier = 0; @@ -4236,7 +4246,17 @@ bool FrameLoader::loadProvisionalItemFromCachedPage() RefPtr<CachedPage> cachedPage = pageCache()->get(m_provisionalHistoryItem.get()); if (!cachedPage || !cachedPage->document()) return false; - provisionalDocumentLoader()->loadFromCachedPage(cachedPage.release()); + + DocumentLoader *provisionalLoader = provisionalDocumentLoader(); + LOG(PageCache, "WebCorePageCache: FrameLoader %p loading provisional DocumentLoader %p with URL '%s' from CachedPage %p", this, provisionalLoader, provisionalLoader->url().string().utf8().data(), cachedPage.get()); + + provisionalLoader->prepareForLoadStart(); + + m_loadingFromCachedPage = true; + + provisionalLoader->setCommitted(true); + commitProvisionalLoad(cachedPage); + return true; } @@ -5111,8 +5131,6 @@ void FrameLoader::dispatchWindowObjectAvailable() m_client->windowObjectCleared(); if (Page* page = m_frame->page()) { - if (InspectorController* inspector = page->inspectorController()) - inspector->inspectedWindowScriptObjectCleared(m_frame); if (InspectorController* inspector = page->parentInspectorController()) inspector->windowScriptObjectAvailable(); } diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index 5a8ee91..17013b5 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -350,6 +350,7 @@ namespace WebCore { void setTitle(const String&); void commitProvisionalLoad(PassRefPtr<CachedPage>); + bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } void goToItem(HistoryItem*, FrameLoadType); void saveDocumentAndScrollState(); @@ -622,6 +623,7 @@ namespace WebCore { RefPtr<HistoryItem> m_provisionalHistoryItem; bool m_didPerformFirstNavigation; + bool m_loadingFromCachedPage; #ifndef NDEBUG bool m_didDispatchDidCommitLoad; diff --git a/WebCore/loader/ImageDocument.h b/WebCore/loader/ImageDocument.h index 1bc5245..080b250 100644 --- a/WebCore/loader/ImageDocument.h +++ b/WebCore/loader/ImageDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,7 +35,7 @@ class ImageDocument : public HTMLDocument { public: static PassRefPtr<ImageDocument> create(Frame* frame) { - return new ImageDocument(frame); + return adoptRef(new ImageDocument(frame)); } CachedImage* cachedImage(); diff --git a/WebCore/loader/MediaDocument.h b/WebCore/loader/MediaDocument.h index ac286f0..aa751ab 100644 --- a/WebCore/loader/MediaDocument.h +++ b/WebCore/loader/MediaDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008,2009 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,22 +36,23 @@ class MediaDocument : public HTMLDocument { public: static PassRefPtr<MediaDocument> create(Frame* frame) { - return new MediaDocument(frame); + return adoptRef(new MediaDocument(frame)); } - - virtual void defaultEventHandler(Event*); + virtual ~MediaDocument(); void mediaElementSawUnsupportedTracks(); private: MediaDocument(Frame*); - virtual ~MediaDocument(); - Timer<MediaDocument> m_replaceMediaElementTimer; virtual bool isMediaDocument() const { return true; } virtual Tokenizer* createTokenizer(); + virtual void defaultEventHandler(Event*); + void replaceMediaElementTimerFired(Timer<MediaDocument>*); + + Timer<MediaDocument> m_replaceMediaElementTimer; }; } diff --git a/WebCore/loader/PlaceholderDocument.h b/WebCore/loader/PlaceholderDocument.h index c542370..a759266 100644 --- a/WebCore/loader/PlaceholderDocument.h +++ b/WebCore/loader/PlaceholderDocument.h @@ -34,7 +34,7 @@ class PlaceholderDocument : public Document { public: static PassRefPtr<PlaceholderDocument> create(Frame* frame) { - return new PlaceholderDocument(frame); + return adoptRef(new PlaceholderDocument(frame)); } virtual void attach(); diff --git a/WebCore/loader/PluginDocument.h b/WebCore/loader/PluginDocument.h index 35e4038..1d5c964 100644 --- a/WebCore/loader/PluginDocument.h +++ b/WebCore/loader/PluginDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2009Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,7 @@ class PluginDocument : public HTMLDocument { public: static PassRefPtr<PluginDocument> create(Frame* frame) { - return new PluginDocument(frame); + return adoptRef(new PluginDocument(frame)); } private: diff --git a/WebCore/loader/TextDocument.h b/WebCore/loader/TextDocument.h index c67fea5..53e3074 100644 --- a/WebCore/loader/TextDocument.h +++ b/WebCore/loader/TextDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,7 +35,7 @@ class TextDocument : public HTMLDocument { public: static PassRefPtr<TextDocument> create(Frame* frame) { - return new TextDocument(frame); + return adoptRef(new TextDocument(frame)); } private: diff --git a/WebCore/loader/ThreadableLoader.cpp b/WebCore/loader/ThreadableLoader.cpp index b174af7..720ba4e 100644 --- a/WebCore/loader/ThreadableLoader.cpp +++ b/WebCore/loader/ThreadableLoader.cpp @@ -40,33 +40,33 @@ namespace WebCore { -PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options) { ASSERT(client); ASSERT(context); #if ENABLE(WORKERS) if (context->isWorkerContext()) - return WorkerThreadableLoader::create(static_cast<WorkerContext*>(context), client, WorkerRunLoop::defaultMode(), request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy); + return WorkerThreadableLoader::create(static_cast<WorkerContext*>(context), client, WorkerRunLoop::defaultMode(), request, options); #endif // ENABLE(WORKERS) ASSERT(context->isDocument()); - return DocumentThreadableLoader::create(static_cast<Document*>(context), client, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy); + return DocumentThreadableLoader::create(static_cast<Document*>(context), client, request, options); } -void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, StoredCredentials storedCredentials) +void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) { ASSERT(context); #if ENABLE(WORKERS) if (context->isWorkerContext()) { - WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(context), request, client, storedCredentials, DenyCrossOriginRedirect); + WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(context), request, client, options); return; } #endif // ENABLE(WORKERS) ASSERT(context->isDocument()); - DocumentThreadableLoader::loadResourceSynchronously(static_cast<Document*>(context), request, client, storedCredentials); + DocumentThreadableLoader::loadResourceSynchronously(static_cast<Document*>(context), request, client, options); } } // namespace WebCore diff --git a/WebCore/loader/ThreadableLoader.h b/WebCore/loader/ThreadableLoader.h index 1ac12cb..a52bfad 100644 --- a/WebCore/loader/ThreadableLoader.h +++ b/WebCore/loader/ThreadableLoader.h @@ -43,32 +43,32 @@ namespace WebCore { class ScriptExecutionContext; class ThreadableLoaderClient; - enum LoadCallbacks { - SendLoadCallbacks, - DoNotSendLoadCallbacks - }; - - enum ContentSniff { - SniffContent, - DoNotSniffContent - }; - enum StoredCredentials { AllowStoredCredentials, DoNotAllowStoredCredentials }; - - enum CrossOriginRedirectPolicy { - DenyCrossOriginRedirect, - AllowCrossOriginRedirect + + enum CrossOriginRequestPolicy { + DenyCrossOriginRequests, + UseAccessControl, + AllowCrossOriginRequests + }; + + struct ThreadableLoaderOptions { + ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false), allowCredentials(false), forcePreflight(false), crossOriginRequestPolicy(DenyCrossOriginRequests) { } + bool sendLoadCallbacks; + bool sniffContent; + bool allowCredentials; // Whether HTTP credentials and cookies are sent with the request. + bool forcePreflight; // If AccessControl is used, whether to force a preflight. + CrossOriginRequestPolicy crossOriginRequestPolicy; }; // Useful for doing loader operations from any thread (not threadsafe, // just able to run on threads other than the main thread). class ThreadableLoader : public Noncopyable { public: - static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, StoredCredentials); - static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); virtual void cancel() = 0; void ref() { refThreadableLoader(); } diff --git a/WebCore/loader/WorkerThreadableLoader.cpp b/WebCore/loader/WorkerThreadableLoader.cpp index 4d12b8d..6819759 100644 --- a/WebCore/loader/WorkerThreadableLoader.cpp +++ b/WebCore/loader/WorkerThreadableLoader.cpp @@ -53,11 +53,10 @@ namespace WebCore { static const char loadResourceSynchronouslyMode[] = "loadResourceSynchronouslyMode"; -WorkerThreadableLoader::WorkerThreadableLoader(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, LoadCallbacks callbacksSetting, - ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +WorkerThreadableLoader::WorkerThreadableLoader(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) : m_workerContext(workerContext) , m_workerClientWrapper(ThreadableLoaderClientWrapper::create(client)) - , m_bridge(*(new MainThreadBridge(m_workerClientWrapper, m_workerContext->thread()->workerLoaderProxy(), taskMode, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy))) + , m_bridge(*(new MainThreadBridge(m_workerClientWrapper, m_workerContext->thread()->workerLoaderProxy(), taskMode, request, options))) { } @@ -66,7 +65,7 @@ WorkerThreadableLoader::~WorkerThreadableLoader() m_bridge.destroy(); } -void WorkerThreadableLoader::loadResourceSynchronously(WorkerContext* workerContext, const ResourceRequest& request, ThreadableLoaderClient& client, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +void WorkerThreadableLoader::loadResourceSynchronously(WorkerContext* workerContext, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) { WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); @@ -74,9 +73,7 @@ void WorkerThreadableLoader::loadResourceSynchronously(WorkerContext* workerCont String mode = loadResourceSynchronouslyMode; mode.append(String::number(runLoop.createUniqueId())); - ContentSniff contentSniff = request.url().isLocalFile() ? SniffContent : DoNotSniffContent; - RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(workerContext, &client, mode, request, DoNotSendLoadCallbacks, contentSniff, storedCredentials, crossOriginRedirectPolicy); - + RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(workerContext, &client, mode, request, options); MessageQueueWaitResult result = MessageQueueMessageReceived; while (!loader->done() && result != MessageQueueTerminated) result = runLoop.runInMode(workerContext, mode); @@ -91,21 +88,20 @@ void WorkerThreadableLoader::cancel() } WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode, - const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, - CrossOriginRedirectPolicy crossOriginRedirectPolicy) + const ResourceRequest& request, const ThreadableLoaderOptions& options) : m_workerClientWrapper(workerClientWrapper) , m_loaderProxy(loaderProxy) , m_taskMode(taskMode.copy()) { ASSERT(m_workerClientWrapper.get()); - m_loaderProxy.postTaskToLoader(createCallbackTask(&MainThreadBridge::mainThreadCreateLoader, this, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy)); + m_loaderProxy.postTaskToLoader(createCallbackTask(&MainThreadBridge::mainThreadCreateLoader, this, request, options)); } WorkerThreadableLoader::MainThreadBridge::~MainThreadBridge() { } -void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExecutionContext* context, MainThreadBridge* thisPtr, auto_ptr<CrossThreadResourceRequestData> requestData, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExecutionContext* context, MainThreadBridge* thisPtr, auto_ptr<CrossThreadResourceRequestData> requestData, ThreadableLoaderOptions options) { ASSERT(isMainThread()); ASSERT(context->isDocument()); @@ -117,7 +113,7 @@ void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExec // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path // will return a 0 value. Either this should return 0 or the other code path should do a callback with // a failure. - thisPtr->m_mainThreadLoader = ThreadableLoader::create(context, thisPtr, *request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy); + thisPtr->m_mainThreadLoader = ThreadableLoader::create(context, thisPtr, *request, options); ASSERT(thisPtr->m_mainThreadLoader); } diff --git a/WebCore/loader/WorkerThreadableLoader.h b/WebCore/loader/WorkerThreadableLoader.h index 8b11b70..230c77d 100644 --- a/WebCore/loader/WorkerThreadableLoader.h +++ b/WebCore/loader/WorkerThreadableLoader.h @@ -55,10 +55,10 @@ namespace WebCore { class WorkerThreadableLoader : public RefCounted<WorkerThreadableLoader>, public ThreadableLoader { public: - static void loadResourceSynchronously(WorkerContext*, const ResourceRequest&, ThreadableLoaderClient&, StoredCredentials, CrossOriginRedirectPolicy); - static PassRefPtr<WorkerThreadableLoader> create(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) + static void loadResourceSynchronously(WorkerContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static PassRefPtr<WorkerThreadableLoader> create(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) { - return adoptRef(new WorkerThreadableLoader(workerContext, client, taskMode, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy)); + return adoptRef(new WorkerThreadableLoader(workerContext, client, taskMode, request, options)); } ~WorkerThreadableLoader(); @@ -97,7 +97,7 @@ namespace WebCore { class MainThreadBridge : ThreadableLoaderClient { public: // All executed on the worker context's thread. - MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, WorkerLoaderProxy&, const String& taskMode, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, WorkerLoaderProxy&, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); void cancel(); void destroy(); @@ -109,7 +109,7 @@ namespace WebCore { static void mainThreadDestroy(ScriptExecutionContext*, MainThreadBridge*); ~MainThreadBridge(); - static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, std::auto_ptr<CrossThreadResourceRequestData>, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, std::auto_ptr<CrossThreadResourceRequestData>, ThreadableLoaderOptions); static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*); virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(const ResourceResponse&); @@ -133,7 +133,7 @@ namespace WebCore { String m_taskMode; }; - WorkerThreadableLoader(WorkerContext*, ThreadableLoaderClient*, const String& taskMode, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + WorkerThreadableLoader(WorkerContext*, ThreadableLoaderClient*, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); RefPtr<WorkerContext> m_workerContext; RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; diff --git a/WebCore/loader/loader.cpp b/WebCore/loader/loader.cpp index 65d15a5..4ab4f34 100644 --- a/WebCore/loader/loader.cpp +++ b/WebCore/loader/loader.cpp @@ -355,7 +355,7 @@ void Loader::Host::didFinishLoading(SubresourceLoader* loader) DocLoader* docLoader = request->docLoader(); // Prevent the document from being destroyed before we are done with // the docLoader that it will delete when the document gets deleted. - DocPtr<Document> protector(docLoader->doc()); + RefPtr<Document> protector(docLoader->doc()); if (!request->isMultipart()) docLoader->decrementRequestCount(); @@ -403,7 +403,7 @@ void Loader::Host::didFail(SubresourceLoader* loader, bool cancelled) DocLoader* docLoader = request->docLoader(); // Prevent the document from being destroyed before we are done with // the docLoader that it will delete when the document gets deleted. - DocPtr<Document> protector(docLoader->doc()); + RefPtr<Document> protector(docLoader->doc()); if (!request->isMultipart()) docLoader->decrementRequestCount(); diff --git a/WebCore/manual-tests/gtk/copy-htmltext.html b/WebCore/manual-tests/gtk/copy-htmltext.html new file mode 100644 index 0000000..0b811f6 --- /dev/null +++ b/WebCore/manual-tests/gtk/copy-htmltext.html @@ -0,0 +1,24 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>Copy HTML content</title> + </head> + <body> + <h1>Copy HTML content from currently editable area</h1> + <div title="EditableArea" contentEditable="true" + style="display: block; border: 2px solid black; margin: 5px; padding: 15px;"> + Here is a Editable Area,<br /> + <img title="It's the test image" src="http://webkit.org/images/icon-gold.png" /><br /><br /> + <b>STEPS TO TEST:</b><br /> + <ol> + <li>Select all that text or picture in this editable area (type <b>Ctrl-A</b> / Option-A)</li> + <li><b>Copy</b> them use <b>Ctrl-C</b> / Option-C</li> + <li>Move the cursor to a blank line below</li> + <li>Paste them use <b>Ctrl-V</b> / Option-V</li> + </ol> + <p><b>Ensure</b> that text and image has been pasted with formats and no garbled.</p> + <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> + </div> + </body> +</html> diff --git a/WebCore/manual-tests/keyboard_select_elements_with_same_beginning.html b/WebCore/manual-tests/keyboard_select_elements_with_same_beginning.html new file mode 100644 index 0000000..8e3c102 --- /dev/null +++ b/WebCore/manual-tests/keyboard_select_elements_with_same_beginning.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> +<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8"> +<title> +Test select on elements with same beginning letter +</title> +</head> +<body> +See bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=28205">28205</a>. +<p> +Click the drop-down to show selections (not navigate to the selection box). +Type the first letter 'A' to go to the elements start with 'A'. +It should select the first item starts with 'A'. +In windows, Continue typing 'A', it should continue to select the next item starts with 'A'. +<p> +<select name="selOrigin"> + <option value="">Select Station</option> + <option value="37169_NJCL">Aberdeen Matawan</option> + <option value="2_ATLC">Absecon</option> + <option value="3_MNBN">Allendale</option> + <option value="4_NJCL">Allenhurst</option> + <option value="12_MNE">Basking Ridge</option> + <option value="13_NJCL">Bay Head</option> + <option value="14_BNTN">Bay Street</option> + <option value="15_NJCL">Belmar</option> +</select> +</body> +</html> diff --git a/WebCore/manual-tests/wml/select-onpick-event-crash.wml b/WebCore/manual-tests/wml/select-onpick-event-crash.wml new file mode 100644 index 0000000..07d0262 --- /dev/null +++ b/WebCore/manual-tests/wml/select-onpick-event-crash.wml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> +<wml> + <card> + <select name="result" dmultiple="true"> + <option onpick="#card2" value="foo">Foo</option> + <option onpick="#card2" value="bar">Bar</option> + </select> + </card> + + <card id="card2">Test pass, if it didn't crash.</card> +</wml> diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp new file mode 100644 index 0000000..266392b --- /dev/null +++ b/WebCore/notifications/Notification.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(NOTIFICATIONS) + +#include "Notification.h" +#include "NotificationContents.h" + +#include "Document.h" +#include "EventNames.h" +#include "WorkerContext.h" + +namespace WebCore { + +Notification::Notification(const String& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) + : ActiveDOMObject(context, this) + , m_isHTML(true) + , m_isShowing(false) + , m_presenter(provider) +{ + if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PERMISSION_ALLOWED) { + ec = SECURITY_ERR; + return; + } + + m_notificationURL = context->completeURL(url); + if (url.isEmpty() || !m_notificationURL.isValid()) { + ec = SYNTAX_ERR; + return; + } +} + +Notification::Notification(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) + : ActiveDOMObject(context, this) + , m_isHTML(false) + , m_contents(contents) + , m_isShowing(false) + , m_presenter(provider) +{ + if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PERMISSION_ALLOWED) { + ec = SECURITY_ERR; + return; + } + + KURL icon = context->completeURL(contents.icon()); + if (!icon.isEmpty() && !icon.isValid()) { + ec = SYNTAX_ERR; + return; + } +} + +Notification::~Notification() +{ + m_presenter->notificationObjectDestroyed(this); +} + +void Notification::show() +{ + // prevent double-showing + if (!m_isShowing) + m_isShowing = m_presenter->show(this); +} + +void Notification::cancel() +{ + if (m_isShowing) + m_presenter->cancel(this); +} + +EventListener* Notification::ondisplay() const +{ + return getAttributeEventListener("display"); +} + +void Notification::setOndisplay(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener("display", eventListener); +} + +EventListener* Notification::onerror() const +{ + return getAttributeEventListener(eventNames().errorEvent); +} + +void Notification::setOnerror(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener(eventNames().errorEvent, eventListener); +} + +EventListener* Notification::onclose() const +{ + return getAttributeEventListener(eventNames().closeEvent); +} + +void Notification::setOnclose(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener(eventNames().closeEvent, eventListener); +} + +EventListener* Notification::getAttributeEventListener(const AtomicString& eventType) const +{ + const RegisteredEventListenerVector& listeners = m_eventListeners; + size_t size = listeners.size(); + for (size_t i = 0; i < size; ++i) { + const RegisteredEventListener& r = *listeners[i]; + if (r.eventType() == eventType && r.listener()->isAttribute()) + return r.listener(); + } + return 0; +} + +void Notification::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) +{ + clearAttributeEventListener(eventType); + if (listener) + addEventListener(eventType, listener, false); +} + +void Notification::clearAttributeEventListener(const AtomicString& eventType) +{ + RegisteredEventListenerVector* listeners = &m_eventListeners; + size_t size = listeners->size(); + for (size_t i = 0; i < size; ++i) { + RegisteredEventListener& r = *listeners->at(i); + if (r.eventType() != eventType || !r.listener()->isAttribute()) + continue; + + r.setRemoved(true); + listeners->remove(i); + return; + } +} + +void Notification::dispatchDisplayEvent() +{ + RefPtr<Event> event = Event::create("display", false, true); + ExceptionCode ec = 0; + dispatchEvent(event.release(), ec); + ASSERT(!ec); +} + +void Notification::dispatchErrorEvent() +{ + RefPtr<Event> event = Event::create(eventNames().errorEvent, false, true); + ExceptionCode ec = 0; + dispatchEvent(event.release(), ec); + ASSERT(!ec); +} + +void Notification::dispatchCloseEvent() +{ + RefPtr<Event> event = Event::create(eventNames().closeEvent, false, true); + ExceptionCode ec = 0; + dispatchEvent(event.release(), ec); + ASSERT(!ec); +} + +void Notification::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) +{ + RefPtr<RegisteredEventListener> registeredListener = RegisteredEventListener::create(eventType, listener, useCapture); + m_eventListeners.append(registeredListener); +} + +void Notification::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) +{ + size_t size = m_eventListeners.size(); + for (size_t i = 0; i < size; ++i) { + RegisteredEventListener& r = *m_eventListeners[i]; + if (r.eventType() == eventType && r.listener() == listener && r.useCapture() == useCapture) { + r.setRemoved(true); + m_eventListeners.remove(i); + return; + } + } +} + +void Notification::handleEvent(PassRefPtr<Event> event, bool useCapture) +{ + RegisteredEventListenerVector listenersCopy = m_eventListeners; + size_t size = listenersCopy.size(); + for (size_t i = 0; i < size; ++i) { + RegisteredEventListener& r = *listenersCopy[i]; + if (r.eventType() == event->type() && r.useCapture() == useCapture && !r.removed()) + r.listener()->handleEvent(event.get()); + } +} + +bool Notification::dispatchEvent(PassRefPtr<Event> inEvent, ExceptionCode&) +{ + RefPtr<Event> event(inEvent); + + event->setEventPhase(Event::AT_TARGET); + event->setCurrentTarget(this); + + handleEvent(event.get(), true); + if (!event->propagationStopped()) { + handleEvent(event.get(), false); + } + + return !event->defaultPrevented(); +} + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h new file mode 100644 index 0000000..9286c55 --- /dev/null +++ b/WebCore/notifications/Notification.h @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Notification_h +#define Notification_h + +#include "ActiveDOMObject.h" +#include "AtomicStringHash.h" +#include "Event.h" +#include "EventListener.h" +#include "EventTarget.h" +#include "ExceptionCode.h" +#include "KURL.h" +#include "NotificationPresenter.h" +#include "NotificationContents.h" +#include "RegisteredEventListener.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +#if ENABLE(NOTIFICATIONS) +namespace WebCore { + + class WorkerContext; + + class Notification : public RefCounted<Notification>, public ActiveDOMObject, public EventTarget { + public: + static Notification* create(const String& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return new Notification(url, context, ec, provider); } + static Notification* create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) { return new Notification(contents, context, ec, provider); } + + virtual ~Notification(); + + void show(); + void cancel(); + + bool isHTML() { return m_isHTML; } + KURL url() { return m_notificationURL; } + NotificationContents& contents() { return m_contents; } + + EventListener* ondisplay() const; + void setOndisplay(PassRefPtr<EventListener> eventListener); + EventListener* onerror() const; + void setOnerror(PassRefPtr<EventListener> eventListener); + EventListener* onclose() const; + void setOnclose(PassRefPtr<EventListener> eventListener); + + using RefCounted<Notification>::ref; + using RefCounted<Notification>::deref; + + // Dispatching of events on the notification. The presenter should call these when events occur. + void dispatchDisplayEvent(); + void dispatchErrorEvent(); + void dispatchCloseEvent(); + + // EventTarget interface + virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } + virtual void addEventListener(const AtomicString&, PassRefPtr<EventListener>, bool); + virtual void removeEventListener(const AtomicString&, EventListener*, bool); + virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); + virtual Notification* toNotification() { return this; } + + private: + Notification(const String& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider); + Notification(const NotificationContents& fields, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider); + + // EventTarget interface + virtual void refEventTarget() { ref(); } + virtual void derefEventTarget() { deref(); } + + void handleEvent(PassRefPtr<Event> event, bool useCapture); + EventListener* getAttributeEventListener(const AtomicString&) const; + void setAttributeEventListener(const AtomicString&, PassRefPtr<EventListener>); + void clearAttributeEventListener(const AtomicString&); + + bool m_isHTML; + KURL m_notificationURL; + NotificationContents m_contents; + + bool m_isShowing; + + RegisteredEventListenerVector m_eventListeners; + + NotificationPresenter* m_presenter; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // Notifications_h diff --git a/WebCore/notifications/Notification.idl b/WebCore/notifications/Notification.idl new file mode 100644 index 0000000..eca2eb4 --- /dev/null +++ b/WebCore/notifications/Notification.idl @@ -0,0 +1,54 @@ +/* + * 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. + */ + +module threads { + + interface [ + Conditional=NOTIFICATIONS + ] Notification { + void show(); + void cancel(); + + attribute EventListener ondisplay; + attribute EventListener onerror; + attribute EventListener onclose; + + // EventTarget interface + [Custom] void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + [Custom] void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); + }; + +} diff --git a/WebCore/notifications/NotificationCenter.cpp b/WebCore/notifications/NotificationCenter.cpp new file mode 100644 index 0000000..94976a2 --- /dev/null +++ b/WebCore/notifications/NotificationCenter.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(NOTIFICATIONS) + +#include "NotificationCenter.h" + +#include "Document.h" +#include "VoidCallback.h" +#include "WorkerContext.h" + +namespace WebCore { + +NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter) + : ActiveDOMObject(context, this) + , m_scriptExecutionContext(context) + , m_notificationPresenter(presenter) {} + +int NotificationCenter::checkPermission() +{ + return m_notificationPresenter->checkPermission(m_scriptExecutionContext->securityOrigin()); +} + +void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback) +{ + m_notificationPresenter->requestPermission(m_scriptExecutionContext->securityOrigin(), callback); +} + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/notifications/NotificationCenter.h b/WebCore/notifications/NotificationCenter.h new file mode 100644 index 0000000..c40693f --- /dev/null +++ b/WebCore/notifications/NotificationCenter.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NotificationCenter_h +#define NotificationCenter_h + +#include "Notification.h" +#include "NotificationContents.h" +#include "WorkerThread.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { + + class ScriptExecutionContext; + + class NotificationCenter : public RefCounted<NotificationCenter>, public ActiveDOMObject { + public: + static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); } + + Notification* createHTMLNotification(const String& URI, ExceptionCode& ec) + { + return Notification::create(KURL(URI), context(), ec, presenter()); + } + + Notification* createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec) + { + NotificationContents contents(iconURI, title, body); + return Notification::create(contents, context(), ec, presenter()); + } + + ScriptExecutionContext* context() const { return m_scriptExecutionContext; } + NotificationPresenter* presenter() const { return m_notificationPresenter; } + + int checkPermission(); + void requestPermission(PassRefPtr<VoidCallback> callback); + + private: + NotificationCenter(ScriptExecutionContext*, NotificationPresenter*); + + ScriptExecutionContext* m_scriptExecutionContext; + NotificationPresenter* m_notificationPresenter; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // NotificationCenter_h diff --git a/WebCore/notifications/NotificationCenter.idl b/WebCore/notifications/NotificationCenter.idl new file mode 100644 index 0000000..9918b15 --- /dev/null +++ b/WebCore/notifications/NotificationCenter.idl @@ -0,0 +1,43 @@ +/* + * 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. + */ + +module threads { + + interface [ + Conditional=NOTIFICATIONS + ] NotificationCenter { + Notification createHTMLNotification(in DOMString url) raises(Exception); + Notification createNotification(in DOMString iconUrl, in DOMString title, in DOMString body) raises(Exception); + + int checkPermission(); + [Custom] void requestPermission(in VoidCallback callback); + }; + +} diff --git a/WebCore/notifications/NotificationContents.h b/WebCore/notifications/NotificationContents.h new file mode 100644 index 0000000..ebdc514 --- /dev/null +++ b/WebCore/notifications/NotificationContents.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NotificationContents_h +#define NotificationContents_h + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { + + class NotificationContents { + public: + NotificationContents() {} + NotificationContents(const String& iconUrl, const String& title, const String& body) + : m_icon(iconUrl) + , m_title(title) + , m_body(body) {} + + String icon() const { return m_icon; } + String title() const { return m_title; } + String body() const { return m_body; } + + private: + String m_icon; + String m_title; + String m_body; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // NotificationContents_h diff --git a/WebCore/notifications/NotificationPresenter.h b/WebCore/notifications/NotificationPresenter.h new file mode 100644 index 0000000..90d6c4c --- /dev/null +++ b/WebCore/notifications/NotificationPresenter.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NotificationPresenter_h +#define NotificationPresenter_h + +#include <wtf/PassRefPtr.h> +#include "VoidCallback.h" + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { + + class Notification; + class SecurityOrigin; + class String; + + class NotificationPresenter { + + public: + enum Permission { + PERMISSION_ALLOWED, // User has allowed notifications + PERMISSION_NOT_ALLOWED, // User has not yet allowed + PERMISSION_DENIED // User has explictly denied permission + }; + + virtual ~NotificationPresenter() {} + + // Requests that a notification be shown. + virtual bool show(Notification* object) = 0; + + // Requests that a notification that has already been shown be canceled. + virtual void cancel(Notification* object) = 0; + + // Informs the presenter that a Notification object has been destroyed + // (such as by a page transition). The presenter may continue showing + // the notification, but must not attempt to call the event handlers. + virtual void notificationObjectDestroyed(Notification* object) = 0; + + // Requests user permission to show desktop notifications from a particular + // origin. The callback parameter should be run when the user has + // made a decision. + virtual void requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) = 0; + + // Checks the current level of permission. + virtual Permission checkPermission(SecurityOrigin* origin) = 0; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // NotificationPresenter_h diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp index 5a5670e..bcfef79 100644 --- a/WebCore/page/Chrome.cpp +++ b/WebCore/page/Chrome.cpp @@ -403,6 +403,13 @@ bool Chrome::setCursor(PlatformCursorHandle cursor) return m_client->setCursor(cursor); } +#if ENABLE(NOTIFICATIONS) +NotificationPresenter* Chrome::notificationPresenter() const +{ + return m_client->notificationPresenter(); +} +#endif + // -------- #if ENABLE(DASHBOARD_SUPPORT) diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h index c26e450..e28661c 100644 --- a/WebCore/page/Chrome.h +++ b/WebCore/page/Chrome.h @@ -44,6 +44,9 @@ namespace WebCore { class IntRect; class Page; class String; +#if ENABLE(NOTIFICATIONS) + class NotificationPresenter; +#endif struct FrameLoadRequest; struct WindowFeatures; @@ -128,6 +131,10 @@ namespace WebCore { void focusNSView(NSView*); #endif +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* notificationPresenter() const; +#endif + private: Page* m_page; ChromeClient* m_client; diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index 409a492..1010273 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -62,6 +62,10 @@ namespace WebCore { class GraphicsLayer; #endif +#if ENABLE(NOTIFICATIONS) + class NotificationPresenter; +#endif + class ChromeClient { public: virtual void chromeDestroyed() = 0; @@ -152,6 +156,10 @@ namespace WebCore { virtual void dashboardRegionsChanged(); #endif +#if ENABLE(NOTIFICATIONS) + virtual NotificationPresenter* notificationPresenter() const = 0; +#endif + virtual void populateVisitedLinks(); virtual FloatRect customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect); diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index e50b488..0cc3e5f 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -80,6 +80,10 @@ #include "DOMApplicationCache.h" #endif +#if ENABLE(NOTIFICATIONS) +#include "NotificationCenter.h" +#endif + using std::min; using std::max; @@ -454,6 +458,10 @@ void DOMWindow::clear() m_applicationCache->disconnectFrame(); m_applicationCache = 0; #endif + +#if ENABLE(NOTIFICATIONS) + m_notifications = 0; +#endif } Screen* DOMWindow::screen() const @@ -593,6 +601,28 @@ Storage* DOMWindow::localStorage() const } #endif +#if ENABLE(NOTIFICATIONS) +NotificationCenter* DOMWindow::webkitNotifications() const +{ + if (m_notifications) + return m_notifications.get(); + + Document* document = this->document(); + if (!document) + return 0; + + Page* page = document->page(); + if (!page) + return 0; + + NotificationPresenter* provider = page->chrome()->notificationPresenter(); + if (provider) + m_notifications = NotificationCenter::create(document, provider); + + return m_notifications.get(); +} +#endif + void DOMWindow::postMessage(const String& message, MessagePort* messagePort, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec) { if (!m_frame) @@ -1532,6 +1562,16 @@ void DOMWindow::setOnfocus(PassRefPtr<EventListener> eventListener) setAttributeEventListener(eventNames().focusEvent, eventListener); } +EventListener* DOMWindow::onhashchange() const +{ + return getAttributeEventListener(eventNames().hashchangeEvent); +} + +void DOMWindow::setOnhashchange(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener(eventNames().hashchangeEvent, eventListener); +} + EventListener* DOMWindow::onkeydown() const { return getAttributeEventListener(eventNames().keydownEvent); diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 12caf7e..ffe4ef5 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -56,6 +56,7 @@ namespace WebCore { class MessagePort; class Navigator; class Node; + class NotificationCenter; class PostMessageTimer; class ScheduledAction; class Screen; @@ -205,6 +206,10 @@ namespace WebCore { DOMApplicationCache* applicationCache() const; #endif +#if ENABLE(NOTIFICATIONS) + NotificationCenter* webkitNotifications() const; +#endif + void postMessage(const String& message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); void postMessageTimerFired(PostMessageTimer*); @@ -274,6 +279,8 @@ namespace WebCore { void setOnerror(PassRefPtr<EventListener>); EventListener* onfocus() const; void setOnfocus(PassRefPtr<EventListener>); + EventListener* onhashchange() const; + void setOnhashchange(PassRefPtr<EventListener>); EventListener* onkeydown() const; void setOnkeydown(PassRefPtr<EventListener>); EventListener* onkeypress() const; @@ -441,6 +448,9 @@ namespace WebCore { #if ENABLE(OFFLINE_WEB_APPLICATIONS) mutable RefPtr<DOMApplicationCache> m_applicationCache; #endif +#if ENABLE(NOTIFICATIONS) + mutable RefPtr<NotificationCenter> m_notifications; +#endif RegisteredEventListenerVector m_eventListeners; }; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index aba92f0..4e7835e 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -55,7 +55,7 @@ module window { attribute [Replaceable] Navigator clientInformation; attribute [DoNotCheckDomainSecurity, JSCCustom, V8CustomSetter, V8DisallowShadowing] Location location; - attribute [Replaceable, CustomGetter] Event event; + attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; readonly attribute [Custom] Crypto crypto; @@ -169,6 +169,9 @@ module window { readonly attribute Storage sessionStorage; readonly attribute Storage localStorage; #endif +#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS + readonly attribute NotificationCenter webkitNotifications; +#endif attribute [Replaceable] Console console; @@ -221,6 +224,7 @@ module window { attribute EventListener onended; attribute EventListener onerror; attribute EventListener onfocus; + attribute EventListener onhashchange; attribute EventListener oninput; attribute EventListener onkeydown; attribute EventListener onkeypress; @@ -454,6 +458,10 @@ module window { attribute RangeConstructor Range; attribute RangeExceptionConstructor RangeException; +#if ENABLE_EVENTSOURCE + attribute [JSCCustomGetter] EventSourceConstructor EventSource; // Usable with new the operator +#endif + // Mozilla has a separate XMLDocument object for XML documents. // We just use Document for this. attribute DocumentConstructor XMLDocument; diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 41e859f..99ecce0 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -442,7 +442,7 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e // If the selection is contained in a layer that can scroll, that layer should handle the autoscroll // Otherwise, let the bridge handle it so the view can scroll itself. RenderObject* renderer = targetNode->renderer(); - while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeProgramaticallyScrolled(false))) { + while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) { if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) renderer = renderer->document()->ownerElement()->renderer(); else @@ -732,7 +732,7 @@ void EventHandler::updateAutoscrollRenderer() if (Node* nodeAtPoint = hitTest.innerNode()) m_autoscrollRenderer = nodeAtPoint->renderer(); - while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !toRenderBox(m_autoscrollRenderer)->canBeProgramaticallyScrolled(false))) + while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !toRenderBox(m_autoscrollRenderer)->canBeScrolledAndHasScrollableArea())) m_autoscrollRenderer = m_autoscrollRenderer->parent(); } @@ -1172,7 +1172,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) if (mouseEvent.button() == MiddleButton && !mev.isOverLink()) { RenderObject* renderer = mev.targetNode()->renderer(); - while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeProgramaticallyScrolled(false))) { + while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) { if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) renderer = renderer->document()->ownerElement()->renderer(); else @@ -2339,7 +2339,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve } -#if !PLATFORM(MAC) && !PLATFORM(QT) +#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(HAIKU) bool EventHandler::invertSenseOfTabsToLinks(KeyboardEvent*) const { return false; diff --git a/WebCore/page/EventSource.cpp b/WebCore/page/EventSource.cpp new file mode 100644 index 0000000..47243d9 --- /dev/null +++ b/WebCore/page/EventSource.cpp @@ -0,0 +1,372 @@ +/* + * Copyright (C) 2009 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Ericsson nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(EVENTSOURCE) + +#include "EventSource.h" + +#include "Cache.h" +#include "DOMWindow.h" +#include "Event.h" +#include "EventException.h" +#include "PlatformString.h" +#include "MessageEvent.h" +#include "ResourceError.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "ScriptExecutionContext.h" +#include "TextResourceDecoder.h" +#include "ThreadableLoader.h" + +namespace WebCore { + +const unsigned long long EventSource::defaultReconnectDelay = 3000; + +EventSource::EventSource(const String& url, ScriptExecutionContext* context, ExceptionCode& ec) + : ActiveDOMObject(context, this) + , m_state(CONNECTING) + , m_reconnectTimer(this, &EventSource::reconnectTimerFired) + , m_failSilently(false) + , m_requestInFlight(false) + , m_reconnectDelay(defaultReconnectDelay) +{ + if (url.isEmpty() || !(m_url = context->completeURL(url)).isValid()) { + ec = SYNTAX_ERR; + return; + } + // FIXME: should support cross-origin requests + if (!scriptExecutionContext()->securityOrigin()->canRequest(m_url)) { + ec = SECURITY_ERR; + return; + } + + m_origin = scriptExecutionContext()->securityOrigin()->toString(); + m_decoder = TextResourceDecoder::create("text/plain", "UTF-8"); + + setPendingActivity(this); + connect(); +} + +EventSource::~EventSource() +{ +} + +void EventSource::connect() +{ + ResourceRequest request(m_url); + request.setHTTPMethod("GET"); + request.setHTTPHeaderField("Accept", "text/event-stream"); + request.setHTTPHeaderField("Cache-Control", "no-cache"); + if (!m_lastEventId.isEmpty()) + request.setHTTPHeaderField("Last-Event-ID", m_lastEventId); + + ThreadableLoaderOptions options; + options.sendLoadCallbacks = true; + options.sniffContent = false; + options.allowCredentials = true; + + m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options); + + m_requestInFlight = true; + + if (!scriptExecutionContext()->isWorkerContext()) + cache()->loader()->nonCacheRequestInFlight(m_url); +} + +void EventSource::endRequest() +{ + m_requestInFlight = false; + + if (!m_failSilently) + dispatchGenericEvent(eventNames().errorEvent); + + if (!scriptExecutionContext()->isWorkerContext()) + cache()->loader()->nonCacheRequestComplete(m_url); + + if (m_state != CLOSED) + scheduleReconnect(); + else + unsetPendingActivity(this); +} + +void EventSource::scheduleReconnect() +{ + m_state = CONNECTING; + m_reconnectTimer.startOneShot(m_reconnectDelay / 1000); +} + +void EventSource::reconnectTimerFired(Timer<EventSource>*) +{ + connect(); +} + +String EventSource::url() const +{ + return m_url.string(); +} + +EventSource::State EventSource::readyState() const +{ + return m_state; +} + +void EventSource::close() +{ + if (m_state == CLOSED) + return; + + if (m_reconnectTimer.isActive()) { + m_reconnectTimer.stop(); + unsetPendingActivity(this); + } + + m_state = CLOSED; + m_failSilently = true; + + if (m_requestInFlight) + m_loader->cancel(); +} + +ScriptExecutionContext* EventSource::scriptExecutionContext() const +{ + return ActiveDOMObject::scriptExecutionContext(); +} + +void EventSource::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) +{ + EventListenersMap::iterator iter = m_eventListeners.find(eventType); + if (iter == m_eventListeners.end()) { + ListenerVector listeners; + listeners.append(eventListener); + m_eventListeners.add(eventType, listeners); + } else { + ListenerVector& listeners = iter->second; + for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { + if (*listenerIter == eventListener) + return; + } + + listeners.append(eventListener); + m_eventListeners.add(eventType, listeners); + } +} + +void EventSource::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) +{ + EventListenersMap::iterator iter = m_eventListeners.find(eventType); + if (iter == m_eventListeners.end()) + return; + + ListenerVector& listeners = iter->second; + for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { + if (*listenerIter == eventListener) { + listeners.remove(listenerIter - listeners.begin()); + return; + } + } +} + +bool EventSource::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) +{ + if (!event || event->type().isEmpty()) { + ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; + return true; + } + + EventListener* attributeListener = m_attributeListeners.get(event->type()).get(); + if (attributeListener) { + event->setTarget(this); + event->setCurrentTarget(this); + attributeListener->handleEvent(event.get(), false); + } + + ListenerVector listenersCopy = m_eventListeners.get(event->type()); + for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { + event->setTarget(this); + event->setCurrentTarget(this); + listenerIter->get()->handleEvent(event.get(), false); + } + + return !event->defaultPrevented(); +} + +void EventSource::didReceiveResponse(const ResourceResponse& response) +{ + int statusCode = response.httpStatusCode(); + if (statusCode == 200 && response.httpHeaderField("Content-Type") == "text/event-stream") { + m_state = OPEN; + dispatchGenericEvent(eventNames().openEvent); + } else { + if (statusCode <= 200 || statusCode > 299) + m_state = CLOSED; + m_loader->cancel(); + } +} + +void EventSource::didReceiveData(const char* data, int length) +{ + append(m_receiveBuf, m_decoder->decode(data, length)); + parseEventStream(); +} + +void EventSource::didFinishLoading(unsigned long) +{ + if (m_receiveBuf.size() > 0 || m_data.size() > 0) { + append(m_receiveBuf, "\n\n"); + parseEventStream(); + } + m_state = CONNECTING; + endRequest(); +} + +void EventSource::didFail(const ResourceError& error) +{ + int canceled = error.isCancellation(); + if (((m_state == CONNECTING) && !canceled) || ((m_state == OPEN) && canceled)) + m_state = CLOSED; + endRequest(); +} + +void EventSource::didFailRedirectCheck() +{ + m_state = CLOSED; + m_loader->cancel(); +} + +void EventSource::parseEventStream() +{ + unsigned int bufPos = 0; + unsigned int bufSize = m_receiveBuf.size(); + for (;;) { + int lineLength = -1; + int fieldLength = -1; + int carriageReturn = 0; + for (unsigned int i = bufPos; lineLength < 0 && i < bufSize; i++) { + switch (m_receiveBuf[i]) { + case ':': + if (fieldLength < 0) + fieldLength = i - bufPos; + break; + case '\n': + if (i > bufPos && m_receiveBuf[i - 1] == '\r') { + carriageReturn++; + i--; + } + lineLength = i - bufPos; + break; + } + } + + if (lineLength < 0) + break; + + parseEventStreamLine(bufPos, fieldLength, lineLength); + bufPos += lineLength + carriageReturn + 1; + } + + if (bufPos == bufSize) + m_receiveBuf.clear(); + else if (bufPos) + m_receiveBuf.remove(0, bufPos); +} + +void EventSource::parseEventStreamLine(unsigned int bufPos, int fieldLength, int lineLength) +{ + if (!lineLength) { + if (!m_data.isEmpty()) + dispatchMessageEvent(); + if (!m_eventName.isEmpty()) + m_eventName = ""; + } else if (fieldLength) { + bool noValue = fieldLength < 0; + + String field(&m_receiveBuf[bufPos], noValue ? lineLength : fieldLength); + int step; + if (noValue) + step = lineLength; + else if (m_receiveBuf[bufPos + fieldLength + 1] != ' ') + step = fieldLength + 1; + else + step = fieldLength + 2; + bufPos += step; + int valueLength = lineLength - step; + + if (field == "data") { + if (m_data.size() > 0) + m_data.append('\n'); + if (valueLength) + m_data.append(&m_receiveBuf[bufPos], valueLength); + } else if (field == "event") + m_eventName = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : ""; + else if (field == "id") + m_lastEventId = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : ""; + else if (field == "retry") { + if (!valueLength) + m_reconnectDelay = defaultReconnectDelay; + else { + String value(&m_receiveBuf[bufPos], valueLength); + bool ok; + unsigned long long retry = value.toUInt64(&ok); + if (ok) + m_reconnectDelay = retry; + } + } + } +} + +void EventSource::dispatchGenericEvent(const AtomicString& type) +{ + RefPtr<Event> evt = Event::create(type, false, false); + ExceptionCode ec = 0; + dispatchEvent(evt.release(), ec); + ASSERT(!ec); +} + +void EventSource::dispatchMessageEvent() +{ + RefPtr<MessageEvent> evt = MessageEvent::create(); + String eventName = m_eventName.isEmpty() ? eventNames().messageEvent.string() : m_eventName; + evt->initMessageEvent(eventName, false, false, String::adopt(m_data), m_origin, m_lastEventId, 0, 0); + ExceptionCode ec = 0; + dispatchEvent(evt.release(), ec); + ASSERT(!ec); +} + +void EventSource::stop() +{ + close(); +} + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/page/EventSource.h b/WebCore/page/EventSource.h new file mode 100644 index 0000000..df55694 --- /dev/null +++ b/WebCore/page/EventSource.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2009 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Ericsson nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EventSource_h +#define EventSource_h + +#if ENABLE(EVENTSOURCE) + +#include "ActiveDOMObject.h" +#include "AtomicStringHash.h" +#include "EventListener.h" +#include "EventNames.h" +#include "EventTarget.h" +#include "KURL.h" +#include "ThreadableLoaderClient.h" +#include "Timer.h" + +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + + class ResourceResponse; + class TextResourceDecoder; + class ThreadableLoader; + + class EventSource : public RefCounted<EventSource>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { + public: + static PassRefPtr<EventSource> create(const String& url, ScriptExecutionContext* context, ExceptionCode& ec) { return adoptRef(new EventSource(url, context, ec)); } + virtual ~EventSource(); + + static const unsigned long long defaultReconnectDelay; + + String url() const; + + enum State { + CONNECTING = 0, + OPEN = 1, + CLOSED = 2, + }; + + State readyState() const; + + void setOnopen(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().openEvent, eventListener); } + EventListener* onopen() const { return m_attributeListeners.get(eventNames().openEvent).get(); } + + void setOnmessage(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().messageEvent, eventListener); } + EventListener* onmessage() const { return m_attributeListeners.get(eventNames().messageEvent).get(); } + + void setOnerror(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().errorEvent, eventListener); } + EventListener* onerror() const { return m_attributeListeners.get(eventNames().errorEvent).get(); } + + void close(); + + using RefCounted<EventSource>::ref; + using RefCounted<EventSource>::deref; + + virtual EventSource* toEventSource() { return this; } + virtual ScriptExecutionContext* scriptExecutionContext() const; + + typedef Vector<RefPtr<EventListener> > ListenerVector; + typedef HashMap<AtomicString, ListenerVector> EventListenersMap; + + virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); + EventListenersMap& eventListeners() { return m_eventListeners; } + + virtual void stop(); + + private: + EventSource(const String& url, ScriptExecutionContext* context, ExceptionCode& ec); + + virtual void refEventTarget() { ref(); } + virtual void derefEventTarget() { deref(); } + + virtual void didReceiveResponse(const ResourceResponse& response); + virtual void didReceiveData(const char* data, int length); + virtual void didFinishLoading(unsigned long); + virtual void didFail(const ResourceError& error); + virtual void didFailRedirectCheck(); + + void connect(); + void endRequest(); + void scheduleReconnect(); + void reconnectTimerFired(Timer<EventSource>*); + void parseEventStream(); + void parseEventStreamLine(unsigned int pos, int fieldLength, int lineLength); + void dispatchGenericEvent(const AtomicString& type); + void dispatchMessageEvent(); + + KURL m_url; + State m_state; + + HashMap<AtomicString, RefPtr<EventListener> > m_attributeListeners; + EventListenersMap m_eventListeners; + + RefPtr<TextResourceDecoder> m_decoder; + RefPtr<ThreadableLoader> m_loader; + Timer<EventSource> m_reconnectTimer; + Vector<UChar> m_receiveBuf; + bool m_failSilently; + bool m_requestInFlight; + + String m_eventName; + Vector<UChar> m_data; + String m_lastEventId; + unsigned long long m_reconnectDelay; + String m_origin; + }; + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) + +#endif // EventSource_h diff --git a/WebCore/page/EventSource.idl b/WebCore/page/EventSource.idl new file mode 100644 index 0000000..c438e68 --- /dev/null +++ b/WebCore/page/EventSource.idl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Ericsson AB + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Ericsson nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module window { + + interface [ + Conditional=EVENTSOURCE, + CustomMarkFunction, + NoStaticTables + ] EventSource { + + readonly attribute DOMString URL; + + // ready state + const unsigned short CONNECTING = 0; + const unsigned short OPEN = 1; + const unsigned short CLOSED = 2; + readonly attribute unsigned short readyState; + + // networking + attribute EventListener onopen; + attribute EventListener onmessage; + attribute EventListener onerror; + void close(); + + // EventTarget interface + [Custom] void addEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + [Custom] void removeEventListener(in DOMString type, + in EventListener listener, + in boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); + + }; +} diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index e57a8b5..f8cc111 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -334,6 +334,7 @@ void Geolocation::requestPermission() void Geolocation::geolocationServicePositionChanged(GeolocationService*) { + ASSERT_UNUSED(service, service == m_service); ASSERT(m_service->lastPosition()); // Stop all currently running timers. diff --git a/WebCore/page/Navigator.cpp b/WebCore/page/Navigator.cpp index 3603b86..4922860 100644 --- a/WebCore/page/Navigator.cpp +++ b/WebCore/page/Navigator.cpp @@ -31,11 +31,13 @@ #include "Language.h" #include "MimeTypeArray.h" #include "Page.h" +#include "PageGroup.h" #include "PlatformString.h" #include "PluginArray.h" #include "PluginData.h" #include "ScriptController.h" #include "Settings.h" +#include "StorageNamespace.h" namespace WebCore { @@ -150,5 +152,21 @@ Geolocation* Navigator::geolocation() const m_geolocation = Geolocation::create(m_frame); return m_geolocation.get(); } - + +#if ENABLE(DOM_STORAGE) +void Navigator::getStorageUpdates() +{ + if (!m_frame) + return; + + Page* page = m_frame->page(); + if (!page) + return; + + StorageNamespace* localStorage = page->group().localStorage(); + if (localStorage) + localStorage->unlock(); +} +#endif + } // namespace WebCore diff --git a/WebCore/page/Navigator.h b/WebCore/page/Navigator.h index d50721e..4adebe1 100644 --- a/WebCore/page/Navigator.h +++ b/WebCore/page/Navigator.h @@ -55,6 +55,11 @@ namespace WebCore { // This is used for GC marking. Geolocation* optionalGeolocation() const { return m_geolocation.get(); } +#if ENABLE(DOM_STORAGE) + // Relinquishes the storage lock, if one exists. + void getStorageUpdates(); +#endif + private: Navigator(Frame*); Frame* m_frame; diff --git a/WebCore/page/Navigator.idl b/WebCore/page/Navigator.idl index 8048ff3..80ef4fb 100644 --- a/WebCore/page/Navigator.idl +++ b/WebCore/page/Navigator.idl @@ -42,6 +42,10 @@ module window { #if defined(ENABLE_GEOLOCATION) && ENABLE_GEOLOCATION readonly attribute Geolocation geolocation; #endif + +#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE + void getStorageUpdates(); +#endif }; } diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h index 9d9af86..fb212a4 100644 --- a/WebCore/page/Page.h +++ b/WebCore/page/Page.h @@ -71,6 +71,9 @@ namespace WebCore { #if ENABLE(WML) class WMLPageState; #endif +#if ENABLE(NOTIFICATIONS) + class NotificationPresenter; +#endif enum FindDirection { FindDirectionForward, FindDirectionBackward }; @@ -272,6 +275,10 @@ namespace WebCore { #if ENABLE(WML) OwnPtr<WMLPageState> m_wmlPageState; #endif + +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* m_notificationPresenter; +#endif }; } // namespace WebCore diff --git a/WebCore/page/PositionOptions.h b/WebCore/page/PositionOptions.h index ee8530a..ed7074b 100644 --- a/WebCore/page/PositionOptions.h +++ b/WebCore/page/PositionOptions.h @@ -33,7 +33,7 @@ namespace WebCore { class PositionOptions : public RefCounted<PositionOptions> { public: - static PassRefPtr<PositionOptions> create() { return adoptRef(new PositionOptions); } + static PassRefPtr<PositionOptions> create() { return adoptRef(new PositionOptions()); } bool enableHighAccuracy() const { return m_highAccuracy; } void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp index 14a1b59..8274e0e 100644 --- a/WebCore/page/SecurityOrigin.cpp +++ b/WebCore/page/SecurityOrigin.cpp @@ -32,15 +32,10 @@ #include "CString.h" #include "FrameLoader.h" #include "KURL.h" -#include "PlatformString.h" -#include "StringHash.h" -#include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> namespace WebCore { -typedef HashSet<String, CaseFoldingHash> URLSchemesMap; - static URLSchemesMap& localSchemes() { DEFINE_STATIC_LOCAL(URLSchemesMap, localSchemes, ()); @@ -346,6 +341,28 @@ void SecurityOrigin::registerURLSchemeAsLocal(const String& scheme) } // static +void SecurityOrigin::removeURLSchemeRegisteredAsLocal(const String& scheme) +{ + if (scheme == "file") + return; +#if PLATFORM(MAC) + if (scheme == "applewebdata") + return; +#endif +#if PLATFORM(QT) + if (scheme == "qrc") + return; +#endif + localSchemes().remove(scheme); +} + +// static +const URLSchemesMap& SecurityOrigin::localURLSchemes() +{ + return localSchemes(); +} + +// static bool SecurityOrigin::shouldTreatURLAsLocal(const String& url) { // This avoids an allocation of another String and the HashSet contains() diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h index ab92683..335ed28 100644 --- a/WebCore/page/SecurityOrigin.h +++ b/WebCore/page/SecurityOrigin.h @@ -29,14 +29,18 @@ #ifndef SecurityOrigin_h #define SecurityOrigin_h +#include <wtf/HashSet.h> #include <wtf/RefCounted.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> #include "PlatformString.h" +#include "StringHash.h" namespace WebCore { + typedef HashSet<String, CaseFoldingHash> URLSchemesMap; + class KURL; class SecurityOrigin : public ThreadSafeShared<SecurityOrigin> { @@ -129,6 +133,8 @@ namespace WebCore { bool isSameSchemeHostPort(const SecurityOrigin*) const; static void registerURLSchemeAsLocal(const String&); + static void removeURLSchemeRegisteredAsLocal(const String&); + static const URLSchemesMap& localURLSchemes(); static bool shouldTreatURLAsLocal(const String&); static bool shouldTreatURLSchemeAsLocal(const String&); diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp index 7503f0a..f85d8e4 100644 --- a/WebCore/page/animation/AnimationBase.cpp +++ b/WebCore/page/animation/AnimationBase.cpp @@ -302,11 +302,21 @@ public: { ShadowData* shadowA = (a->*m_getter)(); ShadowData* shadowB = (b->*m_getter)(); + + while (true) { + if (!shadowA && !shadowB) // end of both lists + return true; + + if (!shadowA || !shadowB) // end of just one of the lists + return false; + + if (*shadowA != *shadowB) + return false; + + shadowA = shadowA->next; + shadowB = shadowB->next; + } - if ((!shadowA && shadowB) || (shadowA && !shadowB)) - return false; - if (shadowA && shadowB && (*shadowA != *shadowB)) - return false; return true; } @@ -316,12 +326,22 @@ public: ShadowData* shadowB = (b->*m_getter)(); ShadowData defaultShadowData(0, 0, 0, 0, Normal, Color::transparent); - if (!shadowA) - shadowA = &defaultShadowData; - if (!shadowB) - shadowB = &defaultShadowData; + ShadowData* newShadowData = 0; + + while (shadowA || shadowB) { + ShadowData* srcShadow = shadowA ? shadowA : &defaultShadowData; + ShadowData* dstShadow = shadowB ? shadowB : &defaultShadowData; + + if (!newShadowData) + newShadowData = blendFunc(anim, srcShadow, dstShadow, progress); + else + newShadowData->next = blendFunc(anim, srcShadow, dstShadow, progress); - (dst->*m_setter)(blendFunc(anim, shadowA, shadowB, progress), false); + shadowA = shadowA ? shadowA->next : 0; + shadowB = shadowB ? shadowB->next : 0; + } + + (dst->*m_setter)(newShadowData, false); } private: @@ -365,6 +385,124 @@ private: void (RenderStyle::*m_setter)(const Color&); }; +// Wrapper base class for an animatable property in a FillLayer +class FillLayerPropertyWrapperBase { +public: + FillLayerPropertyWrapperBase() + { + } + + virtual ~FillLayerPropertyWrapperBase() { } + + virtual bool equals(const FillLayer* a, const FillLayer* b) const = 0; + virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const = 0; +}; + +template <typename T> +class FillLayerPropertyWrapperGetter : public FillLayerPropertyWrapperBase { +public: + FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const) + : m_getter(getter) + { + } + + virtual bool equals(const FillLayer* a, const FillLayer* b) const + { + // If the style pointers are the same, don't bother doing the test. + // If either is null, return false. If both are null, return true. + if ((!a && !b) || a == b) + return true; + if (!a || !b) + return false; + return (a->*m_getter)() == (b->*m_getter)(); + } + +protected: + T (FillLayer::*m_getter)() const; +}; + +template <typename T> +class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<T> { +public: + FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*setter)(T)) + : FillLayerPropertyWrapperGetter<T>(getter) + , m_setter(setter) + { + } + + virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const + { + (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T>::m_getter)(), progress)); + } + +protected: + void (FillLayer::*m_setter)(T); +}; + + +class FillLayersPropertyWrapper : public PropertyWrapperBase { +public: + typedef const FillLayer* (RenderStyle::*LayersGetter)() const; + typedef FillLayer* (RenderStyle::*LayersAccessor)(); + + FillLayersPropertyWrapper(int prop, LayersGetter getter, LayersAccessor accessor) + : PropertyWrapperBase(prop) + , m_layersGetter(getter) + , m_layersAccessor(accessor) + { + switch (prop) { + case CSSPropertyBackgroundPositionX: + case CSSPropertyWebkitMaskPositionX: + m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::xPosition, &FillLayer::setXPosition); + break; + case CSSPropertyBackgroundPositionY: + case CSSPropertyWebkitMaskPositionY: + m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::yPosition, &FillLayer::setYPosition); + break; + case CSSPropertyWebkitBackgroundSize: + case CSSPropertyWebkitMaskSize: + m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::size, &FillLayer::setSize); + break; + } + } + + virtual bool equals(const RenderStyle* a, const RenderStyle* b) const + { + const FillLayer* fromLayer = (a->*m_layersGetter)(); + const FillLayer* toLayer = (b->*m_layersGetter)(); + + while (fromLayer && toLayer) { + if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer)) + return false; + + fromLayer = fromLayer->next(); + toLayer = toLayer->next(); + } + + return true; + } + + virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const + { + const FillLayer* aLayer = (a->*m_layersGetter)(); + const FillLayer* bLayer = (b->*m_layersGetter)(); + FillLayer* dstLayer = (dst->*m_layersAccessor)(); + + while (aLayer && bLayer && dstLayer) { + m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, progress); + aLayer = aLayer->next(); + bLayer = bLayer->next(); + dstLayer = dstLayer->next(); + } + } + +private: + FillLayerPropertyWrapperBase* m_fillLayerPropertyWrapper; + + LayersGetter m_layersGetter; + LayersAccessor m_layersAccessor; +}; + class ShorthandPropertyWrapper : public PropertyWrapperBase { public: ShorthandPropertyWrapper(int property, const CSSPropertyLonghand& longhand) @@ -442,13 +580,14 @@ static void ensurePropertyMap() gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor)); gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundXPosition, &RenderStyle::setBackgroundXPosition)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundYPosition, &RenderStyle::setBackgroundYPosition)); - gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundSize, &RenderStyle::setBackgroundSize)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskXPosition, &RenderStyle::setMaskXPosition)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskYPosition, &RenderStyle::setMaskYPosition)); - gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyWebkitMaskSize, &RenderStyle::maskSize, &RenderStyle::setMaskSize)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyFontSize, &RenderStyle::fontSize, &RenderStyle::setBlendedFontSize)); gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWebkitColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth)); diff --git a/WebCore/page/haiku/DragControllerHaiku.cpp b/WebCore/page/haiku/DragControllerHaiku.cpp index 0b95558..ef08ac2 100644 --- a/WebCore/page/haiku/DragControllerHaiku.cpp +++ b/WebCore/page/haiku/DragControllerHaiku.cpp @@ -32,10 +32,9 @@ #include <InterfaceDefs.h> -namespace WebCore -{ +namespace WebCore { -// FIXME: These values are straight out of DragControllerMac, so probably have +// FIXME: These values are straight out of DragControllerMac, so probably have // little correlation with Haiku standards... const int DragController::LinkDragBorderInset = 2; const int DragController::MaxOriginalImageArea = 1500 * 1500; diff --git a/WebCore/page/haiku/EventHandlerHaiku.cpp b/WebCore/page/haiku/EventHandlerHaiku.cpp index 64b8519..203344e 100644 --- a/WebCore/page/haiku/EventHandlerHaiku.cpp +++ b/WebCore/page/haiku/EventHandlerHaiku.cpp @@ -36,14 +36,13 @@ #include "HitTestResult.h" #include "KeyboardEvent.h" #include "MouseEventWithHitTestResults.h" +#include "NotImplemented.h" #include "Page.h" #include "PlatformKeyboardEvent.h" #include "PlatformScrollBar.h" #include "PlatformWheelEvent.h" #include "RenderWidget.h" -#include "NotImplemented.h" - #include <interface/View.h> @@ -117,13 +116,15 @@ bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& eve bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* widget) { - notImplemented(); - return false; + if (!widget->isFrameView()) + return false; + + return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event); } PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return new ClipboardHaiku(ClipboardWritable, true); + return ClipboardHaiku::create(ClipboardWritable, true); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/platform/ContextMenuItem.h b/WebCore/platform/ContextMenuItem.h index 3a4cdfa..d6ab519 100644 --- a/WebCore/platform/ContextMenuItem.h +++ b/WebCore/platform/ContextMenuItem.h @@ -46,6 +46,8 @@ typedef struct _GtkMenuItem GtkMenuItem; #include <QAction> #elif PLATFORM(WX) class wxMenuItem; +#elif PLATFORM(HAIKU) +class BMenuItem; #endif namespace WebCore { @@ -204,6 +206,8 @@ namespace WebCore { bool checked; bool enabled; }; +#elif PLATFORM(HAIKU) + typedef BMenuItem* PlatformMenuItemDescription; #else typedef void* PlatformMenuItemDescription; #endif diff --git a/WebCore/platform/Cookie.h b/WebCore/platform/Cookie.h new file mode 100644 index 0000000..f646d3a --- /dev/null +++ b/WebCore/platform/Cookie.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Joseph Pecoraro. 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 Cookie_h +#define Cookie_h + +#include "PlatformString.h" + +namespace WebCore { + + struct Cookie { + Cookie(const String& name, const String& value, const String& domain, + const String& path, double expires, bool httpOnly, bool secure, + bool session) + : name(name) + , value(value) + , domain(domain) + , path(path) + , expires(expires) + , httpOnly(httpOnly) + , secure(secure) + , session(session) + { + } + + String name; + String value; + String domain; + String path; + double expires; + bool httpOnly; + bool secure; + bool session; + }; + +} + +#endif diff --git a/WebCore/platform/CookieJar.h b/WebCore/platform/CookieJar.h index 6159386..987543e 100644 --- a/WebCore/platform/CookieJar.h +++ b/WebCore/platform/CookieJar.h @@ -26,15 +26,21 @@ #ifndef CookieJar_h #define CookieJar_h +#include <wtf/Vector.h> + namespace WebCore { + class Document; class KURL; class String; - class Document; + + struct Cookie; String cookies(const Document*, const KURL&); void setCookies(Document*, const KURL&, const String&); bool cookiesEnabled(const Document*); + bool getRawCookies(const Document*, const KURL&, Vector<Cookie>&); + void deleteCookie(const Document*, const KURL&, const String&); } diff --git a/WebCore/platform/CrossThreadCopier.h b/WebCore/platform/CrossThreadCopier.h index d12d72d..178e056 100644 --- a/WebCore/platform/CrossThreadCopier.h +++ b/WebCore/platform/CrossThreadCopier.h @@ -46,6 +46,7 @@ namespace WebCore { class String; struct CrossThreadResourceResponseData; struct CrossThreadResourceRequestData; + struct ThreadableLoaderOptions; template<typename T> struct CrossThreadCopierPassThrough { typedef T Type; @@ -65,6 +66,9 @@ namespace WebCore { template<typename T> struct CrossThreadCopierBase<false, T*> : public CrossThreadCopierPassThrough<T*> { }; + template<> struct CrossThreadCopierBase<false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { + }; + // Custom copy methods. template<typename T> struct CrossThreadCopierBase<false, RefPtr<ThreadSafeShared<T> > > { typedef PassRefPtr<T> Type; diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h index ea75191..2d041d2 100644 --- a/WebCore/platform/Cursor.h +++ b/WebCore/platform/Cursor.h @@ -40,6 +40,8 @@ typedef struct _GdkCursor GdkCursor; #include <QCursor> #elif PLATFORM(CHROMIUM) #include "PlatformCursor.h" +#elif PLATFORM(HAIKU) +#include <app/Cursor.h> #endif #if PLATFORM(MAC) @@ -86,6 +88,9 @@ namespace WebCore { #elif PLATFORM(CHROMIUM) // See PlatformCursor.h typedef void* PlatformCursorHandle; +#elif PLATFORM(HAIKU) + typedef BCursor* PlatformCursor; + typedef BCursor* PlatformCursorHandle; #else typedef void* PlatformCursor; typedef void* PlatformCursorHandle; diff --git a/WebCore/platform/DragData.h b/WebCore/platform/DragData.h index a1555e3..116ffdd 100644 --- a/WebCore/platform/DragData.h +++ b/WebCore/platform/DragData.h @@ -58,6 +58,9 @@ typedef void* DragDataRef; typedef void* DragDataRef; #elif PLATFORM(CHROMIUM) #include "DragDataRef.h" +#elif PLATFORM(HAIKU) +class BMessage; +typedef class BMessage* DragDataRef; #endif diff --git a/WebCore/platform/DragImage.h b/WebCore/platform/DragImage.h index 0196971..611eb8a 100644 --- a/WebCore/platform/DragImage.h +++ b/WebCore/platform/DragImage.h @@ -48,6 +48,8 @@ class wxDragImage; #include "DragImageRef.h" #elif PLATFORM(GTK) typedef struct _GdkPixbuf GdkPixbuf; +#elif PLATFORM(HAIKU) +class BBitmap; #endif //We need to #define YOffset as it needs to be shared with WebKit @@ -72,6 +74,8 @@ namespace WebCore { typedef wxDragImage* DragImageRef; #elif PLATFORM(GTK) typedef GdkPixBuf* DragImageRef; +#elif PLATFORM(HAIKU) + typedef BBitmap* DragImageRef; #elif PLATFORM(ANDROID) typedef void* DragImageRef; #endif diff --git a/WebCore/platform/Pasteboard.h b/WebCore/platform/Pasteboard.h index 883364a..5d63254 100644 --- a/WebCore/platform/Pasteboard.h +++ b/WebCore/platform/Pasteboard.h @@ -102,6 +102,7 @@ public: #if PLATFORM(GTK) void setHelper(PasteboardHelper*); + PasteboardHelper* m_helper; #endif private: @@ -117,10 +118,6 @@ private: HWND m_owner; #endif -#if PLATFORM(GTK) - PasteboardHelper* m_helper; -#endif - #if PLATFORM(QT) bool m_selectionMode; #endif diff --git a/WebCore/platform/PlatformKeyboardEvent.h b/WebCore/platform/PlatformKeyboardEvent.h index 1499ac5..b5c2e95 100644 --- a/WebCore/platform/PlatformKeyboardEvent.h +++ b/WebCore/platform/PlatformKeyboardEvent.h @@ -59,6 +59,10 @@ QT_END_NAMESPACE class wxKeyEvent; #endif +#if PLATFORM(HAIKU) +class BMessage; +#endif + namespace WebCore { class PlatformKeyboardEvent { @@ -155,6 +159,10 @@ namespace WebCore { PlatformKeyboardEvent(wxKeyEvent&); #endif +#if PLATFORM(HAIKU) + PlatformKeyboardEvent(BMessage*); +#endif + #if PLATFORM(WIN) || PLATFORM(CHROMIUM) bool isSystemKey() const { return m_isSystemKey; } #endif diff --git a/WebCore/platform/PlatformMenuDescription.h b/WebCore/platform/PlatformMenuDescription.h index ab71710..c986207 100644 --- a/WebCore/platform/PlatformMenuDescription.h +++ b/WebCore/platform/PlatformMenuDescription.h @@ -40,6 +40,8 @@ typedef struct HMENU__* HMENU; typedef struct _GtkMenu GtkMenu; #elif PLATFORM(WX) class wxMenu; +#elif PLATFORM(HAIKU) +class BMenu; #endif namespace WebCore { @@ -58,6 +60,8 @@ namespace WebCore { typedef void* PlatformMenuDescription; #elif PLATFORM(WX) typedef wxMenu* PlatformMenuDescription; +#elif PLATFORM(HAIKU) + typedef BMenu* PlatformMenuDescription; #else typedef void* PlatformMenuDescription; #endif diff --git a/WebCore/platform/PlatformMouseEvent.h b/WebCore/platform/PlatformMouseEvent.h index 2543d40..d01636e 100644 --- a/WebCore/platform/PlatformMouseEvent.h +++ b/WebCore/platform/PlatformMouseEvent.h @@ -50,6 +50,10 @@ typedef long LPARAM; class wxMouseEvent; #endif +#if PLATFORM(HAIKU) +class BMessage; +#endif + namespace WebCore { // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified. @@ -128,6 +132,10 @@ namespace WebCore { PlatformMouseEvent(const wxMouseEvent&, const wxPoint& globalPoint, int clickCount); #endif +#if PLATFORM(HAIKU) + PlatformMouseEvent(const BMessage*); +#endif + protected: IntPoint m_position; IntPoint m_globalPosition; diff --git a/WebCore/platform/PlatformWheelEvent.h b/WebCore/platform/PlatformWheelEvent.h index ae8df4e..1978438 100644 --- a/WebCore/platform/PlatformWheelEvent.h +++ b/WebCore/platform/PlatformWheelEvent.h @@ -49,6 +49,10 @@ class wxMouseEvent; class wxPoint; #endif +#if PLATFORM(HAIKU) +class BMessage; +#endif + namespace WebCore { class FloatPoint; @@ -109,6 +113,10 @@ namespace WebCore { PlatformWheelEvent(const wxMouseEvent&, const wxPoint&); #endif +#if PLATFORM(HAIKU) + PlatformWheelEvent(BMessage*); +#endif + protected: IntPoint m_position; IntPoint m_globalPosition; diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h index fc85d60..04b5a68 100644 --- a/WebCore/platform/PopupMenu.h +++ b/WebCore/platform/PopupMenu.h @@ -59,6 +59,8 @@ class wxMenu; #include <wx/event.h> #elif PLATFORM(CHROMIUM) #include "PopupMenuPrivate.h" +#elif PLATFORM(HAIKU) +class BMenu; #endif namespace WebCore { @@ -92,6 +94,8 @@ public: #if PLATFORM(WIN) Scrollbar* scrollbar() const { return m_scrollbar.get(); } + static LPCTSTR popupClassName(); + bool up(unsigned lines = 1); bool down(unsigned lines = 1); @@ -177,6 +181,8 @@ private: void OnMenuItemSelected(wxCommandEvent&); #elif PLATFORM(CHROMIUM) PopupMenuPrivate p; +#elif PLATFORM(HAIKU) + BMenu* m_menu; #endif }; diff --git a/WebCore/platform/TreeShared.h b/WebCore/platform/TreeShared.h index 1ac1b33..02728ff 100644 --- a/WebCore/platform/TreeShared.h +++ b/WebCore/platform/TreeShared.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 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 @@ -28,17 +28,8 @@ namespace WebCore { template<class T> class TreeShared : public Noncopyable { public: - TreeShared() - : m_refCount(0) - , m_parent(0) - { -#ifndef NDEBUG - m_deletionHasBegun = false; - m_inRemovedLastRefFunction = false; -#endif - } - TreeShared(T* parent) - : m_refCount(0) + TreeShared(int initialRefCount = 1) + : m_refCount(initialRefCount) , m_parent(0) { #ifndef NDEBUG diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h index 4534d58..798ab9e 100644 --- a/WebCore/platform/Widget.h +++ b/WebCore/platform/Widget.h @@ -70,6 +70,11 @@ class wxWindow; typedef wxWindow* PlatformWidget; #endif +#if PLATFORM(HAIKU) +class BView; +typedef BView* PlatformWidget; +#endif + #if PLATFORM(CHROMIUM) #include "PlatformWidget.h" #endif diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index 51ed6ce..20e0901 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -601,6 +601,22 @@ bool PopupListBox::isInterestedInEventForKey(int keyCode) } } +static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) +{ + // Check whether the event is a character-typed event or not. + // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event + // is considered as character type event. In Mac OS, KeyDown (not + // KeyUp) is considered as character type event. +#if PLATFORM(WIN_OS) + if (event.type() == PlatformKeyboardEvent::Char) + return true; +#else + if (event.type() == PlatformKeyboardEvent::KeyDown) + return true; +#endif + return false; +} + bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) { if (event.type() == PlatformKeyboardEvent::KeyUp) @@ -641,7 +657,8 @@ bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) break; default: if (!event.ctrlKey() && !event.altKey() && !event.metaKey() - && isPrintableChar(event.windowsVirtualKeyCode())) + && isPrintableChar(event.windowsVirtualKeyCode()) + && isCharacterTypeEvent(event)) typeAheadFind(event); break; } @@ -690,21 +707,6 @@ static String stripLeadingWhiteSpace(const String& string) return string.substring(i, length - i); } -static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) { - // Check whether the event is a character-typed event or not. - // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event - // is considered as character type event. In Mac OS, KeyDown (not - // KeyUp) is considered as character type event. -#if PLATFORM(WIN_OS) - if (event.type() == PlatformKeyboardEvent::Char) - return true; -#else - if (event.type() == PlatformKeyboardEvent::KeyDown) - return true; -#endif - return false; -} - // From HTMLSelectElement.cpp, with modifications void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) { @@ -714,8 +716,7 @@ void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) // Reset the time when user types in a character. The time gap between // last character and the current character is used to indicate whether // user typed in a string or just a character as the search prefix. - if (isCharacterTypeEvent(event)) - m_lastCharTime = now; + m_lastCharTime = now; UChar c = event.windowsVirtualKeyCode(); diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h index 807c11b..6a7c02c 100644 --- a/WebCore/platform/graphics/BitmapImage.h +++ b/WebCore/platform/graphics/BitmapImage.h @@ -45,6 +45,10 @@ class NSImage; typedef struct HBITMAP__ *HBITMAP; #endif +#if PLATFORM(HAIKU) +class BBitmap; +#endif + namespace WebCore { struct FrameData; } @@ -165,10 +169,16 @@ protected: virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator); #endif virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator); + #if PLATFORM(WX) || PLATFORM(WINCE) virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect); -#endif +#endif + +#if PLATFORM(HAIKU) + virtual BBitmap* getBBitmap() const; +#endif + size_t currentFrame() const { return m_currentFrame; } size_t frameCount(); NativeImagePtr frameAtIndex(size_t); diff --git a/WebCore/platform/graphics/Color.h b/WebCore/platform/graphics/Color.h index 5baa56e..8e51b95 100644 --- a/WebCore/platform/graphics/Color.h +++ b/WebCore/platform/graphics/Color.h @@ -47,6 +47,10 @@ typedef struct _GdkColor GdkColor; class wxColour; #endif +#if PLATFORM(HAIKU) +struct rgb_color; +#endif + namespace WebCore { class String; @@ -121,6 +125,11 @@ public: Color(CGColorRef); #endif +#if PLATFORM(HAIKU) + Color(const rgb_color&); + operator rgb_color() const; +#endif + static bool parseHexColor(const String& name, RGBA32& rgb); static const RGBA32 black = 0xFF000000; diff --git a/WebCore/platform/graphics/FloatPoint.h b/WebCore/platform/graphics/FloatPoint.h index 0c97c49..a239173 100644 --- a/WebCore/platform/graphics/FloatPoint.h +++ b/WebCore/platform/graphics/FloatPoint.h @@ -51,6 +51,10 @@ class QPointF; QT_END_NAMESPACE #endif +#if PLATFORM(HAIKU) +class BPoint; +#endif + #if PLATFORM(SKIA) struct SkPoint; #endif @@ -90,6 +94,11 @@ public: operator QPointF() const; #endif +#if PLATFORM(HAIKU) + FloatPoint(const BPoint&); + operator BPoint() const; +#endif + #if (PLATFORM(SKIA) || PLATFORM(SGL)) operator SkPoint() const; FloatPoint(const SkPoint&); diff --git a/WebCore/platform/graphics/FloatRect.h b/WebCore/platform/graphics/FloatRect.h index e906812..7c7d32a 100644 --- a/WebCore/platform/graphics/FloatRect.h +++ b/WebCore/platform/graphics/FloatRect.h @@ -51,6 +51,10 @@ QT_END_NAMESPACE class wxRect2DDouble; #endif +#if PLATFORM(HAIKU) +class BRect; +#endif + #if (PLATFORM(SKIA) || PLATFORM(SGL)) struct SkRect; #endif @@ -138,6 +142,11 @@ public: operator wxRect2DDouble() const; #endif +#if PLATFORM(HAIKU) + FloatRect(const BRect&); + operator BRect() const; +#endif + #if (PLATFORM(SKIA) || PLATFORM(SGL)) FloatRect(const SkRect&); operator SkRect() const; diff --git a/WebCore/platform/graphics/FontDescription.h b/WebCore/platform/graphics/FontDescription.h index c893b8a..e5c52bf 100644 --- a/WebCore/platform/graphics/FontDescription.h +++ b/WebCore/platform/graphics/FontDescription.h @@ -80,6 +80,8 @@ public: FontWeight bolderWeight() const; GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); } bool usePrinterFont() const { return m_usePrinterFont; } + // only use fixed default size when there is only one font family, and that family is "monospace" + bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == "-webkit-monospace"; } FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); } unsigned keywordSize() const { return m_keywordSize; } diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp index a4e8408..ccdce08 100644 --- a/WebCore/platform/graphics/GraphicsContext.cpp +++ b/WebCore/platform/graphics/GraphicsContext.cpp @@ -27,9 +27,9 @@ #include "GraphicsContext.h" #include "BidiResolver.h" +#include "Font.h" #include "Generator.h" #include "GraphicsContextPrivate.h" -#include "Font.h" using namespace std; @@ -89,7 +89,7 @@ void GraphicsContext::save() return; m_common->stack.append(m_common->state); - + savePlatformState(); } @@ -104,7 +104,7 @@ void GraphicsContext::restore() } m_common->state = m_common->stack.last(); m_common->stack.removeLast(); - + restorePlatformState(); } @@ -305,7 +305,7 @@ bool GraphicsContext::paintingDisabled() const } void GraphicsContext::drawImage(Image* image, const IntPoint& p, CompositeOperator op) -{ +{ drawImage(image, p, IntRect(0, 0, -1, -1), op); } @@ -329,7 +329,7 @@ void GraphicsContext::drawText(const Font& font, const TextRun& run, const IntPo { if (paintingDisabled()) return; - + font.drawText(this, run, point, from, to); } #endif @@ -383,7 +383,7 @@ void GraphicsContext::initFocusRing(int width, int offset) if (paintingDisabled()) return; clearFocusRing(); - + m_common->m_focusRingWidth = width; m_common->m_focusRingOffset = offset; } @@ -396,12 +396,12 @@ void GraphicsContext::clearFocusRing() IntRect GraphicsContext::focusRingBoundingRect() { IntRect result = IntRect(0, 0, 0, 0); - + const Vector<IntRect>& rects = focusRingRects(); unsigned rectCount = rects.size(); for (unsigned i = 0; i < rectCount; i++) result.unite(rects[i]); - + return result; } @@ -436,7 +436,7 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const Float float tsh = src.height(); float tw = dest.width(); float th = dest.height(); - + if (tsw == -1) tsw = image->width(); if (tsh == -1) @@ -540,10 +540,39 @@ void GraphicsContext::setPlatformTextDrawingMode(int mode) } #endif -#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !PLATFORM(SKIA) +#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !PLATFORM(SKIA) && !PLATFORM(HAIKU) void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle&) { } #endif +void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle& penStyle) +{ + // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic + // works out. For example, with a border width of 3, WebKit will pass us (y1+y2)/2, e.g., + // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave + // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. + if (penStyle == DottedStroke || penStyle == DashedStroke) { + if (p1.x() == p2.x()) { + p1.setY(p1.y() + strokeWidth); + p2.setY(p2.y() - strokeWidth); + } else { + p1.setX(p1.x() + strokeWidth); + p2.setX(p2.x() - strokeWidth); + } + } + + if (static_cast<int>(strokeWidth) % 2) { //odd + if (p1.x() == p2.x()) { + // We're a vertical line. Adjust our x. + p1.setX(p1.x() + 0.5f); + p2.setX(p2.x() + 0.5f); + } else { + // We're a horizontal line. Adjust our y. + p1.setY(p1.y() + 0.5f); + p2.setY(p2.y() + 0.5f); + } + } +} + } diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index b52344d..02914b0 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -55,8 +55,8 @@ struct SkPoint; class wxGCDC; class wxWindowDC; -// wxGraphicsContext allows us to support Path, etc. -// but on some platforms, e.g. Linux, it requires fairly +// wxGraphicsContext allows us to support Path, etc. +// but on some platforms, e.g. Linux, it requires fairly // new software. #if USE(WXGC) // On OS X, wxGCDC is just a typedef for wxDC, so use wxDC explicitly to make @@ -72,6 +72,10 @@ class wxWindowDC; #endif #elif PLATFORM(SKIA) typedef class PlatformContextSkia PlatformGraphicsContext; +#elif PLATFORM(HAIKU) +class BView; +typedef BView PlatformGraphicsContext; +struct pattern; #elif PLATFORM(WINCE) typedef struct HDC__ PlatformGraphicsContext; #else @@ -124,7 +128,7 @@ namespace WebCore { const int cTextFill = 1; const int cTextStroke = 2; const int cTextClip = 4; - + enum StrokeStyle { NoStroke, SolidStroke, @@ -132,12 +136,12 @@ namespace WebCore { DashedStroke }; -// FIXME: This is a place-holder until we decide to add -// real color space support to WebCore. At that time, ColorSpace will be a -// class and instances will be held off of Colors. There will be -// special singleton Gradient and Pattern color spaces to mark when -// a fill or stroke is using a gradient or pattern instead of a solid color. -// https://bugs.webkit.org/show_bug.cgi?id=20558 + // FIXME: This is a place-holder until we decide to add + // real color space support to WebCore. At that time, ColorSpace will be a + // class and instances will be held off of Colors. There will be + // special singleton Gradient and Pattern color spaces to mark when + // a fill or stroke is using a gradient or pattern instead of a solid color. + // https://bugs.webkit.org/show_bug.cgi?id=20558 enum ColorSpace { SolidColorSpace, PatternColorSpace, @@ -156,11 +160,11 @@ namespace WebCore { public: GraphicsContext(PlatformGraphicsContext*); ~GraphicsContext(); - + #if !PLATFORM(WINCE) || PLATFORM(QT) PlatformGraphicsContext* platformContext() const; #endif - + float strokeThickness() const; void setStrokeThickness(float); StrokeStyle strokeStyle() const; @@ -265,7 +269,7 @@ namespace WebCore { CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator = CompositeSourceOver); - void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, + void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, CompositeOperator = CompositeSourceOver); @@ -289,13 +293,13 @@ namespace WebCore { void drawHighlightForText(const Font&, const TextRun&, const IntPoint&, int h, const Color& backgroundColor, int from = 0, int to = -1); FloatRect roundToDevicePixels(const FloatRect&); - + void drawLineForText(const IntPoint&, int width, bool printing); void drawLineForMisspellingOrBadGrammar(const IntPoint&, int width, bool grammar); - + bool paintingDisabled() const; void setPaintingDisabled(bool); - + bool updatingControlTints() const; void setUpdatingControlTints(bool); @@ -334,7 +338,7 @@ namespace WebCore { void rotate(float angleInRadians); void translate(float x, float y); IntPoint origin(); - + void setURLForRect(const KURL&, const IntRect&); void concatCTM(const TransformationMatrix&); @@ -416,6 +420,10 @@ namespace WebCore { GdkEventExpose* gdkExposeEvent() const; #endif +#if PLATFORM(HAIKU) + pattern getHaikuStrokeStyle(); +#endif + private: void savePlatformState(); void restorePlatformState(); @@ -438,6 +446,8 @@ namespace WebCore { void setPlatformShadow(const IntSize&, int blur, const Color&); void clearPlatformShadow(); + static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&); + int focusRingWidth() const; int focusRingOffset() const; const Vector<IntRect>& focusRingRects() const; diff --git a/WebCore/platform/graphics/GraphicsLayer.cpp b/WebCore/platform/graphics/GraphicsLayer.cpp index 7d43832..b375bd3 100644 --- a/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/WebCore/platform/graphics/GraphicsLayer.cpp @@ -69,10 +69,11 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) , m_usingTiledLayer(false) , m_masksToBounds(false) , m_drawsContent(false) - , m_paintingPhase(GraphicsLayerPaintAllMask) + , m_paintingPhase(GraphicsLayerPaintAll) , m_geometryOrientation(CompositingCoordinatesTopDown) , m_contentsOrientation(CompositingCoordinatesTopDown) , m_parent(0) + , m_maskLayer(0) #ifndef NDEBUG , m_repaintCount(0) #endif diff --git a/WebCore/platform/graphics/GraphicsLayer.h b/WebCore/platform/graphics/GraphicsLayer.h index 4d7668a..d3e5fb1 100644 --- a/WebCore/platform/graphics/GraphicsLayer.h +++ b/WebCore/platform/graphics/GraphicsLayer.h @@ -38,6 +38,7 @@ #include "TransformationMatrix.h" #include "TransformOperations.h" #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #if PLATFORM(MAC) #ifdef __OBJC__ @@ -152,7 +153,7 @@ protected: class GraphicsLayer { public: - static GraphicsLayer* createGraphicsLayer(GraphicsLayerClient*); + static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*); virtual ~GraphicsLayer(); @@ -180,6 +181,9 @@ public: void removeAllChildren(); virtual void removeFromParent(); + GraphicsLayer* maskLayer() const { return m_maskLayer; } + virtual void setMaskLayer(GraphicsLayer* layer) { m_maskLayer = layer; } + // Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative). IntSize offsetFromRenderer() const { return m_offsetFromRenderer; } void setOffsetFromRenderer(const IntSize& offset) { m_offsetFromRenderer = offset; } @@ -229,8 +233,8 @@ public: virtual void setOpacity(float opacity) { m_opacity = opacity; } // Some GraphicsLayers paint only the foreground or the background content - GraphicsLayerPaintingPhase drawingPhase() const { return m_paintingPhase; } - void setDrawingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; } + GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; } + void setPaintingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; } virtual void setNeedsDisplay() = 0; // mark the given rect (in layer coords) as needing dispay. Never goes deep. @@ -347,6 +351,8 @@ protected: Vector<GraphicsLayer*> m_children; GraphicsLayer* m_parent; + GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. + IntRect m_contentsRect; #ifndef NDEBUG diff --git a/WebCore/platform/graphics/GraphicsLayerClient.h b/WebCore/platform/graphics/GraphicsLayerClient.h index 8c0b7ed..5facc94 100644 --- a/WebCore/platform/graphics/GraphicsLayerClient.h +++ b/WebCore/platform/graphics/GraphicsLayerClient.h @@ -37,9 +37,10 @@ class IntRect; class FloatPoint; enum GraphicsLayerPaintingPhase { - GraphicsLayerPaintBackgroundMask = (1 << 0), - GraphicsLayerPaintForegroundMask = (1 << 1), - GraphicsLayerPaintAllMask = (GraphicsLayerPaintBackgroundMask | GraphicsLayerPaintForegroundMask) + GraphicsLayerPaintBackground = (1 << 0), + GraphicsLayerPaintForeground = (1 << 1), + GraphicsLayerPaintMask = (1 << 2), + GraphicsLayerPaintAll = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask) }; enum AnimatedPropertyID { diff --git a/WebCore/platform/graphics/Icon.h b/WebCore/platform/graphics/Icon.h index 444c67c..8650130 100644 --- a/WebCore/platform/graphics/Icon.h +++ b/WebCore/platform/graphics/Icon.h @@ -78,6 +78,8 @@ private: #elif PLATFORM(CHROMIUM) Icon(const PlatformIcon&); PlatformIcon m_icon; +#elif PLATFORM(HAIKU) + Icon(); #endif }; diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h index 2a96d3b..9432058 100644 --- a/WebCore/platform/graphics/ImageBuffer.h +++ b/WebCore/platform/graphics/ImageBuffer.h @@ -50,6 +50,11 @@ namespace WebCore { LinearRGB }; + enum Multiply { + Premultiplied, + Unmultiplied + }; + class ImageBuffer : public Noncopyable { public: // Will return a null pointer on allocation failure. @@ -71,8 +76,11 @@ namespace WebCore { void clearImage() { m_image.clear(); } - PassRefPtr<ImageData> getImageData(const IntRect& rect) const; - void putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint); + PassRefPtr<ImageData> getUnmultipliedImageData(const IntRect&) const; + PassRefPtr<ImageData> getPremultipliedImageData(const IntRect&) const; + + void putUnmultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint); + void putPremultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint); String toDataURL(const String& mimeType) const; #if !PLATFORM(CG) diff --git a/WebCore/platform/graphics/cairo/ImageSourceCairo.cpp b/WebCore/platform/graphics/ImageSource.cpp index df62618..3bea57f 100644 --- a/WebCore/platform/graphics/cairo/ImageSourceCairo.cpp +++ b/WebCore/platform/graphics/ImageSource.cpp @@ -1,6 +1,8 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> + * Copyright (C) 2008, Google Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,16 +29,19 @@ #include "config.h" #include "ImageSource.h" -#if PLATFORM(CAIRO) - #include "BMPImageDecoder.h" #include "GIFImageDecoder.h" #include "ICOImageDecoder.h" #include "JPEGImageDecoder.h" #include "PNGImageDecoder.h" -#include "XBMImageDecoder.h" #include "SharedBuffer.h" -#include <cairo.h> +#include "XBMImageDecoder.h" + +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) +#ifndef IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS +#define IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS (1024 * 1024) +#endif +#endif namespace WebCore { @@ -120,21 +125,21 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived) // This method will examine the data and instantiate an instance of the appropriate decoder plugin. // If insufficient bytes are available to determine the image type, no decoder plugin will be // made. - if (!m_decoder) + if (!m_decoder) { m_decoder = createDecoder(data->buffer()); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (m_decoder) + m_decoder->setMaxNumPixels(IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS); +#endif + } - if (!m_decoder) - return; - - m_decoder->setData(data, allDataReceived); + if (m_decoder) + m_decoder->setData(data, allDataReceived); } String ImageSource::filenameExtension() const { - if (!m_decoder) - return String(); - - return m_decoder->filenameExtension(); + return m_decoder ? m_decoder->filenameExtension() : String(); } bool ImageSource::isSizeAvailable() @@ -176,9 +181,6 @@ size_t ImageSource::frameCount() const NativeImagePtr ImageSource::createFrameAtIndex(size_t index) { - if (!initialized()) - return 0; - if (!m_decoder) return 0; @@ -186,11 +188,13 @@ NativeImagePtr ImageSource::createFrameAtIndex(size_t index) if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) return 0; - // Cairo does not like zero height images. - // If we have a zero height image, just pretend we don't have enough data yet. - if (!size().height()) + // Zero-height images can cause problems for some ports. If we have an + // empty image dimension, just bail. + if (size().isEmpty()) return 0; + // Return the buffer contents as a native image. For some ports, the data + // is already in a native container, and this just increments its refcount. return buffer->asNewNativeImage(); } @@ -223,17 +227,14 @@ float ImageSource::frameDurationAtIndex(size_t index) bool ImageSource::frameHasAlphaAtIndex(size_t index) { - // When a frame has not finished decoding, always mark it as having alpha, - // so we don't get a black background for the undecoded sections. - // TODO: A better solution is probably to have the underlying buffer's - // hasAlpha() return true in these cases, since it is, in fact, technically - // true. - if (!frameIsCompleteAtIndex(index)) - return true; - - return m_decoder->frameBufferAtIndex(index)->hasAlpha(); + // When a frame has not finished decoding, always mark it as having alpha. + // Ports that check the result of this function to determine their + // compositing op need this in order to not draw the undecoded portion as + // black. + // TODO: Perhaps we should ensure that each individual decoder returns true + // in this case. + return frameIsCompleteAtIndex(index) ? + m_decoder->frameBufferAtIndex(index)->hasAlpha() : true; } } - -#endif // PLATFORM(CAIRO) diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h index 173d50b..dee3eda 100644 --- a/WebCore/platform/graphics/ImageSource.h +++ b/WebCore/platform/graphics/ImageSource.h @@ -51,6 +51,8 @@ class SkBitmapRef; class PrivateAndroidImageSourceRec; #elif PLATFORM(SKIA) class NativeImageSkia; +#elif PLATFORM(HAIKU) +class BBitmap; #elif PLATFORM(WINCE) #include "SharedBitmap.h" #endif @@ -105,6 +107,10 @@ typedef cairo_surface_t* NativeImagePtr; class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; typedef NativeImageSkia* NativeImagePtr; +#elif PLATFORM(HAIKU) +class ImageDecoder; +typedef ImageDecoder* NativeImageSourcePtr; +typedef BBitmap* NativeImagePtr; #elif PLATFORM(WINCE) class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; diff --git a/WebCore/platform/graphics/IntPoint.h b/WebCore/platform/graphics/IntPoint.h index e6d4816..afbfb46 100644 --- a/WebCore/platform/graphics/IntPoint.h +++ b/WebCore/platform/graphics/IntPoint.h @@ -55,6 +55,8 @@ class QPoint; QT_END_NAMESPACE #elif PLATFORM(GTK) typedef struct _GdkPoint GdkPoint; +#elif PLATFORM(HAIKU) +class BPoint; #endif #if PLATFORM(WX) @@ -121,6 +123,9 @@ public: #elif PLATFORM(GTK) IntPoint(const GdkPoint&); operator GdkPoint() const; +#elif PLATFORM(HAIKU) + explicit IntPoint(const BPoint&); + operator BPoint() const; #endif #if PLATFORM(WX) diff --git a/WebCore/platform/graphics/IntRect.h b/WebCore/platform/graphics/IntRect.h index 0b607f5..c5a12cb 100644 --- a/WebCore/platform/graphics/IntRect.h +++ b/WebCore/platform/graphics/IntRect.h @@ -49,6 +49,8 @@ class QRect; QT_END_NAMESPACE #elif PLATFORM(GTK) typedef struct _GdkRectangle GdkRectangle; +#elif PLATFORM(HAIKU) +class BRect; #endif #if PLATFORM(WX) @@ -144,6 +146,9 @@ public: #elif PLATFORM(GTK) IntRect(const GdkRectangle&); operator GdkRectangle() const; +#elif PLATFORM(HAIKU) + explicit IntRect(const BRect&); + operator BRect() const; #endif #if PLATFORM(CG) diff --git a/WebCore/platform/graphics/IntSize.h b/WebCore/platform/graphics/IntSize.h index dc7a85d..e80b0fa 100644 --- a/WebCore/platform/graphics/IntSize.h +++ b/WebCore/platform/graphics/IntSize.h @@ -47,6 +47,8 @@ typedef struct tagSIZE SIZE; QT_BEGIN_NAMESPACE class QSize; QT_END_NAMESPACE +#elif PLATFORM(HAIKU) +class BSize; #endif namespace WebCore { @@ -113,6 +115,11 @@ public: operator QSize() const; #endif +#if PLATFORM(HAIKU) + explicit IntSize(const BSize&); + operator BSize() const; +#endif + private: int m_width, m_height; diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h index da324bc..6b617a0 100644 --- a/WebCore/platform/graphics/Path.h +++ b/WebCore/platform/graphics/Path.h @@ -52,6 +52,9 @@ typedef WebCore::CairoPath PlatformPath; #elif PLATFORM(SKIA) class SkPath; typedef SkPath PlatformPath; +#elif PLATFORM(HAIKU) +class BRegion; +typedef BRegion PlatformPath; #elif PLATFORM(WINCE) namespace WebCore { class PlatformPath; diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h index 02ad3ec..2f1192c 100644 --- a/WebCore/platform/graphics/Pattern.h +++ b/WebCore/platform/graphics/Pattern.h @@ -53,6 +53,9 @@ typedef wxGraphicsBrush* PlatformPatternPtr; class wxBrush; typedef wxBrush* PlatformPatternPtr; #endif // USE(WXGC) +#elif PLATFORM(HAIKU) +#include <interface/GraphicsDefs.h> +typedef pattern* PlatformPatternPtr; #elif PLATFORM(WINCE) typedef void* PlatformPatternPtr; #endif diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h index cb472b0..8cb8268 100644 --- a/WebCore/platform/graphics/SimpleFontData.h +++ b/WebCore/platform/graphics/SimpleFontData.h @@ -45,6 +45,10 @@ typedef struct OpaqueATSUStyle* ATSUStyle; #include <QFont> #endif +#if PLATFORM(HAIKU) +#include <Font.h> +#endif + namespace WebCore { class FontDescription; diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 5765546..de8afb3 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -31,7 +31,6 @@ #if PLATFORM(CAIRO) -#include "TransformationMatrix.h" #include "CairoPath.h" #include "FloatRect.h" #include "Font.h" @@ -41,6 +40,7 @@ #include "Path.h" #include "Pattern.h" #include "SimpleFontData.h" +#include "TransformationMatrix.h" #include <cairo.h> #include <math.h> @@ -53,8 +53,8 @@ #elif PLATFORM(WIN) #include <cairo-win32.h> #endif -#include "GraphicsContextPrivate.h" #include "GraphicsContextPlatformPrivateCairo.h" +#include "GraphicsContextPrivate.h" #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -142,38 +142,6 @@ void GraphicsContext::drawRect(const IntRect& rect) cairo_restore(cr); } -// FIXME: Now that this is refactored, it should be shared by all contexts. -static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, StrokeStyle style) -{ - // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic - // works out. For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g., - // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave - // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. - if (style == DottedStroke || style == DashedStroke) { - if (p1.x() == p2.x()) { - p1.setY(p1.y() + strokeWidth); - p2.setY(p2.y() - strokeWidth); - } - else { - p1.setX(p1.x() + strokeWidth); - p2.setX(p2.x() - strokeWidth); - } - } - - if (static_cast<int>(strokeWidth) % 2) { - if (p1.x() == p2.x()) { - // We're a vertical line. Adjust our x. - p1.setX(p1.x() + 0.5); - p2.setX(p2.x() + 0.5); - } - else { - // We're a horizontal line. Adjust our y. - p1.setY(p1.y() + 0.5); - p2.setY(p2.y() + 0.5); - } - } -} - // This is only used to draw borders. void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) { @@ -239,20 +207,18 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth == 1) patternOffset = 1.0; else { - bool evenNumberOfSegments = numSegments%2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { if (remainder) { patternOffset += patWidth - remainder; - patternOffset += remainder/2; - } - else - patternOffset = patWidth/2; - } - else if (!evenNumberOfSegments) { + patternOffset += remainder / 2; + } else + patternOffset = patWidth / 2; + } else if (!evenNumberOfSegments) { if (remainder) - patternOffset = (patWidth - remainder)/2; + patternOffset = (patWidth - remainder) / 2; } } @@ -318,7 +284,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (w != h) cairo_scale(cr, 1., scaleFactor); - + cairo_arc_negative(cr, x + hRadius, (y + vRadius) * reverseScaleFactor, hRadius, -fa * M_PI/180, -falen * M_PI/180); if (w != h) @@ -326,16 +292,16 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp float width = strokeThickness(); int patWidth = 0; - + switch (strokeStyle()) { - case DottedStroke: - patWidth = static_cast<int>(width / 2); - break; - case DashedStroke: - patWidth = 3 * static_cast<int>(width / 2); - break; - default: - break; + case DottedStroke: + patWidth = static_cast<int>(width / 2); + break; + case DashedStroke: + patWidth = 3 * static_cast<int>(width / 2); + break; + default: + break; } setColor(cr, strokeColor()); @@ -349,7 +315,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp distance = static_cast<int>((M_PI * hRadius) / 2.0); else // We are elliptical and will have to estimate the distance distance = static_cast<int>((M_PI * sqrtf((hRadius * hRadius + vRadius * vRadius) / 2.0)) / 2.0); - + int remainder = distance % patWidth; int coverage = distance - remainder; int numSegments = coverage / patWidth; @@ -359,7 +325,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (patWidth == 1) patternOffset = 1.0; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -828,15 +794,15 @@ void GraphicsContext::setLineCap(LineCap lineCap) cairo_line_cap_t cairoCap = CAIRO_LINE_CAP_BUTT; switch (lineCap) { - case ButtCap: - // no-op - break; - case RoundCap: - cairoCap = CAIRO_LINE_CAP_ROUND; - break; - case SquareCap: - cairoCap = CAIRO_LINE_CAP_SQUARE; - break; + case ButtCap: + // no-op + break; + case RoundCap: + cairoCap = CAIRO_LINE_CAP_ROUND; + break; + case SquareCap: + cairoCap = CAIRO_LINE_CAP_SQUARE; + break; } cairo_set_line_cap(m_data->cr, cairoCap); } @@ -853,15 +819,15 @@ void GraphicsContext::setLineJoin(LineJoin lineJoin) cairo_line_join_t cairoJoin = CAIRO_LINE_JOIN_MITER; switch (lineJoin) { - case MiterJoin: - // no-op - break; - case RoundJoin: - cairoJoin = CAIRO_LINE_JOIN_ROUND; - break; - case BevelJoin: - cairoJoin = CAIRO_LINE_JOIN_BEVEL; - break; + case MiterJoin: + // no-op + break; + case RoundJoin: + cairoJoin = CAIRO_LINE_JOIN_ROUND; + break; + case BevelJoin: + cairoJoin = CAIRO_LINE_JOIN_BEVEL; + break; } cairo_set_line_join(m_data->cr, cairoJoin); } @@ -887,37 +853,37 @@ float GraphicsContext::getAlpha() static inline cairo_operator_t toCairoOperator(CompositeOperator op) { switch (op) { - case CompositeClear: - return CAIRO_OPERATOR_CLEAR; - case CompositeCopy: - return CAIRO_OPERATOR_SOURCE; - case CompositeSourceOver: - return CAIRO_OPERATOR_OVER; - case CompositeSourceIn: - return CAIRO_OPERATOR_IN; - case CompositeSourceOut: - return CAIRO_OPERATOR_OUT; - case CompositeSourceAtop: - return CAIRO_OPERATOR_ATOP; - case CompositeDestinationOver: - return CAIRO_OPERATOR_DEST_OVER; - case CompositeDestinationIn: - return CAIRO_OPERATOR_DEST_IN; - case CompositeDestinationOut: - return CAIRO_OPERATOR_DEST_OUT; - case CompositeDestinationAtop: - return CAIRO_OPERATOR_DEST_ATOP; - case CompositeXOR: - return CAIRO_OPERATOR_XOR; - case CompositePlusDarker: - return CAIRO_OPERATOR_SATURATE; - case CompositeHighlight: - // There is no Cairo equivalent for CompositeHighlight. - return CAIRO_OPERATOR_OVER; - case CompositePlusLighter: - return CAIRO_OPERATOR_ADD; - default: - return CAIRO_OPERATOR_SOURCE; + case CompositeClear: + return CAIRO_OPERATOR_CLEAR; + case CompositeCopy: + return CAIRO_OPERATOR_SOURCE; + case CompositeSourceOver: + return CAIRO_OPERATOR_OVER; + case CompositeSourceIn: + return CAIRO_OPERATOR_IN; + case CompositeSourceOut: + return CAIRO_OPERATOR_OUT; + case CompositeSourceAtop: + return CAIRO_OPERATOR_ATOP; + case CompositeDestinationOver: + return CAIRO_OPERATOR_DEST_OVER; + case CompositeDestinationIn: + return CAIRO_OPERATOR_DEST_IN; + case CompositeDestinationOut: + return CAIRO_OPERATOR_DEST_OUT; + case CompositeDestinationAtop: + return CAIRO_OPERATOR_DEST_ATOP; + case CompositeXOR: + return CAIRO_OPERATOR_XOR; + case CompositePlusDarker: + return CAIRO_OPERATOR_SATURATE; + case CompositeHighlight: + // There is no Cairo equivalent for CompositeHighlight. + return CAIRO_OPERATOR_OVER; + case CompositePlusLighter: + return CAIRO_OPERATOR_ADD; + default: + return CAIRO_OPERATOR_SOURCE; } } diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index c905ee8..0213944 100644 --- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -138,16 +138,17 @@ void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) } } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& data, const IntSize& size) { - ASSERT(cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + ASSERT(cairo_surface_get_type(data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); PassRefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); - unsigned char* dataSrc = cairo_image_surface_get_data(m_data.m_surface); + unsigned char* dataSrc = cairo_image_surface_get_data(data.m_surface); unsigned char* dataDst = 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(dataSrc, 0, result->data()->length()); + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) + memset(dataDst, 0, result->data()->length()); int originx = rect.x(); int destx = 0; @@ -156,8 +157,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originx = 0; } int endx = rect.x() + rect.width(); - if (endx > m_size.width()) - endx = m_size.width(); + if (endx > size.width()) + endx = size.width(); int numColumns = endx - originx; int originy = rect.y(); @@ -167,11 +168,11 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originy = 0; } int endy = rect.y() + rect.height(); - if (endy > m_size.height()) - endy = m_size.height(); + if (endy > size.height()) + endy = size.height(); int numRows = endy - originy; - int stride = cairo_image_surface_get_stride(m_data.m_surface); + int stride = cairo_image_surface_get_stride(data.m_surface); unsigned destBytesPerRow = 4 * rect.width(); unsigned char* destRows = dataDst + desty * destBytesPerRow + destx * 4; @@ -180,7 +181,11 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const for (int x = 0; x < numColumns; x++) { int basex = x * 4; unsigned* pixel = row + x + originx; - Color pixelColor = colorFromPremultipliedARGB(*pixel); + Color pixelColor; + if (multiplied == Unmultiplied) + pixelColor = colorFromPremultipliedARGB(*pixel); + else + pixelColor = Color(*pixel); destRows[basex] = pixelColor.red(); destRows[basex + 1] = pixelColor.green(); destRows[basex + 2] = pixelColor.blue(); @@ -192,11 +197,22 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { - ASSERT(cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + return getImageData<Unmultiplied>(rect, m_data, m_size); +} - unsigned char* dataDst = cairo_image_surface_get_data(m_data.m_surface); +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, m_data, m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& data, const IntSize& size) +{ + ASSERT(cairo_surface_get_type(data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + + unsigned char* dataDst = cairo_image_surface_get_data(data.m_surface); ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -204,28 +220,28 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < m_size.width()); + ASSERT(destx < size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); int endx = destPoint.x() + sourceRect.right(); - ASSERT(endx <= m_size.width()); + ASSERT(endx <= 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(desty < size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); int endy = destPoint.y() + sourceRect.bottom(); - ASSERT(endy <= m_size.height()); + ASSERT(endy <= size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * source->width(); - int stride = cairo_image_surface_get_stride(m_data.m_surface); + int stride = cairo_image_surface_get_stride(data.m_surface); unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; for (int y = 0; y < numRows; ++y) { @@ -237,12 +253,25 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con srcRows[basex + 1], srcRows[basex + 2], srcRows[basex + 3]); - *pixel = premultipliedARGBFromColor(pixelColor); + if (multiplied == Unmultiplied) + *pixel = premultipliedARGBFromColor(pixelColor); + else + *pixel = pixelColor.rgb(); } srcRows += srcBytesPerRow; } } +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length) { Vector<char>* in = reinterpret_cast<Vector<char>*>(closure); diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index ab8eb3c..f1e6a1f 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -28,14 +28,15 @@ #include "config.h" #include "GraphicsContext.h" -#include "TransformationMatrix.h" #include "FloatConversion.h" -#include "GraphicsContextPrivate.h" #include "GraphicsContextPlatformPrivateCG.h" +#include "GraphicsContextPrivate.h" #include "ImageBuffer.h" #include "KURL.h" #include "Path.h" #include "Pattern.h" +#include "TransformationMatrix.h" + #include <CoreGraphics/CGBitmapContext.h> #include <CoreGraphics/CGPDFContext.h> #include <wtf/MathExtras.h> @@ -178,19 +179,19 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) int patWidth = 0; switch (strokeStyle()) { - case NoStroke: - case SolidStroke: - break; - case DottedStroke: - patWidth = (int)width; - break; - case DashedStroke: - patWidth = 3 * (int)width; - break; + case NoStroke: + case SolidStroke: + break; + case DottedStroke: + patWidth = (int)width; + break; + case DashedStroke: + patWidth = 3 * (int)width; + break; } CGContextRef context = platformContext(); - + if (shouldAntialias()) CGContextSetShouldAntialias(context, false); @@ -221,7 +222,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth == 1) patternOffset = 1.0f; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -235,7 +236,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) patternOffset = (patWidth - remainder)/2; } } - + const CGFloat dottedLine[2] = { patWidth, patWidth }; CGContextSetLineDash(context, patternOffset, dottedLine, 2); } @@ -248,7 +249,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth) CGContextRestoreGState(context); - + if (shouldAntialias()) CGContextSetShouldAntialias(context, true); } @@ -263,7 +264,7 @@ void GraphicsContext::drawEllipse(const IntRect& rect) if (paintingDisabled()) return; - + CGContextRef context = platformContext(); CGContextBeginPath(context); float r = (float)rect.width() / 2; @@ -275,25 +276,25 @@ void GraphicsContext::drawEllipse(const IntRect& rect) void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan) -{ +{ if (paintingDisabled() || strokeStyle() == NoStroke || strokeThickness() <= 0.0f) return; - + CGContextRef context = platformContext(); CGContextSaveGState(context); CGContextBeginPath(context); CGContextSetShouldAntialias(context, false); - + int x = rect.x(); int y = rect.y(); float w = (float)rect.width(); float h = (float)rect.height(); float scaleFactor = h / w; float reverseScaleFactor = w / h; - + if (w != h) scale(FloatSize(1, scaleFactor)); - + float hRadius = w / 2; float vRadius = h / 2; float fa = startAngle; @@ -304,22 +305,21 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (w != h) scale(FloatSize(1, reverseScaleFactor)); - - + float width = strokeThickness(); int patWidth = 0; - + switch (strokeStyle()) { - case DottedStroke: - patWidth = (int)(width / 2); - break; - case DashedStroke: - patWidth = 3 * (int)(width / 2); - break; - default: - break; + case DottedStroke: + patWidth = (int)(width / 2); + break; + case DashedStroke: + patWidth = 3 * (int)(width / 2); + break; + default: + break; } - + if (patWidth) { // Example: 80 pixels with a width of 30 pixels. // Remainder is 20. The maximum pixels of line we could paint @@ -329,7 +329,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp distance = static_cast<int>((piFloat * hRadius) / 2.0f); else // We are elliptical and will have to estimate the distance distance = static_cast<int>((piFloat * sqrtf((hRadius * hRadius + vRadius * vRadius) / 2.0f)) / 2.0f); - + int remainder = distance % patWidth; int coverage = distance - remainder; int numSegments = coverage / patWidth; @@ -339,7 +339,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (patWidth == 1) patternOffset = 1.0f; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -353,13 +353,13 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp patternOffset = (patWidth - remainder) / 2.0f; } } - + const CGFloat dottedLine[2] = { patWidth, patWidth }; CGContextSetLineDash(context, patternOffset, dottedLine, 2); } CGContextStrokePath(context); - + CGContextRestoreGState(context); } @@ -375,7 +375,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points if (antialiased != shouldAntialias()) CGContextSetShouldAntialias(context, antialiased); - + CGContextBeginPath(context); CGContextMoveToPoint(context, points[0].x(), points[0].y()); for (size_t i = 1; i < npoints; i++) @@ -383,7 +383,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points CGContextClosePath(context); drawPath(); - + if (antialiased != shouldAntialias()) CGContextSetShouldAntialias(context, shouldAntialias()); } @@ -391,7 +391,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points void GraphicsContext::applyStrokePattern() { CGContextRef cgContext = platformContext(); - + CGPatternRef platformPattern = m_common->state.strokePattern.get()->createPlatformPattern(getCTM()); if (!platformPattern) return; @@ -463,7 +463,7 @@ void GraphicsContext::drawPath() strokePath(); return; } - + if (state.fillColorSpace == PatternColorSpace) applyFillPattern(); if (state.strokeColorSpace == PatternColorSpace) @@ -599,7 +599,7 @@ void GraphicsContext::clipOut(const IntRect& rect) { if (paintingDisabled()) return; - + CGRect rects[2] = { CGContextGetClipBoundingBox(platformContext()), rect }; CGContextBeginPath(platformContext()); CGContextAddRects(platformContext(), rects, 2); @@ -610,7 +610,7 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) { if (paintingDisabled()) return; - + CGContextBeginPath(platformContext()); CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext())); CGContextAddEllipseInRect(platformContext(), rect); @@ -639,13 +639,13 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness clip(rect); CGContextRef context = platformContext(); - + // Add outer ellipse CGContextAddEllipseInRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height())); // Add inner ellipse. CGContextAddEllipseInRect(context, CGRectMake(rect.x() + thickness, rect.y() + thickness, rect.width() - (thickness * 2), rect.height() - (thickness * 2))); - + CGContextEOClip(context); } @@ -653,7 +653,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const 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()); @@ -734,7 +734,7 @@ void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Col CGColorRef colorCG = createCGColor(color); CGContextSetShadowWithColor(context, CGSizeMake(width, height), - blurRadius, + blurRadius, colorCG); CGColorRelease(colorCG); } @@ -799,15 +799,15 @@ void GraphicsContext::setLineCap(LineCap cap) if (paintingDisabled()) return; switch (cap) { - case ButtCap: - CGContextSetLineCap(platformContext(), kCGLineCapButt); - break; - case RoundCap: - CGContextSetLineCap(platformContext(), kCGLineCapRound); - break; - case SquareCap: - CGContextSetLineCap(platformContext(), kCGLineCapSquare); - break; + case ButtCap: + CGContextSetLineCap(platformContext(), kCGLineCapButt); + break; + case RoundCap: + CGContextSetLineCap(platformContext(), kCGLineCapRound); + break; + case SquareCap: + CGContextSetLineCap(platformContext(), kCGLineCapSquare); + break; } } @@ -821,15 +821,15 @@ void GraphicsContext::setLineJoin(LineJoin join) if (paintingDisabled()) return; switch (join) { - case MiterJoin: - CGContextSetLineJoin(platformContext(), kCGLineJoinMiter); - break; - case RoundJoin: - CGContextSetLineJoin(platformContext(), kCGLineJoinRound); - break; - case BevelJoin: - CGContextSetLineJoin(platformContext(), kCGLineJoinBevel); - break; + case MiterJoin: + CGContextSetLineJoin(platformContext(), kCGLineJoinMiter); + break; + case RoundJoin: + CGContextSetLineJoin(platformContext(), kCGLineJoinRound); + break; + case BevelJoin: + CGContextSetLineJoin(platformContext(), kCGLineJoinBevel); + break; } } @@ -858,7 +858,7 @@ void GraphicsContext::clipOut(const Path& path) { if (paintingDisabled()) return; - + CGContextBeginPath(platformContext()); CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext())); CGContextAddPath(platformContext(), path.platformPath()); @@ -909,9 +909,9 @@ TransformationMatrix GraphicsContext::getCTM() const FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) { - // It is not enough just to round to pixels in device space. The rotation part of the + // It is not enough just to round to pixels in device space. The rotation part of the // affine transform matrix to device space can mess with this conversion if we have a - // rotating image like the hands of the world clock widget. We just need the scale, so + // rotating image like the hands of the world clock widget. We just need the scale, so // we get the affine transform matrix and extract the scale. if (m_data->m_userToDeviceTransformKnownToBeIdentity) @@ -934,11 +934,11 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) deviceOrigin.y = roundf(deviceOrigin.y); deviceLowerRight.x = roundf(deviceLowerRight.x); deviceLowerRight.y = roundf(deviceLowerRight.y); - + // Don't let the height or width round to 0 unless either was originally 0 - if (deviceOrigin.y == deviceLowerRight.y && rect.height() != 0) + if (deviceOrigin.y == deviceLowerRight.y && rect.height()) deviceLowerRight.y += 1; - if (deviceOrigin.x == deviceLowerRight.x && rect.width() != 0) + if (deviceOrigin.x == deviceLowerRight.x && rect.width()) deviceLowerRight.x += 1; FloatPoint roundedOrigin = FloatPoint(deviceOrigin.x / deviceScaleX, deviceOrigin.y / deviceScaleY); @@ -984,13 +984,13 @@ void GraphicsContext::drawLineForText(const IntPoint& point, int width, bool pri } } } - + if (fillColor() != strokeColor()) setCGFillColor(platformContext(), strokeColor()); CGContextFillRect(platformContext(), CGRectMake(x, y, lineLength, thickness)); if (fillColor() != strokeColor()) setCGFillColor(platformContext(), fillColor()); - + if (restoreAntialiasMode) CGContextSetShouldAntialias(platformContext(), true); } @@ -999,11 +999,11 @@ void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect) { if (paintingDisabled()) return; - + CFURLRef urlRef = link.createCFURL(); if (urlRef) { CGContextRef context = platformContext(); - + // Get the bounding box to handle clipping. CGRect box = CGContextGetClipBoundingBox(context); @@ -1022,28 +1022,28 @@ void GraphicsContext::setImageInterpolationQuality(InterpolationQuality mode) { if (paintingDisabled()) return; - + CGInterpolationQuality quality = kCGInterpolationDefault; switch (mode) { - case InterpolationDefault: - quality = kCGInterpolationDefault; - break; - case InterpolationNone: - quality = kCGInterpolationNone; - break; - case InterpolationLow: - quality = kCGInterpolationLow; - break; - - // Fall through to InterpolationHigh if kCGInterpolationMedium is not available - case InterpolationMedium: + case InterpolationDefault: + quality = kCGInterpolationDefault; + break; + case InterpolationNone: + quality = kCGInterpolationNone; + break; + case InterpolationLow: + quality = kCGInterpolationLow; + break; + + // Fall through to InterpolationHigh if kCGInterpolationMedium is not available + case InterpolationMedium: #if HAVE(CG_INTERPOLATION_MEDIUM) - quality = kCGInterpolationMedium; - break; + quality = kCGInterpolationMedium; + break; #endif - case InterpolationHigh: - quality = kCGInterpolationHigh; - break; + case InterpolationHigh: + quality = kCGInterpolationHigh; + break; } CGContextSetInterpolationQuality(platformContext(), quality); } @@ -1055,18 +1055,18 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const CGInterpolationQuality quality = CGContextGetInterpolationQuality(platformContext()); switch (quality) { - case kCGInterpolationDefault: - return InterpolationDefault; - case kCGInterpolationNone: - return InterpolationNone; - case kCGInterpolationLow: - return InterpolationLow; + case kCGInterpolationDefault: + return InterpolationDefault; + case kCGInterpolationNone: + return InterpolationNone; + case kCGInterpolationLow: + return InterpolationLow; #if HAVE(CG_INTERPOLATION_MEDIUM) - case kCGInterpolationMedium: - return InterpolationMedium; + case kCGInterpolationMedium: + return InterpolationMedium; #endif - case kCGInterpolationHigh: - return InterpolationHigh; + case kCGInterpolationHigh: + return InterpolationHigh; } return InterpolationDefault; } @@ -1079,32 +1079,32 @@ void GraphicsContext::setPlatformTextDrawingMode(int mode) // Wow, wish CG had used bits here. CGContextRef context = platformContext(); switch (mode) { - case cTextInvisible: // Invisible - CGContextSetTextDrawingMode(context, kCGTextInvisible); - break; - case cTextFill: // Fill - CGContextSetTextDrawingMode(context, kCGTextFill); - break; - case cTextStroke: // Stroke - CGContextSetTextDrawingMode(context, kCGTextStroke); - break; - case 3: // Fill | Stroke - CGContextSetTextDrawingMode(context, kCGTextFillStroke); - break; - case cTextClip: // Clip - CGContextSetTextDrawingMode(context, kCGTextClip); - break; - case 5: // Fill | Clip - CGContextSetTextDrawingMode(context, kCGTextFillClip); - break; - case 6: // Stroke | Clip - CGContextSetTextDrawingMode(context, kCGTextStrokeClip); - break; - case 7: // Fill | Stroke | Clip - CGContextSetTextDrawingMode(context, kCGTextFillStrokeClip); - break; - default: - break; + case cTextInvisible: // Invisible + CGContextSetTextDrawingMode(context, kCGTextInvisible); + break; + case cTextFill: // Fill + CGContextSetTextDrawingMode(context, kCGTextFill); + break; + case cTextStroke: // Stroke + CGContextSetTextDrawingMode(context, kCGTextStroke); + break; + case 3: // Fill | Stroke + CGContextSetTextDrawingMode(context, kCGTextFillStroke); + break; + case cTextClip: // Clip + CGContextSetTextDrawingMode(context, kCGTextClip); + break; + case 5: // Fill | Clip + CGContextSetTextDrawingMode(context, kCGTextFillClip); + break; + case 6: // Stroke | Clip + CGContextSetTextDrawingMode(context, kCGTextStrokeClip); + break; + case 7: // Fill | Stroke | Clip + CGContextSetTextDrawingMode(context, kCGTextFillStrokeClip); + break; + default: + break; } } @@ -1138,54 +1138,54 @@ void GraphicsContext::setPlatformShouldAntialias(bool enable) #ifndef BUILDING_ON_TIGER // Tiger's setCompositeOperation() is defined in GraphicsContextMac.mm. void GraphicsContext::setCompositeOperation(CompositeOperator mode) -{ +{ if (paintingDisabled()) return; - CGBlendMode target = kCGBlendModeNormal; + CGBlendMode target = kCGBlendModeNormal; switch (mode) { - case CompositeClear: - target = kCGBlendModeClear; - break; - case CompositeCopy: - target = kCGBlendModeCopy; - break; - case CompositeSourceOver: - //kCGBlendModeNormal - break; - case CompositeSourceIn: - target = kCGBlendModeSourceIn; - break; - case CompositeSourceOut: - target = kCGBlendModeSourceOut; - break; - case CompositeSourceAtop: - target = kCGBlendModeSourceAtop; - break; - case CompositeDestinationOver: - target = kCGBlendModeDestinationOver; - break; - case CompositeDestinationIn: - target = kCGBlendModeDestinationIn; - break; - case CompositeDestinationOut: - target = kCGBlendModeDestinationOut; - break; - case CompositeDestinationAtop: - target = kCGBlendModeDestinationAtop; - break; - case CompositeXOR: - target = kCGBlendModeXOR; - break; - case CompositePlusDarker: - target = kCGBlendModePlusDarker; - break; - case CompositeHighlight: - // currently unsupported - break; - case CompositePlusLighter: - target = kCGBlendModePlusLighter; - break; + case CompositeClear: + target = kCGBlendModeClear; + break; + case CompositeCopy: + target = kCGBlendModeCopy; + break; + case CompositeSourceOver: + //kCGBlendModeNormal + break; + case CompositeSourceIn: + target = kCGBlendModeSourceIn; + break; + case CompositeSourceOut: + target = kCGBlendModeSourceOut; + break; + case CompositeSourceAtop: + target = kCGBlendModeSourceAtop; + break; + case CompositeDestinationOver: + target = kCGBlendModeDestinationOver; + break; + case CompositeDestinationIn: + target = kCGBlendModeDestinationIn; + break; + case CompositeDestinationOut: + target = kCGBlendModeDestinationOut; + break; + case CompositeDestinationAtop: + target = kCGBlendModeDestinationAtop; + break; + case CompositeXOR: + target = kCGBlendModeXOR; + break; + case CompositePlusDarker: + target = kCGBlendModePlusDarker; + break; + case CompositeHighlight: + // currently unsupported + break; + case CompositePlusLighter: + target = kCGBlendModePlusLighter; + break; } CGContextSetBlendMode(platformContext(), target); } diff --git a/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/WebCore/platform/graphics/cg/ImageBufferCG.cpp index 6db7e88..97bcba5 100644 --- a/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -65,7 +65,9 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b bytesPerRow *= 4; } - m_data.m_data = tryFastCalloc(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); CGColorSpaceRef colorSpace; @@ -122,12 +124,13 @@ Image* ImageBuffer::image() const return m_image.get(); } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& imageData, const IntSize& size) { PassRefPtr<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()) + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) memset(data, 0, result->data()->length()); int originx = rect.x(); @@ -137,8 +140,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originx = 0; } int endx = rect.x() + rect.width(); - if (endx > m_size.width()) - endx = m_size.width(); + if (endx > size.width()) + endx = size.width(); int numColumns = endx - originx; int originy = rect.y(); @@ -148,20 +151,21 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originy = 0; } int endy = rect.y() + rect.height(); - if (endy > m_size.height()) - endy = m_size.height(); + if (endy > size.height()) + endy = size.height(); int numRows = endy - originy; - unsigned srcBytesPerRow = 4 * m_size.width(); + unsigned srcBytesPerRow = 4 * size.width(); unsigned destBytesPerRow = 4 * rect.width(); // ::create ensures that all ImageBuffers have valid data, so we don't need to check it here. - unsigned char* srcRows = reinterpret_cast<unsigned char*>(m_data.m_data) + originy * srcBytesPerRow + originx * 4; + unsigned char* srcRows = reinterpret_cast<unsigned char*>(imageData.m_data) + originy * srcBytesPerRow + originx * 4; unsigned char* destRows = data + desty * destBytesPerRow + destx * 4; for (int y = 0; y < numRows; ++y) { for (int x = 0; x < numColumns; x++) { int basex = x * 4; - if (unsigned char alpha = srcRows[basex + 3]) { + unsigned char alpha = srcRows[basex + 3]; + if (multiplied == Unmultiplied && alpha) { destRows[basex] = (srcRows[basex] * 255) / alpha; destRows[basex + 1] = (srcRows[basex + 1] * 255) / alpha; destRows[basex + 2] = (srcRows[basex + 2] * 255) / alpha; @@ -175,7 +179,18 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +{ + return getImageData<Unmultiplied>(rect, m_data, m_size); +} + +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, m_data, m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& imageData, const IntSize& size) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -183,36 +198,36 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < m_size.width()); + ASSERT(destx < size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); int endx = destPoint.x() + sourceRect.right(); - ASSERT(endx <= m_size.width()); + ASSERT(endx <= 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(desty < size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); int endy = destPoint.y() + sourceRect.bottom(); - ASSERT(endy <= m_size.height()); + ASSERT(endy <= size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * source->width(); - unsigned destBytesPerRow = 4 * m_size.width(); + unsigned destBytesPerRow = 4 * size.width(); unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; - unsigned char* destRows = reinterpret_cast<unsigned char*>(m_data.m_data) + desty * destBytesPerRow + destx * 4; + unsigned char* destRows = reinterpret_cast<unsigned char*>(imageData.m_data) + desty * destBytesPerRow + destx * 4; for (int y = 0; y < numRows; ++y) { for (int x = 0; x < numColumns; x++) { int basex = x * 4; unsigned char alpha = srcRows[basex + 3]; - if (alpha != 255) { + if (multiplied == Unmultiplied && alpha != 255) { destRows[basex] = (srcRows[basex] * alpha + 254) / 255; destRows[basex + 1] = (srcRows[basex + 1] * alpha + 254) / 255; destRows[basex + 2] = (srcRows[basex + 2] * alpha + 254) / 255; @@ -225,6 +240,16 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con } } +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType) { #if PLATFORM(MAC) diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/WebCore/platform/graphics/filters/FEColorMatrix.cpp index fb0a194..1e2e552 100644 --- a/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -166,7 +166,7 @@ void FEColorMatrix::apply(Filter* filter) filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion())); IntRect imageRect(IntPoint(), resultImage()->size()); - PassRefPtr<ImageData> imageData(resultImage()->getImageData(imageRect)); + PassRefPtr<ImageData> imageData(resultImage()->getUnmultipliedImageData(imageRect)); PassRefPtr<CanvasPixelArray> srcPixelArray(imageData->data()); switch (m_type) { @@ -186,7 +186,7 @@ void FEColorMatrix::apply(Filter* filter) break; } - resultImage()->putImageData(imageData.get(), imageRect, IntPoint()); + resultImage()->putUnmultipliedImageData(imageData.get(), imageRect, IntPoint()); } void FEColorMatrix::dump() diff --git a/WebCore/platform/graphics/haiku/ColorHaiku.cpp b/WebCore/platform/graphics/haiku/ColorHaiku.cpp new file mode 100644 index 0000000..a9ac186 --- /dev/null +++ b/WebCore/platform/graphics/haiku/ColorHaiku.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "Color.h" + +#include <InterfaceDefs.h> + + +namespace WebCore { + +Color::Color(const rgb_color& color) + : m_color(makeRGBA(color.red, color.green, color.blue, color.alpha)) + , m_valid(true) +{ +} + +Color::operator rgb_color() const +{ + return make_color(red(), green(), blue(), alpha()); +} + + +Color focusRingColor() +{ + return Color(keyboard_navigation_color()); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/FloatPointHaiku.cpp b/WebCore/platform/graphics/haiku/FloatPointHaiku.cpp new file mode 100644 index 0000000..0f50898 --- /dev/null +++ b/WebCore/platform/graphics/haiku/FloatPointHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "FloatPoint.h" + +#include <Point.h> + + +namespace WebCore { + +FloatPoint::FloatPoint(const BPoint& point) + : m_x(point.x) + , m_y(point.y) +{ +} + +FloatPoint::operator BPoint() const +{ + return BPoint(m_x, m_y); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp b/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp new file mode 100644 index 0000000..67af3af --- /dev/null +++ b/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "FloatRect.h" + +#include <Rect.h> + + +namespace WebCore { + +FloatRect::FloatRect(const BRect& rect) + : m_location(rect.LeftTop()) + , m_size(rect.Width(), rect.Height()) +{ +} + +FloatRect::operator BRect() const +{ + return BRect(BPoint(x(), y()), BSize(width(), height())); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/GradientHaiku.cpp b/WebCore/platform/graphics/haiku/GradientHaiku.cpp new file mode 100644 index 0000000..469a17f --- /dev/null +++ b/WebCore/platform/graphics/haiku/GradientHaiku.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> All rights reserved. + * Copyright (C) 2009 Maxime Simon <simon.maxime@theolliviers.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 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 "Gradient.h" + +#include "CSSParser.h" +#include "NotImplemented.h" + + +namespace WebCore { + +void Gradient::platformDestroy() +{ + notImplemented(); +} + +PlatformGradient Gradient::platformGradient() +{ + notImplemented(); + return 0; +} + +void Gradient::fill(GraphicsContext*, const FloatRect&) +{ + notImplemented(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp new file mode 100644 index 0000000..d785ef4 --- /dev/null +++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp @@ -0,0 +1,536 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "GraphicsContext.h" + +#include "CString.h" +#include "Color.h" +#include "Font.h" +#include "FontData.h" +#include "NotImplemented.h" +#include "Path.h" +#include "Pen.h" +#include "TransformationMatrix.h" +#include <GraphicsDefs.h> +#include <Region.h> +#include <View.h> +#include <Window.h> +#include <stdio.h> + + +namespace WebCore { + +class GraphicsContextPlatformPrivate { +public: + GraphicsContextPlatformPrivate(BView* view); + ~GraphicsContextPlatformPrivate(); + + BView* m_view; +}; + +GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(BView* view) + : m_view(view) +{ +} + +GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() +{ +} + +GraphicsContext::GraphicsContext(PlatformGraphicsContext* context) + : m_common(createGraphicsContextPrivate()) + , m_data(new GraphicsContextPlatformPrivate(context)) +{ + setPaintingDisabled(!context); +} + +GraphicsContext::~GraphicsContext() +{ + destroyGraphicsContextPrivate(m_common); + delete m_data; +} + +PlatformGraphicsContext* GraphicsContext::platformContext() const +{ + return m_data->m_view; +} + +void GraphicsContext::savePlatformState() +{ + m_data->m_view->PushState(); +} + +void GraphicsContext::restorePlatformState() +{ + m_data->m_view->PopState(); +} + +// Draws a filled rectangle with a stroked border. +void GraphicsContext::drawRect(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + m_data->m_view->FillRect(rect); + if (strokeStyle() != NoStroke) + m_data->m_view->StrokeRect(rect, getHaikuStrokeStyle()); +} + +// This is only used to draw borders. +void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) +{ + if (paintingDisabled()) + return; + + if (strokeStyle() == NoStroke) + return; + + m_data->m_view->StrokeLine(point1, point2, getHaikuStrokeStyle()); +} + +// This method is only used to draw the little circles used in lists. +void GraphicsContext::drawEllipse(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + m_data->m_view->FillEllipse(rect); + if (strokeStyle() != NoStroke) + m_data->m_view->StrokeEllipse(rect, getHaikuStrokeStyle()); +} + +void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan) +{ + if (paintingDisabled()) + return; + + m_data->m_view->StrokeArc(rect, startAngle, angleSpan, getHaikuStrokeStyle()); +} + +void GraphicsContext::strokePath() +{ + notImplemented(); +} + +void GraphicsContext::drawConvexPolygon(size_t pointsLength, const FloatPoint* points, bool shouldAntialias) +{ + if (paintingDisabled()) + return; + + BPoint bPoints[pointsLength]; + for (size_t i = 0; i < pointsLength; i++) + bPoints[i] = points[i]; + + m_data->m_view->FillPolygon(bPoints, pointsLength); + if (strokeStyle() != NoStroke) + // Stroke with low color + m_data->m_view->StrokePolygon(bPoints, pointsLength, true, getHaikuStrokeStyle()); +} + +void GraphicsContext::fillRect(const FloatRect& rect, const Color& color) +{ + if (paintingDisabled()) + return; + + rgb_color oldColor = m_data->m_view->HighColor(); + m_data->m_view->SetHighColor(color); + m_data->m_view->FillRect(rect); + m_data->m_view->SetHighColor(oldColor); +} + +void GraphicsContext::fillRect(const FloatRect& rect) +{ + if (paintingDisabled()) + return; +} + +void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color) +{ + if (paintingDisabled() || !color.alpha()) + return; + + notImplemented(); + // FIXME: A simple implementation could just use FillRoundRect if all + // the sizes are the same, or even if they are not. Otherwise several + // FillRect and FillArc calls are needed. +} + +void GraphicsContext::fillPath() +{ + notImplemented(); +} + +void GraphicsContext::beginPath() +{ + notImplemented(); +} + +void GraphicsContext::addPath(const Path& path) +{ + notImplemented(); +} + +void GraphicsContext::clip(const FloatRect& rect) +{ + if (paintingDisabled()) + return; + + BRegion region(rect); + m_data->m_view->ConstrainClippingRegion(®ion); +} + +void GraphicsContext::drawFocusRing(const Color& color) +{ + if (paintingDisabled()) + return; + + const Vector<IntRect>& rects = focusRingRects(); + unsigned rectCount = rects.size(); + + // FIXME: maybe we should implement this with BShape? + + if (rects.size() > 1) { + BRegion region; + for (int i = 0; i < rectCount; ++i) + region.Include(BRect(rects[i])); + + m_data->m_view->SetHighColor(color); + m_data->m_view->StrokeRect(region.Frame(), B_MIXED_COLORS); + } +} + +void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing) +{ + if (paintingDisabled()) + return; + + IntPoint endPoint = origin + IntSize(width, 0); + drawLine(origin, endPoint); +} + +void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint&, int width, bool grammar) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) +{ + notImplemented(); + return rect; +} + +void GraphicsContext::beginTransparencyLayer(float opacity) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::endTransparencyLayer() +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clearRect(const FloatRect& rect) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::strokeRect(const FloatRect& rect, float width) +{ + if (paintingDisabled()) + return; + + float oldSize = m_data->m_view->PenSize(); + m_data->m_view->SetPenSize(width); + m_data->m_view->StrokeRect(rect, getHaikuStrokeStyle()); + m_data->m_view->SetPenSize(oldSize); +} + +void GraphicsContext::setLineCap(LineCap lineCap) +{ + if (paintingDisabled()) + return; + + cap_mode mode = B_BUTT_CAP; + switch (lineCap) { + case RoundCap: + mode = B_ROUND_CAP; + break; + case SquareCap: + mode = B_SQUARE_CAP; + break; + case ButtCap: + default: + break; + } + + m_data->m_view->SetLineMode(mode, m_data->m_view->LineJoinMode(), m_data->m_view->LineMiterLimit()); +} + +void GraphicsContext::setLineJoin(LineJoin lineJoin) +{ + if (paintingDisabled()) + return; + + join_mode mode = B_MITER_JOIN; + switch (lineJoin) { + case RoundJoin: + mode = B_ROUND_JOIN; + break; + case BevelJoin: + mode = B_BEVEL_JOIN; + break; + case MiterJoin: + default: + break; + } + + m_data->m_view->SetLineMode(m_data->m_view->LineCapMode(), mode, m_data->m_view->LineMiterLimit()); +} + +void GraphicsContext::setMiterLimit(float limit) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetLineMode(m_data->m_view->LineCapMode(), m_data->m_view->LineJoinMode(), limit); +} + +void GraphicsContext::setAlpha(float opacity) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::setCompositeOperation(CompositeOperator op) +{ + if (paintingDisabled()) + return; + + drawing_mode mode = B_OP_COPY; + switch (op) { + case CompositeClear: + case CompositeCopy: + // Use the default above + break; + case CompositeSourceOver: + mode = B_OP_OVER; + break; + default: + printf("GraphicsContext::setCompositeOperation: Unsupported composite operation %s\n", + compositeOperatorName(op).utf8().data()); + } + m_data->m_view->SetDrawingMode(mode); +} + +void GraphicsContext::clip(const Path& path) +{ + if (paintingDisabled()) + return; + + m_data->m_view->ConstrainClippingRegion(path.platformPath()); +} + +void GraphicsContext::clipOut(const Path& path) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) +{ + notImplemented(); +} + +TransformationMatrix GraphicsContext::getCTM() const +{ + notImplemented(); + return TransformationMatrix(); +} + +void GraphicsContext::translate(float x, float y) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +IntPoint GraphicsContext::origin() +{ + notImplemented(); + return IntPoint(0, 0); +} + +void GraphicsContext::rotate(float radians) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::scale(const FloatSize& size) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clipOut(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::concatCTM(const TransformationMatrix& transform) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::setPlatformShouldAntialias(bool enable) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::setImageInterpolationQuality(InterpolationQuality) +{ +} + +void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect) +{ + notImplemented(); +} + +void GraphicsContext::setPlatformFont(const Font& font) +{ + m_data->m_view->SetFont(font.primaryFont()->platformData().font()); +} + +void GraphicsContext::setPlatformStrokeColor(const Color& color) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetHighColor(color); +} + +pattern GraphicsContext::getHaikuStrokeStyle() +{ + switch (strokeStyle()) { + case SolidStroke: + return B_SOLID_HIGH; + break; + case DottedStroke: + return B_MIXED_COLORS; + break; + case DashedStroke: + // FIXME: use a better dashed stroke! + notImplemented(); + return B_MIXED_COLORS; + break; + default: + return B_SOLID_LOW; + break; + } +} + +void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle& strokeStyle) +{ + // FIXME: see getHaikuStrokeStyle. + notImplemented(); +} + +void GraphicsContext::setPlatformStrokeThickness(float thickness) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetPenSize(thickness); +} + +void GraphicsContext::setPlatformFillColor(const Color& color) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetHighColor(color); +} + +void GraphicsContext::clearPlatformShadow() +{ + notImplemented(); +} + +void GraphicsContext::setPlatformShadow(IntSize const&, int, Color const&) +{ + notImplemented(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/IntPointHaiku.cpp b/WebCore/platform/graphics/haiku/IntPointHaiku.cpp new file mode 100644 index 0000000..327e503 --- /dev/null +++ b/WebCore/platform/graphics/haiku/IntPointHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "IntPoint.h" + +#include <Point.h> + + +namespace WebCore { + +IntPoint::IntPoint(const BPoint& point) + : m_x(static_cast<int>(point.x)) + , m_y(static_cast<int>(point.y)) +{ +} + +IntPoint::operator BPoint() const +{ + return BPoint(m_x, m_y); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/IntRectHaiku.cpp b/WebCore/platform/graphics/haiku/IntRectHaiku.cpp new file mode 100644 index 0000000..74a0b9d --- /dev/null +++ b/WebCore/platform/graphics/haiku/IntRectHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "IntRect.h" + +#include <Rect.h> + + +namespace WebCore { + +IntRect::IntRect(const BRect& rect) + : m_location(rect.LeftTop()) + , m_size(rect.IntegerWidth(), rect.IntegerHeight()) +{ +} + +IntRect::operator BRect() const +{ + return BRect(BPoint(x(), y()), BSize(width(), height())); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/IntSizeHaiku.cpp b/WebCore/platform/graphics/haiku/IntSizeHaiku.cpp new file mode 100644 index 0000000..08c3a9d --- /dev/null +++ b/WebCore/platform/graphics/haiku/IntSizeHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "IntSize.h" + +#include <Size.h> + + +namespace WebCore { + +IntSize::IntSize(const BSize& size) + : m_width(size.IntegerWidth()) + , m_height(size.IntegerHeight()) +{ +} + +IntSize::operator BSize() const +{ + return BSize(width(), height()); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/PathHaiku.cpp b/WebCore/platform/graphics/haiku/PathHaiku.cpp new file mode 100644 index 0000000..d0da025 --- /dev/null +++ b/WebCore/platform/graphics/haiku/PathHaiku.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.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. + * + * 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 "Path.h" + +#include "FloatRect.h" +#include "NotImplemented.h" +#include "PlatformString.h" +#include <Region.h> + + +namespace WebCore { + +Path::Path() + : m_path(new BRegion()) +{ +} + +Path::~Path() +{ + delete m_path; +} + +Path::Path(const Path& other) + : m_path(new BRegion(*other.platformPath())) +{ +} + +Path& Path::operator=(const Path& other) +{ + if (&other != this) + m_path = other.platformPath(); + + return *this; +} + +bool Path::hasCurrentPoint() const +{ + return !isEmpty(); +} + +bool Path::contains(const FloatPoint& point, WindRule rule) const +{ + return m_path->Contains(point); +} + +void Path::translate(const FloatSize& size) +{ + notImplemented(); +} + +FloatRect Path::boundingRect() const +{ + return m_path->Frame(); +} + +void Path::moveTo(const FloatPoint& point) +{ + // FIXME: Use OffsetBy? + notImplemented(); +} + +void Path::addLineTo(const FloatPoint& p) +{ + notImplemented(); +} + +void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) +{ + notImplemented(); +} + +void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) +{ + notImplemented(); +} + +void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) +{ + notImplemented(); +} + +void Path::closeSubpath() +{ + notImplemented(); +} + +void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise) +{ + notImplemented(); +} + +void Path::addRect(const FloatRect& r) +{ + m_path->Include(r); +} + +void Path::addEllipse(const FloatRect& r) +{ + notImplemented(); +} + +void Path::clear() +{ + m_path->MakeEmpty(); +} + +bool Path::isEmpty() const +{ + return !m_path->Frame().IsValid(); +} + +String Path::debugString() const +{ + notImplemented(); + return String(); +} + +void Path::apply(void* info, PathApplierFunction function) const +{ + notImplemented(); +} + +void Path::transform(const TransformationMatrix& transform) +{ + notImplemented(); +} + +FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) +{ + notImplemented(); + return FloatRect(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/mac/FontMacATSUI.mm b/WebCore/platform/graphics/mac/FontMacATSUI.mm index 051abb7..35c40bf 100644 --- a/WebCore/platform/graphics/mac/FontMacATSUI.mm +++ b/WebCore/platform/graphics/mac/FontMacATSUI.mm @@ -504,8 +504,8 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& firstGlyphBounds = zeroTrapezoid; } - float beforeWidth = MIN(FixedToFloat(firstGlyphBounds.lowerLeft.x), FixedToFloat(firstGlyphBounds.upperLeft.x)); - float afterWidth = MAX(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x)); + float beforeWidth = min(FixedToFloat(firstGlyphBounds.lowerLeft.x), FixedToFloat(firstGlyphBounds.upperLeft.x)); + float afterWidth = max(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x)); FloatRect rect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h); @@ -591,8 +591,8 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon if (actualNumBounds != 1) LOG_ERROR("unexpected result from ATSUGetGlyphBounds(): actualNumBounds(%d) != 1", actualNumBounds); - return MAX(FixedToFloat(firstGlyphBounds.upperRight.x), FixedToFloat(firstGlyphBounds.lowerRight.x)) - - MIN(FixedToFloat(firstGlyphBounds.upperLeft.x), FixedToFloat(firstGlyphBounds.lowerLeft.x)); + return max(FixedToFloat(firstGlyphBounds.upperRight.x), FixedToFloat(firstGlyphBounds.lowerRight.x)) - + min(FixedToFloat(firstGlyphBounds.upperLeft.x), FixedToFloat(firstGlyphBounds.lowerLeft.x)); } int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool /*includePartialGlyphs*/) const diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h index ebdc6ac..d1bdb7e 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h @@ -62,6 +62,8 @@ public: virtual void removeFromParent(); + virtual void setMaskLayer(GraphicsLayer*); + virtual void setPosition(const FloatPoint&); virtual void setAnchorPoint(const FloatPoint3D&); virtual void setSize(const FloatSize&); @@ -172,6 +174,7 @@ private: void updateContentsVideo(); void updateContentsRect(); void updateGeometryOrientation(); + void updateMaskLayer(); void updateLayerAnimations(); @@ -200,7 +203,8 @@ private: ContentsImageChanged = 1 << 17, ContentsVideoChanged = 1 << 18, ContentsRectChanged = 1 << 19, - GeometryOrientationChanged = 1 << 20 + GeometryOrientationChanged = 1 << 20, + MaskLayerChanged = 1 << 21 }; typedef unsigned LayerChangeFlags; void noteLayerPropertyChanged(LayerChangeFlags flags); diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm index e5b9035..abb310a 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm @@ -331,7 +331,7 @@ static NSDictionary* nullActionsDictionary() return actions; } -GraphicsLayer* GraphicsLayer::createGraphicsLayer(GraphicsLayerClient* client) +PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) { return new GraphicsLayerCA(client); } @@ -432,6 +432,15 @@ void GraphicsLayerCA::removeFromParent() GraphicsLayer::removeFromParent(); } +void GraphicsLayerCA::setMaskLayer(GraphicsLayer* layer) +{ + if (layer == m_maskLayer) + return; + + GraphicsLayer::setMaskLayer(layer); + noteLayerPropertyChanged(MaskLayerChanged); +} + void GraphicsLayerCA::setPosition(const FloatPoint& point) { if (point == m_position) @@ -733,6 +742,9 @@ void GraphicsLayerCA::recursiveCommitChanges() { commitLayerChanges(); + if (m_maskLayer) + static_cast<GraphicsLayerCA*>(m_maskLayer)->commitLayerChanges(); + const Vector<GraphicsLayer*>& childLayers = children(); size_t numChildren = childLayers.size(); for (size_t i = 0; i < numChildren; ++i) { @@ -812,6 +824,9 @@ void GraphicsLayerCA::commitLayerChanges() if (m_uncommittedChanges & GeometryOrientationChanged) updateGeometryOrientation(); + if (m_uncommittedChanges & MaskLayerChanged) + updateMaskLayer(); + m_uncommittedChanges = NoChange; END_BLOCK_OBJC_EXCEPTIONS } @@ -821,10 +836,12 @@ void GraphicsLayerCA::updateSublayerList() NSMutableArray* newSublayers = nil; if (m_transformLayer) { - // FIXME: add the primary layer in the correct order with negative z-order children. + // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind. newSublayers = [[NSMutableArray alloc] initWithObjects:m_layer.get(), nil]; } else if (m_contentsLayer) { // FIXME: add the contents layer in the correct order with negative z-order children. + // This does not cause visible rendering issues because currently contents layers are only used + // for replaced elements that don't have children. newSublayers = [[NSMutableArray alloc] initWithObjects:m_contentsLayer.get(), nil]; } @@ -1094,6 +1111,12 @@ void GraphicsLayerCA::updateGeometryOrientation() #endif } +void GraphicsLayerCA::updateMaskLayer() +{ + CALayer* maskCALayer = m_maskLayer ? m_maskLayer->platformLayer() : 0; + [m_layer.get() setMask:maskCALayer]; +} + void GraphicsLayerCA::updateLayerAnimations() { if (m_transitionPropertiesToRemove.size()) { diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index cdde7cf..acb97a7 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -50,6 +50,8 @@ - (BOOL)_isFakeFixedPitch; @end +using namespace std; + namespace WebCore { const float smallCapsFontSizeMultiplier = 0.7f; @@ -269,7 +271,7 @@ void SimpleFontData::platformInit() // and web pages that foolishly use this metric for width will be laid out // poorly if we return an accurate height. Classic case is Times 13 point, // which has an "x" that is 7x6 pixels. - m_xHeight = MAX(NSMaxX(xBox), NSMaxY(xBox)); + m_xHeight = max(NSMaxX(xBox), NSMaxY(xBox)); } else m_xHeight = [m_platformData.font() xHeight]; } diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index e259a4e..5e04b85 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -34,29 +34,29 @@ */ #include "config.h" +#include "GraphicsContext.h" #ifdef Q_WS_WIN #include <windows.h> #endif -#include "TransformationMatrix.h" #include "Color.h" #include "FloatConversion.h" #include "Font.h" -#include "GraphicsContext.h" #include "GraphicsContextPrivate.h" #include "ImageBuffer.h" +#include "NotImplemented.h" #include "Path.h" #include "Pattern.h" #include "Pen.h" -#include "NotImplemented.h" +#include "TransformationMatrix.h" #include <QBrush> #include <QDebug> #include <QGradient> -#include <QPainter> #include <QPaintDevice> #include <QPaintEngine> +#include <QPainter> #include <QPainterPath> #include <QPixmap> #include <QPolygonF> @@ -72,35 +72,35 @@ namespace WebCore { static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op) { switch (op) { - case CompositeClear: - return QPainter::CompositionMode_Clear; - case CompositeCopy: - return QPainter::CompositionMode_Source; - case CompositeSourceOver: - return QPainter::CompositionMode_SourceOver; - case CompositeSourceIn: - return QPainter::CompositionMode_SourceIn; - case CompositeSourceOut: - return QPainter::CompositionMode_SourceOut; - case CompositeSourceAtop: - return QPainter::CompositionMode_SourceAtop; - case CompositeDestinationOver: - return QPainter::CompositionMode_DestinationOver; - case CompositeDestinationIn: - return QPainter::CompositionMode_DestinationIn; - case CompositeDestinationOut: - return QPainter::CompositionMode_DestinationOut; - case CompositeDestinationAtop: - return QPainter::CompositionMode_DestinationAtop; - case CompositeXOR: - return QPainter::CompositionMode_Xor; - case CompositePlusDarker: - // there is no exact match, but this is the closest - return QPainter::CompositionMode_Darken; - case CompositeHighlight: - return QPainter::CompositionMode_SourceOver; - case CompositePlusLighter: - return QPainter::CompositionMode_Plus; + case CompositeClear: + return QPainter::CompositionMode_Clear; + case CompositeCopy: + return QPainter::CompositionMode_Source; + case CompositeSourceOver: + return QPainter::CompositionMode_SourceOver; + case CompositeSourceIn: + return QPainter::CompositionMode_SourceIn; + case CompositeSourceOut: + return QPainter::CompositionMode_SourceOut; + case CompositeSourceAtop: + return QPainter::CompositionMode_SourceAtop; + case CompositeDestinationOver: + return QPainter::CompositionMode_DestinationOver; + case CompositeDestinationIn: + return QPainter::CompositionMode_DestinationIn; + case CompositeDestinationOut: + return QPainter::CompositionMode_DestinationOut; + case CompositeDestinationAtop: + return QPainter::CompositionMode_DestinationAtop; + case CompositeXOR: + return QPainter::CompositionMode_Xor; + case CompositePlusDarker: + // there is no exact match, but this is the closest + return QPainter::CompositionMode_Darken; + case CompositeHighlight: + return QPainter::CompositionMode_SourceOver; + case CompositePlusLighter: + return QPainter::CompositionMode_Plus; } return QPainter::CompositionMode_SourceOver; @@ -109,12 +109,12 @@ static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op static inline Qt::PenCapStyle toQtLineCap(LineCap lc) { switch (lc) { - case ButtCap: - return Qt::FlatCap; - case RoundCap: - return Qt::RoundCap; - case SquareCap: - return Qt::SquareCap; + case ButtCap: + return Qt::FlatCap; + case RoundCap: + return Qt::RoundCap; + case SquareCap: + return Qt::SquareCap; } return Qt::FlatCap; @@ -123,12 +123,12 @@ static inline Qt::PenCapStyle toQtLineCap(LineCap lc) static inline Qt::PenJoinStyle toQtLineJoin(LineJoin lj) { switch (lj) { - case MiterJoin: - return Qt::SvgMiterJoin; - case RoundJoin: - return Qt::RoundJoin; - case BevelJoin: - return Qt::BevelJoin; + case MiterJoin: + return Qt::SvgMiterJoin; + case RoundJoin: + return Qt::RoundJoin; + case BevelJoin: + return Qt::BevelJoin; } return Qt::MiterJoin; @@ -210,8 +210,8 @@ public: return redirect; return painter; - } else - return &layers.top()->painter; + } + return &layers.top()->painter; } bool antiAliasingForRectsAndLines; @@ -411,46 +411,25 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { + IntRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + shadowRect.inflate(p->pen().widthF()); + p->fillRect(shadowRect, QColor(shadowColor)); + } + p->drawRect(rect); p->setRenderHint(QPainter::Antialiasing, antiAlias); } -// FIXME: Now that this is refactored, it should be shared by all contexts. -static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, - const StrokeStyle& penStyle) -{ - // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic - // works out. For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g., - // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave - // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. - if (penStyle == DottedStroke || penStyle == DashedStroke) { - if (p1.x() == p2.x()) { - p1.setY(p1.y() + strokeWidth); - p2.setY(p2.y() - strokeWidth); - } else { - p1.setX(p1.x() + strokeWidth); - p2.setX(p2.x() - strokeWidth); - } - } - - if (((int) strokeWidth) % 2) { - if (p1.x() == p2.x()) { - // We're a vertical line. Adjust our x. - p1.setX(p1.x() + 0.5); - p2.setX(p2.x() + 0.5); - } else { - // We're a horizontal line. Adjust our y. - p1.setY(p1.y() + 0.5); - p2.setY(p2.y() + 0.5); - } - } -} - // This is only used to draw borders. void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) { @@ -468,7 +447,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) FloatPoint p2 = point2; bool isVerticalLine = (p1.x() == p2.x()); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); adjustLineToPixelBoundaries(p1, p2, width, style); @@ -486,15 +465,15 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) int patWidth = 0; switch (style) { - case NoStroke: - case SolidStroke: - break; - case DottedStroke: - patWidth = (int)width; - break; - case DashedStroke: - patWidth = 3 * (int)width; - break; + case NoStroke: + case SolidStroke: + break; + case DottedStroke: + patWidth = static_cast<int>(width); + break; + case DashedStroke: + patWidth = 3 * static_cast<int>(width); + break; } if (patWidth) { @@ -523,7 +502,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth == 1) patternOffset = 1.0f; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -571,7 +550,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (paintingDisabled() || strokeStyle() == NoStroke || strokeThickness() <= 0.0f || !strokeColor().alpha()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, true); @@ -593,7 +572,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points for (size_t i = 0; i < npoints; i++) polygon[i] = points[i]; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); p->save(); p->setRenderHint(QPainter::Antialiasing, shouldAntialias); p->drawConvexPolygon(polygon); @@ -605,7 +584,7 @@ QPen GraphicsContext::pen() if (paintingDisabled()) return QPen(); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); return p->pen(); } @@ -614,7 +593,7 @@ void GraphicsContext::fillPath() if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPainterPath path = m_data->currentPath; path.setFillRule(toQtFillRule(fillRule())); @@ -642,7 +621,7 @@ void GraphicsContext::strokePath() if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen pen = p->pen(); QPainterPath path = m_data->currentPath; path.setFillRule(toQtFillRule(fillRule())); @@ -676,7 +655,16 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); + + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + if (getShadow(shadowSize, shadowBlur, shadowColor)) { + FloatRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + p->fillRect(shadowRect, QColor(shadowColor)); + } switch (m_common->state.fillColorSpace) { case SolidColorSpace: @@ -703,7 +691,17 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& c) return; m_data->solidColor.setColor(QColor(c)); - m_data->p()->fillRect(rect, m_data->solidColor); + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + QPainter* p = m_data->p(); + if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { + FloatRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + shadowRect.inflate(p->pen().widthF()); + p->fillRect(shadowRect, QColor(shadowColor)); + } + p->fillRect(rect, m_data->solidColor); } void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color) @@ -750,7 +748,7 @@ void GraphicsContext::clipPath(WindRule clipRule) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPainterPath newPath = m_data->currentPath; newPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); p->setClipPath(newPath); @@ -769,10 +767,10 @@ void GraphicsContext::drawFocusRing(const Color& color) const Vector<IntRect>& rects = focusRingRects(); unsigned rectCount = rects.size(); - if (rects.size() == 0) + if (!rects.size()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); @@ -829,10 +827,16 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect) return FloatRect(QRectF(result)); } -void GraphicsContext::setPlatformShadow(const IntSize& pos, int blur, const Color &color) +void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Color &color) { // Qt doesn't support shadows natively, they are drawn manually in the draw* // functions + + if (m_common->state.shadowsIgnoreTransforms) { + // Meaning that this graphics context is associated with a CanvasRenderingContext + // We flip the height since CG and HTML5 Canvas have opposite Y axis + m_common->state.shadowSize = IntSize(size.width(), -size.height()); + } } void GraphicsContext::clearPlatformShadow() @@ -848,8 +852,8 @@ void GraphicsContext::beginTransparencyLayer(float opacity) int x, y, w, h; x = y = 0; - QPainter *p = m_data->p(); - const QPaintDevice *device = p->device(); + QPainter* p = m_data->p(); + const QPaintDevice* device = p->device(); w = device->width(); h = device->height(); @@ -871,10 +875,10 @@ void GraphicsContext::endTransparencyLayer() if (paintingDisabled()) return; - TransparencyLayer *layer = m_data->layers.pop(); + TransparencyLayer* layer = m_data->layers.pop(); layer->painter.end(); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); p->save(); p->resetTransform(); p->setOpacity(layer->opacity); @@ -889,7 +893,7 @@ void GraphicsContext::clearRect(const FloatRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPainter::CompositionMode currentCompositionMode = p->compositionMode(); if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) p->setCompositionMode(QPainter::CompositionMode_Source); @@ -916,7 +920,7 @@ void GraphicsContext::setLineCap(LineCap lc) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen nPen = p->pen(); nPen.setCapStyle(toQtLineCap(lc)); p->setPen(nPen); @@ -948,7 +952,7 @@ void GraphicsContext::setLineJoin(LineJoin lj) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen nPen = p->pen(); nPen.setJoinStyle(toQtLineJoin(lj)); p->setPen(nPen); @@ -959,7 +963,7 @@ void GraphicsContext::setMiterLimit(float limit) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen nPen = p->pen(); nPen.setMiterLimit(limit); p->setPen(nPen); @@ -969,7 +973,7 @@ void GraphicsContext::setAlpha(float opacity) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); p->setOpacity(opacity); } @@ -995,7 +999,7 @@ void GraphicsContext::clipOut(const Path& path) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QRectF clipBounds = p->clipPath().boundingRect(); QPainterPath clippedOut = *path.platformPath(); QPainterPath newClip; @@ -1061,7 +1065,7 @@ void GraphicsContext::clipOut(const IntRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QRectF clipBounds = p->clipPath().boundingRect(); QPainterPath newClip; newClip.setFillRule(Qt::OddEvenFill); @@ -1076,7 +1080,7 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QRectF clipBounds = p->clipPath().boundingRect(); QPainterPath newClip; newClip.setFillRule(Qt::OddEvenFill); @@ -1109,7 +1113,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, path.setFillRule(Qt::OddEvenFill); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, true); @@ -1143,7 +1147,7 @@ void GraphicsContext::setPlatformStrokeColor(const Color& color) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen newPen(p->pen()); newPen.setColor(color); p->setPen(newPen); @@ -1153,7 +1157,7 @@ void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle& strokeStyle) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen newPen(p->pen()); newPen.setStyle(toQPenStyle(strokeStyle)); p->setPen(newPen); @@ -1163,7 +1167,7 @@ void GraphicsContext::setPlatformStrokeThickness(float thickness) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen newPen(p->pen()); newPen.setWidthF(thickness); p->setPen(newPen); @@ -1184,7 +1188,6 @@ void GraphicsContext::setPlatformShouldAntialias(bool enable) } #ifdef Q_WS_WIN -#include <windows.h> HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) { diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp index 22a5a43..6637092 100644 --- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -125,12 +125,13 @@ void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) m_data.m_painter->begin(&m_data.m_pixmap); } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& imageData, const IntSize& size) { PassRefPtr<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()) + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) memset(data, 0, result->data()->length()); int originx = rect.x(); @@ -140,8 +141,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originx = 0; } int endx = rect.x() + rect.width(); - if (endx > m_size.width()) - endx = m_size.width(); + if (endx > size.width()) + endx = size.width(); int numColumns = endx - originx; int originy = rect.y(); @@ -151,11 +152,16 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originy = 0; } int endy = rect.y() + rect.height(); - if (endy > m_size.height()) - endy = m_size.height(); + if (endy > size.height()) + endy = size.height(); int numRows = endy - originy; - QImage image = m_data.m_pixmap.toImage().convertToFormat(QImage::Format_ARGB32); + QImage image = imageData.m_pixmap.toImage(); + if (multiplied == Unmultiplied) + image = image.convertToFormat(QImage::Format_ARGB32); + else + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + ASSERT(!image.isNull()); unsigned destBytesPerRow = 4 * rect.width(); @@ -176,7 +182,18 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +{ + return getImageData<Unmultiplied>(rect, m_data, m_size); +} + +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, m_data, m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& data, const IntSize& size) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -184,33 +201,37 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < m_size.width()); + ASSERT(destx < size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); int endx = destPoint.x() + sourceRect.right(); - ASSERT(endx <= m_size.width()); + ASSERT(endx <= 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(desty < size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); int endy = destPoint.y() + sourceRect.bottom(); - ASSERT(endy <= m_size.height()); + ASSERT(endy <= size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * source->width(); - bool isPainting = m_data.m_painter->isActive(); + bool isPainting = data.m_painter->isActive(); if (isPainting) - m_data.m_painter->end(); + data.m_painter->end(); - QImage image = m_data.m_pixmap.toImage().convertToFormat(QImage::Format_ARGB32); + QImage image = data.m_pixmap.toImage(); + if (multiplied == Unmultiplied) + image = image.convertToFormat(QImage::Format_ARGB32); + else + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; for (int y = 0; y < numRows; ++y) { @@ -223,10 +244,20 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con srcRows += srcBytesPerRow; } - m_data.m_pixmap = QPixmap::fromImage(image); + data.m_pixmap = QPixmap::fromImage(image); if (isPainting) - m_data.m_painter->begin(&m_data.m_pixmap); + data.m_painter->begin(&data.m_pixmap); +} + +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); } // We get a mimeType here but QImageWriter does not support mimetypes but diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 7935ff1..c429bcf 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -118,16 +118,16 @@ void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) } } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const SkBitmap& bitmap, + const IntSize& size) { - ASSERT(context()); - 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()) + (rect.x() + rect.width()) > size.width() || + (rect.y() + rect.height()) > size.height()) memset(data, 0, result->data()->length()); int originX = rect.x(); @@ -137,8 +137,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originX = 0; } int endX = rect.x() + rect.width(); - if (endX > m_size.width()) - endX = m_size.width(); + if (endX > size.width()) + endX = size.width(); int numColumns = endX - originX; int originY = rect.y(); @@ -148,11 +148,10 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originY = 0; } int endY = rect.y() + rect.height(); - if (endY > m_size.height()) - endY = m_size.height(); + if (endY > size.height()) + endY = size.height(); int numRows = endY - originY; - const SkBitmap& bitmap = *context()->platformContext()->bitmap(); ASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); SkAutoLockPixels bitmapLock(bitmap); @@ -162,6 +161,7 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const for (int y = 0; y < numRows; ++y) { uint32_t* srcRow = bitmap.getAddr32(originX, originY + y); for (int x = 0; x < numColumns; ++x) { + // TODO: Support for premultiplied colors SkColor color = SkPMColorToColor(srcRow[x]); unsigned char* destPixel = &destRow[x * 4]; destPixel[0] = SkColorGetR(color); @@ -175,8 +175,19 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, - const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +{ + return getImageData<Unmultiplied>(rect, *context()->platformContext()->bitmap(), m_size); +} + +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, + const SkBitmap& bitmap, const IntSize& size) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -184,27 +195,26 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, int originX = sourceRect.x(); int destX = destPoint.x() + sourceRect.x(); ASSERT(destX >= 0); - ASSERT(destX < m_size.width()); + ASSERT(destX < size.width()); ASSERT(originX >= 0); ASSERT(originX < sourceRect.right()); int endX = destPoint.x() + sourceRect.right(); - ASSERT(endX <= m_size.width()); + ASSERT(endX <= 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(destY < size.height()); ASSERT(originY >= 0); ASSERT(originY < sourceRect.bottom()); int endY = destPoint.y() + sourceRect.bottom(); - ASSERT(endY <= m_size.height()); + ASSERT(endY <= size.height()); int numRows = endY - destY; - const SkBitmap& bitmap = *context()->platformContext()->bitmap(); ASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); SkAutoLockPixels bitmapLock(bitmap); @@ -215,6 +225,7 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, for (int y = 0; y < numRows; ++y) { uint32_t* destRow = bitmap.getAddr32(destX, destY + y); for (int x = 0; x < numColumns; ++x) { + // TODO: Support for premultiplied colors const unsigned char* srcPixel = &srcRow[x * 4]; destRow[x] = SkPreMultiplyARGB(srcPixel[3], srcPixel[0], srcPixel[1], srcPixel[2]); @@ -223,6 +234,16 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, } } +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, *context()->platformContext()->bitmap(), m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, *context()->platformContext()->bitmap(), m_size); +} + String ImageBuffer::toDataURL(const String&) const { // Encode the image into a vector. diff --git a/WebCore/platform/graphics/skia/ImageSourceSkia.cpp b/WebCore/platform/graphics/skia/ImageSourceSkia.cpp deleted file mode 100644 index 1647b86..0000000 --- a/WebCore/platform/graphics/skia/ImageSourceSkia.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2008, 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 "ImageSource.h" -#include "SharedBuffer.h" - -#include "GIFImageDecoder.h" -#include "ICOImageDecoder.h" -#include "JPEGImageDecoder.h" -#include "PNGImageDecoder.h" -#include "BMPImageDecoder.h" -#include "XBMImageDecoder.h" - -#include "SkBitmap.h" - -namespace WebCore { - -ImageDecoder* createDecoder(const Vector<char>& data) -{ - // We need at least 4 bytes to figure out what kind of image we're dealing with. - int length = data.size(); - if (length < 4) - return 0; - - const unsigned char* uContents = (const unsigned char*)data.data(); - const char* contents = data.data(); - - // GIFs begin with GIF8(7 or 9). - if (strncmp(contents, "GIF8", 4) == 0) - return new GIFImageDecoder(); - - // Test for PNG. - if (uContents[0]==0x89 && - uContents[1]==0x50 && - uContents[2]==0x4E && - uContents[3]==0x47) - return new PNGImageDecoder(); - - // JPEG - if (uContents[0]==0xFF && - uContents[1]==0xD8 && - uContents[2]==0xFF) - return new JPEGImageDecoder(); - - // BMP - if (strncmp(contents, "BM", 2) == 0) - return new BMPImageDecoder(); - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // CURs begin with 2-byte 0 followed by 2-byte 2. - if (!memcmp(contents, "\000\000\001\000", 4) || - !memcmp(contents, "\000\000\002\000", 4)) - return new ICOImageDecoder(); - - // XBMs require 8 bytes of info. - if (length >= 8 && strncmp(contents, "#define ", 8) == 0) - return new XBMImageDecoder(); - - // Give up. We don't know what the heck this is. - return 0; -} - -ImageSource::ImageSource() - : m_decoder(0) -{} - -ImageSource::~ImageSource() -{ - clear(true); -} - -void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) -{ - if (!destroyAll) { - if (m_decoder) - m_decoder->clearFrameBufferCache(clearBeforeFrame); - return; - } - - delete m_decoder; - m_decoder = 0; - if (data) - setData(data, allDataReceived); -} - -bool ImageSource::initialized() const -{ - return m_decoder; -} - -void ImageSource::setData(SharedBuffer* data, bool allDataReceived) -{ - // Make the decoder by sniffing the bytes. - // This method will examine the data and instantiate an instance of the appropriate decoder plugin. - // If insufficient bytes are available to determine the image type, no decoder plugin will be - // made. - if (!m_decoder) - m_decoder = createDecoder(data->buffer()); - - // CreateDecoder will return NULL if the decoder could not be created. Plus, - // we should not send more data to a decoder which has already decided it - // has failed. - if (!m_decoder || m_decoder->failed()) - return; - m_decoder->setData(data, allDataReceived); -} - -bool ImageSource::isSizeAvailable() -{ - if (!m_decoder) - return false; - - return m_decoder->isSizeAvailable(); -} - -IntSize ImageSource::size() const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->size(); -} - -IntSize ImageSource::frameSizeAtIndex(size_t index) const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->frameSizeAtIndex(index); -} - -int ImageSource::repetitionCount() -{ - if (!m_decoder) - return cAnimationNone; - - return m_decoder->repetitionCount(); -} - -size_t ImageSource::frameCount() const -{ - if (!m_decoder) - return 0; - return m_decoder->failed() ? 0 : m_decoder->frameCount(); -} - -NativeImagePtr ImageSource::createFrameAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - // Note that the buffer can have NULL bytes even when it is marked as - // non-empty. It seems "FrameEmpty" is only set before the frame has been - // initialized. If it is decoded and it happens to be empty, it will be - // marked as "FrameComplete" but will still have NULL bytes. - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - // Copy the bitmap. The pixel data is refcounted internally by SkBitmap, so - // this doesn't cost much. - return buffer->asNewNativeImage(); -} - -bool ImageSource::frameIsCompleteAtIndex(size_t index) -{ - if (!m_decoder) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - return buffer && buffer->status() == RGBA32Buffer::FrameComplete; -} - -float ImageSource::frameDurationAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - // Many annoying ads specify a 0 duration to make an image flash as quickly - // as possible. We follow WinIE's behavior and use a duration of 100 ms - // for any frames that specify a duration of <= 50 ms. See - // <http://bugs.webkit.org/show_bug.cgi?id=14413> or Radar 4051389 for - // more. - const float duration = buffer->duration() / 1000.0f; - return (duration < 0.051f) ? 0.100f : duration; -} - -bool ImageSource::frameHasAlphaAtIndex(size_t index) -{ - if (!m_decoder || !m_decoder->supportsAlpha()) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return false; - - return buffer->hasAlpha(); -} - -String ImageSource::filenameExtension() const -{ - return m_decoder ? m_decoder->filenameExtension() : String(); -} - -} diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index e0a292c..bf6bae2 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -295,7 +295,7 @@ void PlatformContextSkia::drawRect(SkRect rect) void PlatformContextSkia::setupPaintCommon(SkPaint* paint) const { -#ifdef SK_DEBUGx +#ifdef SK_DEBUG { SkPaint defaultPaint; SkASSERT(*paint == defaultPaint); diff --git a/WebCore/platform/graphics/wince/ColorWince.cpp b/WebCore/platform/graphics/wince/ColorWince.cpp new file mode 100644 index 0000000..820b9d2 --- /dev/null +++ b/WebCore/platform/graphics/wince/ColorWince.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, 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. + * + */ + +#include "config.h" +#include "Color.h" + +#include "NotImplemented.h" + +namespace WebCore { + +Color focusRingColor() +{ + return Color(0, 0, 0); +} + +void setFocusRingColorChangeFunction(void (*)()) +{ + notImplemented(); +} + +} // namespace WebCore diff --git a/WebCore/platform/graphics/wince/GradientWince.cpp b/WebCore/platform/graphics/wince/GradientWince.cpp new file mode 100644 index 0000000..49fa970 --- /dev/null +++ b/WebCore/platform/graphics/wince/GradientWince.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#include "config.h" +#include "Gradient.h" + +#include "GraphicsContext.h" + +namespace WebCore { + +void Gradient::platformDestroy() +{ +} + +static inline bool compareStops(const Gradient::ColorStop& a, const Gradient::ColorStop& b) +{ + return a.stop < b.stop; +} + +const Vector<Gradient::ColorStop>& Gradient::getStops() const +{ + if (!m_stopsSorted) { + if (m_stops.size()) + std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); + m_stopsSorted = true; + } + return m_stops; +} + +void Gradient::fill(GraphicsContext* c, const FloatRect& r) +{ + c->fillRect(r, this); +} + +} diff --git a/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h b/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h new file mode 100644 index 0000000..ff38ada --- /dev/null +++ b/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS 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 MediaPlayerPrivateWince_h +#define MediaPlayerPrivateWince_h + +#if ENABLE(VIDEO) + +#include "MediaPlayerPrivate.h" +#include "Timer.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + + class GraphicsContext; + class IntSize; + class IntRect; + class String; + + class MediaPlayerPrivate : public MediaPlayerPrivateInterface { + public: + static void registerMediaEngine(MediaEngineRegistrar); + + ~MediaPlayerPrivate(); + + IntSize naturalSize() const; + bool hasVideo() const; + + void load(const String& url); + void cancelLoad(); + + void play(); + void pause(); + + bool paused() const; + bool seeking() const; + + float duration() const; + float currentTime() const; + void seek(float time); + void setEndTime(float); + + void setRate(float); + void setVolume(float); + + int dataRate() const; + + MediaPlayer::NetworkState networkState() const { return m_networkState; } + MediaPlayer::ReadyState readyState() const { return m_readyState; } + + float maxTimeBuffered() const; + float maxTimeSeekable() const; + unsigned bytesLoaded() const; + bool totalBytesKnown() const; + unsigned totalBytes() const; + + void setVisible(bool); + void setSize(const IntSize&); + + void loadStateChanged(); + void didEnd(); + + void paint(GraphicsContext*, const IntRect&); + + private: + MediaPlayerPrivate(MediaPlayer*); + + void updateStates(); + void doSeek(); + void cancelSeek(); + void seekTimerFired(Timer<MediaPlayerPrivate>*); + float maxTimeLoaded() const; + void sawUnsupportedTracks(); +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + void setMediaPlayerProxy(WebMediaPlayerProxy*); + void setPoster(const String& url); + void deliverNotification(MediaPlayerProxyNotificationType); +#endif + + // engine support + static MediaPlayerPrivateInterface* create(MediaPlayer*); + static void getSupportedTypes(HashSet<String>& types); + static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs); + static bool isAvailable(); + + MediaPlayer* m_player; + float m_seekTo; + float m_endTime; + Timer<MediaPlayerPrivate> m_seekTimer; + MediaPlayer::NetworkState m_networkState; + MediaPlayer::ReadyState m_readyState; + unsigned m_enabledTrackCount; + unsigned m_totalTrackCount; + bool m_hasUnsupportedTracks; + bool m_startedPlaying; + bool m_isStreaming; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + WebMediaPlayerProxy* m_proxy; +#endif + }; + +} + +#endif + +#endif diff --git a/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp b/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp new file mode 100644 index 0000000..9673d18 --- /dev/null +++ b/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2009 Torch Mobile, 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. + */ + +#if ENABLE(VIDEO) + +#include "config.h" +#include "MediaPlayerProxy.h" + +#include "c_class.h" +#include "c_instance.h" +#include "c_runtime.h" +#include "DocumentLoader.h" +#include "HTMLPlugInElement.h" +#include "HTMLVideoElement.h" +#include "JSDOMBinding.h" +#include "JSPluginElementFunctions.h" +#include "MediaPlayer.h" +#include "Node.h" +#include "npruntime_impl.h" +#include "PlatformString.h" +#include "PluginView.h" +#include "RenderPartObject.h" +#include "RenderWidget.h" +#include "runtime.h" +#include <runtime/Identifier.h> +#include "Widget.h" + +using namespace JSC; + +namespace WebCore { + +using namespace Bindings; +using namespace HTMLNames; + +WebMediaPlayerProxy::WebMediaPlayerProxy(MediaPlayer* player) + : m_mediaPlayer(player) + , m_init(false) + , m_hasSentResponseToPlugin(false) +{ + if (!m_init) + initEngine(); +} + +WebMediaPlayerProxy::~WebMediaPlayerProxy() +{ + m_instance.release(); +} + +ScriptInstance WebMediaPlayerProxy::pluginInstance() +{ + if (!m_instance) { + RenderObject* r = element()->renderer(); + if (!r || !r->isWidget()) + return 0; + + Frame* frame = element()->document()->frame(); + + RenderWidget* renderWidget = static_cast<RenderWidget*>(element()->renderer()); + if (renderWidget && renderWidget->widget()) + m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget()); + } + + return m_instance; +} + +void WebMediaPlayerProxy::load(const String& url) +{ + if (!m_init) + initEngine(); + if (m_init) + invokeMethod("play"); +} + +void WebMediaPlayerProxy::initEngine() +{ + HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_mediaPlayer->mediaPlayerClient()); + String url = element->initialURL(); + + if (url.isEmpty()) + return; + + Frame* frame = element->document()->frame(); + Vector<String> paramNames; + Vector<String> paramValues; + String serviceType; + + // add all attributes set on the embed object + if (NamedNodeMap* attributes = element->attributes()) { + for (unsigned i = 0; i < attributes->length(); ++i) { + Attribute* it = attributes->attributeItem(i); + paramNames.append(it->name().localName().string()); + paramValues.append(it->value().string()); + } + } + serviceType = "application/x-mplayer2"; + frame->loader()->requestObject(static_cast<RenderPartObject*>(element->renderer()), url, nullAtom, serviceType, paramNames, paramValues); + m_init = true; + +} + +HTMLMediaElement* WebMediaPlayerProxy::element() +{ + return static_cast<HTMLMediaElement*>(m_mediaPlayer->mediaPlayerClient()); + +} + +void WebMediaPlayerProxy::invokeMethod(const String& methodName) +{ + Frame* frame = element()->document()->frame(); + RootObject *root = frame->script()->bindingRootObject(); + if (!root) + return; + ExecState *exec = root->globalObject()->globalExec(); + Instance* instance = pluginInstance().get(); + if (!instance) + return; + + instance->begin(); + Class *aClass = instance->getClass(); + Identifier iden(exec, methodName); + MethodList methodList = aClass->methodsNamed(iden, instance); + ArgList args; + instance->invokeMethod(exec, methodList , args); + instance->end(); +} + +} + +#endif diff --git a/WebCore/platform/graphics/wince/MediaPlayerProxy.h b/WebCore/platform/graphics/wince/MediaPlayerProxy.h new file mode 100644 index 0000000..05f9b21 --- /dev/null +++ b/WebCore/platform/graphics/wince/MediaPlayerProxy.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2009 Torch Mobile, 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 MediaPlayerProxy_h +#define MediaPlayerProxy_h + +#if ENABLE(VIDEO) + +#include "ScriptInstance.h" + +namespace WebCore { + + class IntRect; + class IntSize; + class String; + class MediaPlayer; + class PluginView; + class HTMLMediaElement; + + enum MediaPlayerProxyNotificationType { + MediaPlayerNotificationPlayPauseButtonPressed, + Idle, + Loading, + Loaded, + FormatError, + NetworkError, + DecodeError + }; + + class WebMediaPlayerProxy { + public: + WebMediaPlayerProxy(MediaPlayer* player); + ~WebMediaPlayerProxy(); + + MediaPlayer* mediaPlayer() {return m_mediaPlayer;} + void initEngine(); + void load(const String& url); + HTMLMediaElement* element(); + void invokeMethod(const String& methodName); + ScriptInstance pluginInstance(); + + private: + MediaPlayer* m_mediaPlayer; + bool m_init; + WebCore::PluginView* m_pluginView; + bool m_hasSentResponseToPlugin; + ScriptInstance m_instance; + }; + +} +#endif // ENABLE(VIDEO) + +#endif diff --git a/WebCore/platform/graphics/wince/PathWince.cpp b/WebCore/platform/graphics/wince/PathWince.cpp new file mode 100644 index 0000000..7589ccb --- /dev/null +++ b/WebCore/platform/graphics/wince/PathWince.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, 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. + */ + +#include "config.h" +#include "Path.h" + +#include "FloatRect.h" +#include "NotImplemented.h" +#include "PlatformPathWince.h" +#include "PlatformString.h" +#include "TransformationMatrix.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + +Path::Path() + : m_path(new PlatformPath()) +{ +} + +Path::Path(const Path& other) + : m_path(new PlatformPath(*other.m_path)) +{ +} + +Path::~Path() +{ + delete m_path; +} + +Path& Path::operator=(const Path& other) +{ + if (&other != this) { + delete m_path; + m_path = new PlatformPath(*other.m_path); + } + return *this; +} + +bool Path::contains(const FloatPoint& point, WindRule rule) const +{ + return m_path->contains(point, rule); +} + +void Path::translate(const FloatSize& size) +{ + m_path->translate(size); +} + +FloatRect Path::boundingRect() const +{ + return m_path->boundingRect(); +} + +void Path::moveTo(const FloatPoint& point) +{ + m_path->moveTo(point); +} + +void Path::addLineTo(const FloatPoint& point) +{ + m_path->addLineTo(point); +} + +void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) +{ + m_path->addQuadCurveTo(cp, p); +} + +void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) +{ + m_path->addBezierCurveTo(cp1, cp2, p); +} + +void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) +{ + m_path->addArcTo(p1, p2, radius); +} + +void Path::closeSubpath() +{ + m_path->closeSubpath(); +} + +void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise) +{ + m_path->addEllipse(p, r, r, sar, ear, anticlockwise); +} + +void Path::addRect(const FloatRect& r) +{ + m_path->addRect(r); +} + +void Path::addEllipse(const FloatRect& r) +{ + m_path->addEllipse(r); +} + +void Path::clear() +{ + m_path->clear(); +} + +bool Path::isEmpty() const +{ + return m_path->isEmpty(); +} + +String Path::debugString() const +{ + return m_path->debugString(); +} + +void Path::apply(void* info, PathApplierFunction function) const +{ + m_path->apply(info, function); +} + +void Path::transform(const TransformationMatrix& t) +{ + m_path->transform(t); +} + +FloatRect Path::strokeBoundingRect(StrokeStyleApplier *) +{ + notImplemented(); + return FloatRect(); +} + +bool Path::strokeContains(StrokeStyleApplier*, const FloatPoint&) const +{ + notImplemented(); + return false; +} + +bool Path::hasCurrentPoint() const +{ + // Not sure if this is correct. At the meantime, we do what other ports + // do. + // See https://bugs.webkit.org/show_bug.cgi?id=27266, + // https://bugs.webkit.org/show_bug.cgi?id=27187, and + // http://trac.webkit.org/changeset/45873 + return !isEmpty(); +} + +} diff --git a/WebCore/platform/graphics/wince/PlatformPathWince.cpp b/WebCore/platform/graphics/wince/PlatformPathWince.cpp new file mode 100644 index 0000000..66fad50 --- /dev/null +++ b/WebCore/platform/graphics/wince/PlatformPathWince.cpp @@ -0,0 +1,810 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, 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. + */ + +#include "config.h" +#include "PlatformPathWince.h" + +#include "FloatRect.h" +#include "GraphicsContext.h" +#include "Path.h" +#include "PlatformString.h" +#include "TransformationMatrix.h" +#include "WinceGraphicsExtras.h" +#include <wtf/MathExtras.h> +#include <wtf/OwnPtr.h> + +#include <windows.h> + +namespace WebCore { + +// Implemented in GraphicsContextWince.cpp +void getEllipsePointByAngle(double angle, double a, double b, float& x, float& y); + +static void quadCurve(int segments, Vector<PathPoint>& pts, const PathPoint* control) +{ + const float step = 1.0 / segments; + register float tA = 0.0; + register float tB = 1.0; + + float c1x = control[0].x(); + float c1y = control[0].y(); + float c2x = control[1].x(); + float c2y = control[1].y(); + float c3x = control[2].x(); + float c3y = control[2].y(); + + const int offset = pts.size(); + pts.resize(offset + segments); + PathPoint pp; + pp.m_x = c1x; + pp.m_y = c1y; + + for (int i = 1; i < segments; ++i) { + tA += step; + tB -= step; + + const float a = tB * tB; + const float b = 2.0 * tA * tB; + const float c = tA * tA; + + pp.m_x = c1x * a + c2x * b + c3x * c; + pp.m_y = c1y * a + c2y * b + c3y * c; + + pts[offset + i - 1] = pp; + } + + pp.m_x = c3x; + pp.m_y = c3y; + pts[offset + segments - 1] = pp; +} + +static inline void bezier(int segments, Vector<PathPoint>& pts, const PathPoint* control) +{ + const float step = 1.0 / segments; + register float tA = 0.0; + register float tB = 1.0; + + float c1x = control[0].x(); + float c1y = control[0].y(); + float c2x = control[1].x(); + float c2y = control[1].y(); + float c3x = control[2].x(); + float c3y = control[2].y(); + float c4x = control[3].x(); + float c4y = control[3].y(); + + const int offset = pts.size(); + pts.resize(offset + segments); + PathPoint pp; + pp.m_x = c1x; + pp.m_y = c1y; + + for (int i = 1; i < segments; ++i) { + tA += step; + tB -= step; + const float tAsq = tA * tA; + const float tBsq = tB * tB; + + const float a = tBsq * tB; + const float b = 3.0 * tA * tBsq; + const float c = 3.0 * tB * tAsq; + const float d = tAsq * tA; + + pp.m_x = c1x * a + c2x * b + c3x * c + c4x * d; + pp.m_y = c1y * a + c2y * b + c3y * c + c4y * d; + + pts[offset + i - 1] = pp; + } + + pp.m_x = c4x; + pp.m_y = c4y; + pts[offset + segments - 1] = pp; +} + +static bool containsPoint(const FloatRect& r, const FloatPoint& p) +{ + return p.x() >= r.x() && p.y() >= r.y() && p.x() < r.right() && p.y() < r.bottom(); +} + +static void normalizeAngle(float& angle) +{ + angle = fmod(angle, 2 * piFloat); + if (angle < 0) + angle += 2 * piFloat; + if (angle < 0.00001f) + angle = 0; +} + +static void transformArcPoint(float& x, float& y, const FloatPoint& c) +{ + x += c.x(); + y += c.y(); +} + +static void inflateRectToContainPoint(FloatRect& r, float x, float y) +{ + if (r.isEmpty()) { + r.setX(x); + r.setY(y); + r.setSize(FloatSize(1, 1)); + return; + } + if (x < r.x()) { + r.setWidth(r.right() - x); + r.setX(x); + } else { + float w = x - r.x() + 1; + if (w > r.width()) + r.setWidth(w); + } + if (y < r.y()) { + r.setHeight(r.bottom() - y); + r.setY(y); + } else { + float h = y - r.y() + 1; + if (h > r.height()) + r.setHeight(h); + } +} + +// return 0-based value: 0 - first Quadrant ( 0 - 90 degree) +static inline int quadrant(const PathPoint& point, const PathPoint& origin) +{ + return point.m_x < origin.m_x ? + (point.m_y < origin.m_y ? 2 : 1) + : (point.m_y < origin.m_y ? 3 : 0); +} + +static inline bool isQuadrantOnLeft(int q) { return q == 1 || q == 2; } +static inline bool isQuadrantOnRight(int q) { return q == 0 || q == 3; } +static inline bool isQuadrantOnTop(int q) { return q == 2 || q == 3; } +static inline bool isQuadrantOnBottom(int q) { return q == 0 || q == 1; } + +static inline int nextQuadrant(int q) { return q == 3 ? 0 : q + 1; } +static inline int quadrantDiff(int q1, int q2) +{ + int d = q1 - q2; + while (d < 0) + d += 4; + return d; +} + +struct PathVector { + float m_x; + float m_y; + + PathVector() : m_x(0), m_y(0) {} + PathVector(float x, float y) : m_x(x), m_y(y) {} + double angle() const { return atan2(m_y, m_x); } + operator double () const { return angle(); } + double length() const { return _hypot(m_x, m_y); } +}; + +PathVector operator-(const PathPoint& p1, const PathPoint& p2) +{ + return PathVector(p1.m_x - p2.m_x, p1.m_y - p2.m_y); +} + +static void addArcPoint(PathPolygon& poly, const PathPoint& center, const PathPoint& radius, double angle) +{ + PathPoint p; + getEllipsePointByAngle(angle, radius.m_x, radius.m_y, p.m_x, p.m_y); + transformArcPoint(p.m_x, p.m_y, center); + if (poly.isEmpty() || poly.last() != p) + poly.append(p); +} + +static void addArcPoints(PathPolygon& poly, const PlatformPathElement::ArcTo& data) +{ + const PathPoint& startPoint = poly.last(); + double curAngle = startPoint - data.m_center; + double endAngle = data.m_end - data.m_center; + double angleStep = 2. / std::max(data.m_radius.m_x, data.m_radius.m_y); + if (data.m_clockwise) { + if (endAngle <= curAngle || startPoint == data.m_end) + endAngle += 2 * piDouble; + } else { + angleStep = -angleStep; + if (endAngle >= curAngle || startPoint == data.m_end) + endAngle -= 2 * piDouble; + } + + for (curAngle += angleStep; data.m_clockwise ? curAngle < endAngle : curAngle > endAngle; curAngle += angleStep) + addArcPoint(poly, data.m_center, data.m_radius, curAngle); + + if (poly.isEmpty() || poly.last() != data.m_end) + poly.append(data.m_end); +} + +static void drawPolygons(HDC dc, const Vector<PathPolygon>& polygons, bool fill, const TransformationMatrix* transformation) +{ + MemoryAllocationCanFail canFail; + for (Vector<PathPolygon>::const_iterator i = polygons.begin(); i != polygons.end(); ++i) { + int npoints = i->size(); + if (!npoints) + continue; + + POINT* winPoints = 0; + if (fill) { + if (npoints > 2) + winPoints = new POINT[npoints + 1]; + } else + winPoints = new POINT[npoints]; + + if (winPoints) { + if (transformation) { + for (int i2 = 0; i2 < npoints; ++i2) { + FloatPoint trPoint = transformation->mapPoint(i->at(i2)); + winPoints[i2].x = stableRound(trPoint.x()); + winPoints[i2].y = stableRound(trPoint.y()); + } + } else { + for (int i2 = 0; i2 < npoints; ++i2) { + winPoints[i2].x = stableRound(i->at(i2).x()); + winPoints[i2].y = stableRound(i->at(i2).y()); + } + } + + if (fill && winPoints[npoints - 1] != winPoints[0]) { + winPoints[npoints].x = winPoints[0].x; + winPoints[npoints].y = winPoints[0].y; + ++npoints; + } + + if (fill) + ::Polygon(dc, winPoints, npoints); + else + ::Polyline(dc, winPoints, npoints); + delete[] winPoints; + } + } +} + + +int PlatformPathElement::numControlPoints() const +{ + switch (m_type) { + case PathMoveTo: + case PathLineTo: + return 1; + case PathQuadCurveTo: + case PathArcTo: + return 2; + case PathBezierCurveTo: + return 3; + default: + ASSERT(m_type == PathCloseSubpath); + return 0; + } +} + +int PlatformPathElement::numPoints() const +{ + switch (m_type) { + case PathMoveTo: + case PathLineTo: + case PathArcTo: + return 1; + case PathQuadCurveTo: + return 2; + case PathBezierCurveTo: + return 3; + default: + ASSERT(m_type == PathCloseSubpath); + return 0; + } +} + +void PathPolygon::move(const FloatSize& offset) +{ + for (Vector<PathPoint>::iterator i = begin(); i < end(); ++i) + i->move(offset); +} + +void PathPolygon::transform(const TransformationMatrix& t) +{ + for (Vector<PathPoint>::iterator i = begin(); i < end(); ++i) + *i = t.mapPoint(*i); +} + +bool PathPolygon::contains(const FloatPoint& point) const +{ + if (size() < 3) + return false; + + // Test intersections between the polygon and the vertical line: x = point.x() + + int intersected = 0; + const PathPoint* point1 = &last(); + Vector<PathPoint>::const_iterator last = end(); + // wasNegative: -1 means unknown, 0 means false, 1 means true. + int wasNegative = -1; + for (Vector<PathPoint>::const_iterator i = begin(); i != last; ++i) { + const PathPoint& point2 = *i; + if (point1->x() != point.x()) { + if (point2.x() == point.x()) { + // We are getting on the vertical line + wasNegative = point1->x() < point.x() ? 1 : 0; + } else if (point2.x() < point.x() != point1->x() < point.x()) { + float y = (point2.y() - point1->y()) / (point2.x() - point1->x()) * (point.x() - point1->x()) + point1->y(); + if (y >= point.y()) + ++intersected; + } + } else { + // We were on the vertical line + + // handle special case + if (point1->y() == point.y()) + return true; + + if (point1->y() > point.y()) { + if (point2.x() == point.x()) { + // see if the point is on this segment + if (point2.y() <= point.y()) + return true; + + // We are still on the line + } else { + // We are leaving the line now. + // We have to get back to see which side we come from. If we come from + // the same side we are leaving, no intersection should be counted + if (wasNegative < 0) { + Vector<PathPoint>::const_iterator jLast = i; + Vector<PathPoint>::const_iterator j = i; + do { + if (j == begin()) + j = last; + else + --j; + if (j->x() != point.x()) { + if (j->x() > point.x()) + wasNegative = 0; + else + wasNegative = 1; + break; + } + } while (j != jLast); + + if (wasNegative < 0) + return false; + } + if (wasNegative ? point2.x() > point.x() : point2.x() < point.x()) + ++intersected; + } + } else if (point2.x() == point.x() && point2.y() >= point.y()) + return true; + } + point1 = &point2; + } + + return intersected & 1; +} + +void PlatformPathElement::move(const FloatSize& offset) +{ + int n = numControlPoints(); + for (int i = 0; i < n; ++i) + m_data.m_points[i].move(offset); +} + +void PlatformPathElement::transform(const TransformationMatrix& t) +{ + int n = numControlPoints(); + for (int i = 0; i < n; ++i) { + FloatPoint p = t.mapPoint(m_data.m_points[i]); + m_data.m_points[i].set(p.x(), p.y()); + } +} + +void PlatformPathElement::inflateRectToContainMe(FloatRect& r, const FloatPoint& lastPoint) const +{ + if (m_type == PathArcTo) { + const ArcTo& data = m_data.m_arcToData; + PathPoint startPoint; + startPoint = lastPoint; + PathPoint endPoint = data.m_end; + if (!data.m_clockwise) + std::swap(startPoint, endPoint); + + int q0 = quadrant(startPoint, data.m_center); + int q1 = quadrant(endPoint, data.m_center); + bool containsExtremes[4] = { false }; // bottom, left, top, right + static const PathPoint extremeVectors[4] = { { 0, 1 }, { -1, 0 }, { 0, -1 }, { 1, 0 } }; + if (q0 == q1) { + if (startPoint.m_x == endPoint.m_x || isQuadrantOnBottom(q0) != startPoint.m_x > endPoint.m_x) { + for (int i = 0; i < 4; ++i) + containsExtremes[i] = true; + } + } else { + int extreme = q0; + int diff = quadrantDiff(q1, q0); + for (int i = 0; i < diff; ++i) { + containsExtremes[extreme] = true; + extreme = nextQuadrant(extreme); + } + } + + inflateRectToContainPoint(r, startPoint.m_x, startPoint.m_y); + inflateRectToContainPoint(r, endPoint.m_x, endPoint.m_y); + for (int i = 0; i < 4; ++i) { + if (containsExtremes[i]) + inflateRectToContainPoint(r, data.m_center.m_x + data.m_radius.m_x * extremeVectors[i].m_x, data.m_center.m_y + data.m_radius.m_y * extremeVectors[i].m_y); + } + } else { + int n = numPoints(); + for (int i = 0; i < n; ++i) + inflateRectToContainPoint(r, m_data.m_points[i].m_x, m_data.m_points[i].m_y); + } +} + +PathElementType PlatformPathElement::type() const +{ + switch (m_type) { + case PathMoveTo: + return PathElementMoveToPoint; + case PathLineTo: + return PathElementAddLineToPoint; + case PathArcTo: + // FIXME: there's no arcTo type for PathElement + return PathElementAddLineToPoint; + // return PathElementAddQuadCurveToPoint; + case PathQuadCurveTo: + return PathElementAddQuadCurveToPoint; + case PathBezierCurveTo: + return PathElementAddCurveToPoint; + default: + ASSERT(m_type == PathCloseSubpath); + return PathElementCloseSubpath; + } +} + +PlatformPath::PlatformPath() + : m_penLifted(true) +{ + m_currentPoint.clear(); +} + +void PlatformPath::ensureSubpath() +{ + if (m_penLifted) { + m_penLifted = false; + m_subpaths.append(PathPolygon()); + m_subpaths.last().append(m_currentPoint); + } else + ASSERT(!m_subpaths.isEmpty()); +} + +void PlatformPath::addToSubpath(const PlatformPathElement& e) +{ + if (e.platformType() == PlatformPathElement::PathMoveTo) { + m_penLifted = true; + m_currentPoint = e.pointAt(0); + } else if (e.platformType() == PlatformPathElement::PathCloseSubpath) { + m_penLifted = true; + if (!m_subpaths.isEmpty()) { + if (m_currentPoint != m_subpaths.last()[0]) { + // According to W3C, we have to draw a line from current point to the initial point + m_subpaths.last().append(m_subpaths.last()[0]); + m_currentPoint = m_subpaths.last()[0]; + } + } else + m_currentPoint.clear(); + } else { + ensureSubpath(); + switch (e.platformType()) { + case PlatformPathElement::PathLineTo: + m_subpaths.last().append(e.pointAt(0)); + break; + case PlatformPathElement::PathArcTo: + addArcPoints(m_subpaths.last(), e.arcTo()); + break; + case PlatformPathElement::PathQuadCurveTo: + { + PathPoint control[] = { + m_currentPoint, + e.pointAt(0), + e.pointAt(1), + }; + // FIXME: magic number? + quadCurve(50, m_subpaths.last(), control); + } + break; + case PlatformPathElement::PathBezierCurveTo: + { + PathPoint control[] = { + m_currentPoint, + e.pointAt(0), + e.pointAt(1), + e.pointAt(2), + }; + // FIXME: magic number? + bezier(100, m_subpaths.last(), control); + } + break; + default: + ASSERT_NOT_REACHED(); + break; + } + m_currentPoint = m_subpaths.last().last(); + } +} + +void PlatformPath::append(const PlatformPathElement& e) +{ + e.inflateRectToContainMe(m_boundingRect, lastPoint()); + addToSubpath(e); + m_elements.append(e); +} + +void PlatformPath::append(const PlatformPath& p) +{ + const PlatformPathElements& e = p.elements(); + for (PlatformPathElements::const_iterator it(e.begin()); it != e.end(); ++it) { + addToSubpath(*it); + it->inflateRectToContainMe(m_boundingRect, lastPoint()); + m_elements.append(*it); + } +} + +void PlatformPath::clear() +{ + m_elements.clear(); + m_boundingRect = FloatRect(); + m_subpaths.clear(); + m_currentPoint.clear(); + m_penLifted = true; +} + +void PlatformPath::strokePath(HDC dc, const TransformationMatrix* transformation) const +{ + drawPolygons(dc, m_subpaths, false, transformation); +} + +void PlatformPath::fillPath(HDC dc, const TransformationMatrix* transformation) const +{ + HGDIOBJ oldPen = SelectObject(dc, GetStockObject(NULL_PEN)); + drawPolygons(dc, m_subpaths, true, transformation); + SelectObject(dc, oldPen); +} + +void PlatformPath::translate(const FloatSize& size) +{ + for (PlatformPathElements::iterator it(m_elements.begin()); it != m_elements.end(); ++it) + it->move(size); + + m_boundingRect.move(size); + for (Vector<PathPolygon>::iterator it = m_subpaths.begin(); it != m_subpaths.end(); ++it) + it->move(size); +} + +void PlatformPath::transform(const TransformationMatrix& t) +{ + for (PlatformPathElements::iterator it(m_elements.begin()); it != m_elements.end(); ++it) + it->transform(t); + + m_boundingRect = t.mapRect(m_boundingRect); + for (Vector<PathPolygon>::iterator it = m_subpaths.begin(); it != m_subpaths.end(); ++it) + it->transform(t); +} + +bool PlatformPath::contains(const FloatPoint& point, WindRule rule) const +{ + // optimization: check the bounding rect first + if (!containsPoint(m_boundingRect, point)) + return false; + + for (Vector<PathPolygon>::const_iterator i = m_subpaths.begin(); i != m_subpaths.end(); ++i) { + if (i->contains(point)) + return true; + } + + return false; +} + +void PlatformPath::moveTo(const FloatPoint& point) +{ + PlatformPathElement::MoveTo data = { { point.x(), point.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addLineTo(const FloatPoint& point) +{ + PlatformPathElement::LineTo data = { { point.x(), point.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) +{ + PlatformPathElement::QuadCurveTo data = { { cp.x(), cp.y() }, { p.x(), p.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) +{ + PlatformPathElement::BezierCurveTo data = { { cp1.x(), cp1.y() }, { cp2.x(), cp2.y() }, { p.x(), p.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addArcTo(const FloatPoint& fp1, const FloatPoint& fp2, float radius) +{ + const PathPoint& p0 = m_currentPoint; + PathPoint p1; + p1 = fp1; + PathPoint p2; + p2 = fp2; + if (!radius || p0 == p1 || p1 == p2) { + addLineTo(p1); + return; + } + + PathVector v01 = p0 - p1; + PathVector v21 = p2 - p1; + + // sin(A - B) = sin(A) * cos(B) - sin(B) * cos(A) + double cross = v01.m_x * v21.m_y - v01.m_y * v21.m_x; + + if (fabs(cross) < 1E-10) { + // on one line + addLineTo(p1); + return; + } + + double d01 = v01.length(); + double d21 = v21.length(); + double angle = (piDouble - abs(asin(cross / (d01 * d21)))) * 0.5; + double span = radius * tan(angle); + double rate = span / d01; + PathPoint startPoint; + startPoint.m_x = p1.m_x + v01.m_x * rate; + startPoint.m_y = p1.m_y + v01.m_y * rate; + + addLineTo(startPoint); + + PathPoint endPoint; + rate = span / d21; + endPoint.m_x = p1.m_x + v21.m_x * rate; + endPoint.m_y = p1.m_y + v21.m_y * rate; + + PathPoint midPoint; + midPoint.m_x = (startPoint.m_x + endPoint.m_x) * 0.5; + midPoint.m_y = (startPoint.m_y + endPoint.m_y) * 0.5; + + PathVector vm1 = midPoint - p1; + double dm1 = vm1.length(); + double d = _hypot(radius, span); + + PathPoint centerPoint; + rate = d / dm1; + centerPoint.m_x = p1.m_x + vm1.m_x * rate; + centerPoint.m_y = p1.m_y + vm1.m_y * rate; + + PlatformPathElement::ArcTo data = { + endPoint, + centerPoint, + { radius, radius }, + cross < 0 + }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::closeSubpath() +{ + PlatformPathElement pe; + append(pe); +} + +// add a circular arc centred at p with radius r from start angle sar (radians) to end angle ear +void PlatformPath::addEllipse(const FloatPoint& p, float a, float b, float sar, float ear, bool anticlockwise) +{ + float startX, startY, endX, endY; + + normalizeAngle(sar); + normalizeAngle(ear); + + getEllipsePointByAngle(sar, a, b, startX, startY); + getEllipsePointByAngle(ear, a, b, endX, endY); + + transformArcPoint(startX, startY, p); + transformArcPoint(endX, endY, p); + + FloatPoint start(startX, startY); + moveTo(start); + + PlatformPathElement::ArcTo data = { { endX, endY }, { p.x(), p.y() }, { a, b }, !anticlockwise }; + PlatformPathElement pe(data); + append(pe); +} + + +void PlatformPath::addRect(const FloatRect& r) +{ + moveTo(r.location()); + + float right = r.right() - 1; + float bottom = r.bottom() - 1; + addLineTo(FloatPoint(right, r.y())); + addLineTo(FloatPoint(right, bottom)); + addLineTo(FloatPoint(r.x(), bottom)); + addLineTo(r.location()); +} + +void PlatformPath::addEllipse(const FloatRect& r) +{ + FloatSize radius(r.width() * 0.5, r.height() * 0.5); + addEllipse(r.location() + radius, radius.width(), radius.height(), 0, 0, true); +} + +String PlatformPath::debugString() const +{ + String ret; + for (PlatformPathElements::const_iterator i(m_elements.begin()); i != m_elements.end(); ++i) { + switch (i->platformType()) { + case PlatformPathElement::PathMoveTo: + case PlatformPathElement::PathLineTo: + ret += String::format("M %f %f\n", i->pointAt(0).m_x, i->pointAt(0).m_y); + break; + case PlatformPathElement::PathArcTo: + ret += String::format("A %f %f %f %f %f %f %c\n" + , i->arcTo().m_end.m_x, i->arcTo().m_end.m_y + , i->arcTo().m_center.m_x, i->arcTo().m_center.m_y + , i->arcTo().m_radius.m_x, i->arcTo().m_radius.m_y + , i->arcTo().m_clockwise? 'Y' : 'N'); + break; + case PlatformPathElement::PathQuadCurveTo: + ret += String::format("Q %f %f %f %f\n" + , i->pointAt(0).m_x, i->pointAt(0).m_y + , i->pointAt(1).m_x, i->pointAt(1).m_y); + break; + case PlatformPathElement::PathBezierCurveTo: + ret += String::format("B %f %f %f %f %f %f\n" + , i->pointAt(0).m_x, i->pointAt(0).m_y + , i->pointAt(1).m_x, i->pointAt(1).m_y + , i->pointAt(2).m_x, i->pointAt(2).m_y); + break; + default: + ASSERT(i->platformType() == PlatformPathElement::PathCloseSubpath); + ret += "S\n"; + break; + } + } + + return ret; +} + +void PlatformPath::apply(void* info, PathApplierFunction function) const +{ + PathElement pelement; + FloatPoint points[3]; + pelement.points = points; + + for (PlatformPathElements::const_iterator it(m_elements.begin()); it != m_elements.end(); ++it) { + pelement.type = it->type(); + int n = it->numPoints(); + for (int i = 0; i < n; ++i) + points[i] = it->pointAt(i); + function(info, &pelement); + } +} + +} // namespace Webcore diff --git a/WebCore/platform/graphics/wince/PlatformPathWince.h b/WebCore/platform/graphics/wince/PlatformPathWince.h new file mode 100644 index 0000000..fca00a7 --- /dev/null +++ b/WebCore/platform/graphics/wince/PlatformPathWince.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, 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 PlatformPathWince_h +#define PlatformPathWince_h + +namespace WebCore { + + class GraphicsContext; + + struct PathPoint { + float m_x; + float m_y; + const float& x() const { return m_x; } + const float& y() const { return m_y; } + void set(float x, float y) + { + m_x = x; + m_y = y; + }; + operator FloatPoint() const { return FloatPoint(m_x, m_y); } + void move(const FloatSize& offset) + { + m_x += offset.width(); + m_y += offset.height(); + } + PathPoint& operator=(const FloatPoint& p) + { + m_x = p.x(); + m_y = p.y(); + return *this; + } + void clear() { m_x = m_y = 0; } + }; + + struct PathPolygon: public Vector<PathPoint> { + void move(const FloatSize& offset); + void transform(const TransformationMatrix& t); + bool contains(const FloatPoint& point) const; + }; + + class PlatformPathElement { + public: + enum PlaformPathElementType { + PathMoveTo, + PathLineTo, + PathArcTo, + PathQuadCurveTo, + PathBezierCurveTo, + PathCloseSubpath, + }; + + struct MoveTo { + PathPoint m_end; + }; + + struct LineTo { + PathPoint m_end; + }; + + struct ArcTo { + PathPoint m_end; + PathPoint m_center; + PathPoint m_radius; + bool m_clockwise; + }; + + struct QuadCurveTo { + PathPoint m_point0; + PathPoint m_point1; + }; + + struct BezierCurveTo { + PathPoint m_point0; + PathPoint m_point1; + PathPoint m_point2; + }; + + PlatformPathElement(): m_type(PathCloseSubpath) { m_data.m_points[0].set(0, 0); } + PlatformPathElement(const MoveTo& data): m_type(PathMoveTo) { m_data.m_moveToData = data; } + PlatformPathElement(const LineTo& data): m_type(PathLineTo) { m_data.m_lineToData = data; } + PlatformPathElement(const ArcTo& data): m_type(PathArcTo) { m_data.m_arcToData = data; } + PlatformPathElement(const QuadCurveTo& data): m_type(PathQuadCurveTo) { m_data.m_quadCurveToData = data; } + PlatformPathElement(const BezierCurveTo& data): m_type(PathBezierCurveTo) { m_data.m_bezierCurveToData = data; } + + const MoveTo& moveTo() const { return m_data.m_moveToData; } + const LineTo& lineTo() const { return m_data.m_lineToData; } + const ArcTo& arcTo() const { return m_data.m_arcToData; } + const QuadCurveTo& quadCurveTo() const { return m_data.m_quadCurveToData; } + const BezierCurveTo& bezierCurveTo() const { return m_data.m_bezierCurveToData; } + const PathPoint& lastPoint() const + { + int n = numPoints(); + return n > 1 ? m_data.m_points[n - 1] : m_data.m_points[0]; + } + const PathPoint& pointAt(int index) const { return m_data.m_points[index]; } + int numPoints() const; + int numControlPoints() const; + void move(const FloatSize& offset); + void transform(const TransformationMatrix& t); + PathElementType type() const; + PlaformPathElementType platformType() const { return m_type; } + void inflateRectToContainMe(FloatRect& r, const FloatPoint& lastPoint) const; + + private: + PlaformPathElementType m_type; + union { + MoveTo m_moveToData; + LineTo m_lineToData; + ArcTo m_arcToData; + QuadCurveTo m_quadCurveToData; + BezierCurveTo m_bezierCurveToData; + PathPoint m_points[4]; + } m_data; + }; + + typedef Vector<PlatformPathElement> PlatformPathElements; + + class PlatformPath { + public: + PlatformPath(); + const PlatformPathElements& elements() const { return m_elements; } + void append(const PlatformPathElement& e); + void append(const PlatformPath& p); + void clear(); + bool isEmpty() const { return m_elements.isEmpty(); } + + void strokePath(HDC, const TransformationMatrix* tr) const; + void fillPath(HDC, const TransformationMatrix* tr) const; + FloatPoint lastPoint() const { return m_elements.isEmpty() ? FloatPoint(0, 0) : m_elements.last().lastPoint(); } + + const FloatRect& boundingRect() const { return m_boundingRect; } + bool contains(const FloatPoint& point, WindRule rule) const; + void translate(const FloatSize& size); + void transform(const TransformationMatrix& t); + + void moveTo(const FloatPoint&); + void addLineTo(const FloatPoint&); + void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point); + void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint&); + void addArcTo(const FloatPoint&, const FloatPoint&, float radius); + void closeSubpath(); + void addEllipse(const FloatPoint& p, float a, float b, float sar, float ear, bool anticlockwise); + void addRect(const FloatRect& r); + void addEllipse(const FloatRect& r); + String debugString() const; + void apply(void* info, PathApplierFunction function) const; + + private: + void ensureSubpath(); + void addToSubpath(const PlatformPathElement& e); + + PlatformPathElements m_elements; + FloatRect m_boundingRect; + Vector<PathPolygon> m_subpaths; + PathPoint m_currentPoint; + bool m_penLifted; + }; + +} + +#endif // PlatformPathWince_h diff --git a/WebCore/platform/graphics/wince/WinceGraphicsExtras.h b/WebCore/platform/graphics/wince/WinceGraphicsExtras.h new file mode 100644 index 0000000..2a6fae1 --- /dev/null +++ b/WebCore/platform/graphics/wince/WinceGraphicsExtras.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, 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 WinceGraphicsExtras_h +#define WinceGraphicsExtras_h + +// This file is used to contain small utilities used by WINCE graphics code. + +namespace WebCore { + // Always round to same direction. 0.5 is rounded to 1, + // and -0.5 (0.5 - 1) is rounded to 0 (1 - 1), so that it + // is consistent when transformation shifts. + static inline int stableRound(double d) + { + if (d > 0) + return static_cast<int>(d + 0.5); + + int i = static_cast<int>(d); + return i - d > 0.5 ? i - 1 : i; + } +} + +#endif WinceGraphicsExtras_h diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp index e71dbde..49f3f3b 100644 --- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -53,13 +53,24 @@ GraphicsContext* ImageBuffer::context() const return 0; } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect&) const +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { notImplemented(); return 0; } -void ImageBuffer::putImageData(ImageData*, const IntRect&, const IntPoint&) +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + notImplemented(); + return 0; +} + +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + notImplemented(); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) { notImplemented(); } diff --git a/WebCore/platform/graphics/wx/ImageSourceWx.cpp b/WebCore/platform/graphics/wx/ImageSourceWx.cpp deleted file mode 100644 index 06c165d..0000000 --- a/WebCore/platform/graphics/wx/ImageSourceWx.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Computer, 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. - */ - -#include "config.h" -#include "ImageSource.h" - -#include "BMPImageDecoder.h" -#include "GIFImageDecoder.h" -#include "ICOImageDecoder.h" -#include "JPEGImageDecoder.h" -#include "NotImplemented.h" -#include "PNGImageDecoder.h" -#include "SharedBuffer.h" -#include "XBMImageDecoder.h" - -#include <wx/defs.h> -#include <wx/bitmap.h> -#if USE(WXGC) -#include <wx/graphics.h> -#endif -#include <wx/image.h> -#include <wx/rawbmp.h> - -namespace WebCore { - -ImageDecoder* createDecoder(const SharedBuffer& data) -{ - // We need at least 4 bytes to figure out what kind of image we're dealing with. - int length = data.size(); - if (length < 4) - return 0; - - const unsigned char* uContents = (const unsigned char*)data.data(); - const char* contents = data.data(); - - // GIFs begin with GIF8(7 or 9). - if (strncmp(contents, "GIF8", 4) == 0) - return new GIFImageDecoder(); - - // Test for PNG. - if (uContents[0]==0x89 && - uContents[1]==0x50 && - uContents[2]==0x4E && - uContents[3]==0x47) - return new PNGImageDecoder(); - - // JPEG - if (uContents[0]==0xFF && - uContents[1]==0xD8 && - uContents[2]==0xFF) - return new JPEGImageDecoder(); - - // BMP - if (strncmp(contents, "BM", 2) == 0) - return new BMPImageDecoder(); - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // CURs begin with 2-byte 0 followed by 2-byte 2. - if (!memcmp(contents, "\000\000\001\000", 4) || - !memcmp(contents, "\000\000\002\000", 4)) - return new ICOImageDecoder(); - - // XBMs require 8 bytes of info. - if (length >= 8 && strncmp(contents, "#define ", 8) == 0) - return new XBMImageDecoder(); - - // Give up. We don't know what the heck this is. - return 0; -} - -ImageSource::ImageSource() - : m_decoder(0) -{} - -ImageSource::~ImageSource() -{ - clear(true); -} - -bool ImageSource::initialized() const -{ - return m_decoder; -} - -void ImageSource::setData(SharedBuffer* data, bool allDataReceived) -{ - // Make the decoder by sniffing the bytes. - // This method will examine the data and instantiate an instance of the appropriate decoder plugin. - // If insufficient bytes are available to determine the image type, no decoder plugin will be - // made. - if (m_decoder) - delete m_decoder; - m_decoder = createDecoder(*data); - if (!m_decoder) - return; - m_decoder->setData(data, allDataReceived); -} - -bool ImageSource::isSizeAvailable() -{ - if (!m_decoder) - return false; - - return m_decoder->isSizeAvailable(); -} - -IntSize ImageSource::size() const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->size(); -} - -IntSize ImageSource::frameSizeAtIndex(size_t index) const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->frameSizeAtIndex(index); -} - -int ImageSource::repetitionCount() -{ - if (!m_decoder) - return cAnimationNone; - - return m_decoder->repetitionCount(); -} - -String ImageSource::filenameExtension() const -{ - notImplemented(); - return String(); -} - -size_t ImageSource::frameCount() const -{ - return m_decoder ? m_decoder->frameCount() : 0; -} - -bool ImageSource::frameIsCompleteAtIndex(size_t index) -{ - // FIXME: should we be testing the RGBA32Buffer's status as well? - return (m_decoder && m_decoder->frameBufferAtIndex(index) != 0); -} - -void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) -{ - if (!destroyAll) { - if (m_decoder) - m_decoder->clearFrameBufferCache(clearBeforeFrame); - return; - } - - delete m_decoder; - m_decoder = 0; - if (data) - setData(data, allDataReceived); -} - -NativeImagePtr ImageSource::createFrameAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - return buffer->asNewNativeImage(); -} - -float ImageSource::frameDurationAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - float duration = buffer->duration() / 1000.0f; - - // Follow other ports (and WinIE's) behavior to slow annoying ads that - // specify a 0 duration. - if (duration < 0.051f) - return 0.100f; - return duration; -} - -bool ImageSource::frameHasAlphaAtIndex(size_t index) -{ - if (!m_decoder || !m_decoder->supportsAlpha()) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return false; - - return buffer->hasAlpha(); -} - -} diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index 8cbf590..450966e 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -17,11 +17,18 @@ #include "config.h" #include "ClipboardGtk.h" +#include "CachedImage.h" +#include "CString.h" +#include "Editor.h" +#include "Element.h" #include "FileList.h" +#include "Frame.h" +#include "markup.h" #include "NotImplemented.h" +#include "RenderImage.h" #include "StringHash.h" -#include "Editor.h" +#include <gtk/gtk.h> namespace WebCore { @@ -33,12 +40,10 @@ PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, bool forDragging) : Clipboard(policy, forDragging) { - notImplemented(); } ClipboardGtk::~ClipboardGtk() { - notImplemented(); } void ClipboardGtk::clearData(const String&) @@ -110,19 +115,65 @@ DragImageRef ClipboardGtk::createDragImage(IntPoint&) const return 0; } -void ClipboardGtk::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +static CachedImage* getCachedImage(Element* element) { - notImplemented(); + // Attempt to pull CachedImage from element + ASSERT(element); + RenderObject* renderer = element->renderer(); + if (!renderer || !renderer->isImage()) + return 0; + + RenderImage* image = static_cast<RenderImage*>(renderer); + if (image->cachedImage() && !image->cachedImage()->errorOccurred()) + return image->cachedImage(); + + return 0; } -void ClipboardGtk::writeURL(const KURL&, const String&, Frame*) +void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*) { - notImplemented(); + CachedImage* cachedImage = getCachedImage(element); + if (!cachedImage || !cachedImage->isLoaded()) + return; + + GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf(); + if (!pixbuf) + return; + + GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage")); + gtk_clipboard_clear(imageClipboard); + + gtk_clipboard_set_image(imageClipboard, pixbuf); + g_object_unref(pixbuf); + + writeURL(url, label, 0); } -void ClipboardGtk::writeRange(Range*, Frame*) +void ClipboardGtk::writeURL(const KURL& url, const String& label, Frame*) { - notImplemented(); + GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); + GtkClipboard* urlClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrl")); + GtkClipboard* urlLabelClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrlLabel")); + + gtk_clipboard_clear(textClipboard); + gtk_clipboard_clear(urlClipboard); + gtk_clipboard_clear(urlLabelClipboard); + + gtk_clipboard_set_text(textClipboard, url.string().utf8().data(), -1); + gtk_clipboard_set_text(urlClipboard, url.string().utf8().data(), -1); + gtk_clipboard_set_text(urlLabelClipboard, label.utf8().data(), -1); +} + +void ClipboardGtk::writeRange(Range* range, Frame* frame) +{ + GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); + GtkClipboard* htmlClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardHtml")); + + gtk_clipboard_clear(textClipboard); + gtk_clipboard_clear(htmlClipboard); + + gtk_clipboard_set_text(textClipboard, frame->selectedText().utf8().data(), -1); + gtk_clipboard_set_text(htmlClipboard, createMarkup(range, 0, AnnotateForInterchange).utf8().data(), -1); } bool ClipboardGtk::hasData() diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h index 7314ae4..bb21d92 100644 --- a/WebCore/platform/gtk/ClipboardGtk.h +++ b/WebCore/platform/gtk/ClipboardGtk.h @@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ClipboardGdk_h -#define ClipboardGdk_h +#ifndef ClipboardGtk_h +#define ClipboardGtk_h #include "Clipboard.h" diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp index 9f72923..6949b0a 100644 --- a/WebCore/platform/gtk/PasteboardGtk.cpp +++ b/WebCore/platform/gtk/PasteboardGtk.cpp @@ -35,13 +35,6 @@ namespace WebCore { -/* FIXME: we must get rid of this and use the enum in webkitwebview.h someway */ -typedef enum -{ - WEBKIT_WEB_VIEW_TARGET_INFO_HTML = - 1, - WEBKIT_WEB_VIEW_TARGET_INFO_TEXT = - 2 -} WebKitWebViewTargetInfo; - class PasteboardSelectionData { public: PasteboardSelectionData(gchar* text, gchar* markup) @@ -65,11 +58,11 @@ static void clipboard_get_contents_cb(GtkClipboard *clipboard, GtkSelectionData guint info, gpointer data) { PasteboardSelectionData* clipboardData = reinterpret_cast<PasteboardSelectionData*>(data); ASSERT(clipboardData); - if ((gint)info == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) { + if ((gint)info == Pasteboard::generalPasteboard()->m_helper->getWebViewTargetInfoHtml()) gtk_selection_data_set(selection_data, selection_data->target, 8, reinterpret_cast<const guchar*>(clipboardData->markup()), g_utf8_strlen(clipboardData->markup(), -1)); - } else + else gtk_selection_data_set_text(selection_data, clipboardData->text(), -1); } diff --git a/WebCore/platform/gtk/PasteboardHelper.h b/WebCore/platform/gtk/PasteboardHelper.h index 9943a2d..8e67127 100644 --- a/WebCore/platform/gtk/PasteboardHelper.h +++ b/WebCore/platform/gtk/PasteboardHelper.h @@ -43,6 +43,7 @@ public: virtual GtkClipboard* getPrimary(Frame*) const = 0; virtual GtkTargetList* getCopyTargetList(Frame*) const = 0; virtual GtkTargetList* getPasteTargetList(Frame*) const = 0; + virtual gint getWebViewTargetInfoHtml() const = 0; }; } diff --git a/WebCore/platform/haiku/ClipboardHaiku.cpp b/WebCore/platform/haiku/ClipboardHaiku.cpp index 845c08c..a62c30c 100644 --- a/WebCore/platform/haiku/ClipboardHaiku.cpp +++ b/WebCore/platform/haiku/ClipboardHaiku.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "ClipboardHaiku.h" -#include "IntPoint.h" #include "FileList.h" +#include "IntPoint.h" #include "NotImplemented.h" #include "PlatformString.h" #include "StringHash.h" @@ -42,7 +42,7 @@ namespace WebCore { -ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, bool forDragging) +ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, bool forDragging) : Clipboard(policy, forDragging) { } @@ -61,7 +61,7 @@ void ClipboardHaiku::clearData(const String& type) } } -void ClipboardHaiku::clearAllData() +void ClipboardHaiku::clearAllData() { if (be_clipboard->Lock()) { be_clipboard->Clear(); @@ -70,7 +70,7 @@ void ClipboardHaiku::clearAllData() } } -String ClipboardHaiku::getData(const String& type, bool& success) const +String ClipboardHaiku::getData(const String& type, bool& success) const { BString result; success = false; @@ -88,7 +88,7 @@ String ClipboardHaiku::getData(const String& type, bool& success) const return result; } -bool ClipboardHaiku::setData(const String& type, const String& data) +bool ClipboardHaiku::setData(const String& type, const String& data) { bool result = false; @@ -110,7 +110,7 @@ bool ClipboardHaiku::setData(const String& type, const String& data) } // Extensions beyond IE's API. -HashSet<String> ClipboardHaiku::types() const +HashSet<String> ClipboardHaiku::types() const { HashSet<String> result; @@ -138,27 +138,27 @@ PassRefPtr<FileList> ClipboardHaiku::files() const return 0; } -IntPoint ClipboardHaiku::dragLocation() const -{ +IntPoint ClipboardHaiku::dragLocation() const +{ notImplemented(); return IntPoint(0, 0); } -CachedImage* ClipboardHaiku::dragImage() const +CachedImage* ClipboardHaiku::dragImage() const { notImplemented(); - return 0; + return 0; } -void ClipboardHaiku::setDragImage(CachedImage*, const IntPoint&) +void ClipboardHaiku::setDragImage(CachedImage*, const IntPoint&) { notImplemented(); } -Node* ClipboardHaiku::dragImageElement() +Node* ClipboardHaiku::dragImageElement() { notImplemented(); - return 0; + return 0; } void ClipboardHaiku::setDragImageElement(Node*, const IntPoint&) @@ -167,27 +167,27 @@ void ClipboardHaiku::setDragImageElement(Node*, const IntPoint&) } DragImageRef ClipboardHaiku::createDragImage(IntPoint& dragLocation) const -{ +{ notImplemented(); return 0; } -void ClipboardHaiku::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +void ClipboardHaiku::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) { notImplemented(); } -void ClipboardHaiku::writeURL(const KURL&, const String&, Frame*) +void ClipboardHaiku::writeURL(const KURL&, const String&, Frame*) { notImplemented(); } -void ClipboardHaiku::writeRange(Range*, Frame*) +void ClipboardHaiku::writeRange(Range*, Frame*) { notImplemented(); } -bool ClipboardHaiku::hasData() +bool ClipboardHaiku::hasData() { bool result = false; diff --git a/WebCore/platform/haiku/ContextMenuHaiku.cpp b/WebCore/platform/haiku/ContextMenuHaiku.cpp index 03b8978..b978433 100644 --- a/WebCore/platform/haiku/ContextMenuHaiku.cpp +++ b/WebCore/platform/haiku/ContextMenuHaiku.cpp @@ -27,30 +27,27 @@ #include "config.h" #include "ContextMenu.h" -#include "ContextMenuItem.h" #include "ContextMenuController.h" +#include "ContextMenuItem.h" +#include "Document.h" #include "Frame.h" #include "FrameView.h" -#include "Document.h" - -#include <wtf/Assertions.h> - #include <Looper.h> #include <Menu.h> #include <Message.h> +#include <wtf/Assertions.h> namespace WebCore { // FIXME: This class isn't used yet -class ContextMenuReceiver : public BLooper -{ +class ContextMenuReceiver : public BLooper { public: ContextMenuReceiver(ContextMenu* menu) : BLooper("context_menu_receiver") , m_menu(menu) + , m_result(-1) { - m_result = -1; } void HandleMessage(BMessage* msg) @@ -80,21 +77,8 @@ private: ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) - , m_platformDescription(NULL) + , m_platformDescription(new BMenu("context_menu")) { - /* Get position */ - if (result.innerNode() && result.innerNode()->document()) { - BView* view = result.innerNode()->document()->frame()->view()->platformWidget(); - int child = 0; - while (view->ChildAt(child)) { - if (view->ChildAt(child)->Name() == "scroll_view_canvas") { - m_point = view->ChildAt(child)->ConvertToScreen(BPoint(result.point().x(), result.point().y())); - break; - } - child++; - } - } - m_platformDescription = new BMenu("context_menu"); } ContextMenu::~ContextMenu() @@ -106,9 +90,9 @@ void ContextMenu::appendItem(ContextMenuItem& item) { checkOrEnableIfNeeded(item); - BMenuItem* bItem = item.releasePlatformDescription(); - if (bItem) - m_platformDescription->AddItem(bItem); + BMenuItem* menuItem = item.releasePlatformDescription(); + if (menuItem) + m_platformDescription->AddItem(menuItem); } unsigned ContextMenu::itemCount() const @@ -120,9 +104,9 @@ void ContextMenu::insertItem(unsigned position, ContextMenuItem& item) { checkOrEnableIfNeeded(item); - BMenuItem* bItem = item.releasePlatformDescription(); - if (bItem) - m_platformDescription->AddItem(bItem, position); + BMenuItem* menuItem = item.releasePlatformDescription(); + if (menuItem) + m_platformDescription->AddItem(menuItem, position); } PlatformMenuDescription ContextMenu::platformDescription() const diff --git a/WebCore/platform/haiku/CookieJarHaiku.cpp b/WebCore/platform/haiku/CookieJarHaiku.cpp index 73519d7..831b379 100644 --- a/WebCore/platform/haiku/CookieJarHaiku.cpp +++ b/WebCore/platform/haiku/CookieJarHaiku.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "KURL.h" #include "PlatformString.h" #include "StringHash.h" @@ -41,21 +42,33 @@ namespace WebCore { // FIXME: Shouldn't this be saved to and restored from disk too? static HashMap<String, String> cookieJar; -void setCookies(const KURL& url, const KURL& /*policyURL*/, const String& value) +void setCookies(Document*, const KURL& url, const String& value) { cookieJar.set(url.string(), value); } -String cookies(const KURL& url) +String cookies(const Document*, const KURL& url) { return cookieJar.get(url.string()); } -bool cookiesEnabled() +bool cookiesEnabled(const Document*) { // FIXME: This should probably be a setting return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } // namespace WebCore diff --git a/WebCore/platform/haiku/DragDataHaiku.cpp b/WebCore/platform/haiku/DragDataHaiku.cpp index b42b311..4a20147 100644 --- a/WebCore/platform/haiku/DragDataHaiku.cpp +++ b/WebCore/platform/haiku/DragDataHaiku.cpp @@ -27,10 +27,9 @@ #include "config.h" #include "DragData.h" +#include "ClipboardHaiku.h" #include "Document.h" #include "DocumentFragment.h" -#include "ClipboardHaiku.h" - #include "NotImplemented.h" @@ -79,7 +78,7 @@ Color DragData::asColor() const WTF::PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const { - return new ClipboardHaiku(policy, true); + return ClipboardHaiku::create(policy, true); } bool DragData::containsCompatibleContent() const @@ -104,6 +103,6 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const notImplemented(); return 0; } - + } // namespace WebCore diff --git a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp new file mode 100644 index 0000000..a37ffcc --- /dev/null +++ b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp @@ -0,0 +1,346 @@ +/* + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.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. + * + * 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 "LocalizedStrings.h" + +#include "PlatformString.h" + + +namespace WebCore { +String submitButtonDefaultLabel() +{ + return "Submit"; +} + +String inputElementAltText() +{ + return String(); +} + +String resetButtonDefaultLabel() +{ + return "Reset"; +} + +String defaultLanguage() +{ + return "en"; +} + +String searchableIndexIntroduction() +{ + return "Searchable Index"; +} + +String fileButtonChooseFileLabel() +{ + return "Choose File"; +} + +String fileButtonNoFileSelectedLabel() +{ + return "No file selected"; +} + +String contextMenuItemTagOpenLinkInNewWindow() +{ + return "Open in new tab"; +} + +String contextMenuItemTagDownloadLinkToDisk() +{ + return "Download link to disk"; +} + +String contextMenuItemTagCopyLinkToClipboard() +{ + return "Copy link to clipboard"; +} + +String contextMenuItemTagOpenImageInNewWindow() +{ + return "Open image in new window"; +} + +String contextMenuItemTagDownloadImageToDisk() +{ + return "Download image to disk"; +} + +String contextMenuItemTagCopyImageToClipboard() +{ + return "Copy image to clipboard"; +} + +String contextMenuItemTagOpenFrameInNewWindow() +{ + return "Open frame in new window"; +} + +String contextMenuItemTagCopy() +{ + return "Copy"; +} + +String contextMenuItemTagGoBack() +{ + return "Go back"; +} + +String contextMenuItemTagGoForward() +{ + return "Go forward"; +} + +String contextMenuItemTagStop() +{ + return "Stop"; +} + +String contextMenuItemTagReload() +{ + return "Reload"; +} + +String contextMenuItemTagCut() +{ + return "Cut"; +} + +String contextMenuItemTagPaste() +{ + return "Paste"; +} + +String contextMenuItemTagNoGuessesFound() +{ + return "No guesses found"; +} + +String contextMenuItemTagIgnoreSpelling() +{ + return "Ignore spelling"; +} + +String contextMenuItemTagLearnSpelling() +{ + return "Learn spelling"; +} + +String contextMenuItemTagSearchWeb() +{ + return "Search web"; +} + +String contextMenuItemTagLookUpInDictionary() +{ + return "Lookup in dictionary"; +} + +String contextMenuItemTagOpenLink() +{ + return "Open link"; +} + +String contextMenuItemTagIgnoreGrammar() +{ + return "Ignore grammar"; +} + +String contextMenuItemTagSpellingMenu() +{ + return "Spelling menu"; +} + +String contextMenuItemTagShowSpellingPanel(bool show) +{ + return "Show spelling panel"; +} + +String contextMenuItemTagCheckSpelling() +{ + return "Check spelling"; +} + +String contextMenuItemTagCheckSpellingWhileTyping() +{ + return "Check spelling while typing"; +} + +String contextMenuItemTagCheckGrammarWithSpelling() +{ + return "Check for grammar with spelling"; +} + +String contextMenuItemTagFontMenu() +{ + return "Font menu"; +} + +String contextMenuItemTagBold() +{ + return "Bold"; +} + +String contextMenuItemTagItalic() +{ + return "Italic"; +} + +String contextMenuItemTagUnderline() +{ + return "Underline"; +} + +String contextMenuItemTagOutline() +{ + return "Outline"; +} + +String contextMenuItemTagWritingDirectionMenu() +{ + return "Writing direction menu"; +} + +String contextMenuItemTagDefaultDirection() +{ + return "Default direction"; +} + +String contextMenuItemTagLeftToRight() +{ + return "Left to right"; +} + +String contextMenuItemTagRightToLeft() +{ + return "Right to left"; +} + +String contextMenuItemTagInspectElement() +{ + return "Inspect"; +} + +String searchMenuNoRecentSearchesText() +{ + return "No recent text searches"; +} + +String searchMenuRecentSearchesText() +{ + return "Recent text searches"; +} + +String searchMenuClearRecentSearchesText() +{ + return "Clear recent text searches"; +} + +String unknownFileSizeText() +{ + return "Unknown"; +} + +String AXWebAreaText() +{ + return String(); +} + +String AXLinkText() +{ + return String(); +} + +String AXListMarkerText() +{ + return String(); +} + +String AXImageMapText() +{ + return String(); +} + +String AXHeadingText() +{ + return String(); +} + +String imageTitle(const String& filename, const IntSize& size) +{ + return String(filename); +} + +String contextMenuItemTagTextDirectionMenu() +{ + return String(); +} + +String AXButtonActionVerb() +{ + return String(); +} + +String AXTextFieldActionVerb() +{ + return String(); +} + +String AXRadioButtonActionVerb() +{ + return String(); +} + +String AXCheckedCheckBoxActionVerb() +{ + return String(); +} + +String AXUncheckedCheckBoxActionVerb() +{ + return String(); +} + +String AXLinkActionVerb() +{ + return String(); +} + +String AXDefinitionListTermText() +{ + return String(); +} + +String AXDefinitionListDefinitionText() +{ + return String(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/haiku/LoggingHaiku.cpp b/WebCore/platform/haiku/LoggingHaiku.cpp new file mode 100644 index 0000000..f09c483 --- /dev/null +++ b/WebCore/platform/haiku/LoggingHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.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 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 "Logging.h" + + +namespace WebCore { + +void InitializeLoggingChannelsIfNecessary() +{ + // FIXME: Should read the logging channels from a file. + static bool haveInitializedLoggingChannels = false; + if (haveInitializedLoggingChannels) + return; + + haveInitializedLoggingChannels = true; + + LogEvents.state = WTFLogChannelOn; + LogFrames.state = WTFLogChannelOn; + LogLoading.state = WTFLogChannelOn; + LogPlatformLeaks.state = WTFLogChannelOn; +} + +} // namespace WebCore + diff --git a/WebCore/platform/haiku/RenderThemeHaiku.cpp b/WebCore/platform/haiku/RenderThemeHaiku.cpp new file mode 100644 index 0000000..4327795 --- /dev/null +++ b/WebCore/platform/haiku/RenderThemeHaiku.cpp @@ -0,0 +1,178 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" +#include "RenderThemeHaiku.h" + +#include "GraphicsContext.h" +#include "NotImplemented.h" +#include <ControlLook.h> +#include <View.h> + + +namespace WebCore { + +PassRefPtr<RenderTheme> RenderThemeHaiku::create() +{ + return adoptRef(new RenderThemeHaiku()); +} + +PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*) +{ + static RenderTheme* renderTheme = RenderThemeHaiku::create().releaseRef(); + return renderTheme; +} + +RenderThemeHaiku::RenderThemeHaiku() +{ +} + +RenderThemeHaiku::~RenderThemeHaiku() +{ +} + +static bool supportsFocus(ControlPart appearance) +{ + switch (appearance) { + case PushButtonPart: + case ButtonPart: + case TextFieldPart: + case TextAreaPart: + case SearchFieldPart: + case MenulistPart: + case RadioPart: + case CheckboxPart: + return true; + default: + return false; + } +} + +bool RenderThemeHaiku::supportsFocusRing(const RenderStyle* style) const +{ + return supportsFocus(style->appearance()); +} + +Color RenderThemeHaiku::platformActiveSelectionBackgroundColor() const +{ + return Color(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); +} + +Color RenderThemeHaiku::platformInactiveSelectionBackgroundColor() const +{ + return Color(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); +} + +Color RenderThemeHaiku::platformActiveSelectionForegroundColor() const +{ + return Color(ui_color(B_CONTROL_TEXT_COLOR)); +} + +Color RenderThemeHaiku::platformInactiveSelectionForegroundColor() const +{ + return Color(ui_color(B_CONTROL_TEXT_COLOR)); +} + +Color RenderThemeHaiku::platformTextSearchHighlightColor() const +{ + return Color(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR)); +} + +void RenderThemeHaiku::systemFont(int propId, FontDescription&) const +{ + notImplemented(); +} + +bool RenderThemeHaiku::paintCheckbox(RenderObject*, const RenderObject::PaintInfo& info, const IntRect& intRect) +{ + if (info.context->paintingDisabled()) + return false; + + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + BRect rect = intRect; + BView* view = info.context->platformContext(); + + if (!be_control_look) + return false; + + be_control_look->DrawCheckBox(view, rect, rect, base); + return true; +} + +void RenderThemeHaiku::setCheckboxSize(RenderStyle* style) const +{ + int size = 10; + + // If the width and height are both specified, then we have nothing to do. + if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) + return; + + // FIXME: A hard-coded size of 'size' is used. This is wrong but necessary for now. + if (style->width().isIntrinsicOrAuto()) + style->setWidth(Length(size, Fixed)); + + if (style->height().isAuto()) + style->setHeight(Length(size, Fixed)); +} + +bool RenderThemeHaiku::paintRadio(RenderObject*, const RenderObject::PaintInfo& info, const IntRect& intRect) +{ + if (info.context->paintingDisabled()) + return false; + + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + BRect rect = intRect; + BView* view = info.context->platformContext(); + + if (!be_control_look) + return false; + + be_control_look->DrawRadioButton(view, rect, rect, base); + return true; +} + +void RenderThemeHaiku::setRadioSize(RenderStyle* style) const +{ + // This is the same as checkboxes. + setCheckboxSize(style); +} + +void RenderThemeHaiku::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const +{ + // Leave some space for the arrow. + style->setPaddingRight(Length(22, Fixed)); + const int minHeight = 20; + style->setMinHeight(Length(minHeight, Fixed)); +} + +bool RenderThemeHaiku::paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) +{ + notImplemented(); + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/haiku/RenderThemeHaiku.h b/WebCore/platform/haiku/RenderThemeHaiku.h new file mode 100644 index 0000000..7daebc4 --- /dev/null +++ b/WebCore/platform/haiku/RenderThemeHaiku.h @@ -0,0 +1,70 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef RenderThemeHaiku_h +#define RenderThemeHaiku_h + +#include "RenderTheme.h" + +namespace WebCore { + + class RenderThemeHaiku : public RenderTheme { + private: + RenderThemeHaiku(); + virtual ~RenderThemeHaiku(); + + public: + static PassRefPtr<RenderTheme> create(); + + // A method asking if the theme's controls actually care about redrawing when hovered. + virtual bool supportsHover(const RenderStyle* style) const { return false; } + + // A method asking if the theme is able to draw the focus ring. + virtual bool supportsFocusRing(const RenderStyle*) const; + + // The platform selection color. + virtual Color platformActiveSelectionBackgroundColor() const; + virtual Color platformInactiveSelectionBackgroundColor() const; + virtual Color platformActiveSelectionForegroundColor() const; + virtual Color platformInactiveSelectionForegroundColor() const; + + virtual Color platformTextSearchHighlightColor() const; + + // System fonts. + virtual void systemFont(int propId, FontDescription&) const; + + protected: + virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void setCheckboxSize(RenderStyle*) const; + + virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void setRadioSize(RenderStyle*) const; + + virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + }; + +} // namespace WebCore + +#endif // RenderThemeHaiku_h diff --git a/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp b/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp new file mode 100644 index 0000000..8adab3d --- /dev/null +++ b/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright 2009 Maxime Simon <simon.maxime@gmail.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. + * + * 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 "ScrollbarThemeHaiku.h" + +#include "GraphicsContext.h" +#include "Scrollbar.h" +#include <ControlLook.h> +#include <InterfaceDefs.h> + + +int buttonWidth(int scrollbarWidth, int thickness) +{ + return scrollbarWidth < 2 * thickness ? scrollbarWidth / 2 : thickness; +} + +namespace WebCore { + +ScrollbarTheme* ScrollbarTheme::nativeTheme() +{ + static ScrollbarThemeHaiku theme; + return &theme; +} + +ScrollbarThemeHaiku::ScrollbarThemeHaiku() +{ +} + +ScrollbarThemeHaiku::~ScrollbarThemeHaiku() +{ +} + +int ScrollbarThemeHaiku::scrollbarThickness(ScrollbarControlSize controlSize) +{ + // FIXME: Should we make a distinction between a Small and a Regular Scrollbar? + return 16; +} + +bool ScrollbarThemeHaiku::hasButtons(Scrollbar* scrollbar) +{ + return scrollbar->enabled(); +} + +bool ScrollbarThemeHaiku::hasThumb(Scrollbar* scrollbar) +{ + return scrollbar->enabled() && thumbLength(scrollbar) > 0; +} + +IntRect ScrollbarThemeHaiku::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) +{ + if (part == BackButtonEndPart) + return IntRect(); + + int thickness = scrollbarThickness(); + IntPoint buttonOrigin(scrollbar->x(), scrollbar->y()); + IntSize buttonSize = scrollbar->orientation() == HorizontalScrollbar + ? IntSize(buttonWidth(scrollbar->width(), thickness), thickness) + : IntSize(thickness, buttonWidth(scrollbar->height(), thickness)); + IntRect buttonRect(buttonOrigin, buttonSize); + + return buttonRect; +} + +IntRect ScrollbarThemeHaiku::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) +{ + if (part == BackButtonStartPart) + return IntRect(); + + int thickness = scrollbarThickness(); + if (scrollbar->orientation() == HorizontalScrollbar) { + int width = buttonWidth(scrollbar->width(), thickness); + return IntRect(scrollbar->x() + scrollbar->width() - width, scrollbar->y(), width, thickness); + } + + int height = buttonWidth(scrollbar->height(), thickness); + return IntRect(scrollbar->x(), scrollbar->y() + scrollbar->height() - height, thickness, height); +} + +IntRect ScrollbarThemeHaiku::trackRect(Scrollbar* scrollbar, bool) +{ + int thickness = scrollbarThickness(); + if (scrollbar->orientation() == HorizontalScrollbar) { + if (scrollbar->width() < 2 * thickness) + return IntRect(); + return IntRect(scrollbar->x() + thickness, scrollbar->y(), scrollbar->width() - 2 * thickness, thickness); + } + if (scrollbar->height() < 2 * thickness) + return IntRect(); + return IntRect(scrollbar->x(), scrollbar->y() + thickness, thickness, scrollbar->height() - 2 * thickness); +} + +void ScrollbarThemeHaiku::paintScrollbarBackground(GraphicsContext* context, Scrollbar* scrollbar) +{ + if (!be_control_look) + return; + + BRect rect = trackRect(scrollbar, false); + orientation scrollbarOrientation = scrollbar->orientation() == HorizontalScrollbar ? B_HORIZONTAL : B_VERTICAL; + + be_control_look->DrawScrollBarBackground(context->platformContext(), rect, rect, ui_color(B_PANEL_BACKGROUND_COLOR), 0, scrollbarOrientation); +} + +void ScrollbarThemeHaiku::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part) +{ + if (!be_control_look) + return; + + BRect drawRect = BRect(rect); + BView* view = context->platformContext(); + rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); + + be_control_look->DrawButtonFrame(view, drawRect, drawRect, buttonBgColor, panelBgColor); + be_control_look->DrawButtonBackground(view, drawRect, drawRect, buttonBgColor); + + int arrowDirection; + if (scrollbar->orientation() == VerticalScrollbar) + arrowDirection = part == BackButtonStartPart ? BControlLook::B_UP_ARROW : BControlLook::B_DOWN_ARROW; + else + arrowDirection = part == BackButtonStartPart ? BControlLook::B_LEFT_ARROW : BControlLook::B_RIGHT_ARROW; + + be_control_look->DrawArrowShape(view, drawRect, drawRect, ui_color(B_CONTROL_TEXT_COLOR), arrowDirection); +} + +void ScrollbarThemeHaiku::paintThumb(GraphicsContext* context, Scrollbar*, const IntRect& rect) +{ + if (!be_control_look) + return; + + BRect drawRect = BRect(rect); + BView* view = context->platformContext(); + rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); + + be_control_look->DrawButtonFrame(view, drawRect, drawRect, buttonBgColor, panelBgColor); + be_control_look->DrawButtonBackground(view, drawRect, drawRect, buttonBgColor); +} + +} + diff --git a/WebCore/platform/haiku/ScrollbarThemeHaiku.h b/WebCore/platform/haiku/ScrollbarThemeHaiku.h new file mode 100644 index 0000000..18e2cc0 --- /dev/null +++ b/WebCore/platform/haiku/ScrollbarThemeHaiku.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright 2009 Maxime Simon <simon.maxime@gmail.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. + * + * 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 ScrollbarThemeHaiku_h +#define ScrollbarThemeHaiku_h + +#include "ScrollbarThemeComposite.h" + +namespace WebCore { + class Scrollbar; + + class ScrollbarThemeHaiku : public ScrollbarThemeComposite { + public: + ScrollbarThemeHaiku(); + virtual ~ScrollbarThemeHaiku(); + + virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); + + virtual bool hasButtons(Scrollbar*); + virtual bool hasThumb(Scrollbar*); + + virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting); + virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting); + virtual IntRect trackRect(Scrollbar*, bool painting); + + virtual void paintScrollbarBackground(GraphicsContext*, Scrollbar*); + virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart); + virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&); + }; + +} +#endif diff --git a/WebCore/platform/haiku/SharedBufferHaiku.cpp b/WebCore/platform/haiku/SharedBufferHaiku.cpp new file mode 100644 index 0000000..113cd2e --- /dev/null +++ b/WebCore/platform/haiku/SharedBufferHaiku.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.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 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 "SharedBuffer.h" + +#include <File.h> +#include <String.h> + +namespace WebCore { + +PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fileName) +{ + if (fileName.isEmpty()) + return 0; + + BFile file(BString(fileName).String(), B_READ_ONLY); + if (file.InitCheck() != B_OK) + return 0; + + RefPtr<SharedBuffer> result = SharedBuffer::create(); + + off_t size; + file.GetSize(&size); + result->m_buffer.resize(size); + if (result->m_buffer.size() != size) + return 0; + + file.Read(result->m_buffer.data(), result->m_buffer.size()); + return result.release(); +} + +} // namespace WebCore diff --git a/WebCore/platform/haiku/TemporaryLinkStubs.cpp b/WebCore/platform/haiku/TemporaryLinkStubs.cpp index 48380fc..aa3d538 100644 --- a/WebCore/platform/haiku/TemporaryLinkStubs.cpp +++ b/WebCore/platform/haiku/TemporaryLinkStubs.cpp @@ -33,40 +33,11 @@ #include "config.h" -#include "AXObjectCache.h" -#include "CachedResource.h" -#include "CookieJar.h" -#include "Cursor.h" -#include "DataGridColumnList.h" -#include "FileSystem.h" -#include "Font.h" -#include "Frame.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "History.h" -#include "IconLoader.h" -#include "InspectorController.h" -#include "IntPoint.h" #include "KURL.h" -#include "Language.h" -#include "Node.h" #include "NotImplemented.h" -#include "Path.h" -#include "PlatformMouseEvent.h" -#include "PlatformScrollBar.h" -#include "PluginInfoStore.h" -#include "RenderTheme.h" -#include "Screen.h" -#include "Scrollbar.h" -#include "ScrollbarTheme.h" -#include "SharedBuffer.h" -#include "TextBoundaries.h" -#include "Threading.h" -#include "Widget.h" -#include "loader.h" -#include <runtime/JSValue.h> -#include <stdio.h> -#include <stdlib.h> +#include "PlatformString.h" +#include "SSLKeyGenerator.h" +#include "SystemTime.h" using namespace WebCore; @@ -78,20 +49,14 @@ Vector<char> loadResourceIntoArray(const char*) namespace WebCore { -bool historyContains(String const&) +String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { - return false; + return String(); } -Vector<String> supportedKeySizes() +void getSupportedKeySizes(Vector<String>&) { notImplemented(); - return Vector<String>(); -} - -String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) -{ - return String(); } float userIdleTime() @@ -105,22 +70,11 @@ void callOnMainThread(void (*)()) notImplemented(); } -PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&) -{ - notImplemented(); - return 0; -} - String KURL::fileSystemPath() const { notImplemented(); return String(); } -void getSupportedKeySizes(Vector<String>&) -{ - notImplemented(); -} - } // namespace WebCore diff --git a/WebCore/platform/image-decoders/ImageDecoder.cpp b/WebCore/platform/image-decoders/ImageDecoder.cpp new file mode 100644 index 0000000..9c723cc --- /dev/null +++ b/WebCore/platform/image-decoders/ImageDecoder.cpp @@ -0,0 +1,103 @@ +/*
+ * Copyright (C) 2008-2009 Torch Mobile, 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.
+ *
+ */
+
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+
+#include "config.h"
+#include "ImageDecoder.h"
+
+#include <algorithm>
+
+namespace WebCore {
+
+namespace {
+
+enum MatchType {
+ Exact,
+ UpperBound,
+ LowerBound
+};
+
+}
+
+template <MatchType type> static int getScaledValue(const Vector<int>& scaledValues, int valueToMatch, int searchStart)
+{
+ const int* dataStart = scaledValues.data();
+ const int* dataEnd = dataStart + scaledValues.size();
+ const int* matched = std::lower_bound(dataStart + searchStart, dataEnd, valueToMatch);
+ switch (type) {
+ case Exact:
+ return matched != dataEnd && *matched == valueToMatch ? matched - dataStart : -1;
+ case LowerBound:
+ return matched != dataEnd && *matched == valueToMatch ? matched - dataStart : matched - dataStart - 1;
+ case UpperBound:
+ default:
+ return matched != dataEnd ? matched - dataStart : -1;
+ }
+}
+
+int ImageDecoder::upperBoundScaledX(int origX, int searchStart)
+{
+ return getScaledValue<UpperBound>(m_scaledColumns, origX, searchStart);
+}
+
+int ImageDecoder::lowerBoundScaledX(int origX, int searchStart)
+{
+ return getScaledValue<LowerBound>(m_scaledColumns, origX, searchStart);
+}
+
+int ImageDecoder::scaledY(int origY, int searchStart)
+{
+ return getScaledValue<Exact>(m_scaledRows, origY, searchStart);
+}
+
+static inline void fillScaledValues(Vector<int>& scaledValues, double scaleRate, int length)
+{
+ double inflateRate = 1. / scaleRate;
+ scaledValues.reserveCapacity(static_cast<int>(length * scaleRate + 0.5));
+ for (int scaledIndex = 0;;) {
+ int index = static_cast<int>(scaledIndex * inflateRate + 0.5);
+ if (index < length) {
+ scaledValues.append(index);
+ ++scaledIndex;
+ } else
+ break;
+ }
+}
+
+void ImageDecoder::prepareScaleDataIfNecessary()
+{
+ int width = m_size.width();
+ int height = m_size.height();
+ int numPixels = height * width;
+ if (m_maxNumPixels <= 0 || numPixels <= m_maxNumPixels) {
+ m_scaled = false;
+ return;
+ }
+
+ m_scaled = true;
+ double scale = sqrt(m_maxNumPixels / (double)numPixels);
+ fillScaledValues(m_scaledColumns, scale, width);
+ fillScaledValues(m_scaledRows, scale, height);
+}
+
+}
+
+#endif // ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index 57f8735..9256afe 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008-2009 Torch Mobile, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -140,7 +141,7 @@ namespace WebCore { inline PixelData* getAddr(int x, int y) { -#if PLATFORM(CAIRO) || PLATFORM(WX) +#if PLATFORM(CAIRO) || PLATFORM(WX) || PLATFORM(HAIKU) return m_bytes.data() + (y * width()) + x; #elif (PLATFORM(SKIA) || PLATFORM(SGL)) return m_bitmap.getAddr32(x, y); @@ -166,7 +167,7 @@ namespace WebCore { } } -#if PLATFORM(CAIRO) || PLATFORM(WX) +#if PLATFORM(CAIRO) || PLATFORM(WX) || PLATFORM(HAIKU) Vector<PixelData> m_bytes; IntSize m_size; // The size of the buffer. This should be the // same as ImageDecoder::m_size. @@ -188,9 +189,17 @@ namespace WebCore { // and the base class manages the RGBA32 frame cache. class ImageDecoder { public: + // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to write directly to + // scaled output buffers by down sampling. Call setMaxNumPixels() to specify the + // biggest size that decoded images can have. Image decoders will deflate those + // images that are bigger than m_maxNumPixels. (Not supported by all image decoders yet) ImageDecoder() : m_failed(false) , m_sizeAvailable(false) +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , m_maxNumPixels(-1) + , m_scaled(false) +#endif { } @@ -272,8 +281,25 @@ namespace WebCore { // since in practice only GIFs will ever use this. virtual void clearFrameBufferCache(size_t clearBeforeFrame) { } +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + void setMaxNumPixels(int m) { m_maxNumPixels = m; } +#endif + protected: +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + void prepareScaleDataIfNecessary(); + int upperBoundScaledX(int origX, int searchStart = 0); + int lowerBoundScaledX(int origX, int searchStart = 0); + int scaledY(int origY, int searchStart = 0); +#endif + RefPtr<SharedBuffer> m_data; // The encoded data. +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + int m_maxNumPixels; + Vector<int> m_scaledColumns; + Vector<int> m_scaledRows; + bool m_scaled; +#endif Vector<RGBA32Buffer> m_frameBufferCache; bool m_failed; diff --git a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp index e9296ad..bc4f357 100644 --- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp +++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp @@ -249,7 +249,7 @@ bool ICOImageDecoder::processDirectory() ICON = 1, CURSOR = 2, }; - if (((fileType != ICON) && (fileType != CURSOR)) || (idCount == 0)) { + if (((fileType != ICON) && (fileType != CURSOR)) || (!idCount)) { setFailed(); return false; } @@ -303,10 +303,10 @@ ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() // matching uint8_ts) is so we can record dimensions of size 256 (which is // what a zero byte really means). int width = static_cast<uint8_t>(m_data->data()[m_decodedOffset]); - if (width == 0) + if (!width) width = 256; int height = static_cast<uint8_t>(m_data->data()[m_decodedOffset + 1]); - if (height == 0) + if (!height) height = 256; IconDirectoryEntry entry; entry.m_size = IntSize(width, height); @@ -318,11 +318,12 @@ ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() // this isn't quite what the bitmap info header says later, as we only use // this value to determine which icon entry is best. if (!entry.m_bitCount) { - uint8_t colorCount = m_data->data()[m_decodedOffset + 2]; - if (colorCount) { - for (--colorCount; colorCount; colorCount >>= 1) - ++entry.m_bitCount; - } + int colorCount = + static_cast<uint8_t>(m_data->data()[m_decodedOffset + 2]); + if (!colorCount) + colorCount = 256; // Vague in the spec, needed by real-world icons. + for (--colorCount; colorCount; colorCount >>= 1) + ++entry.m_bitCount; } m_decodedOffset += sizeOfDirEntry; diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index ae09586..2565ea6 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -461,11 +461,27 @@ void JPEGImageDecoder::decode(bool sizeOnly) } } -static void convertCMYKToRGBA(RGBA32Buffer& dest, JSAMPROW src, jpeg_decompress_struct* info) +static void convertCMYKToRGBA(RGBA32Buffer& dest, int destY, JSAMPROW src, int srcWidth +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , bool scaled, const Vector<int>& scaledColumns +#endif + ) { - ASSERT(info->out_color_space == JCS_CMYK); - - for (unsigned x = 0; x < info->output_width; ++x) { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (scaled) { + int numColumns = scaledColumns.size(); + for (int x = 0; x < numColumns; ++x) { + JSAMPLE* jsample = src + scaledColumns[x] * 3; + unsigned c = jsample[0]; + unsigned m = jsample[1]; + unsigned y = jsample[2]; + unsigned k = jsample[3]; + dest.setRGBA(x, destY, c * k / 255, m * k / 255, y * k / 255, 0xFF); + } + return; + } +#endif + for (unsigned x = 0; x < srcWidth; ++x) { unsigned c = *src++; unsigned m = *src++; unsigned y = *src++; @@ -489,23 +505,31 @@ static void convertCMYKToRGBA(RGBA32Buffer& dest, JSAMPROW src, jpeg_decompress_ // G = 1 - M => 1 - (1 - iM*iK) => iM*iK // B = 1 - Y => 1 - (1 - iY*iK) => iY*iK - // read_scanlines has increased the scanline counter, so we - // actually mean the previous one. - dest.setRGBA(x, info->output_scanline - 1, c * k / 255, m * k / 255, y * k / 255, 0xFF); + dest.setRGBA(x, destY, c * k / 255, m * k / 255, y * k / 255, 0xFF); } } -static void convertRGBToRGBA(RGBA32Buffer& dest, JSAMPROW src, jpeg_decompress_struct* info) +static void convertRGBToRGBA(RGBA32Buffer& dest, int destY, JSAMPROW src, int srcWidth +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , bool scaled, const Vector<int>& scaledColumns +#endif + ) { - ASSERT(info->out_color_space == JCS_RGB); - - for (unsigned x = 0; x < info->output_width; ++x) { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (scaled) { + int numColumns = scaledColumns.size(); + for (int x = 0; x < numColumns; ++x) { + JSAMPLE* jsample = src + scaledColumns[x] * 3; + dest.setRGBA(x, destY, jsample[0], jsample[1], jsample[2], 0xFF); + } + return; + } +#endif + for (unsigned x = 0; x < srcWidth; ++x) { unsigned r = *src++; unsigned g = *src++; unsigned b = *src++; - // read_scanlines has increased the scanline counter, so we - // actually mean the previous one. - dest.setRGBA(x, info->output_scanline - 1, r, g, b, 0xFF); + dest.setRGBA(x, destY, r, g, b, 0xFF); } } @@ -517,7 +541,17 @@ bool JPEGImageDecoder::outputScanlines() // Initialize the framebuffer if needed. RGBA32Buffer& buffer = m_frameBufferCache[0]; if (buffer.status() == RGBA32Buffer::FrameEmpty) { - if (!buffer.setSize(size().width(), size().height())) { + int bufferWidth = size().width(); + int bufferHeight = size().height(); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + // Let's resize our buffer now to the correct width/height. + if (m_scaled) { + bufferWidth = m_scaledColumns.size(); + bufferHeight = m_scaledRows.size(); + } +#endif + + if (!buffer.setSize(bufferWidth, bufferHeight)) { m_failed = true; return false; } @@ -532,16 +566,34 @@ bool JPEGImageDecoder::outputScanlines() JSAMPARRAY samples = m_reader->samples(); while (info->output_scanline < info->output_height) { + // jpeg_read_scanlines will increase the scanline counter, so we + // save the scanline before calling it. + int sourceY = info->output_scanline; /* Request one scanline. Returns 0 or 1 scanlines. */ if (jpeg_read_scanlines(info, samples, 1) != 1) return false; + int destY = sourceY; +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (m_scaled) { + destY = scaledY(sourceY); + if (destY < 0) + continue; + } if (info->out_color_space == JCS_RGB) - convertRGBToRGBA(buffer, *samples, info); + convertRGBToRGBA(buffer, destY, *samples, info->output_width, m_scaled, m_scaledColumns); else if (info->out_color_space == JCS_CMYK) - convertCMYKToRGBA(buffer, *samples, info); + convertCMYKToRGBA(buffer, destY, *samples, info->output_width, m_scaled, m_scaledColumns); else return false; +#else + if (info->out_color_space == JCS_RGB) + convertRGBToRGBA(buffer, destY, *samples, info->output_width); + else if (info->out_color_space == JCS_CMYK) + convertCMYKToRGBA(buffer, destY, *samples, info->output_width); + else + return false; +#endif } return true; diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h index 56e007d..4a822d7 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008-2009 Torch Mobile, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +58,16 @@ namespace WebCore { bool outputScanlines(); void jpegComplete(); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + bool setSize(int width, int height) + { + if (!ImageDecoder::setSize(width, height)) + return false; + prepareScaleDataIfNecessary(); + return true; + } +#endif + private: JPEGImageReader* m_reader; }; diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp index d14333f..ad79fc8 100644 --- a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2007-2009 Torch Mobile, Inc. * * Portions are Copyright (C) 2001 mozilla.org * @@ -242,6 +243,9 @@ void PNGImageDecoder::headerAvailable() longjmp(png->jmpbuf, 1); return; } +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + prepareScaleDataIfNecessary(); +#endif } int bitDepth, colorType, interlaceType, compressionType, filterType, channels; @@ -313,7 +317,14 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, // Initialize the framebuffer if needed. RGBA32Buffer& buffer = m_frameBufferCache[0]; if (buffer.status() == RGBA32Buffer::FrameEmpty) { - if (!buffer.setSize(size().width(), size().height())) { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + int width = m_scaled ? m_scaledColumns.size() : size().width(); + int height = m_scaled ? m_scaledRows.size() : size().height(); +#else + int width = size().width(); + int height = size().height(); +#endif + if (!buffer.setSize(width, height)) { static_cast<PNGImageDecoder*>(png_get_progressive_ptr(reader()->pngPtr()))->decodingFailed(); longjmp(reader()->pngPtr()->jmpbuf, 1); return; @@ -358,7 +369,7 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, * to pass the current row, and the function will combine the * old row and the new row. */ - + png_structp png = reader()->pngPtr(); bool hasAlpha = reader()->hasAlpha(); unsigned colorChannels = hasAlpha ? 4 : 3; @@ -372,8 +383,27 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, row = rowBuffer; // Copy the data into our buffer. +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (m_scaled) { + int destY = scaledY(rowIndex); + if (destY < 0) + return; + int columns = m_scaledColumns.size(); + bool sawAlpha = buffer.hasAlpha(); + for (int x = 0; x < columns; ++x) { + png_bytep pixel = row + m_scaledColumns[x] * 4; + unsigned alpha = pixel[3]; + buffer.setRGBA(x, destY, pixel[0], pixel[1], pixel[2], alpha); + if (!sawAlpha && alpha < 255) { + sawAlpha = true; + buffer.setHasAlpha(true); + } + } + return; + } +#endif int width = size().width(); - bool sawAlpha = false; + bool sawAlpha = buffer.hasAlpha(); for (int x = 0; x < width; x++) { unsigned red = *row++; unsigned green = *row++; diff --git a/WebCore/platform/mac/CookieJar.mm b/WebCore/platform/mac/CookieJar.mm index d8df601..e1d3e5a 100644 --- a/WebCore/platform/mac/CookieJar.mm +++ b/WebCore/platform/mac/CookieJar.mm @@ -27,6 +27,7 @@ #import "CookieJar.h" #import "BlockExceptions.h" +#import "Cookie.h" #import "Document.h" #import "KURL.h" #import <wtf/RetainPtr.h> @@ -116,4 +117,52 @@ bool cookiesEnabled(const Document*) return false; } +bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies) +{ + rawCookies.clear(); + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + NSURL *cookieURL = url; + NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL]; + + NSUInteger count = [cookies count]; + rawCookies.reserveCapacity(count); + for (NSUInteger i = 0; i < count; ++i) { + NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; + NSString *name = [cookie name]; + NSString *value = [cookie value]; + NSString *domain = [cookie domain]; + NSString *path = [cookie path]; + NSTimeInterval expires = [[cookie expiresDate] timeIntervalSince1970] * 1000; + bool httpOnly = [cookie isHTTPOnly]; + bool secure = [cookie isSecure]; + bool session = [cookie isSessionOnly]; + rawCookies.uncheckedAppend(Cookie(name, value, domain, path, expires, httpOnly, secure, session)); + } + + END_BLOCK_OBJC_EXCEPTIONS; + return true; +} + +void deleteCookie(const Document*, const KURL& url, const String& cookieName) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + NSURL *cookieURL = url; + NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + NSArray *cookies = [cookieStorage cookiesForURL:cookieURL]; + NSString *cookieNameString = (NSString *) cookieName; + + NSUInteger count = [cookies count]; + for (NSUInteger i = 0; i < count; ++i) { + NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; + if ([[cookie name] isEqualToString:cookieNameString]) { + [cookieStorage deleteCookie:cookie]; + break; + } + } + + END_BLOCK_OBJC_EXCEPTIONS; +} + } diff --git a/WebCore/platform/network/cf/DNSCFNet.cpp b/WebCore/platform/network/cf/DNSCFNet.cpp index bf21ab1..9ae15cb 100644 --- a/WebCore/platform/network/cf/DNSCFNet.cpp +++ b/WebCore/platform/network/cf/DNSCFNet.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Collin Jackson <collinj@webkit.org> + * Copyright (C) 2009 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,13 +27,33 @@ #include "config.h" #include "DNS.h" -#include "NotImplemented.h" +#include "PlatformString.h" +#include <wtf/RetainPtr.h> + +#ifdef BUILDING_ON_TIGER +// This function is available on Tiger, but not declared in the CFRunLoop.h header on Tiger. +extern "C" CFRunLoopRef CFRunLoopGetMain(); +#endif namespace WebCore { -void prefetchDNS(const String&) +static void clientCallback(CFHostRef theHost, CFHostInfoType, const CFStreamError*, void*) +{ + CFRelease(theHost); +} + +void prefetchDNS(const String& hostname) { - notImplemented(); + RetainPtr<CFStringRef> hostnameCF(AdoptCF, hostname.createCFString()); + RetainPtr<CFHostRef> host(AdoptCF, CFHostCreateWithName(0, hostnameCF.get())); + if (!host) + return; + CFHostClientContext context = { 0, 0, 0, 0, 0 }; + Boolean result = CFHostSetClient(host.get(), clientCallback, &context); + ASSERT_UNUSED(result, result); + CFHostScheduleWithRunLoop(host.get(), CFRunLoopGetMain(), kCFRunLoopCommonModes); + CFHostStartInfoResolution(host.get(), kCFHostAddresses, 0); + host.releaseRef(); // The host will be released from clientCallback(). } } diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp index 65be451..7862cc3 100644 --- a/WebCore/platform/network/chromium/CookieJarChromium.cpp +++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "ChromiumBridge.h" #include "Document.h" @@ -52,4 +53,16 @@ bool cookiesEnabled(const Document*) return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } // namespace WebCore diff --git a/WebCore/platform/network/curl/CookieJarCurl.cpp b/WebCore/platform/network/curl/CookieJarCurl.cpp index 5ac0f9c..3bad4e4 100644 --- a/WebCore/platform/network/curl/CookieJarCurl.cpp +++ b/WebCore/platform/network/curl/CookieJarCurl.cpp @@ -17,6 +17,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "Document.h" #include "KURL.h" #include "PlatformString.h" @@ -43,4 +44,16 @@ bool cookiesEnabled(const Document* /*document*/) return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp index 2aa286a..baca717 100644 --- a/WebCore/platform/network/curl/ResourceHandleManager.cpp +++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp @@ -5,6 +5,8 @@ * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2008 Collabora Ltd. * Copyright (C) 2008 Nuanti Ltd. + * Copyright (C) 2009 Appcelerator Inc. + * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,10 +56,29 @@ const int maxRunningJobs = 5; static const bool ignoreSSLErrors = getenv("WEBKIT_IGNORE_SSL_ERRORS"); +static CString certificatePath() +{ +#if PLATFORM(CF) + CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")); + RetainPtr<CFURLRef> certURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle, CFSTR("cacert"), CFSTR("pem"), CFSTR("certificates"))); + if (certURLRef) { + char path[MAX_PATH]; + CFURLGetFileSystemRepresentation(certURLRef.get(), false, reinterpret_cast<UInt8*>(path), MAX_PATH); + return path; + } +#endif + char* envPath = getenv("CURL_CA_BUNDLE_PATH"); + if (envPath) + return envPath; + + return CString(); +} + ResourceHandleManager::ResourceHandleManager() : m_downloadTimer(this, &ResourceHandleManager::downloadTimerCallback) , m_cookieJarFileName(0) , m_runningJobs(0) + , m_certificatePath (certificatePath()) { curl_global_init(CURL_GLOBAL_ALL); m_curlMultiHandle = curl_multi_init(); @@ -88,6 +109,23 @@ ResourceHandleManager* ResourceHandleManager::sharedInstance() return sharedInstance; } +static void handleLocalReceiveResponse (CURL* handle, ResourceHandle* job, ResourceHandleInternal* d) +{ + // since the code in headerCallback will not have run for local files + // the code to set the URL and fire didReceiveResponse is never run, + // which means the ResourceLoader's response does not contain the URL. + // Run the code here for local files to resolve the issue. + // TODO: See if there is a better approach for handling this. + const char* hdr; + CURLcode err = curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &hdr); + ASSERT(CURLE_OK == err); + d->m_response.setURL(KURL(hdr)); + if (d->client()) + d->client()->didReceiveResponse(job, d->m_response); + d->m_response.setResponseFired(true); +} + + // called with data after all headers have been processed via headerCallback static size_t writeCallback(void* ptr, size_t size, size_t nmemb, void* data) { @@ -112,18 +150,10 @@ static size_t writeCallback(void* ptr, size_t size, size_t nmemb, void* data) if (CURLE_OK == err && httpCode >= 300 && httpCode < 400) return totalSize; - // since the code in headerCallback will not have run for local files - // the code to set the URL and fire didReceiveResponse is never run, - // which means the ResourceLoader's response does not contain the URL. - // Run the code here for local files to resolve the issue. - // TODO: See if there is a better approach for handling this. if (!d->m_response.responseFired()) { - const char* hdr; - err = curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr); - d->m_response.setURL(KURL(hdr)); - if (d->client()) - d->client()->didReceiveResponse(job, d->m_response); - d->m_response.setResponseFired(true); + handleLocalReceiveResponse(h, job, d); + if (d->m_cancelled) + return 0; } if (d->client()) @@ -222,6 +252,7 @@ size_t readCallback(void* ptr, size_t size, size_t nmemb, void* data) { ResourceHandle* job = static_cast<ResourceHandle*>(data); ResourceHandleInternal* d = job->getInternal(); + if (d->m_cancelled) return 0; @@ -311,6 +342,14 @@ void ResourceHandleManager::downloadTimerCallback(Timer<ResourceHandleManager>* continue; if (CURLE_OK == msg->data.result) { + if (!d->m_response.responseFired()) { + handleLocalReceiveResponse(d->m_handle, job, d); + if (d->m_cancelled) { + removeFromCurl(job); + continue; + } + } + if (d->client()) d->client()->didFinishLoading(job); } else { @@ -629,6 +668,10 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job) // and/or reporting SSL errors to the user. if (ignoreSSLErrors) curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYPEER, false); + + if (!m_certificatePath.isNull()) + curl_easy_setopt(d->m_handle, CURLOPT_CAINFO, m_certificatePath.data()); + // enable gzip and deflate through Accept-Encoding: curl_easy_setopt(d->m_handle, CURLOPT_ENCODING, ""); diff --git a/WebCore/platform/network/curl/ResourceHandleManager.h b/WebCore/platform/network/curl/ResourceHandleManager.h index d38e577..89b27d7 100644 --- a/WebCore/platform/network/curl/ResourceHandleManager.h +++ b/WebCore/platform/network/curl/ResourceHandleManager.h @@ -29,6 +29,7 @@ #define ResourceHandleManager_h #include "Frame.h" +#include "CString.h" #include "Timer.h" #include "ResourceHandleClient.h" @@ -71,6 +72,7 @@ private: char* m_cookieJarFileName; char m_curlErrorBuffer[CURL_ERROR_SIZE]; Vector<ResourceHandle*> m_resourceHandleList; + const CString m_certificatePath; int m_runningJobs; }; diff --git a/WebCore/platform/network/soup/CookieJarSoup.cpp b/WebCore/platform/network/soup/CookieJarSoup.cpp index 705fdf2..3eb578a 100644 --- a/WebCore/platform/network/soup/CookieJarSoup.cpp +++ b/WebCore/platform/network/soup/CookieJarSoup.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "CookieJarSoup.h" +#include "Cookie.h" #include "CString.h" #include "Document.h" #include "KURL.h" @@ -86,4 +87,16 @@ bool cookiesEnabled(const Document* /*document*/) return defaultCookieJar(); } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index 4a22d8a..280fc38 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -118,7 +118,7 @@ void WebCoreSynchronousLoader::run() g_main_loop_run(m_mainLoop); } -static void cleanupGioOperation(ResourceHandleInternal* handle); +static void cleanupGioOperation(ResourceHandle* handle, bool isDestroying); static bool startData(ResourceHandle* handle, String urlString); static bool startGio(ResourceHandle* handle, KURL url); @@ -129,8 +129,6 @@ ResourceHandleInternal::~ResourceHandleInternal() m_msg = 0; } - cleanupGioOperation(this); - if (m_idleHandler) { g_source_remove(m_idleHandler); m_idleHandler = 0; @@ -142,6 +140,8 @@ ResourceHandle::~ResourceHandle() if (d->m_msg) g_signal_handlers_disconnect_matched(d->m_msg, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + + cleanupGioOperation(this, true); } static void fillResponseFromMessage(SoupMessage* msg, ResourceResponse* response) @@ -276,7 +276,7 @@ static void gotChunkCallback(SoupMessage* msg, SoupBuffer* chunk, gpointer data) // Doesn't get called for redirects. static void finishedCallback(SoupSession *session, SoupMessage* msg, gpointer data) { - RefPtr<ResourceHandle>handle = adoptRef(static_cast<ResourceHandle*>(data)); + RefPtr<ResourceHandle> handle = adoptRef(static_cast<ResourceHandle*>(data)); // TODO: maybe we should run this code even if there's no client? if (!handle) return; @@ -625,8 +625,10 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S // GIO-based loader -static void cleanupGioOperation(ResourceHandleInternal* d) +static void cleanupGioOperation(ResourceHandle* handle, bool isDestroying = false) { + ResourceHandleInternal* d = handle->getInternal(); + if (d->m_gfile) { g_object_set_data(G_OBJECT(d->m_gfile), "webkit-resource", 0); g_object_unref(d->m_gfile); @@ -648,11 +650,14 @@ static void cleanupGioOperation(ResourceHandleInternal* d) g_free(d->m_buffer); d->m_buffer = 0; } + + if (!isDestroying) + handle->deref(); } static void closeCallback(GObject* source, GAsyncResult* res, gpointer) { - ResourceHandle* handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); + RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -660,13 +665,12 @@ static void closeCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); g_input_stream_close_finish(d->m_inputStream, res, 0); - cleanupGioOperation(d); - client->didFinishLoading(handle); + cleanupGioOperation(handle.get()); + client->didFinishLoading(handle.get()); } static void readCallback(GObject* source, GAsyncResult* res, gpointer) { - // didReceiveData may cancel the load, which may release the last reference. RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -675,7 +679,7 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); if (d->m_cancelled || !client) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -690,7 +694,7 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) error ? String::fromUTF8(error->message) : String()); g_free(uri); g_error_free(error); - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); client->didFail(handle.get(), resourceError); return; } @@ -704,8 +708,9 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) d->m_total += bytesRead; client->didReceiveData(handle.get(), d->m_buffer, bytesRead, d->m_total); + // didReceiveData may cancel the load, which may release the last reference. if (d->m_cancelled) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -716,7 +721,7 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) static void openCallback(GObject* source, GAsyncResult* res, gpointer) { - ResourceHandle* handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); + RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -724,7 +729,7 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); if (d->m_cancelled || !client) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -738,8 +743,8 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) error ? String::fromUTF8(error->message) : String()); g_free(uri); g_error_free(error); - cleanupGioOperation(d); - client->didFail(handle, resourceError); + cleanupGioOperation(handle.get()); + client->didFail(handle.get(), resourceError); return; } @@ -747,7 +752,8 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) d->m_bufferSize = 8192; d->m_buffer = static_cast<char*>(g_malloc(d->m_bufferSize)); d->m_total = 0; - g_object_set_data(G_OBJECT(d->m_inputStream), "webkit-resource", handle); + + g_object_set_data(G_OBJECT(d->m_inputStream), "webkit-resource", handle.get()); g_input_stream_read_async(d->m_inputStream, d->m_buffer, d->m_bufferSize, G_PRIORITY_DEFAULT, d->m_cancellable, readCallback, 0); @@ -755,7 +761,7 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) { - ResourceHandle* handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); + RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -763,7 +769,7 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); if (d->m_cancelled) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -790,8 +796,8 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) error ? String::fromUTF8(error->message) : String()); g_free(uri); g_error_free(error); - cleanupGioOperation(d); - client->didFail(handle, resourceError); + cleanupGioOperation(handle.get()); + client->didFail(handle.get(), resourceError); return; } @@ -804,8 +810,8 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) uri, String()); g_free(uri); - cleanupGioOperation(d); - client->didFail(handle, resourceError); + cleanupGioOperation(handle.get()); + client->didFail(handle.get(), resourceError); return; } @@ -816,7 +822,12 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) g_file_info_get_modification_time(info, &tv); response.setLastModifiedDate(tv.tv_sec); - client->didReceiveResponse(handle, response); + client->didReceiveResponse(handle.get(), response); + + if (d->m_cancelled) { + cleanupGioOperation(handle.get()); + return; + } g_file_read_async(d->m_gfile, G_PRIORITY_DEFAULT, d->m_cancellable, openCallback, 0); @@ -852,6 +863,10 @@ static bool startGio(ResourceHandle* handle, KURL url) #endif d->m_gfile = g_file_new_for_uri(url.string().utf8().data()); g_object_set_data(G_OBJECT(d->m_gfile), "webkit-resource", handle); + + // balanced by a deref() in cleanupGioOperation, which should always run + handle->ref(); + d->m_cancellable = g_cancellable_new(); g_file_query_info_async(d->m_gfile, G_FILE_ATTRIBUTE_STANDARD_TYPE "," diff --git a/WebCore/platform/network/win/CookieJarCFNetWin.cpp b/WebCore/platform/network/win/CookieJarCFNetWin.cpp index af9e3f3..519a1b9 100644 --- a/WebCore/platform/network/win/CookieJarCFNetWin.cpp +++ b/WebCore/platform/network/win/CookieJarCFNetWin.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "CookieStorageWin.h" #include "Document.h" #include "KURL.h" @@ -113,4 +114,16 @@ bool cookiesEnabled(const Document* /*document*/) return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/network/win/CookieJarWin.cpp b/WebCore/platform/network/win/CookieJarWin.cpp index 41d12d9..6576e07 100644 --- a/WebCore/platform/network/win/CookieJarWin.cpp +++ b/WebCore/platform/network/win/CookieJarWin.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "KURL.h" #include "PlatformString.h" #include "Document.h" @@ -35,7 +36,6 @@ namespace WebCore { - void setCookies(Document* /*document*/, const KURL& url, const String& value) { // FIXME: Deal with document->firstPartyForCookies(). @@ -64,4 +64,16 @@ bool cookiesEnabled(const Document* /*document*/) return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp index 40d9309..56d3372 100644 --- a/WebCore/platform/qt/CookieJarQt.cpp +++ b/WebCore/platform/qt/CookieJarQt.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "Document.h" #include "KURL.h" #include "PlatformString.h" @@ -128,6 +129,18 @@ bool cookiesEnabled(const Document* document) #endif } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } // vim: ts=4 sw=4 et diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp index 28d3ca7..02bc678 100644 --- a/WebCore/platform/qt/FileSystemQt.cpp +++ b/WebCore/platform/qt/FileSystemQt.cpp @@ -81,7 +81,7 @@ bool makeAllDirectories(const String& path) String pathByAppendingComponent(const String& path, const String& component) { - return QDir(path).filePath(component); + return QDir::toNativeSeparators(QDir(path).filePath(component)); } String homeDirectoryPath() diff --git a/WebCore/platform/text/PlatformString.h b/WebCore/platform/text/PlatformString.h index 6d5384f..258b28d 100644 --- a/WebCore/platform/text/PlatformString.h +++ b/WebCore/platform/text/PlatformString.h @@ -56,6 +56,10 @@ QT_END_NAMESPACE class wxString; #endif +#if PLATFORM(HAIKU) +class BString; +#endif + namespace WebCore { class CString; @@ -229,6 +233,11 @@ public: operator wxString() const; #endif +#if PLATFORM(HAIKU) + String(const BString&); + operator BString() const; +#endif + #ifndef NDEBUG Vector<char> ascii() const; #endif diff --git a/WebCore/platform/text/UnicodeRange.h b/WebCore/platform/text/UnicodeRange.h index 7ecf03f..2278a0e 100644 --- a/WebCore/platform/text/UnicodeRange.h +++ b/WebCore/platform/text/UnicodeRange.h @@ -35,6 +35,10 @@ #ifndef UnicodeRange_H #define UnicodeRange_H +#if PLATFORM(HAIKU) +#include "stdint.h" +#endif + #include <wtf/unicode/Unicode.h> namespace WebCore { diff --git a/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp b/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp index 2c732d6..8bb8c70 100644 --- a/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp +++ b/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp @@ -26,6 +26,12 @@ namespace WebCore { +const char* currentSearchLocaleID() +{ + notImplemented(); + return ""; +} + const char* currentTextBreakLocaleID() { notImplemented(); diff --git a/WebCore/platform/text/mac/TextCodecMac.cpp b/WebCore/platform/text/mac/TextCodecMac.cpp index 93b9da2..1152cc2 100644 --- a/WebCore/platform/text/mac/TextCodecMac.cpp +++ b/WebCore/platform/text/mac/TextCodecMac.cpp @@ -36,7 +36,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/Threading.h> -using std::min; +using namespace std; namespace WebCore { @@ -141,7 +141,7 @@ OSStatus TextCodecMac::decode(const unsigned char* inputBuffer, int inputBufferL // First, fill the partial character buffer with as many bytes as are available. ASSERT(m_numBufferedBytes < sizeof(m_bufferedBytes)); const int spaceInBuffer = sizeof(m_bufferedBytes) - m_numBufferedBytes; - const int bytesToPutInBuffer = MIN(spaceInBuffer, inputBufferLength); + const int bytesToPutInBuffer = min(spaceInBuffer, inputBufferLength); ASSERT(bytesToPutInBuffer != 0); memcpy(m_bufferedBytes + m_numBufferedBytes, inputBuffer, bytesToPutInBuffer); diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp index e53053f..216c7c5 100644 --- a/WebCore/platform/win/PopupMenuWin.cpp +++ b/WebCore/platform/win/PopupMenuWin.cpp @@ -94,6 +94,11 @@ PopupMenu::~PopupMenu() ::DestroyWindow(m_popup); } +LPCTSTR PopupMenu::popupClassName() +{ + return kPopupWindowClassName; +} + void PopupMenu::show(const IntRect& r, FrameView* v, int index) { calculatePositionAndSize(r, v); diff --git a/WebCore/platform/wince/CursorWince.cpp b/WebCore/platform/wince/CursorWince.cpp new file mode 100644 index 0000000..e35f1f9 --- /dev/null +++ b/WebCore/platform/wince/CursorWince.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008-2009 Torch Mobile 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. + */ + +#include "config.h" +#include "Cursor.h" + +namespace WebCore { + +struct AllCursors { + AllCursors() + { + for (int i = 0; i < NumCursorTypes; ++i) + m_cursors[i] = (CursorType) i; + } + Cursor m_cursors[NumCursorTypes]; +}; + +static const Cursor& getCursor(CursorType type) +{ + static AllCursors allCursors; + return allCursors.m_cursors[type]; +} + +Cursor::Cursor(const Cursor& other) +: m_impl(other.m_impl) +{ +} + +Cursor::Cursor(Image* img, const IntPoint& hotspot) +: m_impl(CursorNone) +{ +} + +Cursor::~Cursor() +{ +} + +Cursor& Cursor::operator=(const Cursor& other) +{ + m_impl = other.m_impl; + return *this; +} + +Cursor::Cursor(PlatformCursor c) +: m_impl(c) +{ +} + +const Cursor& noneCursor() { return getCursor(CursorNone); } +const Cursor& pointerCursor() { return getCursor(CursorPointer); } +const Cursor& crossCursor() { return getCursor(CursorCross); } +const Cursor& handCursor() { return getCursor(CursorHand); } +const Cursor& iBeamCursor() { return getCursor(CursorBeam); } +const Cursor& waitCursor() { return getCursor(CursorWait); } +const Cursor& helpCursor() { return getCursor(CursorHelp); } +const Cursor& moveCursor() { return getCursor(CursorMove); } +const Cursor& eastResizeCursor() { return getCursor(CursorEastResize); } +const Cursor& northResizeCursor() { return getCursor(CursorNorthResize); } +const Cursor& northEastResizeCursor() { return getCursor(CursorNorthEastResize); } +const Cursor& northWestResizeCursor() { return getCursor(CursorNorthWestResize); } +const Cursor& southResizeCursor() { return getCursor(CursorSouthResize); } +const Cursor& southEastResizeCursor() { return getCursor(CursorSouthEastResize); } +const Cursor& southWestResizeCursor() { return getCursor(CursorSouthWestResize); } +const Cursor& westResizeCursor() { return getCursor(CursorWestResize); } +const Cursor& northSouthResizeCursor() { return getCursor(CursorNorthSouthResize); } +const Cursor& eastWestResizeCursor() { return getCursor(CursorEastWestResize); } +const Cursor& northEastSouthWestResizeCursor() { return getCursor(CursorNorthEastSouthWestResize); } +const Cursor& northWestSouthEastResizeCursor() { return getCursor(CursorNorthWestSouthEastResize); } +const Cursor& columnResizeCursor() { return getCursor(CursorColumnResize); } +const Cursor& rowResizeCursor() { return getCursor(CursorRowResize); } +const Cursor& verticalTextCursor() { return getCursor(CursorVerticalText); } +const Cursor& cellCursor() { return getCursor(CursorCell); } +const Cursor& contextMenuCursor() { return getCursor(CursorContextMenu); } +const Cursor& noDropCursor() { return getCursor(CursorNoDrop); } +const Cursor& notAllowedCursor() { return getCursor(CursorNotAllowed); } +const Cursor& progressCursor() { return getCursor(CursorProgress); } +const Cursor& aliasCursor() { return getCursor(CursorAlias); } +const Cursor& zoomInCursor() { return getCursor(CursorZoomIn); } +const Cursor& zoomOutCursor() { return getCursor(CursorZoomOut); } +const Cursor& copyCursor() { return getCursor(CursorCopy); } +const Cursor& middlePanningCursor() { return crossCursor(); } +const Cursor& eastPanningCursor() { return crossCursor(); } +const Cursor& northPanningCursor() { return crossCursor(); } +const Cursor& northEastPanningCursor() { return crossCursor(); } +const Cursor& northWestPanningCursor() { return crossCursor(); } +const Cursor& southPanningCursor() { return crossCursor(); } +const Cursor& southEastPanningCursor() { return crossCursor(); } +const Cursor& southWestPanningCursor() { return crossCursor(); } +const Cursor& westPanningCursor() { return crossCursor(); } +const Cursor& grabbingCursor() { return moveCursor(); } +const Cursor& grabCursor() { return moveCursor(); } + +} diff --git a/WebCore/platform/wince/DragDataWince.cpp b/WebCore/platform/wince/DragDataWince.cpp new file mode 100644 index 0000000..881d7d4 --- /dev/null +++ b/WebCore/platform/wince/DragDataWince.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, 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. + * + */ + +#include "config.h" +#include "DragData.h" + +#include "Clipboard.h" +#include "DocumentFragment.h" +#include "PlatformString.h" + +namespace WebCore { + +PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const +{ + return 0; +} + +bool DragData::containsURL() const +{ + return false; +} + +String DragData::asURL(String* title) const +{ + return String(); +} + +bool DragData::containsFiles() const +{ + return false; +} + +void DragData::asFilenames(Vector<String>&) const +{ +} + +bool DragData::containsPlainText() const +{ + return false; +} + +String DragData::asPlainText() const +{ + return String(); +} + +bool DragData::containsColor() const +{ + return false; +} + +bool DragData::canSmartReplace() const +{ + return false; +} + +bool DragData::containsCompatibleContent() const +{ + return false; +} + +PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const +{ + return 0; +} + +Color DragData::asColor() const +{ + return Color(); +} + +} + diff --git a/WebCore/platform/wince/DragImageWince.cpp b/WebCore/platform/wince/DragImageWince.cpp new file mode 100644 index 0000000..4d60f80 --- /dev/null +++ b/WebCore/platform/wince/DragImageWince.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, 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. + * + */ + +#include "config.h" +#include "DragImage.h" + +#include "CachedImage.h" +#include "GraphicsContext.h" +#include "Image.h" + +#include <windows.h> + +namespace WebCore { + +IntSize dragImageSize(DragImageRef) +{ + return IntSize(0, 0); +} + +void deleteDragImage(DragImageRef image) +{ + if (image) + ::DeleteObject(image); +} + +DragImageRef scaleDragImage(DragImageRef, FloatSize) +{ + return 0; +} + +DragImageRef dissolveDragImageToFraction(DragImageRef image, float) +{ + return image; +} + +DragImageRef createDragImageFromImage(Image*) +{ + return 0; +} + +DragImageRef createDragImageIconForCachedImage(CachedImage*) +{ + return 0; +} + +} diff --git a/WebCore/platform/wince/EditorWince.cpp b/WebCore/platform/wince/EditorWince.cpp new file mode 100644 index 0000000..02af780 --- /dev/null +++ b/WebCore/platform/wince/EditorWince.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, 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. + * + */ + +#include "config.h" + +#include "Editor.h" + +#include "ClipboardWince.h" +#include "Document.h" +#include "EditorClient.h" +#include "Element.h" +#include "HtmlEditing.h" +#include "TextIterator.h" +#include "visible_units.h" + +#include <windows.h> +#define _SYS_GUID_OPERATORS_ + +namespace WebCore { + +PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) +{ + return adoptRef(new ClipboardWince(policy, false)); +} + +} // namespace WebCore diff --git a/WebCore/platform/wince/FileChooserWince.cpp b/WebCore/platform/wince/FileChooserWince.cpp new file mode 100644 index 0000000..07c99b1 --- /dev/null +++ b/WebCore/platform/wince/FileChooserWince.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * 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 "FileChooser.h" + +#include "Chrome.h" +#include "ChromeClient.h" +#include "Document.h" +#include "Frame.h" +#include "Icon.h" +#include "LocalizedStrings.h" +#include "Page.h" +#include "StringTruncator.h" + +namespace WebCore { + +String pathGetFileName(const String& path); + +String FileChooser::basenameForWidth(const Font& font, int width) const +{ + if (width <= 0) + return String(); + + String string; + if (m_filenames.isEmpty()) + string = fileButtonNoFileSelectedLabel(); + else if (m_filenames.size() == 1) { + String tmpFilename = m_filenames[0]; + string = pathGetFileName(tmpFilename); + } else + return StringTruncator::rightTruncate(String::number(m_filenames.size()) + " files", width, font, false); + + return StringTruncator::centerTruncate(string, width, font, false); +} + +} diff --git a/WebCore/platform/wince/FileSystemWince.cpp b/WebCore/platform/wince/FileSystemWince.cpp new file mode 100644 index 0000000..2bb4dd5 --- /dev/null +++ b/WebCore/platform/wince/FileSystemWince.cpp @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Collabora, Ltd. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FileSystem.h" + +#include "CString.h" +#include "PlatformString.h" + +#include <windows.h> +#include <wincrypt.h> + +namespace WebCore { + +static bool getFileInfo(const String& path, BY_HANDLE_FILE_INFORMATION& fileInfo) +{ + String filename = path; + HANDLE hFile = CreateFile(filename.charactersWithNullTermination(), GENERIC_READ, FILE_SHARE_READ, 0 + , OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0); + + if (hFile == INVALID_HANDLE_VALUE) + return false; + + bool rtn = GetFileInformationByHandle(hFile, &fileInfo) ? true : false; + + CloseHandle(hFile); + return rtn; +} + +bool getFileSize(const String& path, long long& result) +{ + BY_HANDLE_FILE_INFORMATION fileInformation; + if (!getFileInfo(path, fileInformation)) + return false; + + ULARGE_INTEGER fileSize; + fileSize.LowPart = fileInformation.nFileSizeLow; + fileSize.HighPart = fileInformation.nFileSizeHigh; + + result = fileSize.QuadPart; + + return true; +} + +bool getFileModificationTime(const String& path, time_t& result) +{ + BY_HANDLE_FILE_INFORMATION fileInformation; + if (!getFileInfo(path, fileInformation)) + return false; + + ULARGE_INTEGER t; + memcpy(&t, &fileInformation.ftLastWriteTime, sizeof(t)); + + result = t.QuadPart * 0.0000001 - 11644473600.0; + + return true; +} + +bool fileExists(const String& path) +{ + String filename = path; + HANDLE hFile = CreateFile(filename.charactersWithNullTermination(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE + , 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0); + + CloseHandle(hFile); + + return hFile != INVALID_HANDLE_VALUE; +} + +bool deleteFile(const String& path) +{ + String filename = path; + return !!DeleteFileW(filename.charactersWithNullTermination()); +} + + +bool deleteEmptyDirectory(const String& path) +{ + String filename = path; + return !!RemoveDirectoryW(filename.charactersWithNullTermination()); +} + +String pathByAppendingComponent(const String& path, const String& component) +{ + if (component.isEmpty()) + return path; + + Vector<UChar, MAX_PATH> buffer; + + buffer.append(path.characters(), path.length()); + + if (buffer.last() != L'\\' && buffer.last() != L'/' + && component[0] != L'\\' && component[0] != L'/') + buffer.append(L'\\'); + + buffer.append(component.characters(), component.length()); + + return String(buffer.data(), buffer.size()); +} + +CString fileSystemRepresentation(const String&) +{ + return ""; +} + +bool makeAllDirectories(const String& path) +{ + int lastDivPos = max(path.reverseFind('/'), path.reverseFind('\\')); + int endPos = path.length(); + if (lastDivPos == path.length() - 1) { + endPos -= 1; + lastDivPos = max(path.reverseFind('/', lastDivPos), path.reverseFind('\\', lastDivPos)); + } + + if (lastDivPos > 0) { + if (!makeAllDirectories(path.substring(0, lastDivPos))) + return false; + } + + String folder(path.substring(0, endPos)); + CreateDirectory(folder.charactersWithNullTermination(), 0); + + DWORD fileAttr = GetFileAttributes(folder.charactersWithNullTermination()); + return fileAttr != 0xFFFFFFFF && (fileAttr & FILE_ATTRIBUTE_DIRECTORY); +} + +String homeDirectoryPath() +{ + notImplemented(); + return ""; +} + +String pathGetFileName(const String& path) +{ + return path.substring(max(path.reverseFind('/'), path.reverseFind('\\')) + 1); +} + +String directoryName(const String& path) +{ + notImplemented(); + return String(); +} + +CString openTemporaryFile(const char*, PlatformFileHandle& handle) +{ + handle = INVALID_HANDLE_VALUE; + + wchar_t tempPath[MAX_PATH]; + int tempPathLength = ::GetTempPath(_countof(tempPath), tempPath); + if (tempPathLength <= 0 || tempPathLength > _countof(tempPath)) + return CString(); + + HCRYPTPROV hCryptProv = 0; + if (!CryptAcquireContext(&hCryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) + return CString(); + + String proposedPath; + while (1) { + + wchar_t tempFile[] = L"XXXXXXXX.tmp"; // Use 8.3 style name (more characters aren't helpful due to 8.3 short file names) + const int randomPartLength = 8; + if (!CryptGenRandom(hCryptProv, randomPartLength * 2, reinterpret_cast<BYTE*>(tempFile))) + break; + + // Limit to valid filesystem characters, also excluding others that could be problematic, like punctuation. + // don't include both upper and lowercase since Windows file systems are typically not case sensitive. + const char validChars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + for (int i = 0; i < randomPartLength; ++i) + tempFile[i] = validChars[tempFile[i] % (sizeof(validChars) - 1)]; + + ASSERT(wcslen(tempFile) * 2 == sizeof(tempFile) - 2); + + proposedPath = pathByAppendingComponent(String(tempPath), String(tempFile)); + + // use CREATE_NEW to avoid overwriting an existing file with the same name + handle = CreateFile(proposedPath.charactersWithNullTermination(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); + if (!isHandleValid(handle) && GetLastError() == ERROR_ALREADY_EXISTS) + continue; + + break; + } + + CryptReleaseContext(hCryptProv, 0); + + if (!isHandleValid(handle)) + return CString(); + + return proposedPath.latin1(); +} + +void closeFile(PlatformFileHandle& handle) +{ + if (isHandleValid(handle)) { + ::CloseHandle(handle); + handle = invalidPlatformFileHandle; + } +} + +int writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + if (!isHandleValid(handle)) + return -1; + + DWORD bytesWritten; + bool success = WriteFile(handle, data, length, &bytesWritten, 0); + + if (!success) + return -1; + return static_cast<int>(bytesWritten); +} + +bool unloadModule(PlatformModule module) +{ + return ::FreeLibrary(module); +} + +String localUserSpecificStorageDirectory() +{ + return String(L"\\"); +} + +String roamingUserSpecificStorageDirectory() +{ + return String(L"\\"); +} + +Vector<String> listDirectory(const String& path, const String& filter) +{ + Vector<String> entries; + + Vector<UChar, 256> pattern; + pattern.append(path.characters(), path.length()); + if (pattern.last() != L'/' && pattern.last() != L'\\') + pattern.append(L'\\'); + + String root(pattern.data(), pattern.size()); + pattern.append(filter.characters(), filter.length()); + pattern.append(0); + + WIN32_FIND_DATA findData; + HANDLE hFind = FindFirstFile(pattern.data(), &findData); + if (INVALID_HANDLE_VALUE != hFind) { + do { + // FIXEME: should we also add the folders? This function + // is so far only called by PluginDatabase.cpp to list + // all plugins in a folder, where it's not supposed to list sub-folders. + if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + entries.append(root + findData.cFileName); + } while (FindNextFile(hFind, &findData)); + FindClose(hFind); + } + + return entries; +} + +} diff --git a/WebCore/platform/wince/KURLWince.cpp b/WebCore/platform/wince/KURLWince.cpp new file mode 100644 index 0000000..5ca1e4b --- /dev/null +++ b/WebCore/platform/wince/KURLWince.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 Torch Mobile 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. + */ + +#include "config.h" +#include "KURL.h" + +namespace WebCore { + +String KURL::fileSystemPath() const +{ + return path(); +} + +} diff --git a/WebCore/platform/wince/KeygenWince.cpp b/WebCore/platform/wince/KeygenWince.cpp new file mode 100644 index 0000000..b0f4d63 --- /dev/null +++ b/WebCore/platform/wince/KeygenWince.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2008-2009 Torch Mobile 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. + */ + +#include "config.h" +#include "SSLKeyGenerator.h" + +#include "Base64.h" +#include "CString.h" + +#include <windows.h> +#include <wincrypt.h> + +namespace WebCore { + +void WebCore::getSupportedKeySizes(Vector<String>& v) +{ + v.append("High Grade"); + v.append("Medium Grade"); +} + +String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url) +{ + String keyString; + + HCRYPTPROV hContext = 0; + HCRYPTKEY hKey = 0; + PCERT_PUBLIC_KEY_INFO pPubInfo = 0; + + // Try to delete it if it exists already + CryptAcquireContext(&hContext, _T("keygen_container"), MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + + do { + if (!CryptAcquireContext(&hContext, _T("keygen_container"), MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)) + break; + + DWORD dwPubInfoLength = 0; + if (!CryptGenKey(hContext, AT_KEYEXCHANGE, 0, &hKey) || !CryptExportPublicKeyInfo(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, 0, &dwPubInfoLength)) + break; + + // Use malloc instead of new, because malloc guarantees to return a pointer aligned for all data types. + pPubInfo = reinterpret_cast<PCERT_PUBLIC_KEY_INFO>(fastMalloc(dwPubInfoLength)); + + if (!CryptExportPublicKeyInfo(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, pPubInfo, &dwPubInfoLength)) + break; + + CERT_KEYGEN_REQUEST_INFO requestInfo = { 0 }; + requestInfo.dwVersion = CERT_KEYGEN_REQUEST_V1; + requestInfo.pwszChallengeString = L""; + requestInfo.SubjectPublicKeyInfo = *pPubInfo; + + String localChallenge = challenge; + + // Windows API won't write to our buffer, although it's not declared with const. + requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallenge.charactersWithNullTermination()); + + CRYPT_ALGORITHM_IDENTIFIER signAlgo = { 0 }; + signAlgo.pszObjId = szOID_RSA_SHA1RSA; + + DWORD dwEncodedLength; + if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, 0, &dwEncodedLength)) + break; + + Vector<char> binary(dwEncodedLength); + if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, reinterpret_cast<LPBYTE>(binary.data()), &dwEncodedLength)) + break; + + Vector<char> base64; + base64Encode(binary, base64); + keyString = String(base64.data(), base64.size()); + + } while(0); + + if (pPubInfo) + fastFree(pPubInfo); + + if (hKey) + CryptDestroyKey(hKey); + + if (hContext) + CryptReleaseContext(hContext, 0); + + return keyString; +} + +} // namespace WebCore diff --git a/WebCore/platform/wince/MIMETypeRegistryWince.cpp b/WebCore/platform/wince/MIMETypeRegistryWince.cpp new file mode 100644 index 0000000..2ecde48 --- /dev/null +++ b/WebCore/platform/wince/MIMETypeRegistryWince.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * 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 "MIMETypeRegistry.h" + +#include <windows.h> +#include <winreg.h> + +namespace WebCore { + +static String mimeTypeForExtension(const String& extension) +{ + String ext = "." + extension; + WCHAR contentTypeStr[256]; + DWORD contentTypeStrLen = sizeof(contentTypeStr); + DWORD valueType; + + HKEY key; + String result; + if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, ext.charactersWithNullTermination(), 0, 0, &key)) + return result; + + if (ERROR_SUCCESS == RegQueryValueEx(key, L"Content Type", 0, &valueType, (LPBYTE)contentTypeStr, &contentTypeStrLen) && valueType == REG_SZ) + result = String(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1); + + RegCloseKey(key); + + return result; +} + +static HashMap<String, String> mimetypeMap; + +static void initMIMETypeEntensionMap() +{ + if (mimetypeMap.isEmpty()) { + //fill with initial values + mimetypeMap.add("txt", "text/plain"); + mimetypeMap.add("pdf", "application/pdf"); + mimetypeMap.add("ps", "application/postscript"); + mimetypeMap.add("html", "text/html"); + mimetypeMap.add("htm", "text/html"); + mimetypeMap.add("xml", "text/xml"); + mimetypeMap.add("xsl", "text/xsl"); + mimetypeMap.add("js", "application/x-javascript"); + mimetypeMap.add("xhtml", "application/xhtml+xml"); + mimetypeMap.add("rss", "application/rss+xml"); + mimetypeMap.add("webarchive", "application/x-webarchive"); + mimetypeMap.add("svg", "image/svg+xml"); + mimetypeMap.add("svgz", "image/svg+xml"); + mimetypeMap.add("jpg", "image/jpeg"); + mimetypeMap.add("jpeg", "image/jpeg"); + mimetypeMap.add("png", "image/png"); + mimetypeMap.add("tif", "image/tiff"); + mimetypeMap.add("tiff", "image/tiff"); + mimetypeMap.add("ico", "image/ico"); + mimetypeMap.add("cur", "image/ico"); + mimetypeMap.add("bmp", "image/bmp"); + mimetypeMap.add("css", "text/css"); + // FIXME: Custom font works only when MIME is "text/plain" + mimetypeMap.add("ttf", "text/plain"); // "font/ttf" + mimetypeMap.add("otf", "text/plain"); // "font/otf" +#if ENABLE(WML) + mimetypeMap.add("wml", "text/vnd.wap.wml"); +#endif +#if ENABLE(WBXML) + mimetypeMap.add("wbxml", "application/vnd.wap.wmlc"); +#endif + } +} + +String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type) +{ + if (type.isEmpty()) + return String(); + + // Avoid conflicts with "ttf" and "otf" + if (equalIgnoringCase(type, "text/plain")) + return "txt"; + + initMIMETypeEntensionMap(); + + for (HashMap<String, String>::iterator i = mimetypeMap.begin(); i != mimetypeMap.end(); ++i) { + if (equalIgnoringCase(i->second, type)) + return i->first; + } + +#if ENABLE(XHTMLMP) + if (equalIgnoringCase("application/vnd.wap.xhtml+xml", type)) + return String("xml"); +#endif + + return String(); +} + +String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) +{ + if (ext.isEmpty()) + return String(); + + initMIMETypeEntensionMap(); + + String result = mimetypeMap.get(ext.lower()); + if (result.isEmpty()) { + result = mimeTypeForExtension(ext); + if (!result.isEmpty()) + mimetypeMap.add(ext, result); + } + return result.isEmpty() ? "unknown/unknown" : result; +} + +} diff --git a/WebCore/platform/wince/PasteboardWince.cpp b/WebCore/platform/wince/PasteboardWince.cpp new file mode 100644 index 0000000..cba85b8 --- /dev/null +++ b/WebCore/platform/wince/PasteboardWince.cpp @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * 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 "Pasteboard.h" + +#include "CString.h" +#include "ClipboardUtilitiesWin.h" +#include "Document.h" +#include "DocumentFragment.h" +#include "Element.h" +#include "Frame.h" +#include "HitTestResult.h" +#include "Image.h" +#include "KURL.h" +#include "Page.h" +#include "Range.h" +#include "RenderImage.h" +#include "TextEncoding.h" +#include "markup.h" + +namespace WebCore { + +static UINT HTMLClipboardFormat = 0; +static UINT BookmarkClipboardFormat = 0; +static UINT WebSmartPasteFormat = 0; + +extern HDC hScreenDC; + +static LRESULT CALLBACK PasteboardOwnerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lresult = 0; + LONG longPtr = GetWindowLong(hWnd, 0); + + switch (message) { + case WM_RENDERFORMAT: + // This message comes when SetClipboardData was sent a null data handle + // and now it's come time to put the data on the clipboard. + break; + case WM_RENDERALLFORMATS: + // This message comes when SetClipboardData was sent a null data handle + // and now this application is about to quit, so it must put data on + // the clipboard before it exits. + break; + case WM_DESTROY: + break; + default: + lresult = DefWindowProc(hWnd, message, wParam, lParam); + break; + } + return lresult; +} + +Pasteboard* Pasteboard::generalPasteboard() +{ + static Pasteboard* pasteboard = new Pasteboard; + return pasteboard; +} + +Pasteboard::Pasteboard() +{ + // make a dummy HWND to be the Windows clipboard's owner + WNDCLASS wc = {0}; + memset(&wc, 0, sizeof(wc)); + wc.lpfnWndProc = PasteboardOwnerWndProc; + wc.hInstance = Page::instanceHandle(); + wc.lpszClassName = L"PasteboardOwnerWindowClass"; + ::RegisterClass(&wc); + + m_owner = ::CreateWindow(L"PasteboardOwnerWindowClass", L"PasteboardOwnerWindow", 0, 0, 0, 0, 0, + HWND_MESSAGE, 0, 0, 0); + + HTMLClipboardFormat = ::RegisterClipboardFormat(L"HTML Format"); + BookmarkClipboardFormat = ::RegisterClipboardFormat(L"UniformResourceLocatorW"); + WebSmartPasteFormat = ::RegisterClipboardFormat(L"WebKit Smart Paste Format"); +} + +void Pasteboard::clear() +{ + if (::OpenClipboard(m_owner)) { + ::EmptyClipboard(); + ::CloseClipboard(); + } +} + +void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) +{ + clear(); + + // Put CF_HTML format on the pasteboard + if (::OpenClipboard(m_owner)) { + ExceptionCode ec = 0; + Vector<char> data; + markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer(ec)->document()->url(), data); + HGLOBAL cbData = createGlobalData(data); + if (!::SetClipboardData(HTMLClipboardFormat, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well + String str = frame->selectedText(); + replaceNewlinesWithWindowsStyleNewlines(str); + replaceNBSPWithSpace(str); + if (::OpenClipboard(m_owner)) { + HGLOBAL cbData = createGlobalData(str); + if (!::SetClipboardData(CF_UNICODETEXT, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // enable smart-replacing later on by putting dummy data on the pasteboard + if (canSmartCopyOrDelete) { + if (::OpenClipboard(m_owner)) { + ::SetClipboardData(WebSmartPasteFormat, 0); + ::CloseClipboard(); + } + } +} + +void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) +{ + ASSERT(!url.isEmpty()); + + clear(); + + String title(titleStr); + if (title.isEmpty()) { + title = url.lastPathComponent(); + if (title.isEmpty()) + title = url.host(); + } + + // write to clipboard in format com.apple.safari.bookmarkdata to be able to paste into the bookmarks view with appropriate title + if (::OpenClipboard(m_owner)) { + HGLOBAL cbData = createGlobalData(url, title); + if (!::SetClipboardData(BookmarkClipboardFormat, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // write to clipboard in format CF_HTML to be able to paste into contenteditable areas as a link + if (::OpenClipboard(m_owner)) { + Vector<char> data; + markupToCF_HTML(urlToMarkup(url, title), "", data); + HGLOBAL cbData = createGlobalData(data); + if (!::SetClipboardData(HTMLClipboardFormat, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // bare-bones CF_UNICODETEXT support + if (::OpenClipboard(m_owner)) { + HGLOBAL cbData = createGlobalData(url.string()); + if (!::SetClipboardData(CF_UNICODETEXT, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } +} + +void Pasteboard::writeImage(Node* node, const KURL&, const String&) +{ + ASSERT(node && node->renderer() && node->renderer()->isImage()); + RenderImage* renderer = static_cast<RenderImage*>(node->renderer()); + CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage()); + ASSERT(cachedImage); + Image* image = cachedImage->image(); + ASSERT(image); + + clear(); + + RefPtr<SharedBitmap> sourceBmp = image->nativeImageForCurrentFrame(); + if (!sourceBmp) + return; + + IntRect rect(0, 0, sourceBmp->width(), sourceBmp->height()); + BitmapInfo bmpInfo; + void* pixels; + HBITMAP resultBitmap = sourceBmp->clipBitmap(rect, true, bmpInfo, pixels); + if (!resultBitmap) + return; + + if (::OpenClipboard(m_owner)) { + ::SetClipboardData(CF_BITMAP, resultBitmap); + ::CloseClipboard(); + } else + DeleteObject(resultBitmap); +} + +bool Pasteboard::canSmartReplace() +{ + return ::IsClipboardFormatAvailable(WebSmartPasteFormat); +} + +String Pasteboard::plainText(Frame* frame) +{ + if (::IsClipboardFormatAvailable(CF_UNICODETEXT) && ::OpenClipboard(m_owner)) { + HANDLE cbData = ::GetClipboardData(CF_UNICODETEXT); + if (cbData) { + UChar* buffer = (UChar*)GlobalLock(cbData); + String fromClipboard(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + return fromClipboard; + } else + CloseClipboard(); + } + + if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(m_owner)) { + HANDLE cbData = ::GetClipboardData(CF_TEXT); + if (cbData) { + char* buffer = (char*)GlobalLock(cbData); + String fromClipboard(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + return fromClipboard; + } else + CloseClipboard(); + } + + return String(); +} + +PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) +{ + chosePlainText = false; + + if (::IsClipboardFormatAvailable(HTMLClipboardFormat) && ::OpenClipboard(m_owner)) { + // get data off of clipboard + HANDLE cbData = ::GetClipboardData(HTMLClipboardFormat); + if (cbData) { + SIZE_T dataSize = ::GlobalSize(cbData); + String cf_html(UTF8Encoding().decode((char*)GlobalLock(cbData), dataSize)); + GlobalUnlock(cbData); + CloseClipboard(); + + PassRefPtr<DocumentFragment> fragment = fragmentFromCF_HTML(frame->document(), cf_html); + if (fragment) + return fragment; + } else + CloseClipboard(); + } + + if (allowPlainText && IsClipboardFormatAvailable(CF_UNICODETEXT)) { + chosePlainText = true; + if (OpenClipboard(m_owner)) { + HANDLE cbData = GetClipboardData(CF_UNICODETEXT); + if (cbData) { + UChar* buffer = (UChar*)GlobalLock(cbData); + String str(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str); + if (fragment) + return fragment.release(); + } else + CloseClipboard(); + } + } + + if (allowPlainText && ::IsClipboardFormatAvailable(CF_TEXT)) { + chosePlainText = true; + if (::OpenClipboard(m_owner)) { + HANDLE cbData = ::GetClipboardData(CF_TEXT); + if (cbData) { + char* buffer = (char*)GlobalLock(cbData); + String str(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str); + if (fragment) + return fragment.release(); + } else + CloseClipboard(); + } + } + + return 0; +} + +bool Pasteboard::hasData() +{ + return hasDataInFormat(CF_UNICODETEXT) || hasDataInFormat(CF_TEXT); +} + +bool Pasteboard::hasDataInFormat(unsigned int format) +{ + return ::IsClipboardFormatAvailable(format); +} + +} // namespace WebCore diff --git a/WebCore/platform/wince/SearchPopupMenuWince.cpp b/WebCore/platform/wince/SearchPopupMenuWince.cpp new file mode 100644 index 0000000..ca11292 --- /dev/null +++ b/WebCore/platform/wince/SearchPopupMenuWince.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Torch Mobile 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. + */ + +#include "config.h" +#include "SearchPopupMenu.h" + +#include "AtomicString.h" + +namespace WebCore { + +SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) +: PopupMenu(client) +{ +} + +bool SearchPopupMenu::enabled() +{ + return false; +} + +void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +{ + if (name.isEmpty()) + return; + + notImplemented(); +} + +void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +{ + if (name.isEmpty()) + return; + + notImplemented(); +} + +} diff --git a/WebCore/platform/wince/SharedTimerWince.cpp b/WebCore/platform/wince/SharedTimerWince.cpp new file mode 100644 index 0000000..ca2f104 --- /dev/null +++ b/WebCore/platform/wince/SharedTimerWince.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007-2008 Torch Mobile, Inc. + * + * 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 "SharedTimer.h" + +#include "Page.h" +#include "SystemTime.h" +#include "Widget.h" +#include <wtf/Assertions.h> +#include <wtf/CurrentTime.h> +#include <windows.h> + +namespace JSC { +extern void* g_stackBase; +} + +namespace WebCore { + +enum { + TimerIdNone = 0, + TimerIdAuto, + TimerIdManual, +}; +static UINT timerID = TimerIdNone; + +static void (*sharedTimerFiredFunction)(); + +static HWND timerWindowHandle = 0; +const LPCWSTR kTimerWindowClassName = L"TimerWindowClass"; + +LRESULT CALLBACK TimerWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int dummy; + JSC::g_stackBase = &dummy; + + if (message == WM_TIMER) { + if (timerID != TimerIdNone) + sharedTimerFiredFunction(); + } else if (message == WM_USER) { + if (timerID = TimerIdManual) { + sharedTimerFiredFunction(); + PostMessage(hWnd, WM_USER, 0, 0); + } + } else { + JSC::g_stackBase = 0; + return DefWindowProc(hWnd, message, wParam, lParam); + } + JSC::g_stackBase = 0; + return 0; +} + +static void initializeOffScreenTimerWindow() +{ + if (timerWindowHandle) + return; + + WNDCLASS wcex = {0}; + wcex.lpfnWndProc = TimerWindowWndProc; + wcex.hInstance = Page::instanceHandle(); + wcex.lpszClassName = kTimerWindowClassName; + RegisterClass(&wcex); + + timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, Page::instanceHandle(), 0); +} + +void setSharedTimerFiredFunction(void (*f)()) +{ + sharedTimerFiredFunction = f; +} + +#define USER_TIMER_MAXIMUM 0x7FFFFFFF +#define USER_TIMER_MINIMUM 0x0000000A + +void setSharedTimerFireTime(double fireTime) +{ + ASSERT(sharedTimerFiredFunction); + + double interval = (fireTime - currentTime()) * 1000.; + unsigned intervalInMS = interval < USER_TIMER_MINIMUM + ? USER_TIMER_MINIMUM + : interval > USER_TIMER_MAXIMUM + ? USER_TIMER_MAXIMUM + : static_cast<unsigned>(interval); + + if (timerID == TimerIdAuto) { + KillTimer(timerWindowHandle, TimerIdAuto); + timerID = TimerIdNone; + } + + initializeOffScreenTimerWindow(); + if (SetTimer(timerWindowHandle, TimerIdAuto, intervalInMS, 0)) + timerID = TimerIdAuto; + else if (timerID != TimerIdManual) + PostMessage(timerWindowHandle, WM_USER, 0, 0); +} + +void stopSharedTimer() +{ + if (timerID == TimerIdAuto) + KillTimer(timerWindowHandle, TimerIdAuto); + + timerID = TimerIdNone; +} + +} diff --git a/WebCore/platform/wince/SystemTimeWince.cpp b/WebCore/platform/wince/SystemTimeWince.cpp new file mode 100644 index 0000000..70b705b --- /dev/null +++ b/WebCore/platform/wince/SystemTimeWince.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007-2008 Torch Mobile, Inc. + * + * 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 "SystemTime.h" + +#include <windows.h> + +namespace WebCore { + +float userIdleTime() +{ + return FLT_MAX; +} + +} diff --git a/WebCore/plugins/win/PaintHooks.asm b/WebCore/plugins/win/PaintHooks.asm new file mode 100644 index 0000000..1508813 --- /dev/null +++ b/WebCore/plugins/win/PaintHooks.asm @@ -0,0 +1,50 @@ +;/* +; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) +; +; This library is free software; you can redistribute it and/or +; modify it under the terms of the GNU Library General Public +; License as published by the Free Software Foundation; either +; version 2 of the License, or (at your option) any later version. +; +; This library is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +; Library General Public License for more details. +; +; You should have received a copy of the GNU Library General Public License +; along with this library; see the file COPYING.LIB. If not, write to +; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +; Boston, MA 02110-1301, USA. +;*/ + +;HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint); + +PUBLIC _HBeginPaint + +_TEXT SEGMENT + +_HBeginPaint PROC + mov r10,rcx + mov eax,1017h + syscall + ret +_HBeginPaint ENDP + +_TEXT ENDS + +;BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint); + +PUBLIC _HEndPaint + +_TEXT SEGMENT + +_HEndPaint PROC + mov r10,rcx + mov eax,1019h + syscall + ret +_HEndPaint ENDP + +_TEXT ENDS + +END diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp index 0da4402..4e94feb 100644 --- a/WebCore/plugins/win/PluginViewWin.cpp +++ b/WebCore/plugins/win/PluginViewWin.cpp @@ -115,6 +115,14 @@ static BYTE* beginPaint; static unsigned endPaintSysCall; static BYTE* endPaint; +typedef HDC (WINAPI *PtrBeginPaint)(HWND, PAINTSTRUCT*); +typedef BOOL (WINAPI *PtrEndPaint)(HWND, const PAINTSTRUCT*); + +#if PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC) +extern "C" HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint); +extern "C" BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint); +#endif + HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) { PluginView* pluginView = reinterpret_cast<PluginView*>(GetProp(hWnd, kWebPluginViewProperty)); @@ -137,12 +145,14 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) : "memory" ); return result; -#else +#elif defined(_M_IX86) // Call through to the original BeginPaint. __asm mov eax, beginPaintSysCall __asm push lpPaint __asm push hWnd __asm call beginPaint +#else + return _HBeginPaint(hWnd, lpPaint); #endif } @@ -164,12 +174,14 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint) : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*endPaint) ); return result; -#else +#elif defined (_M_IX86) // Call through to the original EndPaint. __asm mov eax, endPaintSysCall __asm push lpPaint __asm push hWnd __asm call endPaint +#else + return _HEndPaint(hWnd, lpPaint); #endif } @@ -182,6 +194,7 @@ static void hook(const char* module, const char* proc, unsigned& sysCallID, BYTE pProc = reinterpret_cast<BYTE*>(reinterpret_cast<ptrdiff_t>(GetProcAddress(hMod, proc))); +#if COMPILER(GCC) || defined(_M_IX86) if (pProc[0] != 0xB8) return; @@ -197,6 +210,35 @@ static void hook(const char* module, const char* proc, unsigned& sysCallID, BYTE *reinterpret_cast<unsigned*>(pProc + 1) = reinterpret_cast<intptr_t>(pNewProc) - reinterpret_cast<intptr_t>(pProc + 5); pProc += 5; +#else + /* Disassembly of BeginPaint() + 00000000779FC5B0 4C 8B D1 mov r10,rcx + 00000000779FC5B3 B8 17 10 00 00 mov eax,1017h + 00000000779FC5B8 0F 05 syscall + 00000000779FC5BA C3 ret + 00000000779FC5BB 90 nop + 00000000779FC5BC 90 nop + 00000000779FC5BD 90 nop + 00000000779FC5BE 90 nop + 00000000779FC5BF 90 nop + 00000000779FC5C0 90 nop + 00000000779FC5C1 90 nop + 00000000779FC5C2 90 nop + 00000000779FC5C3 90 nop + */ + // Check for the signature as in the above disassembly + DWORD guard = 0xB8D18B4C; + if (*reinterpret_cast<DWORD*>(pProc) != guard) + return; + + DWORD flOldProtect; + VirtualProtect(pProc, 12, PAGE_EXECUTE_READWRITE, & flOldProtect); + pProc[0] = 0x48; // mov rax, this + pProc[1] = 0xb8; + *(__int64*)(pProc+2) = (__int64)pNewProc; + pProc[10] = 0xff; // jmp rax + pProc[11] = 0xe0; +#endif } static void setUpOffscreenPaintingHooks(HDC (WINAPI*hookedBeginPaint)(HWND, PAINTSTRUCT*), BOOL (WINAPI*hookedEndPaint)(HWND, const PAINTSTRUCT*)) diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index b7de46b..0aaddc9 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -209,7 +209,7 @@ String HitTestResult::altDisplayString() const if (m_innerNonSharedNode->hasTagName(imgTag)) { HTMLImageElement* image = static_cast<HTMLImageElement*>(m_innerNonSharedNode.get()); - return displayString(image->alt(), m_innerNonSharedNode.get()); + return displayString(image->getAttribute(altAttr), m_innerNonSharedNode.get()); } if (m_innerNonSharedNode->hasTagName(inputTag)) { diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index 543c190..98c5c43 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -29,6 +29,7 @@ #include "RootInlineBox.h" #include "RenderBlock.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderListMarker.h" #include "RenderTableCell.h" #include "RootInlineBox.h" @@ -774,18 +775,23 @@ void InlineFlowBox::paintMask(RenderObject::PaintInfo& paintInfo, int tx, int ty int w = width(); int h = height(); - // Figure out if we need to push a transparency layer to render our mask. - bool pushTransparencyLayer = false; const NinePieceImage& maskNinePieceImage = renderer()->style()->maskBoxImage(); StyleImage* maskBoxImage = renderer()->style()->maskBoxImage().image(); - if ((maskBoxImage && renderer()->style()->maskLayers()->hasImage()) || renderer()->style()->maskLayers()->next()) - pushTransparencyLayer = true; - - CompositeOperator compositeOp = CompositeDestinationIn; - if (pushTransparencyLayer) { - paintInfo.context->setCompositeOperation(CompositeDestinationIn); - paintInfo.context->beginTransparencyLayer(1.0f); - compositeOp = CompositeSourceOver; + + // Figure out if we need to push a transparency layer to render our mask. + bool pushTransparencyLayer = false; + bool compositedMask = renderer()->hasLayer() && boxModelObject()->layer()->hasCompositedMask(); + CompositeOperator compositeOp = CompositeSourceOver; + if (!compositedMask) { + if ((maskBoxImage && renderer()->style()->maskLayers()->hasImage()) || renderer()->style()->maskLayers()->next()) + pushTransparencyLayer = true; + + compositeOp = CompositeDestinationIn; + if (pushTransparencyLayer) { + paintInfo.context->setCompositeOperation(CompositeDestinationIn); + paintInfo.context->beginTransparencyLayer(1.0f); + compositeOp = CompositeSourceOver; + } } paintFillLayers(paintInfo, Color(), renderer()->style()->maskLayers(), tx, ty, w, h, compositeOp); diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 352f270..6715111 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -32,28 +32,27 @@ #include "MediaControlElements.h" -#include "LocalizedStrings.h" #include "EventNames.h" #include "FloatConversion.h" #include "Frame.h" #include "HTMLNames.h" +#include "LocalizedStrings.h" #include "MouseEvent.h" #include "RenderMedia.h" #include "RenderSlider.h" #include "RenderTheme.h" -#include "CString.h" namespace WebCore { using namespace HTMLNames; -// FIXME: These constants may need to be tweaked to better match the seeking in the QT plugin +// FIXME: These constants may need to be tweaked to better match the seeking in the QuickTime plug-in. static const float cSeekRepeatDelay = 0.1f; static const float cStepTime = 0.07f; static const float cSeekTime = 0.2f; -MediaControlShadowRootElement::MediaControlShadowRootElement(Document* doc, HTMLMediaElement* mediaElement) - : HTMLDivElement(divTag, doc) +MediaControlShadowRootElement::MediaControlShadowRootElement(Document* document, HTMLMediaElement* mediaElement) + : HTMLDivElement(divTag, document) , m_mediaElement(mediaElement) { RefPtr<RenderStyle> rootStyle = RenderStyle::create(); @@ -76,10 +75,9 @@ void MediaControlShadowRootElement::updateStyle() } // ---------------------------- - -MediaControlElement::MediaControlElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement) - : HTMLDivElement(divTag, doc) +MediaControlElement::MediaControlElement(Document* document, PseudoId pseudo, HTMLMediaElement* mediaElement) + : HTMLDivElement(divTag, document) , m_mediaElement(mediaElement) , m_pseudoStyleId(pseudo) { @@ -165,8 +163,8 @@ void MediaControlElement::updateStyle() // ---------------------------- -MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* doc, HTMLMediaElement* element) -: MediaControlElement(doc, MEDIA_CONTROLS_TIMELINE_CONTAINER, element) +MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* document, HTMLMediaElement* element) + : MediaControlElement(document, MEDIA_CONTROLS_TIMELINE_CONTAINER, element) { } @@ -188,9 +186,9 @@ bool MediaControlTimelineContainerElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* doc, HTMLMediaElement* element) -: MediaControlElement(doc, MEDIA_CONTROLS_STATUS_DISPLAY, element) -, m_stateBeingDisplayed(Nothing) +MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* document, HTMLMediaElement* element) + : MediaControlElement(document, MEDIA_CONTROLS_STATUS_DISPLAY, element) + , m_stateBeingDisplayed(Nothing) { } @@ -235,8 +233,8 @@ bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType) - : HTMLInputElement(inputTag, doc) +MediaControlInputElement::MediaControlInputElement(Document* document, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType) + : HTMLInputElement(inputTag, document) , m_mediaElement(mediaElement) , m_pseudoStyleId(pseudo) , m_displayType(displayType) @@ -330,8 +328,8 @@ void MediaControlInputElement::setDisplayType(MediaControlElementType displayTyp // ---------------------------- -MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* doc, HTMLMediaElement* element) - : MediaControlInputElement(doc, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton) +MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton) { } @@ -351,8 +349,8 @@ void MediaControlMuteButtonElement::updateDisplayType() // ---------------------------- -MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* doc, HTMLMediaElement* element) - : MediaControlInputElement(doc, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton) +MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton) { } @@ -372,8 +370,8 @@ void MediaControlPlayButtonElement::updateDisplayType() // ---------------------------- -MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* doc, HTMLMediaElement* element, bool forward) - : MediaControlInputElement(doc, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON, +MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* document, HTMLMediaElement* element, bool forward) + : MediaControlInputElement(document, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON, "button", element, forward ? MediaSeekForwardButton : MediaSeekBackButton) , m_forward(forward) , m_seeking(false) @@ -432,8 +430,8 @@ void MediaControlSeekButtonElement::detach() // ---------------------------- -MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* doc, HTMLMediaElement* element) -: MediaControlInputElement(doc, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton) +MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton) { } @@ -454,8 +452,8 @@ bool MediaControlRewindButtonElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* doc, HTMLMediaElement* element) -: MediaControlInputElement(doc, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton) +MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton) { } @@ -482,8 +480,8 @@ MediaControlTimelineElement::MediaControlTimelineElement(Document* document, HTM void MediaControlTimelineElement::defaultEventHandler(Event* event) { - // Left button is 0. Accepts only if mouse event is from left button. - if (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button()) + // Left button is 0. Rejects mouse events not from left button. + if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button()) return; if (event->type() == eventNames().mousedownEvent) @@ -520,8 +518,8 @@ void MediaControlTimelineElement::update(bool updateDuration) // ---------------------------- -MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* doc, HTMLMediaElement* element) - : MediaControlInputElement(doc, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton) +MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton) { } @@ -541,8 +539,8 @@ bool MediaControlFullscreenButtonElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* doc, PseudoId pseudo, HTMLMediaElement* element) - : MediaControlElement(doc, pseudo, element) +MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* document, PseudoId pseudo, HTMLMediaElement* element) + : MediaControlElement(document, pseudo, element) , m_isVisible(true) { } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index e10c331..03f5781 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -33,6 +33,7 @@ #include "HTMLNames.h" #include "HitTestResult.h" #include "InlineTextBox.h" +#include "RenderFlexibleBox.h" #include "RenderImage.h" #include "RenderInline.h" #include "RenderMarquee.h" @@ -734,6 +735,31 @@ void RenderBlock::updateScrollInfoAfterLayout() } } +void RenderBlock::updateOverflowWithShadowAndReflection() +{ + if (hasOverflowClip()) + return; + + int shadowLeft; + int shadowRight; + int shadowTop; + int shadowBottom; + style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); + + m_overflowLeft = min(m_overflowLeft, shadowLeft); + m_overflowWidth = max(m_overflowWidth, width() + shadowRight); + m_overflowTop = min(m_overflowTop, shadowTop); + m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); + + if (hasReflection()) { + IntRect reflection(reflectionBox()); + m_overflowLeft = min(m_overflowLeft, reflection.x()); + m_overflowWidth = max(m_overflowWidth, reflection.right()); + m_overflowTop = min(m_overflowTop, reflection.y()); + m_overflowHeight = max(m_overflowHeight, reflection.bottom()); + } +} + void RenderBlock::layout() { // Update our first letter info now. @@ -884,26 +910,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren) m_overflowWidth = max(m_overflowWidth, width()); m_overflowHeight = max(m_overflowHeight, height()); - if (!hasOverflowClip()) { - int shadowLeft; - int shadowRight; - int shadowTop; - int shadowBottom; - style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); - - m_overflowLeft = min(m_overflowLeft, shadowLeft); - m_overflowWidth = max(m_overflowWidth, width() + shadowRight); - m_overflowTop = min(m_overflowTop, shadowTop); - m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); - - if (hasReflection()) { - IntRect reflection(reflectionBox()); - m_overflowLeft = min(m_overflowLeft, reflection.x()); - m_overflowWidth = max(m_overflowWidth, reflection.right()); - m_overflowTop = min(m_overflowTop, reflection.y()); - m_overflowHeight = max(m_overflowHeight, reflection.bottom()); - } - } + updateOverflowWithShadowAndReflection(); statePusher.pop(); @@ -1032,7 +1039,10 @@ bool RenderBlock::handleRunInChild(RenderBox* child) // See if we have a run-in element with inline children. If the // children aren't inline, then just treat the run-in as a normal // block. - if (!child->isRunIn() || !child->childrenInline() && !child->isReplaced()) + if (!child->isRunIn() || !child->childrenInline()) + return false; + // FIXME: We don't handle non-block elements with run-in for now. + if (!child->isRenderBlock()) return false; // Get the next non-positioned/non-floating RenderBlock. @@ -3298,13 +3308,17 @@ int RenderBlock::getClearDelta(RenderBox* child, int yPos) // We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default). // FIXME: Note that the remaining space checks aren't quite accurate, since you should be able to clear only some floats (the minimum # needed // to fit) and not all (we should be using nextFloatBottomBelow and looping). - // Do not allow tables to wrap in quirks or even in almost strict mode - // (ebay on the PLT, finance.yahoo.com in the real world, versiontracker.com forces even almost strict mode not to work) int result = clearSet ? max(0, bottom - yPos) : 0; - if (!result && child->avoidsFloats() && child->style()->width().isFixed() && - child->minPrefWidth() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth() && - document()->inStrictMode()) - result = max(0, floatBottom() - yPos); + if (!result && child->avoidsFloats()) { + int oldYPos = child->y(); + int oldWidth = child->width(); + child->setY(yPos); + child->calcWidth(); + if (child->width() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth()) + result = max(0, floatBottom() - yPos); + child->setY(oldYPos); + child->setWidth(oldWidth); + } return result; } @@ -5121,13 +5135,20 @@ void RenderBlock::addFocusRingRects(GraphicsContext* graphicsContext, int tx, in ty - y() + inlineContinuation()->containingBlock()->y()); } -RenderBlock* RenderBlock::createAnonymousBlock() const +RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const { RefPtr<RenderStyle> newStyle = RenderStyle::create(); newStyle->inheritFrom(style()); - newStyle->setDisplay(BLOCK); - RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */); + RenderBlock* newBox = 0; + if (isFlexibleBox) { + newStyle->setDisplay(BOX); + newBox = new (renderArena()) RenderFlexibleBox(document() /* anonymous box */); + } else { + newStyle->setDisplay(BLOCK); + newBox = new (renderArena()) RenderBlock(document() /* anonymous box */); + } + newBox->setStyle(newStyle.release()); return newBox; } diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index 839be16..88d2386 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -147,7 +147,7 @@ public: // This function is a convenience helper for creating an anonymous block that inherits its // style from this RenderBlock. - RenderBlock* createAnonymousBlock() const; + RenderBlock* createAnonymousBlock(bool isFlexibleBox = false) const; Vector<IntRect>* columnRects() const; int columnGap() const; @@ -207,7 +207,9 @@ protected: virtual bool hasLineIfEmpty() const; bool layoutOnlyPositionedObjects(); - + + void updateOverflowWithShadowAndReflection(); + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 4c2bff0..a1a2d9a 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -416,6 +416,11 @@ bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, return b->scroll(direction, granularity, multiplier); return false; } + +bool RenderBox::canBeScrolledAndHasScrollableArea() const +{ + return canBeProgramaticallyScrolled(false) && (scrollHeight() != clientHeight() || scrollWidth() != clientWidth()); +} bool RenderBox::canBeProgramaticallyScrolled(bool) const { @@ -653,31 +658,36 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, int tx, int ty, int { // Figure out if we need to push a transparency layer to render our mask. bool pushTransparencyLayer = false; - StyleImage* maskBoxImage = style()->maskBoxImage().image(); - if (maskBoxImage && style()->maskLayers()->hasImage()) { - pushTransparencyLayer = true; - } else { - // We have to use an extra image buffer to hold the mask. Multiple mask images need - // to composite together using source-over so that they can then combine into a single unified mask that - // can be composited with the content using destination-in. SVG images need to be able to set compositing modes - // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer - // and composite that buffer as the mask. - // We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering - // before pushing the transparency layer. - for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) { - if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) { - pushTransparencyLayer = true; - // We found one image that can be used in rendering, exit the loop - break; + bool compositedMask = hasLayer() && layer()->hasCompositedMask(); + CompositeOperator compositeOp = CompositeSourceOver; + + if (!compositedMask) { + StyleImage* maskBoxImage = style()->maskBoxImage().image(); + if (maskBoxImage && style()->maskLayers()->hasImage()) { + pushTransparencyLayer = true; + } else { + // We have to use an extra image buffer to hold the mask. Multiple mask images need + // to composite together using source-over so that they can then combine into a single unified mask that + // can be composited with the content using destination-in. SVG images need to be able to set compositing modes + // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer + // and composite that buffer as the mask. + // We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering + // before pushing the transparency layer. + for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) { + if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) { + pushTransparencyLayer = true; + // We found one image that can be used in rendering, exit the loop + break; + } } } - } - - CompositeOperator compositeOp = CompositeDestinationIn; - if (pushTransparencyLayer) { - paintInfo.context->setCompositeOperation(CompositeDestinationIn); - paintInfo.context->beginTransparencyLayer(1.0f); - compositeOp = CompositeSourceOver; + + compositeOp = CompositeDestinationIn; + if (pushTransparencyLayer) { + paintInfo.context->setCompositeOperation(CompositeDestinationIn); + paintInfo.context->beginTransparencyLayer(1.0f); + compositeOp = CompositeSourceOver; + } } paintFillLayers(paintInfo, Color(), style()->maskLayers(), tx, ty, w, h, compositeOp); @@ -2701,11 +2711,6 @@ int RenderBox::leftmostPosition(bool /*includeOverflowInterior*/, bool includeSe return left; } -bool RenderBox::isAfterContent(RenderObject* child) const -{ - return (child && child->style()->styleType() == AFTER && (!child->isText() || child->isBR())); -} - VisiblePosition RenderBox::positionForPoint(const IntPoint& point) { // no children...return this render object's element, if there is one, and offset 0 diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h index cb2297b..e86d073 100644 --- a/WebCore/rendering/RenderBox.h +++ b/WebCore/rendering/RenderBox.h @@ -230,6 +230,7 @@ public: virtual int verticalScrollbarWidth() const; int horizontalScrollbarHeight() const; virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f); + bool canBeScrolledAndHasScrollableArea() const; virtual bool canBeProgramaticallyScrolled(bool) const; virtual void autoscroll(); virtual void stopAutoscroll() { } @@ -333,9 +334,6 @@ private: // These include tables, positioned objects, floats and flexible boxes. virtual void calcPrefWidths() { setPrefWidthsDirty(false); } -protected: - bool isAfterContent(RenderObject* child) const; - private: // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). IntRect m_frameRect; diff --git a/WebCore/rendering/RenderButton.cpp b/WebCore/rendering/RenderButton.cpp index 6d36a0f..f3ae558 100644 --- a/WebCore/rendering/RenderButton.cpp +++ b/WebCore/rendering/RenderButton.cpp @@ -52,7 +52,8 @@ void RenderButton::addChild(RenderObject* newChild, RenderObject* beforeChild) if (!m_inner) { // Create an anonymous block. ASSERT(!firstChild()); - m_inner = createAnonymousBlock(); + bool isFlexibleBox = style()->display() == BOX || style()->display() == INLINE_BOX; + m_inner = createAnonymousBlock(isFlexibleBox); setupInnerStyle(m_inner->style()); RenderFlexibleBox::addChild(m_inner); } @@ -108,6 +109,7 @@ void RenderButton::setupInnerStyle(RenderStyle* innerStyle) // RenderBlock::createAnonymousBlock creates a new RenderStyle, so this is // safe to modify. innerStyle->setBoxFlex(1.0f); + innerStyle->setBoxOrient(style()->boxOrient()); innerStyle->setPaddingTop(Length(theme()->buttonInternalPaddingTop(), Fixed)); innerStyle->setPaddingRight(Length(theme()->buttonInternalPaddingRight(), Fixed)); diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp index 437991a..8618d11 100644 --- a/WebCore/rendering/RenderFieldset.cpp +++ b/WebCore/rendering/RenderFieldset.cpp @@ -108,10 +108,11 @@ RenderBox* RenderFieldset::findLegend() const { for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) { if (!legend->isFloatingOrPositioned() && legend->node() && - legend->node()->hasTagName(legendTag) + (legend->node()->hasTagName(legendTag) #if ENABLE(WML) || legend->node()->hasTagName(WMLNames::insertedLegendTag) #endif + ) ) return toRenderBox(legend); } diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp index 6bbcc43..fa6d7a0 100644 --- a/WebCore/rendering/RenderFlexibleBox.cpp +++ b/WebCore/rendering/RenderFlexibleBox.cpp @@ -295,26 +295,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren) if (m_overflowWidth < width()) m_overflowWidth = width(); - if (!hasOverflowClip()) { - int shadowLeft; - int shadowRight; - int shadowTop; - int shadowBottom; - style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); - - m_overflowLeft = min(m_overflowLeft, shadowLeft); - m_overflowWidth = max(m_overflowWidth, width() + shadowRight); - m_overflowTop = min(m_overflowTop, shadowTop); - m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); - - if (hasReflection()) { - IntRect reflection(reflectionBox()); - m_overflowTop = min(m_overflowTop, reflection.y()); - m_overflowHeight = max(m_overflowHeight, reflection.bottom()); - m_overflowLeft = min(m_overflowLeft, reflection.x()); - m_overflowHeight = max(m_overflowWidth, reflection.right()); - } - } + updateOverflowWithShadowAndReflection(); statePusher.pop(); @@ -1161,6 +1142,8 @@ const char *RenderFlexibleBox::renderName() const return "RenderFlexibleBox (floating)"; if (isPositioned()) return "RenderFlexibleBox (positioned)"; + if (isAnonymous()) + return "RenderFlexibleBox (generated)"; if (isRelPositioned()) return "RenderFlexibleBox (relative positioned)"; return "RenderFlexibleBox"; diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp index 1fc07f0..3a776ba 100644 --- a/WebCore/rendering/RenderHTMLCanvas.cpp +++ b/WebCore/rendering/RenderHTMLCanvas.cpp @@ -55,10 +55,13 @@ void RenderHTMLCanvas::canvasSizeChanged() IntSize canvasSize = static_cast<HTMLCanvasElement*>(node())->size(); IntSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasSize.height() * style()->effectiveZoom()); - if (canvasSize == intrinsicSize()) + if (zoomedSize == intrinsicSize()) return; - setIntrinsicSize(canvasSize); + setIntrinsicSize(zoomedSize); + + if (!parent()) + return; if (!prefWidthsDirty()) setPrefWidthsDirty(true); diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 5c11e41..9692a09 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -440,7 +440,7 @@ int RenderImage::minimumReplacedHeight() const HTMLMapElement* RenderImage::imageMap() { HTMLImageElement* i = node() && node()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(node()) : 0; - return i ? i->document()->getImageMap(i->useMap()) : 0; + return i ? i->document()->getImageMap(i->getAttribute(usemapAttr)) : 0; } bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp index 53962d2..664af93 100644 --- a/WebCore/rendering/RenderInline.cpp +++ b/WebCore/rendering/RenderInline.cpp @@ -131,18 +131,6 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt } } -static inline bool isAfterContent(RenderObject* child) -{ - if (!child) - return false; - if (child->style()->styleType() != AFTER) - return false; - // Text nodes don't have their own styles, so ignore the style on a text node. - if (child->isText() && !child->isBR()) - return false; - return true; -} - void RenderInline::addChild(RenderObject* newChild, RenderObject* beforeChild) { if (continuation()) diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index ab78f40..ca6e5a6 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -207,12 +207,8 @@ RenderLayer::~RenderLayer() // Make sure we have no lingering clip rects. ASSERT(!m_clipRects); - if (m_reflection) { - if (!m_reflection->documentBeingDestroyed()) - m_reflection->removeLayers(this); - m_reflection->setParent(0); - m_reflection->destroy(); - } + if (m_reflection) + removeReflection(); if (m_scrollCorner) m_scrollCorner->destroy(); @@ -997,6 +993,9 @@ void RenderLayer::panScrollFromPoint(const IntPoint& sourcePoint) void RenderLayer::scrollByRecursively(int xDelta, int yDelta) { + if (!xDelta && !yDelta) + return; + bool restrictedByLineClamp = false; if (renderer()->parent()) restrictedByLineClamp = renderer()->parent()->style()->lineClamp() >= 0; @@ -1006,17 +1005,30 @@ void RenderLayer::scrollByRecursively(int xDelta, int yDelta) int newOffsetY = scrollYOffset() + yDelta; scrollToOffset(newOffsetX, newOffsetY); - // If this layer can't do the scroll we ask its parent + // If this layer can't do the scroll we ask the next layer up that can scroll to try int leftToScrollX = newOffsetX - scrollXOffset(); int leftToScrollY = newOffsetY - scrollYOffset(); if ((leftToScrollX || leftToScrollY) && renderer()->parent()) { - renderer()->parent()->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY); + RenderObject* nextRenderer = renderer()->parent(); + while (nextRenderer) { + if (nextRenderer->isBox() && toRenderBox(nextRenderer)->canBeScrolledAndHasScrollableArea()) { + nextRenderer->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY); + break; + } + nextRenderer = nextRenderer->parent(); + } + Frame* frame = renderer()->document()->frame(); if (frame) frame->eventHandler()->updateAutoscrollRenderer(); } - } else if (renderer()->view()->frameView()) + } else if (renderer()->view()->frameView()) { + // If we are here, we were called on a renderer that can be programatically scrolled, but doesn't + // have an overflow clip. Which means that it is a document node that can be scrolled. renderer()->view()->frameView()->scrollBy(IntSize(xDelta, yDelta)); + // FIXME: If we didn't scroll the whole way, do we want to try looking at the frames ownerElement? + // https://bugs.webkit.org/show_bug.cgi?id=28237 + } } @@ -2873,6 +2885,11 @@ void RenderLayer::clearBacking() { m_backing.clear(); } + +bool RenderLayer::hasCompositedMask() const +{ + return m_backing && m_backing->hasMaskLayer(); +} #endif void RenderLayer::setParent(RenderLayer* parent) @@ -3183,10 +3200,9 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*) m_marquee = 0; } - if (!hasReflection() && m_reflection) { - m_reflection->destroy(); - m_reflection = 0; - } else if (hasReflection()) { + if (!hasReflection() && m_reflection) + removeReflection(); + else if (hasReflection()) { if (!m_reflection) createReflection(); updateReflectionStyle(); @@ -3260,6 +3276,16 @@ void RenderLayer::createReflection() m_reflection->setParent(renderer()); // We create a 1-way connection. } +void RenderLayer::removeReflection() +{ + if (!m_reflection->documentBeingDestroyed()) + m_reflection->removeLayers(this); + + m_reflection->setParent(0); + m_reflection->destroy(); + m_reflection = 0; +} + void RenderLayer::updateReflectionStyle() { RefPtr<RenderStyle> newStyle = RenderStyle::create(); diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h index 1772c66..16ad4d4 100644 --- a/WebCore/rendering/RenderLayer.h +++ b/WebCore/rendering/RenderLayer.h @@ -415,11 +415,13 @@ public: #if USE(ACCELERATED_COMPOSITING) bool isComposited() const { return m_backing != 0; } + bool hasCompositedMask() const; RenderLayerBacking* backing() const { return m_backing.get(); } RenderLayerBacking* ensureBacking(); void clearBacking(); #else bool isComposited() const { return false; } + bool hasCompositedMask() const { return false; } #endif bool paintsWithTransparency() const @@ -507,6 +509,8 @@ private: Node* enclosingElement() const; void createReflection(); + void removeReflection(); + void updateReflectionStyle(); bool paintingInsideReflection() const { return m_paintingInsideReflection; } void setPaintingInsideReflection(bool b) { m_paintingInsideReflection = b; } diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index e98c458..b60e18f 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -47,16 +47,14 @@ using namespace std; namespace WebCore { +using namespace HTMLNames; + static bool hasBorderOutlineOrShadow(const RenderStyle*); static bool hasBoxDecorations(const RenderStyle*); static bool hasBoxDecorationsWithBackgroundImage(const RenderStyle*); RenderLayerBacking::RenderLayerBacking(RenderLayer* layer) : m_owningLayer(layer) - , m_ancestorClippingLayer(0) - , m_graphicsLayer(0) - , m_foregroundLayer(0) - , m_clippingLayer(0) , m_hasDirectlyCompositedContent(false) { createGraphicsLayer(); @@ -66,12 +64,13 @@ RenderLayerBacking::~RenderLayerBacking() { updateClippingLayers(false, false); updateForegroundLayer(false); + updateMaskLayer(false); destroyGraphicsLayer(); } void RenderLayerBacking::createGraphicsLayer() { - m_graphicsLayer = GraphicsLayer::createGraphicsLayer(this); + m_graphicsLayer = GraphicsLayer::create(this); #ifndef NDEBUG if (renderer()->node()) { @@ -79,7 +78,7 @@ void RenderLayerBacking::createGraphicsLayer() m_graphicsLayer->setName("Document Node"); else { if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID()) - m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->id()); + m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->getAttribute(idAttr)); else m_graphicsLayer->setName(renderer()->renderName()); } @@ -96,14 +95,10 @@ void RenderLayerBacking::destroyGraphicsLayer() if (m_graphicsLayer) m_graphicsLayer->removeFromParent(); - delete m_graphicsLayer; m_graphicsLayer = 0; - - delete m_foregroundLayer; m_foregroundLayer = 0; - - delete m_clippingLayer; m_clippingLayer = 0; + m_maskLayer = 0; } void RenderLayerBacking::updateLayerOpacity() @@ -158,6 +153,9 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration() if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), compositor->clipsCompositingDescendants(m_owningLayer))) layerConfigChanged = true; + if (updateMaskLayer(m_owningLayer->renderer()->hasMask())) + m_graphicsLayer->setMaskLayer(m_maskLayer.get()); + m_hasDirectlyCompositedContent = false; if (canUseDirectCompositing()) { if (renderer()->isImage()) { @@ -251,13 +249,19 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() } // If we have a layer that clips children, position it. + IntRect clippingBox; if (m_clippingLayer) { - IntRect clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0); + clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0); m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location())); m_clippingLayer->setSize(clippingBox.size()); m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint()); } + if (m_maskLayer) { + m_maskLayer->setSize(m_graphicsLayer->size()); + m_maskLayer->setPosition(FloatPoint()); + } + if (m_owningLayer->hasTransform()) { const IntRect borderBox = toRenderBox(renderer())->borderBoxRect(); @@ -293,10 +297,20 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() } if (m_foregroundLayer) { - // The contents layer is always coincidental with the graphicsLayer for now. - m_foregroundLayer->setPosition(IntPoint(0, 0)); - m_foregroundLayer->setSize(newSize); - m_foregroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()); + FloatPoint foregroundPosition; + FloatSize foregroundSize = newSize; + IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer(); + // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it, + // so that it gets correctly sorted with children. In that case, position relative to the clipping layer. + if (m_clippingLayer) { + foregroundPosition = FloatPoint() + (localCompositingBounds.location() - clippingBox.location()); + foregroundSize = FloatSize(clippingBox.size()); + foregroundOffset = clippingBox.location() - IntPoint(); + } + + m_foregroundLayer->setPosition(foregroundPosition); + m_foregroundLayer->setSize(foregroundSize); + m_foregroundLayer->setOffsetFromRenderer(foregroundOffset); } m_graphicsLayer->setContentsRect(contentsBox()); @@ -311,12 +325,12 @@ void RenderLayerBacking::updateInternalHierarchy() if (m_ancestorClippingLayer) { m_ancestorClippingLayer->removeAllChildren(); m_graphicsLayer->removeFromParent(); - m_ancestorClippingLayer->addChild(m_graphicsLayer); + m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); } if (m_clippingLayer) { m_clippingLayer->removeFromParent(); - m_graphicsLayer->addChild(m_clippingLayer); + m_graphicsLayer->addChild(m_clippingLayer.get()); } } @@ -327,7 +341,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs if (needsAncestorClip) { if (!m_ancestorClippingLayer) { - m_ancestorClippingLayer = GraphicsLayer::createGraphicsLayer(this); + m_ancestorClippingLayer = GraphicsLayer::create(this); #ifndef NDEBUG m_ancestorClippingLayer->setName("Ancestor clipping Layer"); #endif @@ -336,14 +350,13 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs } } else if (m_ancestorClippingLayer) { m_ancestorClippingLayer->removeFromParent(); - delete m_ancestorClippingLayer; m_ancestorClippingLayer = 0; layersChanged = true; } if (needsDescendantClip) { if (!m_clippingLayer) { - m_clippingLayer = GraphicsLayer::createGraphicsLayer(0); + m_clippingLayer = GraphicsLayer::create(0); #ifndef NDEBUG m_clippingLayer->setName("Child clipping Layer"); #endif @@ -352,7 +365,6 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs } } else if (m_clippingLayer) { m_clippingLayer->removeFromParent(); - delete m_clippingLayer; m_clippingLayer = 0; layersChanged = true; } @@ -368,25 +380,61 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer) bool layerChanged = false; if (needsForegroundLayer) { if (!m_foregroundLayer) { - m_foregroundLayer = GraphicsLayer::createGraphicsLayer(this); + m_foregroundLayer = GraphicsLayer::create(this); #ifndef NDEBUG - m_foregroundLayer->setName("Contents"); + m_foregroundLayer->setName("Foreground"); #endif m_foregroundLayer->setDrawsContent(true); - m_foregroundLayer->setDrawingPhase(GraphicsLayerPaintForegroundMask); - m_graphicsLayer->setDrawingPhase(GraphicsLayerPaintBackgroundMask); + m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); layerChanged = true; } } else if (m_foregroundLayer) { m_foregroundLayer->removeFromParent(); - delete m_foregroundLayer; m_foregroundLayer = 0; - m_graphicsLayer->setDrawingPhase(GraphicsLayerPaintAllMask); layerChanged = true; } + + if (layerChanged) + m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); + + return layerChanged; +} + +bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer) +{ + bool layerChanged = false; + if (needsMaskLayer) { + if (!m_maskLayer) { + m_maskLayer = GraphicsLayer::create(this); +#ifndef NDEBUG + m_maskLayer->setName("Mask"); +#endif + m_maskLayer->setDrawsContent(true); + m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask); + layerChanged = true; + } + } else if (m_maskLayer) { + m_maskLayer = 0; + layerChanged = true; + } + + if (layerChanged) + m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); + return layerChanged; } +GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const +{ + unsigned phase = GraphicsLayerPaintBackground; + if (!m_foregroundLayer) + phase |= GraphicsLayerPaintForeground; + if (!m_maskLayer) + phase |= GraphicsLayerPaintMask; + + return static_cast<GraphicsLayerPaintingPhase>(phase); +} + float RenderLayerBacking::compositingOpacity(float rendererOpacity) const { float finalOpacity = rendererOpacity; @@ -500,7 +548,7 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const // Now look at the body's renderer. HTMLElement* body = renderObject->document()->body(); - RenderObject* bodyObject = (body && body->hasLocalName(HTMLNames::bodyTag)) ? body->renderer() : 0; + RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0; if (!bodyObject) return false; @@ -705,13 +753,16 @@ void RenderLayerBacking::setContentsNeedDisplay() if (m_foregroundLayer && m_foregroundLayer->drawsContent()) m_foregroundLayer->setNeedsDisplay(); + + if (m_maskLayer && m_maskLayer->drawsContent()) + m_maskLayer->setNeedsDisplay(); } // r is in the coordinate space of the layer's render object void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) { if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { - FloatPoint dirtyOrigin = contentsToGraphicsLayerCoordinates(m_graphicsLayer, FloatPoint(r.x(), r.y())); + FloatPoint dirtyOrigin = contentsToGraphicsLayerCoordinates(m_graphicsLayer.get(), FloatPoint(r.x(), r.y())); FloatRect dirtyRect(dirtyOrigin, r.size()); FloatRect bounds(FloatPoint(), m_graphicsLayer->size()); if (bounds.intersects(dirtyRect)) @@ -722,6 +773,11 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) // FIXME: do incremental repaint m_foregroundLayer->setNeedsDisplay(); } + + if (m_maskLayer && m_maskLayer->drawsContent()) { + // FIXME: do incremental repaint + m_maskLayer->setNeedsDisplay(); + } } static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect) @@ -779,7 +835,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* bool shouldPaint = m_owningLayer->hasVisibleContent() && m_owningLayer->isSelfPaintingLayer(); - if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackgroundMask)) { + if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackground)) { // If this is the root then we need to send in a bigger bounding box // because we'll be painting the background as well (see RenderBox::paintRootBoxDecorations()). IntRect paintBox = clipRectToApply; @@ -823,7 +879,10 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* restoreClip(context, paintDirtyRect, damageRect); } - if (shouldPaint && (paintingPhase & GraphicsLayerPaintForegroundMask)) { + bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText; + bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText; + + if (shouldPaint && (paintingPhase & GraphicsLayerPaintForeground)) { // Now walk the sorted list of children with negative z-indices. Only RenderLayers without compositing layers will paint. // FIXME: should these be painted as background? Vector<RenderLayer*>* negZOrderList = m_owningLayer->negZOrderList(); @@ -832,9 +891,6 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot); } - bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText; - bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText; - // Set up the clip used when painting our children. setClip(context, paintDirtyRect, clipRectToApply); RenderObject::PaintInfo paintInfo(context, clipRectToApply, @@ -877,7 +933,9 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* for (Vector<RenderLayer*>::iterator it = posZOrderList->begin(); it != posZOrderList->end(); ++it) it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot); } - + } + + if (shouldPaint && (paintingPhase & GraphicsLayerPaintMask)) { if (renderer()->hasMask() && !selectionOnly && !damageRect.isEmpty()) { setClip(context, paintDirtyRect, damageRect); @@ -894,7 +952,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* } // Up-call from compositing layer drawing callback. -void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase drawingPhase, const IntRect& clip) +void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip) { // We have to use the same root as for hit testing, because both methods // can compute and cache clipRects. @@ -912,7 +970,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& co IntRect dirtyRect = enclosingBBox; dirtyRect.intersect(clipRect); - paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, drawingPhase, renderer()); + paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, paintingPhase, renderer()); } bool RenderLayerBacking::startAnimation(double beginTime, const Animation* anim, const KeyframeList& keyframes) diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index b027685..731e741 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -63,21 +63,23 @@ public: // Update contents and clipping structure. void updateInternalHierarchy(); // make private - GraphicsLayer* graphicsLayer() const { return m_graphicsLayer; } + GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); } // Layer to clip children bool hasClippingLayer() const { return m_clippingLayer != 0; } - GraphicsLayer* clippingLayer() const { return m_clippingLayer; } + GraphicsLayer* clippingLayer() const { return m_clippingLayer.get(); } // Layer to get clipped by ancestor bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != 0; } - GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer; } + GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); } bool hasContentsLayer() const { return m_foregroundLayer != 0; } - GraphicsLayer* foregroundLayer() const { return m_foregroundLayer; } + GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); } - GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer : m_graphicsLayer; } - GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer : m_graphicsLayer; } + bool hasMaskLayer() const { return m_maskLayer != 0; } + + GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer.get() : m_graphicsLayer.get(); } + GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer.get() : m_graphicsLayer.get(); } // RenderLayers with backing normally short-circuit paintLayer() because // their content is rendered via callbacks from GraphicsLayer. However, the document @@ -127,7 +129,10 @@ private: bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); bool updateForegroundLayer(bool needsForegroundLayer); + bool updateMaskLayer(bool needsMaskLayer); + GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; + IntSize contentOffsetInCompostingLayer() const; // Result is transform origin in pixels. FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const; @@ -162,10 +167,11 @@ private: private: RenderLayer* m_owningLayer; - GraphicsLayer* m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context - GraphicsLayer* m_graphicsLayer; - GraphicsLayer* m_foregroundLayer; // only used in cases where we need to draw the foreground separately - GraphicsLayer* m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children + OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context + OwnPtr<GraphicsLayer> m_graphicsLayer; + OwnPtr<GraphicsLayer> m_foregroundLayer; // only used in cases where we need to draw the foreground separately + OwnPtr<GraphicsLayer> m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children + OwnPtr<GraphicsLayer> m_maskLayer; // only used if we have a mask IntRect m_compositedBounds; diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index fb15800..10da951 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -92,7 +92,6 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) RenderLayerCompositor::~RenderLayerCompositor() { ASSERT(!m_rootLayerAttached); - delete m_rootPlatformLayer; } void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) @@ -503,8 +502,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O // If we have a software transform, and we have layers under us, we need to also // be composited. Also, if we have opacity < 1, then we need to be a layer so that // the child layers are opaque, then rendered with opacity on this layer. - if (childState.m_subtreeIsCompositing && - (layer->renderer()->hasTransform() || layer->renderer()->style()->opacity() < 1)) { + if (childState.m_subtreeIsCompositing && requiresCompositingWhenDescendantsAreCompositing(layer->renderer())) { layer->setMustOverlapCompositedLayers(true); if (overlapMap) addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); @@ -573,7 +571,7 @@ bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const { // FIXME: ideally we need to look at all ancestors for mask or video. But for now, // just bail on the obvious cases. - if (o->hasMask() || o->hasReflection() || !m_hasAcceleratedCompositing) + if (o->hasReflection() || !m_hasAcceleratedCompositing) return false; return o->supportsAcceleratedRendering(); @@ -632,10 +630,10 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru } if (updateHierarchy && layerBacking && layerBacking->foregroundLayer()) { - // we only have a contents layer if we have an m_layer layerBacking->foregroundLayer()->removeFromParent(); - - GraphicsLayer* hostingLayer = layerBacking->clippingLayer() ? layerBacking->clippingLayer() : layerBacking->graphicsLayer(); + + // The foreground layer has to be correctly sorted with child layers, so needs to become a child of the clipping layer. + GraphicsLayer* hostingLayer = layerBacking->parentForSublayers(); hostingLayer->addChild(layerBacking->foregroundLayer()); } } @@ -759,7 +757,7 @@ RenderLayer* RenderLayerCompositor::rootRenderLayer() const GraphicsLayer* RenderLayerCompositor::rootPlatformLayer() const { - return m_rootPlatformLayer; + return m_rootPlatformLayer.get(); } void RenderLayerCompositor::didMoveOnscreen() @@ -772,7 +770,7 @@ void RenderLayerCompositor::didMoveOnscreen() if (!page) return; - page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer); + page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get()); m_rootLayerAttached = true; } @@ -906,6 +904,11 @@ bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* render return false; } +bool RenderLayerCompositor::requiresCompositingWhenDescendantsAreCompositing(RenderObject* renderer) const +{ + return renderer->hasTransform() || renderer->isTransparent() || renderer->hasMask(); +} + // If an element has negative z-index children, those children render in front of the // layer background, so we need an extra 'contents' layer for the foreground of the layer // object. @@ -919,7 +922,7 @@ void RenderLayerCompositor::ensureRootPlatformLayer() if (m_rootPlatformLayer) return; - m_rootPlatformLayer = GraphicsLayer::createGraphicsLayer(0); + m_rootPlatformLayer = GraphicsLayer::create(0); m_rootPlatformLayer->setSize(FloatSize(m_renderView->overflowWidth(), m_renderView->overflowHeight())); m_rootPlatformLayer->setPosition(FloatPoint(0, 0)); // The root layer does flipping if we need it on this platform. @@ -937,7 +940,6 @@ void RenderLayerCompositor::destroyRootPlatformLayer() return; willMoveOffscreen(); - delete m_rootPlatformLayer; m_rootPlatformLayer = 0; } diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h index 02929dc..8dd689c 100644 --- a/WebCore/rendering/RenderLayerCompositor.h +++ b/WebCore/rendering/RenderLayerCompositor.h @@ -164,10 +164,11 @@ private: bool requiresCompositingForAnimation(RenderObject*) const; bool requiresCompositingForTransform(RenderObject*) const; bool requiresCompositingForVideo(RenderObject*) const; + bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const; private: RenderView* m_renderView; - GraphicsLayer* m_rootPlatformLayer; + OwnPtr<GraphicsLayer> m_rootPlatformLayer; bool m_hasAcceleratedCompositing; bool m_compositingConsultsOverlap; bool m_compositing; diff --git a/WebCore/rendering/RenderListItem.h b/WebCore/rendering/RenderListItem.h index 21544f9..c4c41dc 100644 --- a/WebCore/rendering/RenderListItem.h +++ b/WebCore/rendering/RenderListItem.h @@ -44,6 +44,8 @@ public: void setNotInList(bool notInList) { m_notInList = notInList; } bool notInList() const { return m_notInList; } + const String& markerText() const; + private: virtual const char* renderName() const { return "RenderListItem"; } @@ -59,8 +61,6 @@ private: virtual void positionListMarker(); - const String& markerText() const; - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); void updateMarkerLocation(); diff --git a/WebCore/rendering/RenderMarquee.cpp b/WebCore/rendering/RenderMarquee.cpp index 31a8305..bb917f8 100644 --- a/WebCore/rendering/RenderMarquee.cpp +++ b/WebCore/rendering/RenderMarquee.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Portions are Copyright (C) 1998 Netscape Communications Corporation. * @@ -152,7 +153,11 @@ int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge void RenderMarquee::start() { - if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero()) + if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero() +#if ENABLE(WCSS) && ENABLE(XHTMLMP) + || (m_layer->renderer()->document()->isXHTMLMPDocument() && !m_layer->renderer()->style()->marqueeLoopCount()) +#endif + ) return; // We may end up propagating a scroll event. It is important that we suspend events until diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index 5137338..728ff7a 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -4,6 +4,7 @@ * (C) 2000 Dirk Mueller (mueller@kde.org) * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -145,6 +146,12 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style) o = new (arena) RenderTableCell(node); break; case TABLE_CAPTION: +#if ENABLE(WCSS) + // As per the section 17.1 of the spec WAP-239-WCSS-20011026-a.pdf, + // the marquee box inherits and extends the characteristics of the + // principal block box ([CSS2] section 9.2.1). + case WAP_MARQUEE: +#endif o = new (arena) RenderBlock(node); break; case BOX: @@ -1612,15 +1619,20 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*) void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers) { - // FIXME: This will be slow when a large number of images is used. Fix by using a dict. - for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) { - if (currOld->image() && (!newLayers || !newLayers->containsImage(currOld->image()))) - currOld->image()->removeClient(this); - } + // Optimize the common case + if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image())) + return; + + // Go through the new layers and addClients first, to avoid removing all clients of an image. for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) { - if (currNew->image() && (!oldLayers || !oldLayers->containsImage(currNew->image()))) + if (currNew->image()) currNew->image()->addClient(this); } + + for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) { + if (currOld->image()) + currOld->image()->removeClient(this); + } } void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage) diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 911169d..eb558f6 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -285,6 +285,9 @@ public: bool isHTMLMarquee() const; + inline bool isAfterContent() const; + static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); } + bool childrenInline() const { return m_childrenInline; } void setChildrenInline(bool b = true) { m_childrenInline = b; } bool hasColumns() const { return m_hasColumns; } @@ -858,6 +861,16 @@ inline bool RenderObject::documentBeingDestroyed() const return !document()->renderer(); } +inline bool RenderObject::isAfterContent() const +{ + if (style()->styleType() != AFTER) + return false; + // Text nodes don't have their own styles, so ignore the style on a text node. + if (isText() && !isBR()) + return false; + return true; +} + inline void RenderObject::setNeedsLayout(bool b, bool markParents) { bool alreadyNeededLayout = m_needsLayout; diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp index 692a66e..0ab11b6 100644 --- a/WebCore/rendering/RenderReplaced.cpp +++ b/WebCore/rendering/RenderReplaced.cpp @@ -66,7 +66,7 @@ void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* old bool hadStyle = (oldStyle != 0); float oldZoom = hadStyle ? oldStyle->effectiveZoom() : RenderStyle::initialZoom(); - if (hadStyle && style() && style()->effectiveZoom() != oldZoom) + if (style() && style()->effectiveZoom() != oldZoom) intrinsicSizeChanged(); } diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 7599999..ebd7fbe 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -456,26 +456,7 @@ void RenderTable::layout() // FIXME: Only pass true if width or height changed. layoutPositionedObjects(true); - if (!hasOverflowClip()) { - int shadowLeft; - int shadowRight; - int shadowTop; - int shadowBottom; - style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); - - m_overflowLeft = min(m_overflowLeft, shadowLeft); - m_overflowWidth = max(m_overflowWidth, width() + shadowRight); - m_overflowTop = min(m_overflowTop, shadowTop); - m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); - - if (hasReflection()) { - IntRect reflection(reflectionBox()); - m_overflowTop = min(m_overflowTop, reflection.y()); - m_overflowHeight = max(m_overflowHeight, reflection.bottom()); - m_overflowLeft = min(m_overflowLeft, reflection.x()); - m_overflowHeight = max(m_overflowWidth, reflection.right()); - } - } + updateOverflowWithShadowAndReflection(); statePusher.pop(); diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index ada3961..383a394 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -207,7 +207,7 @@ void RenderText::deleteTextBoxes() PassRefPtr<StringImpl> RenderText::originalText() const { Node* e = node(); - return e ? static_cast<Text*>(e)->string() : 0; + return e ? static_cast<Text*>(e)->dataImpl() : 0; } void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty) diff --git a/WebCore/rendering/RenderTextFragment.cpp b/WebCore/rendering/RenderTextFragment.cpp index 7da9e5a..9ff1106 100644 --- a/WebCore/rendering/RenderTextFragment.cpp +++ b/WebCore/rendering/RenderTextFragment.cpp @@ -47,7 +47,7 @@ RenderTextFragment::RenderTextFragment(Node* node, StringImpl* str) PassRefPtr<StringImpl> RenderTextFragment::originalText() const { Node* e = node(); - RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->string() : contentString()); + RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->dataImpl() : contentString()); if (result && (start() > 0 || start() < result->length())) result = result->substring(start(), end()); return result.release(); @@ -76,7 +76,7 @@ UChar RenderTextFragment::previousCharacter() { if (start()) { Node* e = node(); - StringImpl* original = (e ? static_cast<Text*>(e)->string() : contentString()); + StringImpl* original = (e ? static_cast<Text*>(e)->dataImpl() : contentString()); if (original) return (*original)[start() - 1]; } diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h index ffb2548..0c417a2 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.h +++ b/WebCore/rendering/RenderThemeChromiumMac.h @@ -156,6 +156,7 @@ namespace WebCore { IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const; void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const; + void updateActiveState(NSCell*, const RenderObject*); void updateCheckedState(NSCell*, const RenderObject*); void updateEnabledState(NSCell*, const RenderObject*); void updateFocusedState(NSCell*, const RenderObject*); diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index 23201c9..42e2aca 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -549,6 +549,25 @@ IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& siz return result; } +// Updates the control tint (a.k.a. active state) of |cell| (from |o|). +// In the Chromium port, the renderer runs as a background process and controls' +// NSCell(s) lack a parent NSView. Therefore controls don't have their tint +// color updated correctly when the application is activated/deactivated. +// FocusController's setActive() is called when the application is +// activated/deactivated, which causes a repaint at which time this code is +// called. +// This function should be called before drawing any NSCell-derived controls, +// unless you're sure it isn't needed. +void RenderThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject* o) +{ + NSControlTint oldTint = [cell controlTint]; + NSControlTint tint = isActive(o) ? [NSColor currentControlTint] : + NSClearControlTint; + + if (tint != oldTint) + [cell setControlTint:tint]; +} + void RenderThemeChromiumMac::updateCheckedState(NSCell* cell, const RenderObject* o) { bool oldIndeterminate = [cell state] == NSMixedState; @@ -765,6 +784,7 @@ void RenderThemeChromiumMac::setCheckboxCellState(const RenderObject* o, const I setControlSize(checkbox, checkboxSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(checkbox, o); updateCheckedState(checkbox, o); updateEnabledState(checkbox, o); updatePressedState(checkbox, o); @@ -846,6 +866,7 @@ void RenderThemeChromiumMac::setRadioCellState(const RenderObject* o, const IntR setControlSize(radio, radioSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(radio, o); updateCheckedState(radio, o); updateEnabledState(radio, o); updatePressedState(radio, o); @@ -976,6 +997,7 @@ void RenderThemeChromiumMac::setButtonCellState(const RenderObject* o, const Int [button setKeyEquivalent:(isDefaultButton ? @"\r" : @"")]; // Update the various states we respond to. + updateActiveState(button, o); updateCheckedState(button, o); updateEnabledState(button, o); updatePressedState(button, o); @@ -1414,6 +1436,7 @@ void RenderThemeChromiumMac::setPopupButtonCellState(const RenderObject* o, cons setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(popupButton, o); updateCheckedState(popupButton, o); updateEnabledState(popupButton, o); updatePressedState(popupButton, o); @@ -1496,6 +1519,7 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec LocalCurrentGraphicsContext localContext(paintInfo.context); // Update the various states we respond to. + updateActiveState(sliderThumbCell, o); updateEnabledState(sliderThumbCell, o->parent()); updateFocusedState(sliderThumbCell, o->parent()); @@ -1607,6 +1631,7 @@ void RenderThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect& [search setControlSize:controlSizeForFont(o->style())]; // Update the various states we respond to. + updateActiveState(search, o); updateEnabledState(search, o); updateFocusedState(search, o); } @@ -1667,6 +1692,7 @@ bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const NSSearchFieldCell* search = this->search(); + updateActiveState([search cancelButtonCell], o); updatePressedState([search cancelButtonCell], o); paintInfo.context->save(); @@ -1742,6 +1768,8 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o, NSSearchFieldCell* search = this->search(); + updateActiveState([search searchButtonCell], o); + if ([search searchMenuTemplate] != nil) [search setSearchMenuTemplate:nil]; @@ -1769,6 +1797,8 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons NSSearchFieldCell* search = this->search(); + updateActiveState([search searchButtonCell], o); + if (![search searchMenuTemplate]) [search setSearchMenuTemplate:searchMenuTemplate()]; diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp index 79804ac..c8875dc 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -610,6 +610,10 @@ bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const R static Image* mediaPlay = Image::loadPlatformResource("mediaPlay").releaseRef(); static Image* mediaPause = Image::loadPlatformResource("mediaPause").releaseRef(); + static Image* mediaPlayDisabled = Image::loadPlatformResource("mediaPlayDisabled").releaseRef(); + + if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE) + return paintMediaButtonInternal(paintInfo.context, rect, mediaPlayDisabled); return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause); #else diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h index c3944ad..aad7900 100644 --- a/WebCore/rendering/style/FillLayer.h +++ b/WebCore/rendering/style/FillLayer.h @@ -63,14 +63,14 @@ public: bool isSizeSet() const { return m_sizeSet; } void setImage(StyleImage* i) { m_image = i; m_imageSet = true; } - void setXPosition(const Length& l) { m_xPosition = l; m_xPosSet = true; } - void setYPosition(const Length& l) { m_yPosition = l; m_yPosSet = true; } + void setXPosition(Length l) { m_xPosition = l; m_xPosSet = true; } + void setYPosition(Length l) { m_yPosition = l; m_yPosSet = true; } void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; } void setClip(EFillBox b) { m_clip = b; m_clipSet = true; } void setOrigin(EFillBox b) { m_origin = b; m_originSet = true; } void setRepeat(EFillRepeat r) { m_repeat = r; m_repeatSet = true; } void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; } - void setSize(const LengthSize& b) { m_size = b; m_sizeSet = true; } + void setSize(LengthSize b) { m_size = b; m_sizeSet = true; } void clearImage() { m_imageSet = false; } void clearXPosition() { m_xPosSet = false; } diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index c491816..013d335 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -4,6 +4,7 @@ * (C) 2000 Dirk Mueller (mueller@kde.org) * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.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 @@ -298,7 +299,11 @@ enum EDisplay { TABLE, INLINE_TABLE, TABLE_ROW_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW, TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL, - TABLE_CAPTION, BOX, INLINE_BOX, NONE + TABLE_CAPTION, BOX, INLINE_BOX, +#if ENABLE(WCSS) + WAP_MARQUEE, +#endif + NONE }; enum EPointerEvents { diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 5504cb1..12416e9 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -50,6 +50,7 @@ #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" #include "SQLResultSet.h" +#include "SQLTransactionCoordinator.h" #include <wtf/MainThread.h> #endif @@ -544,13 +545,17 @@ void Database::scheduleTransaction() m_transactionInProgress = false; } -void Database::scheduleTransactionStep(SQLTransaction* transaction) +void Database::scheduleTransactionStep(SQLTransaction* transaction, bool immediately) { - if (m_document->databaseThread()) { - RefPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); - LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); + if (!m_document->databaseThread()) + return; + + RefPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); + LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); + if (immediately) + m_document->databaseThread()->scheduleImmediateTask(task.release()); + else m_document->databaseThread()->scheduleTask(task.release()); - } } void Database::scheduleTransactionCallback(SQLTransaction* transaction) @@ -588,6 +593,11 @@ Vector<String> Database::performGetTableNames() return tableNames; } +SQLTransactionCoordinator* Database::transactionCoordinator() const +{ + return m_document->databaseThread()->transactionCoordinator(); +} + String Database::version() const { if (m_deleted) diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h index 0bdb37b..02736c8 100644 --- a/WebCore/storage/Database.h +++ b/WebCore/storage/Database.h @@ -57,6 +57,7 @@ class DatabaseThread; class Document; class SQLResultSet; class SQLTransactionCallback; +class SQLTransactionCoordinator; class SQLTransactionErrorCallback; class SQLValue; @@ -116,6 +117,8 @@ public: Vector<String> performGetTableNames(); + SQLTransactionCoordinator* transactionCoordinator() const; + private: Database(Document* document, const String& name, const String& expectedVersion); @@ -123,7 +126,7 @@ private: void scheduleTransaction(); void scheduleTransactionCallback(SQLTransaction*); - void scheduleTransactionStep(SQLTransaction* transaction); + void scheduleTransactionStep(SQLTransaction* transaction, bool immediately = false); MessageQueue<RefPtr<SQLTransaction> > m_transactionQueue; Mutex m_transactionInProgressMutex; diff --git a/WebCore/storage/DatabaseThread.cpp b/WebCore/storage/DatabaseThread.cpp index b6c9b5d..fb9b603 100644 --- a/WebCore/storage/DatabaseThread.cpp +++ b/WebCore/storage/DatabaseThread.cpp @@ -35,11 +35,13 @@ #include "Database.h" #include "DatabaseTask.h" #include "Logging.h" +#include "SQLTransactionCoordinator.h" namespace WebCore { DatabaseThread::DatabaseThread() : m_threadID(0) + , m_transactionCoordinator(new SQLTransactionCoordinator()) { m_selfRef = this; } @@ -97,6 +99,9 @@ void* DatabaseThread::databaseThread() pool.cycle(); } + // Clean up the list of all pending transactions on this database thread + m_transactionCoordinator->shutdown(); + LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThread %p, which currently has %i ref(s)", m_threadID, this, refCount()); // Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the database in an diff --git a/WebCore/storage/DatabaseThread.h b/WebCore/storage/DatabaseThread.h index 5aab5fd..59d7a5d 100644 --- a/WebCore/storage/DatabaseThread.h +++ b/WebCore/storage/DatabaseThread.h @@ -33,6 +33,7 @@ #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/MessageQueue.h> +#include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> @@ -42,6 +43,7 @@ namespace WebCore { class Database; class DatabaseTask; class Document; +class SQLTransactionCoordinator; class DatabaseThread : public ThreadSafeShared<DatabaseThread> { public: @@ -60,6 +62,8 @@ public: void recordDatabaseClosed(Database*); ThreadIdentifier getThreadID() { return m_threadID; } + SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCoordinator.get(); } + private: DatabaseThread(); @@ -75,6 +79,8 @@ private: // This set keeps track of the open databases that have been used on this thread. typedef HashSet<RefPtr<Database> > DatabaseSet; DatabaseSet m_openDatabaseSet; + + OwnPtr<SQLTransactionCoordinator> m_transactionCoordinator; }; } // namespace WebCore diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index 3331e6e..dc48ae1 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -50,6 +50,7 @@ #include "SQLStatement.h" #include "SQLStatementCallback.h" #include "SQLStatementErrorCallback.h" +#include "SQLTransactionCoordinator.h" #include "SQLValue.h" // There's no way of knowing exactly how much more space will be required when a statement hits the quota limit. @@ -67,7 +68,7 @@ PassRefPtr<SQLTransaction> SQLTransaction::create(Database* db, PassRefPtr<SQLTr SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback, PassRefPtr<SQLTransactionWrapper> wrapper) - : m_nextStep(&SQLTransaction::openTransactionAndPreflight) + : m_nextStep(&SQLTransaction::acquireLock) , m_executeSqlAllowed(false) , m_database(db) , m_wrapper(wrapper) @@ -76,6 +77,7 @@ SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> , m_errorCallback(errorCallback) , m_shouldRetryCurrentStatement(false) , m_modifiedDatabase(false) + , m_lockAcquired(false) { ASSERT(m_database); } @@ -116,7 +118,9 @@ void SQLTransaction::enqueueStatement(PassRefPtr<SQLStatement> statement) #ifndef NDEBUG const char* SQLTransaction::debugStepName(SQLTransaction::TransactionStepMethod step) { - if (step == &SQLTransaction::openTransactionAndPreflight) + if (step == &SQLTransaction::acquireLock) + return "acquireLock"; + else if (step == &SQLTransaction::openTransactionAndPreflight) return "openTransactionAndPreflight"; else if (step == &SQLTransaction::runStatements) return "runStatements"; @@ -157,6 +161,9 @@ void SQLTransaction::checkAndHandleClosedDatabase() m_sqliteTransaction->stop(); m_sqliteTransaction.clear(); } + + if (m_lockAcquired) + m_database->transactionCoordinator()->releaseLock(this); } @@ -164,7 +171,8 @@ bool SQLTransaction::performNextStep() { LOG(StorageAPI, "Step %s\n", debugStepName(m_nextStep)); - ASSERT(m_nextStep == &SQLTransaction::openTransactionAndPreflight || + ASSERT(m_nextStep == &SQLTransaction::acquireLock || + m_nextStep == &SQLTransaction::openTransactionAndPreflight || m_nextStep == &SQLTransaction::runStatements || m_nextStep == &SQLTransaction::postflightAndCommit || m_nextStep == &SQLTransaction::cleanupAfterSuccessCallback || @@ -195,9 +203,23 @@ void SQLTransaction::performPendingCallback() (this->*m_nextStep)(); } +void SQLTransaction::acquireLock() +{ + m_database->transactionCoordinator()->acquireLock(this); +} + +void SQLTransaction::lockAcquired() +{ + m_lockAcquired = true; + m_nextStep = &SQLTransaction::openTransactionAndPreflight; + LOG(StorageAPI, "Scheduling openTransactionAndPreflight immediately for transaction %p\n", this); + m_database->scheduleTransactionStep(this, true); +} + void SQLTransaction::openTransactionAndPreflight() { ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(m_lockAcquired); LOG(StorageAPI, "Opening and preflighting transaction %p", this); @@ -273,6 +295,8 @@ void SQLTransaction::scheduleToRunStatements() void SQLTransaction::runStatements() { + ASSERT(m_lockAcquired); + // If there is a series of statements queued up that are all successful and have no associated // SQLStatementCallback objects, then we can burn through the queue do { @@ -411,6 +435,8 @@ void SQLTransaction::deliverQuotaIncreaseCallback() void SQLTransaction::postflightAndCommit() { + ASSERT(m_lockAcquired); + // Transaction Step 7 - Peform postflight steps, jumping to the error callback if they fail if (m_wrapper && !m_wrapper->performPostflight(this)) { m_transactionError = m_wrapper->sqlError(); @@ -469,11 +495,16 @@ void SQLTransaction::deliverSuccessCallback() void SQLTransaction::cleanupAfterSuccessCallback() { + ASSERT(m_lockAcquired); + // Transaction Step 11 - End transaction steps // There is no next step LOG(StorageAPI, "Transaction %p is complete\n", this); ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); m_nextStep = 0; + + // Release the lock on this database + m_database->transactionCoordinator()->releaseLock(this); } void SQLTransaction::handleTransactionError(bool inCallback) @@ -516,6 +547,8 @@ void SQLTransaction::deliverTransactionErrorCallback() void SQLTransaction::cleanupAfterTransactionErrorCallback() { + ASSERT(m_lockAcquired); + m_database->m_databaseAuthorizer->disable(); if (m_sqliteTransaction) { // Transaction Step 12 - Rollback the transaction. @@ -540,6 +573,9 @@ void SQLTransaction::cleanupAfterTransactionErrorCallback() // Now release our callbacks, to break reference cycles. m_callback = 0; m_errorCallback = 0; + + // Now release the lock on this database + m_database->transactionCoordinator()->releaseLock(this); } } // namespace WebCore diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h index e77c183..141cef7 100644 --- a/WebCore/storage/SQLTransaction.h +++ b/WebCore/storage/SQLTransaction.h @@ -73,6 +73,7 @@ public: void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e); + void lockAcquired(); bool performNextStep(); void performPendingCallback(); @@ -88,6 +89,7 @@ private: void checkAndHandleClosedDatabase(); + void acquireLock(); void openTransactionAndPreflight(); void deliverTransactionCallback(); void scheduleToRunStatements(); @@ -120,6 +122,7 @@ private: RefPtr<SQLError> m_transactionError; bool m_shouldRetryCurrentStatement; bool m_modifiedDatabase; + bool m_lockAcquired; Mutex m_statementMutex; Deque<RefPtr<SQLStatement> > m_statementQueue; diff --git a/WebCore/storage/SQLTransactionCoordinator.cpp b/WebCore/storage/SQLTransactionCoordinator.cpp new file mode 100644 index 0000000..63fd38e --- /dev/null +++ b/WebCore/storage/SQLTransactionCoordinator.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SQLTransactionCoordinator.h" + +#include "CString.h" +#include "Database.h" +#include "SQLTransaction.h" +#include <wtf/Deque.h> +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +static String getDatabaseIdentifier(SQLTransaction* transaction) +{ + Database* database = transaction->database(); + ASSERT(database); + return database->stringIdentifier(); +} + +void SQLTransactionCoordinator::acquireLock(SQLTransaction* transaction) +{ + String dbIdentifier = getDatabaseIdentifier(transaction); + + TransactionsHashMap::iterator it = m_pendingTransactions.find(dbIdentifier); + if (it == m_pendingTransactions.end()) { + // No pending transactions for this DB + TransactionsQueue pendingTransactions; + pendingTransactions.append(transaction); + m_pendingTransactions.add(dbIdentifier, pendingTransactions); + + // Start the transaction + transaction->lockAcquired(); + } else { + // Another transaction is running on this DB; put this one in the queue + TransactionsQueue& pendingTransactions = it->second; + pendingTransactions.append(transaction); + } +} + +void SQLTransactionCoordinator::releaseLock(SQLTransaction* transaction) +{ + if (m_pendingTransactions.isEmpty()) + return; + + String dbIdentifier = getDatabaseIdentifier(transaction); + + TransactionsHashMap::iterator it = m_pendingTransactions.find(dbIdentifier); + ASSERT(it != m_pendingTransactions.end()); + TransactionsQueue& pendingTransactions = it->second; + ASSERT(!pendingTransactions.isEmpty()); + + // 'transaction' should always be the first transaction in this queue + ASSERT(pendingTransactions.first().get() == transaction); + + // Remove 'transaction' from the queue of pending transactions + pendingTransactions.removeFirst(); + if (pendingTransactions.isEmpty()) { + // No more pending transactions; delete dbIdentifier's queue + m_pendingTransactions.remove(it); + } else { + // We have more pending transactions; start the next one + pendingTransactions.first()->lockAcquired(); + } +} + +void SQLTransactionCoordinator::shutdown() +{ + // Clean up all pending transactions for all databases + m_pendingTransactions.clear(); +} + +} diff --git a/WebCore/storage/SQLTransactionCoordinator.h b/WebCore/storage/SQLTransactionCoordinator.h new file mode 100644 index 0000000..c6abfda --- /dev/null +++ b/WebCore/storage/SQLTransactionCoordinator.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SQLTransactionCoordinator_h +#define SQLTransactionCoordinator_h + +#include "CString.h" +#include "StringHash.h" +#include <wtf/Deque.h> +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + + class SQLTransaction; + + class SQLTransactionCoordinator { + public: + void acquireLock(SQLTransaction*); + void releaseLock(SQLTransaction*); + void shutdown(); + private: + typedef Deque<RefPtr<SQLTransaction> > TransactionsQueue; + typedef HashMap<String, TransactionsQueue> TransactionsHashMap; + TransactionsHashMap m_pendingTransactions; + }; +} + +#endif // SQLTransactionCoordinator_h diff --git a/WebCore/storage/Storage.h b/WebCore/storage/Storage.h index d68e9bc..197e693 100644 --- a/WebCore/storage/Storage.h +++ b/WebCore/storage/Storage.h @@ -53,6 +53,7 @@ namespace WebCore { bool contains(const String& key) const; + Frame* frame() { return m_frame; } void disconnectFrame() { m_frame = 0; } private: diff --git a/WebCore/storage/StorageNamespace.h b/WebCore/storage/StorageNamespace.h index edbe339..825581f 100644 --- a/WebCore/storage/StorageNamespace.h +++ b/WebCore/storage/StorageNamespace.h @@ -48,6 +48,7 @@ namespace WebCore { virtual PassRefPtr<StorageArea> storageArea(SecurityOrigin*) = 0; virtual PassRefPtr<StorageNamespace> copy() = 0; virtual void close() = 0; + virtual void unlock() = 0; }; } // namespace WebCore diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp index b4caaeb..23725a5 100644 --- a/WebCore/storage/StorageNamespaceImpl.cpp +++ b/WebCore/storage/StorageNamespaceImpl.cpp @@ -134,6 +134,11 @@ void StorageNamespaceImpl::close() m_isShutdown = true; } +void StorageNamespaceImpl::unlock() +{ + // Because there's a single event loop per-process, this is a no-op. +} + } // namespace WebCore #endif // ENABLE(DOM_STORAGE) diff --git a/WebCore/storage/StorageNamespaceImpl.h b/WebCore/storage/StorageNamespaceImpl.h index 0b15e43..d3ef37f 100644 --- a/WebCore/storage/StorageNamespaceImpl.h +++ b/WebCore/storage/StorageNamespaceImpl.h @@ -49,6 +49,7 @@ namespace WebCore { virtual PassRefPtr<StorageArea> storageArea(SecurityOrigin*); virtual PassRefPtr<StorageNamespace> copy(); virtual void close(); + virtual void unlock(); private: StorageNamespaceImpl(StorageType, const String& path); diff --git a/WebCore/svg/SVGColor.cpp b/WebCore/svg/SVGColor.cpp index f939ef0..d819ebf 100644 --- a/WebCore/svg/SVGColor.cpp +++ b/WebCore/svg/SVGColor.cpp @@ -62,9 +62,9 @@ unsigned short SVGColor::colorType() const return m_colorType; } -RGBColor* SVGColor::rgbColor() const +PassRefPtr<RGBColor> SVGColor::rgbColor() const { - return RGBColor::create(m_color.rgb()).releaseRef(); + return RGBColor::create(m_color.rgb()); } void SVGColor::setRGBColor(const String& rgbColor, ExceptionCode& ec) diff --git a/WebCore/svg/SVGColor.h b/WebCore/svg/SVGColor.h index 5dfb694..406166b 100644 --- a/WebCore/svg/SVGColor.h +++ b/WebCore/svg/SVGColor.h @@ -57,8 +57,8 @@ namespace WebCore { // 'SVGColor' functions unsigned short colorType() const; - RGBColor* rgbColor() const; - + PassRefPtr<RGBColor> rgbColor() const; + static Color colorFromRGBColorString(const String&); void setRGBColor(const String& rgbColor) { ExceptionCode ignored = 0; setRGBColor(rgbColor, ignored); } diff --git a/WebCore/svg/SVGDocument.h b/WebCore/svg/SVGDocument.h index 02e3649..c7006f9 100644 --- a/WebCore/svg/SVGDocument.h +++ b/WebCore/svg/SVGDocument.h @@ -35,13 +35,11 @@ namespace WebCore { public: static PassRefPtr<SVGDocument> create(Frame* frame) { - return new SVGDocument(frame); + return adoptRef(new SVGDocument(frame)); } virtual ~SVGDocument(); - virtual bool isSVGDocument() const { return true; } - SVGSVGElement* rootElement() const; void dispatchZoomEvent(float prevScale, float newScale); @@ -52,11 +50,13 @@ namespace WebCore { void startPan(const FloatPoint& start); void updatePan(const FloatPoint& pos) const; - virtual bool childShouldCreateRenderer(Node*) const; - private: SVGDocument(Frame*); + virtual bool isSVGDocument() const { return true; } + + virtual bool childShouldCreateRenderer(Node*) const; + FloatPoint m_translate; }; diff --git a/WebCore/svg/SVGElementInstance.cpp b/WebCore/svg/SVGElementInstance.cpp index 01555fc..3a82067 100644 --- a/WebCore/svg/SVGElementInstance.cpp +++ b/WebCore/svg/SVGElementInstance.cpp @@ -1,8 +1,6 @@ /* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - This file is part of the KDE project - 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 @@ -25,7 +23,6 @@ #include "SVGElementInstance.h" #include "ContainerNodeAlgorithms.h" -#include "Document.h" #include "Event.h" #include "EventException.h" #include "EventListener.h" @@ -46,7 +43,7 @@ namespace WebCore { static WTF::RefCountedLeakCounter instanceCounter("WebCoreSVGElementInstance"); #endif -SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, SVGElement* originalElement) +SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) : m_needsUpdate(false) , m_useElement(useElement) , m_element(originalElement) diff --git a/WebCore/svg/SVGElementInstance.h b/WebCore/svg/SVGElementInstance.h index c477718..048c66c 100644 --- a/WebCore/svg/SVGElementInstance.h +++ b/WebCore/svg/SVGElementInstance.h @@ -1,8 +1,6 @@ /* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - This file is part of the KDE project - 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 @@ -27,9 +25,6 @@ #include "SVGElement.h" #include "TreeShared.h" -#include <wtf/RefPtr.h> -#include <wtf/PassRefPtr.h> - namespace WebCore { namespace Private { @@ -37,8 +32,6 @@ namespace WebCore { void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); }; - class EventListener; - class Frame; class SVGUseElement; class SVGElementInstanceList; @@ -46,7 +39,11 @@ namespace WebCore { class SVGElementInstance : public TreeShared<SVGElementInstance>, public EventTarget { public: - SVGElementInstance(SVGUseElement*, SVGElement* originalElement); + static PassRefPtr<SVGElementInstance> create(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) + { + return adoptRef(new SVGElementInstance(useElement, originalElement)); + } + virtual ~SVGElementInstance(); bool needsUpdate() const { return m_needsUpdate; } @@ -54,9 +51,6 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const; - virtual Node* toNode() { return shadowTreeElement(); } - virtual SVGElementInstance* toSVGElementInstance() { return this; } - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); @@ -167,6 +161,11 @@ namespace WebCore { private: friend class SVGUseElement; + SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement); + + virtual Node* toNode() { return shadowTreeElement(); } + virtual SVGElementInstance* toSVGElementInstance() { return this; } + void appendChild(PassRefPtr<SVGElementInstance> child); void setShadowTreeElement(SVGElement*); void forgetWrapper(); @@ -191,7 +190,6 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - private: bool m_needsUpdate : 1; SVGUseElement* m_useElement; diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp index b73a692..9cb3024 100644 --- a/WebCore/svg/SVGUseElement.cpp +++ b/WebCore/svg/SVGUseElement.cpp @@ -324,7 +324,7 @@ void SVGUseElement::buildPendingResource() // Spec: If the 'use' element references a simple graphics element such as a 'rect', then there is only a // single SVGElementInstance object, and the correspondingElement attribute on this SVGElementInstance object // is the SVGRectElement that corresponds to the referenced 'rect' element. - m_targetElementInstance = new SVGElementInstance(this, target); + m_targetElementInstance = SVGElementInstance::create(this, target); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children bool foundProblem = false; @@ -474,17 +474,17 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta continue; // Create SVGElementInstance object, for both container/non-container nodes. - SVGElementInstance* instancePtr = new SVGElementInstance(this, element); - targetInstance->appendChild(instancePtr); + RefPtr<SVGElementInstance> instancePtr = SVGElementInstance::create(this, element); + targetInstance->appendChild(instancePtr.get()); // Enter recursion, appending new instance tree nodes to the "instance" object. if (element->hasChildNodes()) - buildInstanceTree(element, instancePtr, foundProblem); + buildInstanceTree(element, instancePtr.get(), foundProblem); // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced // object, the instance tree will contain recursive expansion of the indirect references to form a complete tree. if (element->hasTagName(SVGNames::useTag)) - handleDeepUseReferencing(static_cast<SVGUseElement*>(element), instancePtr, foundProblem); + handleDeepUseReferencing(static_cast<SVGUseElement*>(element), instancePtr.get(), foundProblem); } // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced @@ -524,11 +524,11 @@ void SVGUseElement::handleDeepUseReferencing(SVGUseElement* use, SVGElementInsta } // Create an instance object, even if we're dealing with a cycle - SVGElementInstance* newInstance = new SVGElementInstance(this, target); + RefPtr<SVGElementInstance> newInstance = SVGElementInstance::create(this, target); targetInstance->appendChild(newInstance); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children - buildInstanceTree(target, newInstance, foundProblem); + buildInstanceTree(target, newInstance.get(), foundProblem); } void SVGUseElement::alterShadowTreeForSVGTag(SVGElement* target) diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp index d6c401b..97467c1 100644 --- a/WebCore/svg/graphics/SVGResourceMasker.cpp +++ b/WebCore/svg/graphics/SVGResourceMasker.cpp @@ -76,8 +76,8 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou if (!luminancedImage) return; - PassRefPtr<CanvasPixelArray> srcPixelArray(m_mask->getImageData(intImageRect)->data()); - PassRefPtr<ImageData> destImageData(luminancedImage->getImageData(intImageRect)); + PassRefPtr<CanvasPixelArray> srcPixelArray(m_mask->getUnmultipliedImageData(intImageRect)->data()); + PassRefPtr<ImageData> destImageData(luminancedImage->getUnmultipliedImageData(intImageRect)); for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset++) { unsigned pixelByteOffset = pixelOffset * 4; @@ -93,7 +93,7 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou destImageData->data()->set(pixelByteOffset + 3, luma); } - luminancedImage->putImageData(destImageData.get(), intImageRect, IntPoint(0, 0)); + luminancedImage->putUnmultipliedImageData(destImageData.get(), intImageRect, IntPoint(0, 0)); context->clipToImageBuffer(m_maskRect, luminancedImage.get()); } diff --git a/WebCore/webcore-wx.bkl b/WebCore/webcore-wx.bkl index b31a178..a058e18 100644 --- a/WebCore/webcore-wx.bkl +++ b/WebCore/webcore-wx.bkl @@ -58,7 +58,6 @@ wxWebCore port Bakefile project file. platform/graphics/wx/GradientWx.cpp platform/graphics/wx/GraphicsContextWx.cpp platform/graphics/wx/ImageBufferWx.cpp - platform/graphics/wx/ImageSourceWx.cpp platform/graphics/wx/ImageWx.cpp platform/graphics/wx/IntPointWx.cpp platform/graphics/wx/IntRectWx.cpp diff --git a/WebCore/wml/WMLAnchorElement.cpp b/WebCore/wml/WMLAnchorElement.cpp index 91526b9..b9b3f53 100644 --- a/WebCore/wml/WMLAnchorElement.cpp +++ b/WebCore/wml/WMLAnchorElement.cpp @@ -54,7 +54,7 @@ void WMLAnchorElement::defaultEventHandler(Event* event) shouldHandle = static_cast<KeyboardEvent*>(event)->keyIdentifier() == "Enter"; if (shouldHandle && m_task) { - m_task->executeTask(event); + m_task->executeTask(); event->setDefaultHandled(); return; } @@ -71,7 +71,7 @@ void WMLAnchorElement::registerTask(WMLTaskElement* task) void WMLAnchorElement::deregisterTask(WMLTaskElement* task) { - ASSERT(m_task == task); + ASSERT_UNUSED(task, m_task == task); m_task = 0; } diff --git a/WebCore/wml/WMLCardElement.cpp b/WebCore/wml/WMLCardElement.cpp index 63240f3..818b818 100644 --- a/WebCore/wml/WMLCardElement.cpp +++ b/WebCore/wml/WMLCardElement.cpp @@ -339,8 +339,6 @@ WMLCardElement* WMLCardElement::determineActiveCard(Document* doc) // Update the document title doc->setTitle(activeCard->title()); - // Set the active activeCard in the WMLPageState object - pageState->setActiveCard(activeCard); return activeCard; } diff --git a/WebCore/wml/WMLDoElement.cpp b/WebCore/wml/WMLDoElement.cpp index 34be6df..38ad5dd 100644 --- a/WebCore/wml/WMLDoElement.cpp +++ b/WebCore/wml/WMLDoElement.cpp @@ -70,14 +70,17 @@ void WMLDoElement::defaultEventHandler(Event* event) if (m_type == "accept" || m_type == "options") { if (m_task) - m_task->executeTask(event); + m_task->executeTask(); } else if (m_type == "prev") { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - + // Stop the timer of the current card if it is active - if (WMLCardElement* card = pageState->activeCard()) { + if (WMLCardElement* card = document->activeCard()) { if (WMLTimerElement* eventTimer = card->eventTimer()) eventTimer->stop(); } @@ -172,7 +175,7 @@ void WMLDoElement::registerTask(WMLTaskElement* task) void WMLDoElement::deregisterTask(WMLTaskElement* task) { - ASSERT(m_task == task); + ASSERT_UNUSED(task, m_task == task); m_task = 0; } diff --git a/WebCore/wml/WMLDocument.cpp b/WebCore/wml/WMLDocument.cpp index f2287be..ef0bfc8 100644 --- a/WebCore/wml/WMLDocument.cpp +++ b/WebCore/wml/WMLDocument.cpp @@ -79,10 +79,8 @@ void WMLDocument::finishedParsing() return; } - if (m_activeCard) { + if (m_activeCard) m_activeCard->handleIntrinsicEventIfNeeded(); - m_activeCard = 0; - } } bool WMLDocument::initialize(bool aboutToFinishParsing) diff --git a/WebCore/wml/WMLDocument.h b/WebCore/wml/WMLDocument.h index fb3e62e..9053518 100644 --- a/WebCore/wml/WMLDocument.h +++ b/WebCore/wml/WMLDocument.h @@ -34,7 +34,7 @@ class WMLDocument : public Document { public: static PassRefPtr<WMLDocument> create(Frame* frame) { - return new WMLDocument(frame); + return adoptRef(new WMLDocument(frame)); } virtual ~WMLDocument(); @@ -44,6 +44,8 @@ public: bool initialize(bool aboutToFinishParsing = false); + WMLCardElement* activeCard() const { return m_activeCard; } + private: WMLDocument(Frame*); WMLCardElement* m_activeCard; diff --git a/WebCore/wml/WMLGoElement.cpp b/WebCore/wml/WMLGoElement.cpp index 635302f..8076207 100644 --- a/WebCore/wml/WMLGoElement.cpp +++ b/WebCore/wml/WMLGoElement.cpp @@ -73,18 +73,20 @@ void WMLGoElement::parseMappedAttribute(MappedAttribute* attr) WMLTaskElement::parseMappedAttribute(attr); } -void WMLGoElement::executeTask(Event*) +void WMLGoElement::executeTask() { - Document* doc = document(); - WMLPageState* pageState = wmlPageStateForDocument(doc); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; - Frame* frame = doc->frame(); + Frame* frame = document->frame(); if (!frame) return; @@ -97,7 +99,7 @@ void WMLGoElement::executeTask(Event*) return; // Substitute variables within target url attribute value - KURL url = doc->completeURL(substituteVariableReferences(href, doc, WMLVariableEscapingEscape)); + KURL url = document->completeURL(substituteVariableReferences(href, document, WMLVariableEscapingEscape)); if (url.isEmpty()) return; @@ -108,9 +110,9 @@ void WMLGoElement::executeTask(Event*) eventTimer->stop(); // FIXME: 'newcontext' handling not implemented for external cards - bool inSameDeck = doc->url().path() == url.path(); + bool inSameDeck = document->url().path() == url.path(); if (inSameDeck && url.hasFragmentIdentifier()) { - if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(doc, url.fragmentIdentifier())) { + if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(document, url.fragmentIdentifier())) { if (card->isNewContext()) pageState->reset(); } diff --git a/WebCore/wml/WMLGoElement.h b/WebCore/wml/WMLGoElement.h index 75c1858..36c7be2 100644 --- a/WebCore/wml/WMLGoElement.h +++ b/WebCore/wml/WMLGoElement.h @@ -39,7 +39,7 @@ public: void deregisterPostfieldElement(WMLPostfieldElement*); virtual void parseMappedAttribute(MappedAttribute*); - virtual void executeTask(Event*); + virtual void executeTask(); private: void preparePOSTRequest(ResourceRequest&, bool inSameDeck, const String& cacheControl); diff --git a/WebCore/wml/WMLIntrinsicEventHandler.cpp b/WebCore/wml/WMLIntrinsicEventHandler.cpp index 67364d9..8e4c276 100644 --- a/WebCore/wml/WMLIntrinsicEventHandler.cpp +++ b/WebCore/wml/WMLIntrinsicEventHandler.cpp @@ -48,7 +48,7 @@ void WMLIntrinsicEventHandler::triggerIntrinsicEvent(WMLIntrinsicEventType type) { RefPtr<WMLIntrinsicEvent> event = m_events.get(type); ASSERT(event->taskElement()); - event->taskElement()->executeTask(0); + event->taskElement()->executeTask(); } bool WMLIntrinsicEventHandler::hasIntrinsicEvent(WMLIntrinsicEventType type) const diff --git a/WebCore/wml/WMLOptionElement.cpp b/WebCore/wml/WMLOptionElement.cpp index 764d3a1..61fa762 100644 --- a/WebCore/wml/WMLOptionElement.cpp +++ b/WebCore/wml/WMLOptionElement.cpp @@ -158,6 +158,10 @@ RenderStyle* WMLOptionElement::nonRendererRenderStyle() const void WMLOptionElement::handleIntrinsicEventIfNeeded() { + WMLSelectElement* select = ownerSelectElement(this); + if (!select || !select->initialized()) + return; + WMLIntrinsicEventHandler* eventHandler = this->eventHandler(); if (!eventHandler) return; diff --git a/WebCore/wml/WMLPageState.cpp b/WebCore/wml/WMLPageState.cpp index 5f431bb..3e1863d 100644 --- a/WebCore/wml/WMLPageState.cpp +++ b/WebCore/wml/WMLPageState.cpp @@ -35,7 +35,6 @@ namespace WebCore { WMLPageState::WMLPageState(Page* page) : m_page(page) - , m_activeCard(0) , m_hasAccessControlData(false) { } diff --git a/WebCore/wml/WMLPageState.h b/WebCore/wml/WMLPageState.h index de0af91..a5d8b23 100644 --- a/WebCore/wml/WMLPageState.h +++ b/WebCore/wml/WMLPageState.h @@ -54,9 +54,6 @@ public: Page* page() const { return m_page; } - WMLCardElement* activeCard() const { return m_activeCard; } - void setActiveCard(WMLCardElement* card) { m_activeCard = card; } - // Deck access control bool processAccessControlData(const String& dmain, const String& path); void resetAccessControlData(); @@ -70,7 +67,6 @@ private: private: Page* m_page; WMLVariableMap m_variables; - WMLCardElement* m_activeCard; String m_accessDomain; String m_accessPath; bool m_hasAccessControlData; diff --git a/WebCore/wml/WMLPrevElement.cpp b/WebCore/wml/WMLPrevElement.cpp index 2688d03..3d487ea 100644 --- a/WebCore/wml/WMLPrevElement.cpp +++ b/WebCore/wml/WMLPrevElement.cpp @@ -40,13 +40,16 @@ WMLPrevElement::~WMLPrevElement() { } -void WMLPrevElement::executeTask(Event*) +void WMLPrevElement::executeTask() { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; diff --git a/WebCore/wml/WMLPrevElement.h b/WebCore/wml/WMLPrevElement.h index 232c1b0..ce8596e 100644 --- a/WebCore/wml/WMLPrevElement.h +++ b/WebCore/wml/WMLPrevElement.h @@ -31,7 +31,7 @@ public: WMLPrevElement(const QualifiedName& tagName, Document*); virtual ~WMLPrevElement(); - virtual void executeTask(Event*); + virtual void executeTask(); }; } diff --git a/WebCore/wml/WMLRefreshElement.cpp b/WebCore/wml/WMLRefreshElement.cpp index c05a2c9..bcf87ac 100644 --- a/WebCore/wml/WMLRefreshElement.cpp +++ b/WebCore/wml/WMLRefreshElement.cpp @@ -41,13 +41,16 @@ WMLRefreshElement::~WMLRefreshElement() { } -void WMLRefreshElement::executeTask(Event*) +void WMLRefreshElement::executeTask() { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; @@ -62,7 +65,7 @@ void WMLRefreshElement::executeTask(Event*) storeVariableState(pageState); // Redisplay curremt card with current variable state - if (Frame* frame = document()->frame()) { + if (Frame* frame = document->frame()) { if (FrameLoader* loader = frame->loader()) loader->reload(); } diff --git a/WebCore/wml/WMLRefreshElement.h b/WebCore/wml/WMLRefreshElement.h index 7b1729e..43b71b5 100644 --- a/WebCore/wml/WMLRefreshElement.h +++ b/WebCore/wml/WMLRefreshElement.h @@ -31,7 +31,7 @@ public: WMLRefreshElement(const QualifiedName& tagName, Document*); virtual ~WMLRefreshElement(); - virtual void executeTask(Event*); + virtual void executeTask(); }; } diff --git a/WebCore/wml/WMLSelectElement.cpp b/WebCore/wml/WMLSelectElement.cpp index 2d03a3f..03ca05a 100644 --- a/WebCore/wml/WMLSelectElement.cpp +++ b/WebCore/wml/WMLSelectElement.cpp @@ -39,6 +39,7 @@ using namespace WMLNames; WMLSelectElement::WMLSelectElement(const QualifiedName& tagName, Document* document) : WMLFormControlElement(tagName, document) + , m_initialized(false) { } @@ -242,14 +243,17 @@ void WMLSelectElement::selectInitialOptions() // Spec: Step 1 - the default option index is determined using iname and ivalue calculateDefaultOptionIndices(); - if (m_defaultOptionIndices.isEmpty()) + if (m_defaultOptionIndices.isEmpty()) { + m_initialized = true; return; + } // Spec: Step 2 – initialise variables initializeVariables(); // Spec: Step 3 – pre-select option(s) specified by the default option index selectDefaultOptions(); + m_initialized = true; } void WMLSelectElement::insertedIntoTree(bool deep) diff --git a/WebCore/wml/WMLSelectElement.h b/WebCore/wml/WMLSelectElement.h index 412a950..5ab7da6 100644 --- a/WebCore/wml/WMLSelectElement.h +++ b/WebCore/wml/WMLSelectElement.h @@ -85,6 +85,8 @@ public: void scrollToSelection(); void selectInitialOptions(); + bool initialized() const { return m_initialized; } + private: virtual void insertedIntoTree(bool); @@ -104,6 +106,7 @@ private: String ivalue() const; SelectElementData m_data; + bool m_initialized; Vector<unsigned> m_defaultOptionIndices; }; diff --git a/WebCore/wml/WMLTaskElement.h b/WebCore/wml/WMLTaskElement.h index b5dab8c..b813285 100644 --- a/WebCore/wml/WMLTaskElement.h +++ b/WebCore/wml/WMLTaskElement.h @@ -40,7 +40,7 @@ public: virtual void insertedIntoDocument(); virtual void removedFromDocument(); - virtual void executeTask(Event*) = 0; + virtual void executeTask() = 0; void registerVariableSetter(WMLSetvarElement*); void deregisterVariableSetter(WMLSetvarElement*); diff --git a/WebCore/workers/DedicatedWorkerContext.cpp b/WebCore/workers/DedicatedWorkerContext.cpp index ae5c547..6e5a317 100644 --- a/WebCore/workers/DedicatedWorkerContext.cpp +++ b/WebCore/workers/DedicatedWorkerContext.cpp @@ -46,23 +46,6 @@ DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& us { } -DedicatedWorkerContext::~DedicatedWorkerContext() -{ - ASSERT(currentThread() == thread()->threadID()); - // Notify parent worker we are going away. This can free the WorkerThread object, so do not access it after this. - thread()->workerObjectProxy().workerContextDestroyed(); -} - -void DedicatedWorkerContext::forwardException(const String& errorMessage, int lineNumber, const String& sourceURL) -{ - thread()->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); -} - -void DedicatedWorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) -{ - thread()->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL); -} - void DedicatedWorkerContext::postMessage(const String& message, ExceptionCode& ec) { postMessage(message, 0, ec); diff --git a/WebCore/workers/DedicatedWorkerContext.h b/WebCore/workers/DedicatedWorkerContext.h index e974cef..be9be0b 100644 --- a/WebCore/workers/DedicatedWorkerContext.h +++ b/WebCore/workers/DedicatedWorkerContext.h @@ -46,18 +46,12 @@ namespace WebCore { { return adoptRef(new DedicatedWorkerContext(url, userAgent, thread)); } - virtual ~DedicatedWorkerContext(); virtual bool isDedicatedWorkerContext() const { return true; } // Overridden to allow us to check our pending activity after executing imported script. virtual void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&); - // ScriptExecutionContext - virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - - virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL); - // EventTarget virtual DedicatedWorkerContext* toDedicatedWorkerContext() { return this; } void postMessage(const String&, ExceptionCode&); diff --git a/WebCore/workers/DedicatedWorkerThread.cpp b/WebCore/workers/DedicatedWorkerThread.cpp index 0905843..d4789a1 100644 --- a/WebCore/workers/DedicatedWorkerThread.cpp +++ b/WebCore/workers/DedicatedWorkerThread.cpp @@ -45,7 +45,7 @@ PassRefPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(const KURL& scri } DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy) - : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy) + : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy) , m_workerObjectProxy(workerObjectProxy) { } diff --git a/WebCore/workers/DefaultSharedWorkerRepository.cpp b/WebCore/workers/DefaultSharedWorkerRepository.cpp index 1c1ed4c..e55d3e1 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -35,6 +35,7 @@ #include "DefaultSharedWorkerRepository.h" #include "ActiveDOMObject.h" +#include "Document.h" #include "MessagePort.h" #include "NotImplemented.h" #include "PlatformString.h" @@ -42,52 +43,118 @@ #include "SecurityOriginHash.h" #include "SharedWorker.h" #include "SharedWorkerContext.h" +#include "SharedWorkerRepository.h" #include "SharedWorkerThread.h" #include "WorkerLoaderProxy.h" +#include "WorkerReportingProxy.h" #include "WorkerScriptLoader.h" #include "WorkerScriptLoaderClient.h" - +#include <wtf/HashSet.h> #include <wtf/Threading.h> namespace WebCore { -class SharedWorkerProxy : public ThreadSafeShared<SharedWorkerProxy>, public WorkerLoaderProxy { +class SharedWorkerProxy : public ThreadSafeShared<SharedWorkerProxy>, public WorkerLoaderProxy, public WorkerReportingProxy { public: - static PassRefPtr<SharedWorkerProxy> create(const String& name, const KURL& url) { return adoptRef(new SharedWorkerProxy(name, url)); } + static PassRefPtr<SharedWorkerProxy> create(const String& name, const KURL& url, PassRefPtr<SecurityOrigin> origin) { return adoptRef(new SharedWorkerProxy(name, url, origin)); } void setThread(PassRefPtr<SharedWorkerThread> thread) { m_thread = thread; } SharedWorkerThread* thread() { return m_thread.get(); } - bool closing() const { return m_closing; } + bool isClosing() const { return m_closing; } + void close(); KURL url() const { return m_url.copy(); } String name() const { return m_name.copy(); } + bool matches(const String& name, PassRefPtr<SecurityOrigin> origin) const { return name == m_name && origin->equal(m_origin.get()); } // WorkerLoaderProxy // FIXME: Implement WorkerLoaderProxy APIs by proxying to an active document. virtual void postTaskToLoader(PassRefPtr<ScriptExecutionContext::Task>) { notImplemented(); } virtual void postTaskForModeToWorkerContext(PassRefPtr<ScriptExecutionContext::Task>, const String&) { notImplemented(); } + // WorkerReportingProxy + virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL); + virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL); + virtual void workerContextClosed(); + virtual void workerContextDestroyed(); + // Updates the list of the worker's documents, per section 4.5 of the WebWorkers spec. void addToWorkerDocuments(ScriptExecutionContext*); + + bool isInWorkerDocuments(Document* document) { return m_workerDocuments.contains(document); } + + // Removes a detached document from the list of worker's documents. May set the closing flag if this is the last document in the list. + void documentDetached(Document*); + private: - SharedWorkerProxy(const String& name, const KURL&); + SharedWorkerProxy(const String& name, const KURL&, PassRefPtr<SecurityOrigin>); bool m_closing; String m_name; KURL m_url; + // The thread is freed when the proxy is destroyed, so we need to make sure that the proxy stays around until the SharedWorkerContext exits. RefPtr<SharedWorkerThread> m_thread; + RefPtr<SecurityOrigin> m_origin; + HashSet<Document*> m_workerDocuments; }; -SharedWorkerProxy::SharedWorkerProxy(const String& name, const KURL& url) +SharedWorkerProxy::SharedWorkerProxy(const String& name, const KURL& url, PassRefPtr<SecurityOrigin> origin) : m_closing(false) , m_name(name.copy()) , m_url(url.copy()) + , m_origin(origin) +{ + // We should be the sole owner of the SecurityOrigin, as we will free it on another thread. + ASSERT(m_origin->hasOneRef()); +} + +void SharedWorkerProxy::postExceptionToWorkerObject(const String&, int, const String&) +{ + // FIXME: Log exceptions to all parent documents. + notImplemented(); +} + +void SharedWorkerProxy::postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String&, int, const String&) { + // FIXME: Log console messages to all parent documents. + notImplemented(); +} + +void SharedWorkerProxy::workerContextClosed() +{ + m_closing = true; +} + +void SharedWorkerProxy::workerContextDestroyed() +{ + // The proxy may be freed by this call, so do not reference it any further. + DefaultSharedWorkerRepository::instance().removeProxy(this); } void SharedWorkerProxy::addToWorkerDocuments(ScriptExecutionContext* context) { // Nested workers are not yet supported, so passed-in context should always be a Document. ASSERT(context->isDocument()); - // FIXME: track referring documents so we can shutdown the thread when the last one exits and remove the proxy from the cache. + ASSERT(!isClosing()); + Document* document = static_cast<Document*>(context); + m_workerDocuments.add(document); +} + +void SharedWorkerProxy::documentDetached(Document* document) +{ + if (isClosing()) + return; + // Remove the document from our set (if it's there) and if that was the last document in the set, mark the proxy as closed. + m_workerDocuments.remove(document); + if (!m_workerDocuments.size()) + close(); +} + +void SharedWorkerProxy::close() +{ + ASSERT(!isClosing()); + m_closing = true; + // Stop the worker thread - the proxy will stay around until we get workerThreadExited() notification. + if (m_thread) + m_thread->stop(); } class SharedWorkerConnectTask : public ScriptExecutionContext::Task { @@ -172,12 +239,12 @@ DefaultSharedWorkerRepository& DefaultSharedWorkerRepository::instance() void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel> port) { MutexLocker lock(m_lock); - if (proxy.closing()) + if (proxy.isClosing()) return; // Another loader may have already started up a thread for this proxy - if so, just send a connect to the pre-existing thread. if (!proxy.thread()) { - RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy); + RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy); proxy.setThread(thread); thread->start(); } @@ -189,6 +256,44 @@ void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr DefaultSharedWorkerRepository::instance().connectToWorker(worker, port, url, name, ec); } +void SharedWorkerRepository::documentDetached(Document* document) +{ + DefaultSharedWorkerRepository::instance().documentDetached(document); +} + +bool SharedWorkerRepository::hasSharedWorkers(Document* document) +{ + return DefaultSharedWorkerRepository::instance().hasSharedWorkers(document); +} + +bool DefaultSharedWorkerRepository::hasSharedWorkers(Document* document) +{ + MutexLocker lock(m_lock); + for (unsigned i = 0; i < m_proxies.size(); i++) { + if (m_proxies[i]->isInWorkerDocuments(document)) + return true; + } + return false; +} + +void DefaultSharedWorkerRepository::removeProxy(SharedWorkerProxy* proxy) +{ + MutexLocker lock(m_lock); + for (unsigned i = 0; i < m_proxies.size(); i++) { + if (proxy == m_proxies[i].get()) { + m_proxies.remove(i); + return; + } + } +} + +void DefaultSharedWorkerRepository::documentDetached(Document* document) +{ + MutexLocker lock(m_lock); + for (unsigned i = 0; i < m_proxies.size(); i++) + m_proxies[i]->documentDetached(document); +} + void DefaultSharedWorkerRepository::connectToWorker(PassRefPtr<SharedWorker> worker, PassOwnPtr<MessagePortChannel> port, const KURL& url, const String& name, ExceptionCode& ec) { MutexLocker lock(m_lock); @@ -216,18 +321,14 @@ PassRefPtr<SharedWorkerProxy> DefaultSharedWorkerRepository::getProxy(const Stri // Look for an existing worker, and create one if it doesn't exist. // Items in the cache are freed on another thread, so copy the URL before creating the origin, to make sure no references to external strings linger. RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url.copy()); - SharedWorkerNameMap* nameMap = m_cache.get(origin); - if (!nameMap) { - nameMap = new SharedWorkerNameMap(); - m_cache.set(origin, nameMap); - } - - RefPtr<SharedWorkerProxy> proxy = nameMap->get(name); - if (!proxy.get()) { - proxy = SharedWorkerProxy::create(name, url); - nameMap->set(proxy->name(), proxy); + for (unsigned i = 0; i < m_proxies.size(); i++) { + if (!m_proxies[i]->isClosing() && m_proxies[i]->matches(name, origin)) + return m_proxies[i]; } - return proxy; + // Proxy is not in the repository currently - create a new one. + RefPtr<SharedWorkerProxy> proxy = SharedWorkerProxy::create(name, url, origin.release()); + m_proxies.append(proxy); + return proxy.release(); } DefaultSharedWorkerRepository::DefaultSharedWorkerRepository() diff --git a/WebCore/workers/DefaultSharedWorkerRepository.h b/WebCore/workers/DefaultSharedWorkerRepository.h index 0b4e66c..c2eaff4 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.h +++ b/WebCore/workers/DefaultSharedWorkerRepository.h @@ -33,22 +33,24 @@ #if ENABLE(SHARED_WORKERS) -#include "SharedWorkerRepository.h" +#include "ExceptionCode.h" #include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> namespace WebCore { + class Document; class KURL; + class MessagePortChannel; class ScriptExecutionContext; - class SecurityOrigin; + class SharedWorker; class SharedWorkerProxy; - - struct SecurityOriginHash; - struct SecurityOriginTraits; + class String; // Platform-specific implementation of the SharedWorkerRepository static interface. class DefaultSharedWorkerRepository : public Noncopyable { @@ -59,6 +61,14 @@ namespace WebCore { // Internal implementation of SharedWorkerRepository::connect() void connectToWorker(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionCode&); + // Notification that a document has been detached. + void documentDetached(Document*); + + // Removes the passed SharedWorkerProxy from the repository. + void removeProxy(SharedWorkerProxy*); + + bool hasSharedWorkers(Document*); + static DefaultSharedWorkerRepository& instance(); private: DefaultSharedWorkerRepository(); @@ -68,11 +78,9 @@ namespace WebCore { // Mutex used to protect internal data structures. Mutex m_lock; - typedef HashMap<String, RefPtr<SharedWorkerProxy> > SharedWorkerNameMap; - typedef HashMap<RefPtr<SecurityOrigin>, SharedWorkerNameMap*, SecurityOriginHash> SharedWorkerProxyCache; - - // Items in this cache may be freed on another thread, so all keys and values must be either copied before insertion or thread safe. - SharedWorkerProxyCache m_cache; + // List of shared workers. Expectation is that there will be a limited number of shared workers, and so tracking them in a Vector is more efficient than nested HashMaps. + typedef Vector<RefPtr<SharedWorkerProxy> > SharedWorkerProxyRepository; + SharedWorkerProxyRepository m_proxies; }; } // namespace WebCore diff --git a/WebCore/workers/SharedWorkerContext.cpp b/WebCore/workers/SharedWorkerContext.cpp index 2c50d94..ef35a60 100644 --- a/WebCore/workers/SharedWorkerContext.cpp +++ b/WebCore/workers/SharedWorkerContext.cpp @@ -39,7 +39,6 @@ #include "MessageEvent.h" #include "NotImplemented.h" #include "SharedWorkerThread.h" -#include "WorkerObjectProxy.h" namespace WebCore { @@ -53,17 +52,6 @@ SharedWorkerContext::~SharedWorkerContext() { } -void SharedWorkerContext::forwardException(const String&, int, const String&) -{ - // FIXME: forward to console (do not need to report to parent context). -} - -void SharedWorkerContext::addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&) -{ - // FIXME: forward to console. - notImplemented(); -} - void SharedWorkerContext::dispatchConnect(PassRefPtr<MessagePort> port) { // Since close() stops the thread event loop, this should not ever get called while closing. diff --git a/WebCore/workers/SharedWorkerContext.h b/WebCore/workers/SharedWorkerContext.h index a7e4133..d6956cd 100644 --- a/WebCore/workers/SharedWorkerContext.h +++ b/WebCore/workers/SharedWorkerContext.h @@ -50,11 +50,6 @@ namespace WebCore { virtual bool isSharedWorkerContext() const { return true; } - // ScriptExecutionContext - virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - - virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL); - // EventTarget virtual SharedWorkerContext* toSharedWorkerContext() { return this; } diff --git a/WebCore/workers/SharedWorkerRepository.h b/WebCore/workers/SharedWorkerRepository.h index 84acf77..96d2fb1 100644 --- a/WebCore/workers/SharedWorkerRepository.h +++ b/WebCore/workers/SharedWorkerRepository.h @@ -34,12 +34,12 @@ #if ENABLE(SHARED_WORKERS) #include "ExceptionCode.h" - #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> namespace WebCore { + class Document; class KURL; class MessagePortChannel; class SharedWorker; @@ -50,6 +50,12 @@ namespace WebCore { public: // Connects the passed SharedWorker object with the specified worker thread, creating a new thread if necessary. static void connect(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionCode&); + + // Invoked when a document has been detached. + static void documentDetached(Document*); + + // Returns true if the passed document is associated with any SharedWorkers. + static bool hasSharedWorkers(Document*); private: SharedWorkerRepository() { } }; diff --git a/WebCore/workers/SharedWorkerThread.cpp b/WebCore/workers/SharedWorkerThread.cpp index 40bb2de..ded4834 100644 --- a/WebCore/workers/SharedWorkerThread.cpp +++ b/WebCore/workers/SharedWorkerThread.cpp @@ -38,13 +38,13 @@ namespace WebCore { -PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy) +PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) { - return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy)); + return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy)); } -SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy) - : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy) +SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) + : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy) , m_name(name.copy()) { } diff --git a/WebCore/workers/SharedWorkerThread.h b/WebCore/workers/SharedWorkerThread.h index 15838d7..d96fd2a 100644 --- a/WebCore/workers/SharedWorkerThread.h +++ b/WebCore/workers/SharedWorkerThread.h @@ -38,14 +38,14 @@ namespace WebCore { class SharedWorkerThread : public WorkerThread { public: - static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&); + static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&); ~SharedWorkerThread(); protected: virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&); private: - SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&); + SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&); String m_name; }; diff --git a/WebCore/workers/Worker.cpp b/WebCore/workers/Worker.cpp index a906134..d4d0e9b 100644 --- a/WebCore/workers/Worker.cpp +++ b/WebCore/workers/Worker.cpp @@ -58,7 +58,7 @@ Worker::Worker(const String& url, ScriptExecutionContext* context, ExceptionCode return; m_scriptLoader = new WorkerScriptLoader(); - m_scriptLoader->loadAsynchronously(scriptExecutionContext(), scriptURL, DenyCrossOriginRedirect, this); + m_scriptLoader->loadAsynchronously(scriptExecutionContext(), scriptURL, DenyCrossOriginRequests, this); setPendingActivity(this); // The worker context does not exist while loading, so we must ensure that the worker object is not collected, as well as its event listeners. } diff --git a/WebCore/workers/WorkerContext.cpp b/WebCore/workers/WorkerContext.cpp index 722588f..3cb1733 100644 --- a/WebCore/workers/WorkerContext.cpp +++ b/WebCore/workers/WorkerContext.cpp @@ -50,6 +50,10 @@ #include "XMLHttpRequestException.h" #include <wtf/RefPtr.h> +#if ENABLE(NOTIFICATIONS) +#include "NotificationCenter.h" +#endif + namespace WebCore { WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread) @@ -64,6 +68,12 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThr WorkerContext::~WorkerContext() { + ASSERT(currentThread() == thread()->threadID()); +#if ENABLE(NOTIFICATIONS) + m_notifications.clear(); +#endif + // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this. + thread()->workerReportingProxy().workerContextDestroyed(); } ScriptExecutionContext* WorkerContext::scriptExecutionContext() const @@ -109,6 +119,8 @@ void WorkerContext::close() return; m_closing = true; + // Notify parent that this context is closed. + thread()->workerReportingProxy().workerContextClosed(); m_thread->stop(); } @@ -244,7 +256,7 @@ void WorkerContext::importScripts(const Vector<String>& urls, const String& call for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++it) { WorkerScriptLoader scriptLoader; - scriptLoader.loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRedirect); + scriptLoader.loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRequests); // If the fetching attempt failed, throw a NETWORK_ERR exception and abort all these steps. if (scriptLoader.failed()) { @@ -271,8 +283,22 @@ void WorkerContext::reportException(const String& errorMessage, int lineNumber, errorHandled = onerror()->reportError(errorMessage, sourceURL, lineNumber); if (!errorHandled) - forwardException(errorMessage, lineNumber, sourceURL); + thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); +} + +void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) +{ + thread()->workerReportingProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL); +} + +#if ENABLE(NOTIFICATIONS) +NotificationCenter* WorkerContext::webkitNotifications() const +{ + if (!m_notifications) + m_notifications = NotificationCenter::create(scriptExecutionContext(), m_thread->getNotificationPresenter()); + return m_notifications.get(); } +#endif } // namespace WebCore diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index aa47475..2131a7c 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -41,6 +41,7 @@ namespace WebCore { + class NotificationCenter; class ScheduledAction; class WorkerLocation; class WorkerNavigator; @@ -48,7 +49,6 @@ namespace WebCore { class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecutionContext, public EventTarget { public: - virtual ~WorkerContext(); virtual bool isWorkerContext() const { return true; } @@ -103,8 +103,11 @@ namespace WebCore { // ScriptExecutionContext virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); + virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; +#if ENABLE(NOTIFICATIONS) + NotificationCenter* webkitNotifications() const; +#endif // These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in // JSWorkerContextCustom.cpp. @@ -139,6 +142,9 @@ namespace WebCore { RefPtr<EventListener> m_onerrorListener; EventListenersMap m_eventListeners; +#if ENABLE_NOTIFICATIONS + mutable RefPtr<NotificationCenter> m_notifications; +#endif bool m_closing; }; diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl index 2404d22..6a4a7fa 100644 --- a/WebCore/workers/WorkerContext.idl +++ b/WebCore/workers/WorkerContext.idl @@ -69,6 +69,10 @@ module threads { boolean dispatchEvent(in Event evt) raises(EventException); +#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS + // Notification interface + readonly attribute NotificationCenter webkitNotifications; +#endif // Constructors attribute MessageEventConstructor MessageEvent; @@ -77,6 +81,9 @@ module threads { #if ENABLE_CHANNEL_MESSAGING attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel; #endif +#if ENABLE_EVENTSOURCE + attribute [JSCCustomGetter] EventSourceConstructor EventSource; +#endif attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest; }; diff --git a/WebCore/workers/WorkerObjectProxy.h b/WebCore/workers/WorkerObjectProxy.h index c5f4456..586e7a0 100644 --- a/WebCore/workers/WorkerObjectProxy.h +++ b/WebCore/workers/WorkerObjectProxy.h @@ -33,31 +33,24 @@ #if ENABLE(WORKERS) -#include "Console.h" +#include "WorkerReportingProxy.h" #include <wtf/PassOwnPtr.h> namespace WebCore { class MessagePortChannel; - class String; // A proxy to talk to the worker object. - class WorkerObjectProxy { + class WorkerObjectProxy : public WorkerReportingProxy { public: - virtual ~WorkerObjectProxy() {} - virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>) = 0; - virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; - - virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0; - virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; - virtual void reportPendingActivity(bool hasPendingActivity) = 0; - virtual void workerContextDestroyed() = 0; + // No need to notify the parent page context when dedicated workers are closing. + virtual void workerContextClosed() { } }; } // namespace WebCore diff --git a/WebCore/workers/WorkerReportingProxy.h b/WebCore/workers/WorkerReportingProxy.h new file mode 100644 index 0000000..f0447c8 --- /dev/null +++ b/WebCore/workers/WorkerReportingProxy.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WorkerReportingProxy_h +#define WorkerReportingProxy_h + +#if ENABLE(WORKERS) + +#include "Console.h" + +namespace WebCore { + + class String; + + // APIs used by workers to report console activity. + class WorkerReportingProxy { + public: + virtual ~WorkerReportingProxy() {} + + virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0; + + // Invoked when close() is invoked on the worker context. + virtual void workerContextClosed() = 0; + + // Invoked when the thread has stopped. + virtual void workerContextDestroyed() = 0; + }; +} // namespace WebCore + +#endif // ENABLE(WORKERS) + +#endif // WorkerReportingProxy_h diff --git a/WebCore/workers/WorkerScriptLoader.cpp b/WebCore/workers/WorkerScriptLoader.cpp index 0162b26..52baf2d 100644 --- a/WebCore/workers/WorkerScriptLoader.cpp +++ b/WebCore/workers/WorkerScriptLoader.cpp @@ -50,7 +50,7 @@ WorkerScriptLoader::WorkerScriptLoader() { } -void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) { m_url = url; @@ -59,10 +59,15 @@ void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecuti return; ASSERT(scriptExecutionContext->isWorkerContext()); - WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(scriptExecutionContext), *request, *this, AllowStoredCredentials, crossOriginRedirectPolicy); + + ThreadableLoaderOptions options; + options.allowCredentials = true; + options.crossOriginRequestPolicy = crossOriginRequestPolicy; + + WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(scriptExecutionContext), *request, *this, options); } -void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRedirectPolicy crossOriginRedirectPolicy, WorkerScriptLoaderClient* client) +void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScriptLoaderClient* client) { ASSERT(client); m_client = client; @@ -72,7 +77,11 @@ void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecut if (!request) return; - m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this, *request, DoNotSendLoadCallbacks, DoNotSniffContent, AllowStoredCredentials, crossOriginRedirectPolicy); + ThreadableLoaderOptions options; + options.allowCredentials = true; + options.crossOriginRequestPolicy = crossOriginRequestPolicy; + + m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this, *request, options); } PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() diff --git a/WebCore/workers/WorkerScriptLoader.h b/WebCore/workers/WorkerScriptLoader.h index 2924ec8..47623f6 100644 --- a/WebCore/workers/WorkerScriptLoader.h +++ b/WebCore/workers/WorkerScriptLoader.h @@ -46,8 +46,8 @@ namespace WebCore { public: WorkerScriptLoader(); - void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRedirectPolicy); - void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRedirectPolicy, WorkerScriptLoaderClient*); + void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy); + void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*); void notifyError(); diff --git a/WebCore/workers/WorkerThread.cpp b/WebCore/workers/WorkerThread.cpp index 86a5fa8..752c178 100644 --- a/WebCore/workers/WorkerThread.cpp +++ b/WebCore/workers/WorkerThread.cpp @@ -61,9 +61,10 @@ WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const St { } -WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy) +WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) : m_threadID(0) , m_workerLoaderProxy(workerLoaderProxy) + , m_workerReportingProxy(workerReportingProxy) , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode)) { } diff --git a/WebCore/workers/WorkerThread.h b/WebCore/workers/WorkerThread.h index a6b22dc..5d861e1 100644 --- a/WebCore/workers/WorkerThread.h +++ b/WebCore/workers/WorkerThread.h @@ -37,9 +37,11 @@ namespace WebCore { class KURL; + class NotificationPresenter; class String; class WorkerContext; class WorkerLoaderProxy; + class WorkerReportingProxy; struct WorkerThreadStartupData; class WorkerThread : public RefCounted<WorkerThread> { @@ -52,9 +54,10 @@ namespace WebCore { ThreadIdentifier threadID() const { return m_threadID; } WorkerRunLoop& runLoop() { return m_runLoop; } WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; } + WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; } protected: - WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&); + WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&); // Factory method for creating a new worker context for the thread. virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL& url, const String& userAgent) = 0; @@ -64,6 +67,11 @@ namespace WebCore { WorkerContext* workerContext() { return m_workerContext.get(); } +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* getNotificationPresenter() { return m_notificationPresenter; } + void setNotificationPresenter(NotificationPresenter* presenter) { m_notificationPresenter = presenter; } +#endif + private: // Static function executed as the core routine on the new thread. Passed a pointer to a WorkerThread object. static void* workerThreadStart(void*); @@ -72,11 +80,16 @@ namespace WebCore { ThreadIdentifier m_threadID; WorkerRunLoop m_runLoop; WorkerLoaderProxy& m_workerLoaderProxy; + WorkerReportingProxy& m_workerReportingProxy; RefPtr<WorkerContext> m_workerContext; Mutex m_threadCreationMutex; OwnPtr<WorkerThreadStartupData> m_startupData; + +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* m_notificationPresenter; +#endif }; } // namespace WebCore diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index 5e20252..0b2fabb 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -25,7 +25,6 @@ #include "Cache.h" #include "CString.h" #include "CrossOriginAccessControl.h" -#include "CrossOriginPreflightResultCache.h" #include "DOMImplementation.h" #include "Document.h" #include "Event.h" @@ -93,25 +92,25 @@ static bool isValidToken(const String& name) unsigned length = name.length(); for (unsigned i = 0; i < length; i++) { UChar c = name[i]; - + if (c >= 127 || c <= 32) return false; - + if (c == '(' || c == ')' || c == '<' || c == '>' || c == '@' || c == ',' || c == ';' || c == ':' || c == '\\' || c == '\"' || c == '/' || c == '[' || c == ']' || c == '?' || c == '=' || c == '{' || c == '}') return false; } - + return true; } - + static bool isValidHeaderValue(const String& name) { - // FIXME: This should really match name against + // FIXME: This should really match name against // field-value in section 4.2 of RFC 2616. - + return !name.contains('\r') && !name.contains('\n'); } @@ -143,9 +142,9 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context) , m_responseText("") , m_createdDocument(false) , m_error(false) + , m_uploadEventsAllowed(true) , m_uploadComplete(false) , m_sameOriginRequest(true) - , m_inPreflight(false) , m_didTellLoaderAboutRequest(false) , m_receivedLength(0) , m_lastSendLineNumber(0) @@ -207,7 +206,7 @@ Document* XMLHttpRequest::responseXML() const m_responseXML->write(String(m_responseText)); m_responseXML->finishParsing(); m_responseXML->close(); - + if (!m_responseXML->wellFormed()) m_responseXML = 0; } @@ -236,7 +235,7 @@ void XMLHttpRequest::addEventListener(const AtomicString& eventType, PassRefPtr< for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) if (*listenerIter == eventListener) return; - + listeners.append(eventListener); m_eventListeners.add(eventType, listeners); } @@ -322,10 +321,10 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc ec = SYNTAX_ERR; return; } - + // Method names are case sensitive. But since Firefox uppercases method names it knows, we'll do the same. String methodUpper(method.upper()); - + if (methodUpper == "TRACE" || methodUpper == "TRACK" || methodUpper == "CONNECT") { ec = SECURITY_ERR; return; @@ -335,7 +334,7 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc if (methodUpper == "COPY" || methodUpper == "DELETE" || methodUpper == "GET" || methodUpper == "HEAD" || methodUpper == "INDEX" || methodUpper == "LOCK" || methodUpper == "M-POST" || methodUpper == "MKCOL" || methodUpper == "MOVE" - || methodUpper == "OPTIONS" || methodUpper == "POST" || methodUpper == "PROPFIND" || methodUpper == "PROPPATCH" || methodUpper == "PUT" + || methodUpper == "OPTIONS" || methodUpper == "POST" || methodUpper == "PROPFIND" || methodUpper == "PROPPATCH" || methodUpper == "PUT" || methodUpper == "UNLOCK") m_method = methodUpper; else @@ -357,7 +356,7 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, con { KURL urlWithCredentials(url); urlWithCredentials.setUser(user); - + open(method, urlWithCredentials, async, ec); } @@ -366,7 +365,7 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, con KURL urlWithCredentials(url); urlWithCredentials.setUser(user); urlWithCredentials.setPass(password); - + open(method, urlWithCredentials, async, ec); } @@ -463,34 +462,23 @@ void XMLHttpRequest::send(File* body, ExceptionCode& ec) void XMLHttpRequest::createRequest(ExceptionCode& ec) { - // Upload event listeners should be disallowed for simple cross-origin requests, because POSTing to an URL that does not - // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all. If a listener exists - // when creating the request, it will force preflight. + // The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not + // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all. // Also, only async requests support upload progress events. - m_uploadEventsAllowed = false; + bool forcePreflight = false; if (m_async) { dispatchLoadStartEvent(); if (m_requestEntityBody && m_upload) { - m_uploadEventsAllowed = m_upload->hasListeners(); + forcePreflight = m_upload->hasListeners(); m_upload->dispatchLoadStartEvent(); } } m_sameOriginRequest = scriptExecutionContext()->securityOrigin()->canRequest(m_url); - if (!m_sameOriginRequest) { - makeCrossOriginAccessRequest(ec); - return; - } - - m_uploadEventsAllowed = true; - - makeSameOriginRequest(ec); -} - -void XMLHttpRequest::makeSameOriginRequest(ExceptionCode& ec) -{ - ASSERT(m_sameOriginRequest); + // We also remember whether upload events should be allowed for this request in case the upload listeners are + // added after the request is started. + m_uploadEventsAllowed = !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); ResourceRequest request(m_url); request.setHTTPMethod(m_method); @@ -504,202 +492,28 @@ void XMLHttpRequest::makeSameOriginRequest(ExceptionCode& ec) if (m_requestHeaders.size() > 0) request.addHTTPHeaderFields(m_requestHeaders); - if (m_async) - loadRequestAsynchronously(request); - else - loadRequestSynchronously(request, ec); -} - -void XMLHttpRequest::makeCrossOriginAccessRequest(ExceptionCode& ec) -{ - ASSERT(!m_sameOriginRequest); + ThreadableLoaderOptions options; + options.sendLoadCallbacks = true; + options.sniffContent = false; + options.forcePreflight = forcePreflight; + options.allowCredentials = m_sameOriginRequest || m_includeCredentials; + options.crossOriginRequestPolicy = UseAccessControl; - if (!m_uploadEventsAllowed && isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders)) - makeSimpleCrossOriginAccessRequest(ec); - else - makeCrossOriginAccessRequestWithPreflight(ec); -} - -void XMLHttpRequest::makeSimpleCrossOriginAccessRequest(ExceptionCode& ec) -{ - ASSERT(isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders)); - - // Cross-origin requests are only defined for HTTP. We would catch this when checking response headers later, but there is no reason to send a request that's guaranteed to be denied. - if (!m_url.protocolInHTTPFamily()) { - ec = XMLHttpRequestException::NETWORK_ERR; - networkError(); - return; - } - - KURL url = m_url; - url.setUser(String()); - url.setPass(String()); - - ResourceRequest request(url); - request.setHTTPMethod(m_method); - request.setAllowHTTPCookies(m_includeCredentials); - request.setHTTPOrigin(scriptExecutionContext()->securityOrigin()->toString()); - - if (m_requestHeaders.size() > 0) - request.addHTTPHeaderFields(m_requestHeaders); - - if (m_requestEntityBody) { - ASSERT(m_method != "GET"); - ASSERT(m_method != "HEAD"); - request.setHTTPBody(m_requestEntityBody.release()); - } - - if (m_async) - loadRequestAsynchronously(request); - else - loadRequestSynchronously(request, ec); -} - -void XMLHttpRequest::makeCrossOriginAccessRequestWithPreflight(ExceptionCode& ec) -{ - String origin = scriptExecutionContext()->securityOrigin()->toString(); - KURL url = m_url; - url.setUser(String()); - url.setPass(String()); - - if (!CrossOriginPreflightResultCache::shared().canSkipPreflight(origin, url, m_includeCredentials, m_method, m_requestHeaders)) { - m_inPreflight = true; - ResourceRequest preflightRequest(url); - preflightRequest.setHTTPMethod("OPTIONS"); - preflightRequest.setHTTPHeaderField("Origin", origin); - preflightRequest.setHTTPHeaderField("Access-Control-Request-Method", m_method); - - if (m_requestHeaders.size() > 0) { - Vector<UChar> headerBuffer; - HTTPHeaderMap::const_iterator it = m_requestHeaders.begin(); - append(headerBuffer, it->first); - ++it; - - HTTPHeaderMap::const_iterator end = m_requestHeaders.end(); - for (; it != end; ++it) { - headerBuffer.append(','); - headerBuffer.append(' '); - append(headerBuffer, it->first); - } - - preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer)); - preflightRequest.addHTTPHeaderFields(m_requestHeaders); - } - - if (m_async) { - m_uploadEventsAllowed = true; - loadRequestAsynchronously(preflightRequest); - return; - } - - loadRequestSynchronously(preflightRequest, ec); - m_inPreflight = false; - - if (ec) - return; - } - - // Send the actual request. - ResourceRequest request(url); - request.setHTTPMethod(m_method); - request.setAllowHTTPCookies(m_includeCredentials); - request.setHTTPHeaderField("Origin", origin); - - if (m_requestHeaders.size() > 0) - request.addHTTPHeaderFields(m_requestHeaders); - - if (m_requestEntityBody) { - ASSERT(m_method != "GET"); - ASSERT(m_method != "HEAD"); - request.setHTTPBody(m_requestEntityBody.release()); - } + m_exceptionCode = 0; + m_error = false; if (m_async) { - m_uploadEventsAllowed = true; - loadRequestAsynchronously(request); - return; - } - - loadRequestSynchronously(request, ec); -} - -void XMLHttpRequest::handleAsynchronousPreflightResult() -{ - ASSERT(m_inPreflight); - ASSERT(m_async); - - m_inPreflight = false; - - KURL url = m_url; - url.setUser(String()); - url.setPass(String()); - - ResourceRequest request(url); - request.setHTTPMethod(m_method); - request.setAllowHTTPCookies(m_includeCredentials); - request.setHTTPOrigin(scriptExecutionContext()->securityOrigin()->toString()); - - if (m_requestHeaders.size() > 0) - request.addHTTPHeaderFields(m_requestHeaders); - - if (m_requestEntityBody) { - ASSERT(m_method != "GET"); - ASSERT(m_method != "HEAD"); - request.setHTTPBody(m_requestEntityBody.release()); - } - - m_uploadEventsAllowed = true; - loadRequestAsynchronously(request); -} - -void XMLHttpRequest::loadRequestSynchronously(ResourceRequest& request, ExceptionCode& ec) -{ - ASSERT(!m_async); - - m_loader = 0; - m_exceptionCode = 0; - StoredCredentials storedCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; + request.setReportUploadProgress(true); + setPendingActivity(this); + m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options); + } else + ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options); - ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, storedCredentials); if (!m_exceptionCode && m_error) m_exceptionCode = XMLHttpRequestException::NETWORK_ERR; ec = m_exceptionCode; } -void XMLHttpRequest::loadRequestAsynchronously(ResourceRequest& request) -{ - ASSERT(m_async); - m_exceptionCode = 0; - // SubresourceLoader::create can return null here, for example if we're no longer attached to a page. - // This is true while running onunload handlers. - // FIXME: We need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>. - // FIXME: Maybe create can return null for other reasons too? - LoadCallbacks callbacks = m_inPreflight ? DoNotSendLoadCallbacks : SendLoadCallbacks; - StoredCredentials storedCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; - - if (m_upload) - request.setReportUploadProgress(true); - - m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, callbacks, DoNotSniffContent, storedCredentials, DenyCrossOriginRedirect); - - if (m_loader) { - // Neither this object nor the JavaScript wrapper should be deleted while - // a request is in progress because we need to keep the listeners alive, - // and they are referenced by the JavaScript wrapper. - setPendingActivity(this); - - // For now we should only balance the nonCached request count for main-thread XHRs and not - // Worker XHRs, as the Cache is not thread-safe. - // This will become irrelevant after https://bugs.webkit.org/show_bug.cgi?id=27165 is resolved. - if (!scriptExecutionContext()->isWorkerContext()) { - ASSERT(isMainThread()); - ASSERT(!m_didTellLoaderAboutRequest); - cache()->loader()->nonCacheRequestInFlight(m_url); - m_didTellLoaderAboutRequest = true; - } - } -} - void XMLHttpRequest::abort() { // internalAbort() calls dropProtection(), which may release the last reference. @@ -711,7 +525,7 @@ void XMLHttpRequest::abort() // Clear headers as required by the spec m_requestHeaders.clear(); - + if ((m_state <= OPENED && !sendFlag) || m_state == DONE) m_state = UNSENT; else { @@ -794,7 +608,7 @@ void XMLHttpRequest::abortError() } } -void XMLHttpRequest::dropProtection() +void XMLHttpRequest::dropProtection() { #if USE(JSC) // The XHR object itself holds on to the responseText, and @@ -854,7 +668,7 @@ void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& va void XMLHttpRequest::setRequestHeaderInternal(const AtomicString& name, const String& value) { - pair<HTTPHeaderMap::iterator, bool> result = m_requestHeaders.add(name, value); + pair<HTTPHeaderMap::iterator, bool> result = m_requestHeaders.add(name, value); if (!result.second) result.first->second += ", " + value; } @@ -939,7 +753,7 @@ String XMLHttpRequest::responseMIMEType() const } if (mimeType.isEmpty()) mimeType = "text/xml"; - + return mimeType; } @@ -981,7 +795,7 @@ void XMLHttpRequest::didFail(const ResourceError& error) cache()->loader()->nonCacheRequestComplete(m_url); m_didTellLoaderAboutRequest = false; } - + // If we are already in an error state, for instance we called abort(), bail out early. if (m_error) return; @@ -1011,11 +825,6 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier) if (m_error) return; - if (m_inPreflight) { - didFinishLoadingPreflight(); - return; - } - if (m_state < HEADERS_RECEIVED) changeState(HEADERS_RECEIVED); @@ -1035,19 +844,6 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier) dropProtection(); } -void XMLHttpRequest::didFinishLoadingPreflight() -{ - ASSERT(m_inPreflight); - ASSERT(!m_sameOriginRequest); - - // FIXME: this can probably be moved to didReceiveResponsePreflight. - if (m_async) - handleAsynchronousPreflightResult(); - - if (m_loader) - unsetPendingActivity(this); -} - void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { if (!m_upload) @@ -1065,45 +861,12 @@ void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long lon void XMLHttpRequest::didReceiveResponse(const ResourceResponse& response) { - if (m_inPreflight) { - didReceiveResponsePreflight(response); - return; - } - - if (!m_sameOriginRequest) { - if (!passesAccessControlCheck(response, m_includeCredentials, scriptExecutionContext()->securityOrigin())) { - networkError(); - return; - } - } - m_response = response; m_responseEncoding = extractCharsetFromMediaType(m_mimeTypeOverride); if (m_responseEncoding.isEmpty()) m_responseEncoding = response.textEncodingName(); } -void XMLHttpRequest::didReceiveResponsePreflight(const ResourceResponse& response) -{ - ASSERT(m_inPreflight); - ASSERT(!m_sameOriginRequest); - - if (!passesAccessControlCheck(response, m_includeCredentials, scriptExecutionContext()->securityOrigin())) { - networkError(); - return; - } - - OwnPtr<CrossOriginPreflightResultCacheItem> preflightResult(new CrossOriginPreflightResultCacheItem(m_includeCredentials)); - if (!preflightResult->parse(response) - || !preflightResult->allowsCrossOriginMethod(m_method) - || !preflightResult->allowsCrossOriginHeaders(m_requestHeaders)) { - networkError(); - return; - } - - CrossOriginPreflightResultCache::shared().appendEntry(scriptExecutionContext()->securityOrigin()->toString(), m_url, preflightResult.release()); -} - void XMLHttpRequest::didReceiveAuthenticationCancellation(const ResourceResponse& failureResponse) { m_response = failureResponse; @@ -1111,12 +874,12 @@ void XMLHttpRequest::didReceiveAuthenticationCancellation(const ResourceResponse void XMLHttpRequest::didReceiveData(const char* data, int len) { - if (m_inPreflight || m_error) + if (m_error) return; if (m_state < HEADERS_RECEIVED) changeState(HEADERS_RECEIVED); - + if (!m_decoder) { if (!m_responseEncoding.isEmpty()) m_decoder = TextResourceDecoder::create("text/plain", m_responseEncoding); @@ -1210,7 +973,7 @@ void XMLHttpRequest::dispatchLoadStartEvent() void XMLHttpRequest::dispatchProgressEvent(long long expectedLength) { - dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, + dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); } @@ -1235,4 +998,4 @@ ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } -} // namespace WebCore +} // namespace WebCore diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h index d581d3d..aa33b8b 100644 --- a/WebCore/xml/XMLHttpRequest.h +++ b/WebCore/xml/XMLHttpRequest.h @@ -117,7 +117,7 @@ public: private: XMLHttpRequest(ScriptExecutionContext*); - + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } @@ -135,10 +135,6 @@ private: virtual void didFailRedirectCheck(); virtual void didReceiveAuthenticationCancellation(const ResourceResponse&); - // Special versions for the preflight - void didReceiveResponsePreflight(const ResourceResponse&); - void didFinishLoadingPreflight(); - void updateAndDispatchOnProgress(unsigned int len); String responseMIMEType() const; @@ -159,16 +155,6 @@ private: void createRequest(ExceptionCode&); - void makeSameOriginRequest(ExceptionCode&); - void makeCrossOriginAccessRequest(ExceptionCode&); - - void makeSimpleCrossOriginAccessRequest(ExceptionCode&); - void makeCrossOriginAccessRequestWithPreflight(ExceptionCode&); - void handleAsynchronousPreflightResult(); - - void loadRequestSynchronously(ResourceRequest&, ExceptionCode&); - void loadRequestAsynchronously(ResourceRequest&); - void genericError(); void networkError(); void abortError(); @@ -223,13 +209,11 @@ private: bool m_uploadComplete; bool m_sameOriginRequest; - bool m_allowAccess; - bool m_inPreflight; bool m_didTellLoaderAboutRequest; // Used for onprogress tracking long long m_receivedLength; - + unsigned m_lastSendLineNumber; String m_lastSendURL; ExceptionCode m_exceptionCode; diff --git a/WebCore/xml/XPathNamespace.cpp b/WebCore/xml/XPathNamespace.cpp index 3c8c42c..9646402 100644 --- a/WebCore/xml/XPathNamespace.cpp +++ b/WebCore/xml/XPathNamespace.cpp @@ -1,6 +1,6 @@ /* * Copyright 2005 Frerich Raabe <raabe@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,18 +33,14 @@ namespace WebCore { -XPathNamespace::XPathNamespace(PassRefPtr<Element> ownerElement, const String& prefix, const String& uri) - : Node(ownerElement->document()) +XPathNamespace::XPathNamespace(PassRefPtr<Element> ownerElement, const AtomicString& prefix, const AtomicString& uri) + : Node(ownerElement->document(), CreateOther) , m_ownerElement(ownerElement) , m_prefix(prefix) , m_uri(uri) { } -XPathNamespace::~XPathNamespace() -{ -} - Document* XPathNamespace::ownerDocument() const { return m_ownerElement->ownerDocument(); diff --git a/WebCore/xml/XPathNamespace.h b/WebCore/xml/XPathNamespace.h index c0e4280..996cb9a 100644 --- a/WebCore/xml/XPathNamespace.h +++ b/WebCore/xml/XPathNamespace.h @@ -1,6 +1,6 @@ /* * Copyright 2005 Frerich Raabe <raabe@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,13 +34,11 @@ namespace WebCore { - class Document; - class Element; + // FIXME: This class is never instantiated. Maybe it should be removed. class XPathNamespace : public Node { - public: - XPathNamespace(PassRefPtr<Element> ownerElement, const String& prefix, const String& uri); - virtual ~XPathNamespace(); + private: + XPathNamespace(PassRefPtr<Element> ownerElement, const AtomicString& prefix, const AtomicString& uri); virtual Document* ownerDocument() const; virtual Element* ownerElement() const; @@ -50,9 +48,8 @@ namespace WebCore { virtual String nodeValue() const; virtual const AtomicString& namespaceURI() const; - virtual Node::NodeType nodeType() const; + virtual NodeType nodeType() const; - private: RefPtr<Element> m_ownerElement; AtomicString m_prefix; AtomicString m_uri; diff --git a/WebCore/xml/XSLTProcessor.cpp b/WebCore/xml/XSLTProcessor.cpp index a26fe77..9fdf31f 100644 --- a/WebCore/xml/XSLTProcessor.cpp +++ b/WebCore/xml/XSLTProcessor.cpp @@ -285,12 +285,12 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc static inline RefPtr<DocumentFragment> createFragmentFromSource(const String& sourceString, const String& sourceMIMEType, Document* outputDoc) { - RefPtr<DocumentFragment> fragment = new DocumentFragment(outputDoc); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(outputDoc); if (sourceMIMEType == "text/html") parseHTMLDocumentFragment(sourceString, fragment.get()); else if (sourceMIMEType == "text/plain") - fragment->addChild(new Text(outputDoc, sourceString)); + fragment->addChild(Text::create(outputDoc, sourceString)); else { bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), outputDoc->documentElement()); if (!successfulParse) |