OSDN Git Service

am 3c54ece0: am 5dc34a85: activeDocumentLoader() causes crash in WebCoreFrameBridge.cpp
[android-x86/external-webkit.git] / WebCore / css / SVGCSSComputedStyleDeclaration.cpp
index 00cb308..410eede 100644 (file)
@@ -46,6 +46,19 @@ static PassRefPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphO
     }
 }
 
+static PassRefPtr<CSSValue> strokeDashArrayToCSSValueList(const Vector<SVGLength>& dashes)
+{
+    if (dashes.isEmpty())
+        return CSSPrimitiveValue::createIdentifier(CSSValueNone);
+
+    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+    const Vector<SVGLength>::const_iterator end = dashes.end();
+    for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
+        list->append(SVGLength::toCSSPrimitiveValue(*it));
+
+    return list.release();
+}
+
 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
 {
     Node* node = m_node.get();
@@ -122,7 +135,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
         case CSSPropertyFill:
             return svgStyle->fillPaint();
         case CSSPropertyKerning:
-            return svgStyle->kerning();
+            return SVGLength::toCSSPrimitiveValue(svgStyle->kerning());
         case CSSPropertyMarkerEnd:
             if (!svgStyle->markerEndResource().isEmpty())
                 return CSSPrimitiveValue::create(svgStyle->markerEndResource(), CSSPrimitiveValue::CSS_URI);
@@ -138,11 +151,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
         case CSSPropertyStroke:
             return svgStyle->strokePaint();
         case CSSPropertyStrokeDasharray:
-            return svgStyle->strokeDashArray();
+            return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray());
         case CSSPropertyStrokeDashoffset:
-            return svgStyle->strokeDashOffset();
+            return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset());
         case CSSPropertyStrokeWidth:
-            return svgStyle->strokeWidth();
+            return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth());
         case CSSPropertyBaselineShift: {
             switch (svgStyle->baselineShift()) {
                 case BS_BASELINE:
@@ -152,7 +165,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
                 case BS_SUB:
                     return CSSPrimitiveValue::createIdentifier(CSSValueSub);
                 case BS_LENGTH:
-                    return svgStyle->baselineShiftValue();
+                    return SVGLength::toCSSPrimitiveValue(svgStyle->baselineShiftValue());
             }
         }
         case CSSPropertyGlyphOrientationHorizontal: