OSDN Git Service

AI 145053: add SVG to the browser [disabled by default]
authorCary Clark <>
Wed, 8 Apr 2009 15:09:33 +0000 (08:09 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Wed, 8 Apr 2009 15:09:33 +0000 (08:09 -0700)
  To enable SVG, edit your buildspec.mk to
  ENABLE_SVG:=true
  then
  make clean-libwebcore && make
  Some SVG functionality has been stubbed out in this checkin.
  //branches/master/android/build/buildspec.mk.default # edit
  - add ENABLE_SVG, commented out by default
  - fix up WEBCORE_INSTRUMENTATION define while I was in there
  //branches/master/android/external/webkit/Android.mk # edit
  - add ENABLE_SVG C define
  - add svg paths to C includes
  //branches/master/android/external/webkit/WebCore/Android.derived.mk # edit
  - update merge tool rules
  - add svg to css property names, keywords, generated bindings
  - add svg names, element factory, wrappers
  - remove obsolete ksvgcssproperties.h
  - add XLinkNames, required by SVG
  //branches/master/android/external/webkit/WebCore/Android.mk # edit
  - update merge tool rules
  - add svg bindings, css svg parsing, svg rendering, svg engine
  //branches/master/android/external/webkit/WebCore/config.h # edit
  - leave ENABLE_SVG alone if it is already defined
  //branches/master/android/external/webkit/WebCore/loader/EmptyClients.h # edit
  - add some Android extensions as empty virtuals (EmptyClients is only used by SVG)
  //branches/master/android/external/webkit/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp # edit
  //branches/master/android/external/webkit/WebCore/platform/graphics/android/PathAndroid.cpp # edit
  - add SVG graphics porting functions. Note the FIXMEs -- some are unimplemented.
  BUG=1474412

Automated import of CL 145053

Android.mk
WebCore/Android.derived.mk
WebCore/Android.mk
WebCore/config.h
WebCore/loader/EmptyClients.h
WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
WebCore/platform/graphics/android/PathAndroid.cpp

index 1a142f4..cebfb23 100644 (file)
@@ -70,6 +70,10 @@ ifeq ($(TARGET_ARCH),arm)
 LOCAL_CFLAGS += -Darm -fvisibility=hidden
 endif
 
+ifeq ($(ENABLE_SVG),true)
+LOCAL_CFLAGS += -DENABLE_SVG=1
+endif
+
 ifeq ($(WEBCORE_INSTRUMENTATION),true)
 LOCAL_CFLAGS += -DANDROID_INSTRUMENT
 endif
@@ -171,6 +175,14 @@ LOCAL_C_INCLUDES := \
        $(base_intermediates)/WebCore/plugins \
        $(base_intermediates)/WebCore/xml
 
+ifeq ($(ENABLE_SVG), true)
+LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
+       $(LOCAL_PATH)/WebCore/svg \
+       $(LOCAL_PATH)/WebCore/svg/animation \
+       $(LOCAL_PATH)/WebCore/svg/graphics \
+       $(base_intermediates)/WebCore/svg
+endif
+
 # Build the list of shared libraries
 LOCAL_SHARED_LIBRARIES := \
        libandroid_runtime \
index 843453c..b29cdd2 100644 (file)
 #
 # The following files are intentionally not generated
 # LOCAL_GENERATED_FILES_EXCLUDED := \
-#      JSSVGElementWrapperFactory.cpp \
 #      JSWorkerContextBase.lut.h \
-#      SVGElementFactory.cpp \
-#      SVGNames.cpp \
 #      WMLElementFactory.cpp \
 #      WMLNames.cpp \
 #      XLinkNames.cpp \
@@ -52,7 +49,6 @@
 # If an entry starts with '^', the first directory must match
 # LOCAL_DIR_WILDCARD_EXCLUDED := \
 #      ^storage/* \
-#      ^svg/* \
 #      ^workers/* \
 
 # This comment block is read by tools/webkitsync/diff.cpp
@@ -68,23 +64,29 @@ LOCAL_SRC_FILES :=
 
 GEN := $(intermediates)/css/CSSPropertyNames.h
 $(GEN): SCRIPT := $(LOCAL_PATH)/css/makeprop.pl
-$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in
+$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSPropertyNames.in
        @echo "Generating CSSPropertyNames.h <= CSSPropertyNames.in"
        @mkdir -p $(dir $@)
-       @cp -f $< $(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): PRIVATE_INTERMEDIATES := $(intermediates)
-$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in
+$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSValueKeywords.in
        @echo "Generating CSSValueKeywords.h <= CSSValueKeywords.in"
-       mkdir -p $(dir $@)
-       cp -f $(SCRIPT) $(dir $@)
-       perl -ne 'print lc' $< > $(PRIVATE_INTERMEDIATES)/css/CSSValueKeywords.in
-       @cd $(PRIVATE_INTERMEDIATES)/css ; perl makevalues.pl
+       @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)
 
 
@@ -148,6 +150,9 @@ 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
+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,$^)
@@ -460,6 +465,153 @@ LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp)
 # above rules.  Specifying this explicitly makes -j2 work.
 $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/plugins/%.cpp : $(intermediates)/plugins/%.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 xml/DOMParser.idl
 GEN := \
     $(intermediates)/xml/JSDOMParser.h \
@@ -495,6 +647,19 @@ $(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
+$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --tags $(svg_tags) --attrs $(svg_attrs) --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
@@ -505,7 +670,14 @@ $(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xml_attrs)
        $(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
 
-GEN:= $(intermediates)/ksvgcssproperties.h
-$(GEN): 
-       @echo > $@
+# 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
index 4b41efa..6bead25 100644 (file)
 #      bindings/js/JSCustomSQL*.cpp \
 #      bindings/js/JSCustomVersionChangeCallback.cpp \
 #      bindings/js/JSDatabaseCustom.cpp \
-#      bindings/js/JSEventTargetSVGElementInstance.cpp \
 #      bindings/js/JSHTMLAudioElementConstructor.cpp \
 #      bindings/js/JSSQL*.cpp \
-#      bindings/js/JSSVG*.cpp \
 #      bindings/js/JSStorageCustom.cpp \
 #      bindings/js/JSXSLTProcessor*.cpp \
 #      bindings/js/JSWorker*.cpp \
@@ -39,7 +37,6 @@
 #      bindings/js/*Wx.cpp \
 #      bridge/test*.cpp \
 #      css/CSSGrammar.y \
-#      css/SVG*.cpp \
 #      dom/Worker*.cpp \
 #      dom/XMLTokenizerQt.cpp \
 #      editing/BackForwardListChromium.cpp \
@@ -50,7 +47,6 @@
 #      html/HTMLMediaElement.cpp \
 #      html/HTMLSourceElement.cpp \
 #      html/HTMLVideoElement.cpp \
-#      loader/CachedResourceClientWalker.cpp \
 #      loader/CachedXBLDocument.cpp \
 #      loader/CachedXSLStyleSheet.cpp \
 #      loader/FTP*.cpp \
 #      page/WorkerNavigator.cpp \
 #      platform/ThreadingNone.cpp \
 #      platform/graphics/FloatPoint3D.cpp \
-#      rendering/RenderSVG*.cpp \
 #      rendering/RenderThemeChromium*.cpp \
 #      rendering/RenderThemeSafari.cpp \
 #      rendering/RenderThemeWin.cpp \
 #      rendering/RenderVideo.cpp \
-#      rendering/SVG*.cpp \
 #      xml/Access*.cpp \
 #      xml/NativeXPathNSResolver.cpp \
 #      xml/XPath* \
 #      /qt/* \
 #      /skia/* \
 #      ^storage/* \
-#      ^svg/* \
 #      /symbian/* \
 #      /v8/* \
 #      /win/* \
@@ -186,6 +179,20 @@ LOCAL_SRC_FILES := \
        bindings/js/JSPluginElementFunctions.cpp \
        bindings/js/JSQuarantinedObjectWrapper.cpp \
        bindings/js/JSRGBColor.cpp \
+    
+ifeq ($(ENABLE_SVG), true)
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
+       bindings/js/JSSVGElementInstanceCustom.cpp \
+       bindings/js/JSSVGLengthCustom.cpp \
+       bindings/js/JSSVGMatrixCustom.cpp \
+       bindings/js/JSSVGPathSegCustom.cpp \
+       bindings/js/JSSVGPathSegListCustom.cpp \
+       bindings/js/JSSVGPointListCustom.cpp \
+       bindings/js/JSSVGTransformListCustom.cpp \
+    
+endif
+    
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        bindings/js/JSStyleSheetCustom.cpp \
        bindings/js/JSStyleSheetListCustom.cpp \
        bindings/js/JSTextCustom.cpp \
@@ -267,6 +274,16 @@ LOCAL_SRC_FILES := \
        css/MediaQuery.cpp \
        css/MediaQueryEvaluator.cpp \
        css/MediaQueryExp.cpp \
+    
+ifeq ($(ENABLE_SVG), true)
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
+       css/SVGCSSComputedStyleDeclaration.cpp \
+       css/SVGCSSParser.cpp \
+       css/SVGCSSStyleSelector.cpp \
+    
+endif
+
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        css/ShadowValue.cpp \
        css/StyleBase.cpp \
        css/StyleList.cpp \
@@ -403,7 +420,6 @@ LOCAL_SRC_FILES := \
        editing/WrapContentsInDummySpanCommand.cpp \
        \
        editing/android/EditorAndroid.cpp \
-       \
        editing/htmlediting.cpp \
        editing/markup.cpp \
        editing/visible_units.cpp \
@@ -792,6 +808,26 @@ LOCAL_SRC_FILES := \
        rendering/RenderPath.cpp \
        rendering/RenderReplaced.cpp \
        rendering/RenderReplica.cpp \
+    
+ifeq ($(ENABLE_SVG), true)
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
+       rendering/RenderSVGBlock.cpp \
+       rendering/RenderSVGContainer.cpp \
+       rendering/RenderSVGGradientStop.cpp \
+       rendering/RenderSVGHiddenContainer.cpp \
+       rendering/RenderSVGImage.cpp \
+       rendering/RenderSVGInline.cpp \
+       rendering/RenderSVGInlineText.cpp \
+       rendering/RenderSVGRoot.cpp \
+       rendering/RenderSVGTSpan.cpp \
+       rendering/RenderSVGText.cpp \
+       rendering/RenderSVGTextPath.cpp \
+       rendering/RenderSVGTransformableContainer.cpp \
+       rendering/RenderSVGViewportContainer.cpp \
+
+endif
+
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        rendering/RenderScrollbar.cpp \
        rendering/RenderScrollbarPart.cpp \
        rendering/RenderScrollbarTheme.cpp \
@@ -812,6 +848,18 @@ LOCAL_SRC_FILES := \
        rendering/RenderWidget.cpp \
        rendering/RenderWordBreak.cpp \
        rendering/RootInlineBox.cpp \
+    
+ifeq ($(ENABLE_SVG), true)
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
+       rendering/SVGCharacterLayoutInfo.cpp \
+       rendering/SVGInlineFlowBox.cpp \
+       rendering/SVGInlineTextBox.cpp \
+       rendering/SVGRenderSupport.cpp \
+       rendering/SVGRenderTreeAsText.cpp \
+       rendering/SVGRootInlineBox.cpp \
+
+endif
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        rendering/TextControlInnerElements.cpp \
        rendering/bidi.cpp \
        rendering/break_lines.cpp \
@@ -823,8 +871,14 @@ LOCAL_SRC_FILES := \
        rendering/style/KeyframeList.cpp \
        rendering/style/NinePieceImage.cpp \
        rendering/style/RenderStyle.cpp \
+    
+ifeq ($(ENABLE_SVG), true)
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        rendering/style/SVGRenderStyle.cpp \
        rendering/style/SVGRenderStyleDefs.cpp \
+
+endif
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        rendering/style/ShadowData.cpp \
        rendering/style/StyleBackgroundData.cpp \
        rendering/style/StyleBoxData.cpp \
@@ -841,7 +895,179 @@ LOCAL_SRC_FILES := \
        rendering/style/StyleVisualData.cpp \
        \
        storage/DatabaseAuthorizer.cpp \
+    
+ifeq ($(ENABLE_SVG), true)
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
+       svg/ColorDistance.cpp \
+       svg/Filter.cpp \
+       svg/FilterEffect.cpp \
+       svg/SVGAElement.cpp \
+       svg/SVGAltGlyphElement.cpp \
+       svg/SVGAngle.cpp \
+       svg/SVGAnimateColorElement.cpp \
+       svg/SVGAnimateElement.cpp \
+       svg/SVGAnimateMotionElement.cpp \
+       svg/SVGAnimateTransformElement.cpp \
+       svg/SVGAnimatedPathData.cpp \
+       svg/SVGAnimatedPoints.cpp \
+       svg/SVGAnimationElement.cpp \
+       svg/SVGCircleElement.cpp \
+       svg/SVGClipPathElement.cpp \
+       svg/SVGColor.cpp \
+       svg/SVGComponentTransferFunctionElement.cpp \
+       svg/SVGCursorElement.cpp \
+       svg/SVGDefinitionSrcElement.cpp \
+       svg/SVGDefsElement.cpp \
+       svg/SVGDescElement.cpp \
+       svg/SVGDocument.cpp \
+       svg/SVGDocumentExtensions.cpp \
+       svg/SVGElement.cpp \
+       svg/SVGElementInstance.cpp \
+       svg/SVGElementInstanceList.cpp \
+       svg/SVGEllipseElement.cpp \
+       svg/SVGExternalResourcesRequired.cpp \
+       svg/SVGFEBlendElement.cpp \
+       svg/SVGFEColorMatrixElement.cpp \
+       svg/SVGFEComponentTransferElement.cpp \
+       svg/SVGFECompositeElement.cpp \
+       svg/SVGFEDiffuseLightingElement.cpp \
+       svg/SVGFEDisplacementMapElement.cpp \
+       svg/SVGFEDistantLightElement.cpp \
+       svg/SVGFEFloodElement.cpp \
+       svg/SVGFEFuncAElement.cpp \
+       svg/SVGFEFuncBElement.cpp \
+       svg/SVGFEFuncGElement.cpp \
+       svg/SVGFEFuncRElement.cpp \
+       svg/SVGFEGaussianBlurElement.cpp \
+       svg/SVGFEImageElement.cpp \
+       svg/SVGFELightElement.cpp \
+       svg/SVGFEMergeElement.cpp \
+       svg/SVGFEMergeNodeElement.cpp \
+       svg/SVGFEOffsetElement.cpp \
+       svg/SVGFEPointLightElement.cpp \
+       svg/SVGFESpecularLightingElement.cpp \
+       svg/SVGFESpotLightElement.cpp \
+       svg/SVGFETileElement.cpp \
+       svg/SVGFETurbulenceElement.cpp \
+       svg/SVGFilterElement.cpp \
+       svg/SVGFilterPrimitiveStandardAttributes.cpp \
+       svg/SVGFitToViewBox.cpp \
+       svg/SVGFont.cpp \
+       svg/SVGFontData.cpp \
+       svg/SVGFontElement.cpp \
+       svg/SVGFontFaceElement.cpp \
+       svg/SVGFontFaceFormatElement.cpp \
+       svg/SVGFontFaceNameElement.cpp \
+       svg/SVGFontFaceSrcElement.cpp \
+       svg/SVGFontFaceUriElement.cpp \
+       svg/SVGForeignObjectElement.cpp \
+       svg/SVGGElement.cpp \
+       svg/SVGGlyphElement.cpp \
+       svg/SVGGradientElement.cpp \
+       svg/SVGHKernElement.cpp \
+       svg/SVGImageElement.cpp \
+       svg/SVGImageLoader.cpp \
+       svg/SVGLangSpace.cpp \
+       svg/SVGLength.cpp \
+       svg/SVGLengthList.cpp \
+       svg/SVGLineElement.cpp \
+       svg/SVGLinearGradientElement.cpp \
+       svg/SVGLocatable.cpp \
+       svg/SVGMPathElement.cpp \
+       svg/SVGMarkerElement.cpp \
+       svg/SVGMaskElement.cpp \
+       svg/SVGMetadataElement.cpp \
+       svg/SVGMissingGlyphElement.cpp \
+       svg/SVGNumberList.cpp \
+       svg/SVGPaint.cpp \
+       svg/SVGParserUtilities.cpp \
+       svg/SVGPathElement.cpp \
+       svg/SVGPathSegArc.cpp \
+       svg/SVGPathSegClosePath.cpp \
+       svg/SVGPathSegCurvetoCubic.cpp \
+       svg/SVGPathSegCurvetoCubicSmooth.cpp \
+       svg/SVGPathSegCurvetoQuadratic.cpp \
+       svg/SVGPathSegCurvetoQuadraticSmooth.cpp \
+       svg/SVGPathSegLineto.cpp \
+       svg/SVGPathSegLinetoHorizontal.cpp \
+       svg/SVGPathSegLinetoVertical.cpp \
+       svg/SVGPathSegList.cpp \
+       svg/SVGPathSegMoveto.cpp \
+       svg/SVGPatternElement.cpp \
+       svg/SVGPointList.cpp \
+       svg/SVGPolyElement.cpp \
+       svg/SVGPolygonElement.cpp \
+       svg/SVGPolylineElement.cpp \
+       svg/SVGPreserveAspectRatio.cpp \
+       svg/SVGRadialGradientElement.cpp \
+       svg/SVGRectElement.cpp \
+       svg/SVGSVGElement.cpp \
+       svg/SVGScriptElement.cpp \
+       svg/SVGSetElement.cpp \
+       svg/SVGStopElement.cpp \
+       svg/SVGStringList.cpp \
+       svg/SVGStylable.cpp \
+       svg/SVGStyleElement.cpp \
+       svg/SVGStyledElement.cpp \
+       svg/SVGStyledLocatableElement.cpp \
+       svg/SVGStyledTransformableElement.cpp \
+       svg/SVGSwitchElement.cpp \
+       svg/SVGSymbolElement.cpp \
+       svg/SVGTRefElement.cpp \
+       svg/SVGTSpanElement.cpp \
+       svg/SVGTests.cpp \
+       svg/SVGTextContentElement.cpp \
+       svg/SVGTextElement.cpp \
+       svg/SVGTextPathElement.cpp \
+       svg/SVGTextPositioningElement.cpp \
+       svg/SVGTitleElement.cpp \
+       svg/SVGTransform.cpp \
+       svg/SVGTransformDistance.cpp \
+       svg/SVGTransformList.cpp \
+       svg/SVGTransformable.cpp \
+       svg/SVGURIReference.cpp \
+       svg/SVGUseElement.cpp \
+       svg/SVGViewElement.cpp \
+       svg/SVGViewSpec.cpp \
+       svg/SVGZoomAndPan.cpp \
+       svg/SVGZoomEvent.cpp \
+       \
+       svg/animation/SMILTime.cpp \
+       svg/animation/SMILTimeContainer.cpp \
+       svg/animation/SVGSMILElement.cpp \
+       \
+       svg/graphics/SVGImage.cpp \
+       svg/graphics/SVGPaintServer.cpp \
+       svg/graphics/SVGPaintServerGradient.cpp \
+       svg/graphics/SVGPaintServerLinearGradient.cpp \
+       svg/graphics/SVGPaintServerPattern.cpp \
+       svg/graphics/SVGPaintServerRadialGradient.cpp \
+       svg/graphics/SVGPaintServerSolid.cpp \
+       svg/graphics/SVGResource.cpp \
+       svg/graphics/SVGResourceClipper.cpp \
+       svg/graphics/SVGResourceFilter.cpp \
+       svg/graphics/SVGResourceMarker.cpp \
+       svg/graphics/SVGResourceMasker.cpp \
        \
+       svg/graphics/filters/SVGFEConvolveMatrix.cpp \
+       svg/graphics/filters/SVGFEDiffuseLighting.cpp \
+       svg/graphics/filters/SVGFEDisplacementMap.cpp \
+       svg/graphics/filters/SVGFEFlood.cpp \
+       svg/graphics/filters/SVGFEGaussianBlur.cpp \
+       svg/graphics/filters/SVGFEImage.cpp \
+       svg/graphics/filters/SVGFEMerge.cpp \
+       svg/graphics/filters/SVGFEMorphology.cpp \
+       svg/graphics/filters/SVGFEOffset.cpp \
+       svg/graphics/filters/SVGFESpecularLighting.cpp \
+       svg/graphics/filters/SVGFETile.cpp \
+       svg/graphics/filters/SVGFETurbulence.cpp \
+       svg/graphics/filters/SVGFilterEffect.cpp \
+       svg/graphics/filters/SVGLightSource.cpp \
+       \
+       svg/graphics/skia/SVGResourceMaskerSkia.cpp \
+
+endif
+LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        xml/DOMParser.cpp \
        xml/XMLHttpRequest.cpp \
        xml/XMLHttpRequestUpload.cpp \
index 1fb55eb..ddb772b 100644 (file)
@@ -84,7 +84,9 @@
 #define ENABLE_DATABASE 0
 #undef ENABLE_FTPDIR
 #define ENABLE_FTPDIR 0
+#ifndef ENABLE_SVG
 #define ENABLE_SVG 0
+#endif
 #define ENABLE_SVG_EXPERIMENTAL_FEATURES 0
 #define ENABLE_XBL 0
 #define ENABLE_XPATH 0
index 1a412f7..5871f9f 100644 (file)
@@ -246,6 +246,11 @@ public:
     virtual void updateGlobalHistory() { }
     virtual void updateGlobalHistoryForRedirectWithoutHistoryItem() { }
     virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
+#ifdef ANDROID_HISTORY_CLIENT
+    virtual void dispatchDidAddHistoryItem(HistoryItem*) const {}
+    virtual void dispatchDidRemoveHistoryItem(HistoryItem*, int) const {}
+    virtual void dispatchDidChangeHistoryIndex(BackForwardList*) const {}
+#endif
     virtual void saveViewStateToItem(HistoryItem*) { }
     virtual bool canCachePage() const { return false; }
 
index 40d98ec..6a92a7f 100644 (file)
@@ -754,6 +754,18 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& r)
     GC2Canvas(this)->clipPath(path, SkRegion::kDifference_Op);
 }
 
+#if ENABLE(SVG)
+void GraphicsContext::clipPath(WindRule clipRule)
+{
+    if (paintingDisabled())
+        return;
+    const SkPath* oldPath = m_data->getPath();
+    SkPath path(*oldPath);
+    path.setFillType(clipRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
+    GC2Canvas(this)->clipPath(path);
+}
+#endif
+
 void GraphicsContext::clipOut(const Path& p)
 {
     if (paintingDisabled())
@@ -943,6 +955,30 @@ void GraphicsContext::setLineCap(LineCap cap)
     }
 }
 
+#if ENABLE(SVG)
+void GraphicsContext::setLineDash(const DashArray& dashes, float dashOffset)
+{
+    if (paintingDisabled())
+        return;
+
+    // FIXME: This is lifted directly off SkiaSupport, lines 49-74
+    // so it is not guaranteed to work correctly.
+    size_t dashLength = dashes.size();
+    if (!dashLength)
+        return;
+
+    size_t count = (dashLength % 2) == 0 ? dashLength : dashLength * 2;
+    SkScalar* intervals = new SkScalar[count];
+
+    for (unsigned int i = 0; i < count; i++)
+        intervals[i] = dashes[i % dashLength];
+// FIXME: setDashPathEffect not defined
+//    platformContext()->setDashPathEffect(new SkDashPathEffect(intervals, count, dashOffset));
+
+    delete[] intervals;
+}
+#endif
+
 void GraphicsContext::setLineJoin(LineJoin join)
 {
     switch (join) {
index af870f5..6687c2b 100644 (file)
@@ -266,6 +266,64 @@ void Path::transform(const TransformationMatrix& xform)
     m_path->transform(xform);
 }
     
+#if ENABLE(SVG)
+String Path::debugString() const
+{
+    String result;
+
+    SkPath::Iter iter(*m_path, false);
+    SkPoint pts[4];
+
+    int numPoints = m_path->getPoints(0, 0);
+    SkPath::Verb verb;
+
+    do {
+        verb = iter.next(pts);
+        switch (verb) {
+        case SkPath::kMove_Verb:
+            result += String::format("M%.2f,%.2f ", pts[0].fX, pts[0].fY);
+            numPoints -= 1;
+            break;
+        case SkPath::kLine_Verb:
+          if (!iter.isCloseLine()) {
+                result += String::format("L%.2f,%.2f ", pts[1].fX, pts[1].fY); 
+                numPoints -= 1;
+            }
+            break;
+        case SkPath::kQuad_Verb:
+            result += String::format("Q%.2f,%.2f,%.2f,%.2f ",
+                pts[1].fX, pts[1].fY,
+                pts[2].fX, pts[2].fY);
+            numPoints -= 2;
+            break;
+        case SkPath::kCubic_Verb:
+            result += String::format("C%.2f,%.2f,%.2f,%.2f,%.2f,%.2f ",
+                pts[1].fX, pts[1].fY,
+                pts[2].fX, pts[2].fY,
+                pts[3].fX, pts[3].fY);
+            numPoints -= 3;
+            break;
+        case SkPath::kClose_Verb:
+            result += "Z ";
+            break;
+        case SkPath::kDone_Verb:
+            break;
+        }
+    } while (verb != SkPath::kDone_Verb);
+
+    // If you have a path that ends with an M, Skia will not iterate the
+    // trailing M. That's nice of it, but Apple's paths output the trailing M
+    // and we want out layout dumps to look like theirs
+    if (numPoints) {
+        ASSERT(numPoints==1);
+        m_path->getLastPt(pts);
+        result += String::format("M%.2f,%.2f ", pts[0].fX, pts[0].fY);
+    }
+
+    return result.stripWhiteSpace();
+}
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 
 // Computes the bounding box for the stroke and style currently selected into
@@ -311,4 +369,30 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
     return r;
 }
 
+#if ENABLE(SVG)
+bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) const
+{
+#if 0
+    ASSERT(applier);
+    GraphicsContext* scratch = scratchContext();
+    scratch->save();
+
+    applier->strokeStyle(scratch);
+
+    SkPaint paint;
+    scratch->platformContext()->setupPaintForStroking(&paint, 0, 0);
+    SkPath strokePath;
+    paint.getFillPath(*platformPath(), &strokePath);
+    bool contains = SkPathContainsPoint(&strokePath, point,
+                                        SkPath::kWinding_FillType);
+
+    scratch->restore();
+    return contains;
+#else
+    // FIXME: 
+    return false;
+#endif
+}
+#endif
+
 }