Commit 604f4f32 authored by andersca's avatar andersca
Browse files

2006-10-01 Anders Carlsson <acarlsson@apple.com>

        Reviewed by Mitz Pettel.

        Convert the SVG code to use Vector<String> instead of DeprecatedStringList.

        * ksvg2/svg/SVGColor.cpp:
        (WebCore::SVGColor::setRGBColor):
        * ksvg2/svg/SVGComponentTransferFunctionElement.cpp:
        * ksvg2/svg/SVGFEDiffuseLightingElement.cpp:
        (WebCore::SVGFEDiffuseLightingElement::parseMappedAttribute):
        * ksvg2/svg/SVGFEGaussianBlurElement.cpp:
        (WebCore::SVGFEGaussianBlurElement::parseMappedAttribute):
        * ksvg2/svg/SVGFESpecularLightingElement.cpp:
        (SVGFESpecularLightingElement::parseMappedAttribute):
        * ksvg2/svg/SVGFETurbulenceElement.cpp:
        (WebCore::SVGFETurbulenceElement::parseMappedAttribute):
        * ksvg2/svg/SVGLengthList.cpp:
        * ksvg2/svg/SVGNumberList.cpp:
        (SVGNumberList::parse):
        * ksvg2/svg/SVGNumberList.h:
        * ksvg2/svg/SVGPreserveAspectRatio.cpp:
        (WebCore::SVGPreserveAspectRatio::parsePreserveAspectRatio):
        * ksvg2/svg/SVGStringList.cpp:
        (WebCore::SVGStringList::reset):
        * ksvg2/svg/SVGStringList.h:
        * ksvg2/svg/SVGTransformable.cpp:
        (SVGTransformable::parseTransformAttribute):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4e81e6bc
2006-10-01 Anders Carlsson <acarlsson@apple.com>
Reviewed by Mitz Pettel.
Convert the SVG code to use Vector<String> instead of DeprecatedStringList.
* ksvg2/svg/SVGColor.cpp:
(WebCore::SVGColor::setRGBColor):
* ksvg2/svg/SVGComponentTransferFunctionElement.cpp:
* ksvg2/svg/SVGFEDiffuseLightingElement.cpp:
(WebCore::SVGFEDiffuseLightingElement::parseMappedAttribute):
* ksvg2/svg/SVGFEGaussianBlurElement.cpp:
(WebCore::SVGFEGaussianBlurElement::parseMappedAttribute):
* ksvg2/svg/SVGFESpecularLightingElement.cpp:
(SVGFESpecularLightingElement::parseMappedAttribute):
* ksvg2/svg/SVGFETurbulenceElement.cpp:
(WebCore::SVGFETurbulenceElement::parseMappedAttribute):
* ksvg2/svg/SVGLengthList.cpp:
* ksvg2/svg/SVGNumberList.cpp:
(SVGNumberList::parse):
* ksvg2/svg/SVGNumberList.h:
* ksvg2/svg/SVGPreserveAspectRatio.cpp:
(WebCore::SVGPreserveAspectRatio::parsePreserveAspectRatio):
* ksvg2/svg/SVGStringList.cpp:
(WebCore::SVGStringList::reset):
* ksvg2/svg/SVGStringList.h:
* ksvg2/svg/SVGTransformable.cpp:
(SVGTransformable::parseTransformAttribute):
2006-10-01 Nikolas Zimmermann <zimmermann@kde.org>
 
Reviewed by Eric, tweaked and landed by ap.
......@@ -24,7 +24,6 @@
#ifdef SVG_SUPPORT
#include "SVGColor.h"
#include "DeprecatedStringList.h"
#include "ksvg.h"
namespace WebCore {
......@@ -227,24 +226,24 @@ void SVGColor::setRGBColor(const String& rgbColor, ExceptionCode& ec)
String parse = m_rgbColor.stripWhiteSpace();
if (parse.startsWith("rgb(")) {
DeprecatedStringList colors = DeprecatedStringList::split(',', parse.deprecatedString());
DeprecatedString r = colors[0].right((colors[0].length() - 4));
DeprecatedString g = colors[1];
DeprecatedString b = colors[2].left((colors[2].length() - 1));
Vector<String> colors = parse.split(',');
String r = colors[0].right((colors[0].length() - 4));
String g = colors[1];
String b = colors[2].left((colors[2].length() - 1));
if (r.contains("%")) {
r = r.left(r.length() - 1);
r = DeprecatedString::number(int(((255.0 * r.toDouble()) / 100.0)));
r = String::number(int(((255.0 * r.toDouble()) / 100.0)));
}
if (g.contains("%")) {
g = g.left(g.length() - 1);
g = DeprecatedString::number(int(((255.0 * g.toDouble()) / 100.0)));
g = String::number(int(((255.0 * g.toDouble()) / 100.0)));
}
if (b.contains("%")) {
b = b.left(b.length() - 1);
b = DeprecatedString::number(int(((255.0 * b.toDouble()) / 100.0)));
b = String::number(int(((255.0 * b.toDouble()) / 100.0)));
}
m_color = Color(r.toInt(), g.toInt(), b.toInt());
......
......@@ -22,8 +22,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "Attr.h"
#include "SVGNames.h"
......
......@@ -67,9 +67,9 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
else if (attr->name() == SVGNames::diffuseConstantAttr)
setDiffuseConstantBaseValue(value.toInt());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
Vector<String> numbers = value.split(' ');
setKernelUnitLengthXBaseValue(numbers[0].toDouble());
if (numbers.count() == 1)
if (numbers.size() == 1)
setKernelUnitLengthYBaseValue(numbers[0].toDouble());
else
setKernelUnitLengthYBaseValue(numbers[1].toDouble());
......
......@@ -22,8 +22,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "Attr.h"
#include "KCanvasFilters.h"
......@@ -62,9 +60,9 @@ void SVGFEGaussianBlurElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::stdDeviationAttr) {
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
Vector<String> numbers = value.split(' ');
setStdDeviationXBaseValue(numbers[0].toDouble());
if(numbers.count() == 1)
if(numbers.size() == 1)
setStdDeviationYBaseValue(numbers[0].toDouble());
else
setStdDeviationYBaseValue(numbers[1].toDouble());
......
......@@ -21,8 +21,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "Attr.h"
#include <kcanvas/KCanvasFilters.h>
......@@ -75,9 +73,9 @@ void SVGFESpecularLightingElement::parseMappedAttribute(MappedAttribute *attr)
else if (attr->name() == SVGNames::specularExponentAttr)
setSpecularExponentBaseValue(value.toDouble());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
Vector<String> numbers = value.split(' ');
setKernelUnitLengthXBaseValue(numbers[0].toDouble());
if (numbers.count() == 1)
if (numbers.size() == 1)
setKernelUnitLengthYBaseValue(numbers[0].toDouble());
else
setKernelUnitLengthYBaseValue(numbers[1].toDouble());
......
......@@ -22,8 +22,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "Attr.h"
#include "KCanvasFilters.h"
......@@ -80,9 +78,9 @@ void SVGFETurbulenceElement::parseMappedAttribute(MappedAttribute *attr)
}
else if (attr->name() == SVGNames::baseFrequencyAttr)
{
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value.deprecatedString());
Vector<String> numbers = value.split(' ');
setBaseFrequencyXBaseValue(numbers[0].toDouble());
if(numbers.count() == 1)
if(numbers.size() == 1)
setBaseFrequencyYBaseValue(numbers[0].toDouble());
else
setBaseFrequencyYBaseValue(numbers[1].toDouble());
......
......@@ -23,9 +23,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "SVGMatrix.h"
#include "SVGSVGElement.h"
#include "SVGLengthList.h"
......
......@@ -23,10 +23,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedString.h"
#include "DeprecatedStringList.h"
#include "SVGMatrix.h"
#include "SVGSVGElement.h"
#include "SVGNumberList.h"
......@@ -42,12 +38,12 @@ SVGNumberList::~SVGNumberList()
{
}
void SVGNumberList::parse(const DeprecatedString& value)
void SVGNumberList::parse(const String& value)
{
ExceptionCode ec = 0;
DeprecatedStringList numbers = DeprecatedStringList::split(' ', value);
for (unsigned int i = 0; i < numbers.count(); i++)
Vector<String> numbers = value.split(' ');
for (unsigned int i = 0; i < numbers.size(); i++)
appendItem(numbers[i].toDouble(), ec);
}
......
......@@ -37,7 +37,7 @@ namespace WebCore
SVGNumberList();
virtual ~SVGNumberList();
void parse(const DeprecatedString& value);
void parse(const String& value);
};
} // namespace WebCore
......
......@@ -22,8 +22,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "ksvg.h"
#include "SVGMatrix.h"
#include "SVGSVGElement.h"
......@@ -69,7 +67,7 @@ void SVGPreserveAspectRatio::parsePreserveAspectRatio(const String& string)
setAlign(SVG_PRESERVEASPECTRATIO_NONE);
setMeetOrSlice(SVG_MEETORSLICE_MEET);
DeprecatedStringList params = DeprecatedStringList::split(' ', string.deprecatedString().simplifyWhiteSpace());
Vector<String> params = string.simplifyWhiteSpace().split(' ');
if (params[0] == "none")
m_align = SVG_PRESERVEASPECTRATIO_NONE;
......@@ -93,7 +91,7 @@ void SVGPreserveAspectRatio::parsePreserveAspectRatio(const String& string)
m_align = SVG_PRESERVEASPECTRATIO_XMAXYMAX;
if (m_align != SVG_PRESERVEASPECTRATIO_NONE) {
if ((params.count() > 1) && (params[1] == "slice"))
if ((params.size() > 1) && (params[1] == "slice"))
m_meetOrSlice = SVG_MEETORSLICE_SLICE;
else
m_meetOrSlice = SVG_MEETORSLICE_MEET;
......
......@@ -23,8 +23,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "DeprecatedStringList.h"
#include "SVGStringList.h"
namespace WebCore {
......@@ -38,16 +36,17 @@ SVGStringList::~SVGStringList()
{
}
void SVGStringList::reset(const DeprecatedString& str)
void SVGStringList::reset(const String& str)
{
ExceptionCode ec = 0;
DeprecatedStringList list = DeprecatedStringList::split(' ', str);
if (list.count() == 0) {
Vector<String> vector = str.split(' ');
if (vector.size() == 0) {
appendItem(String(""), ec); // Create empty string...
} else {
for(DeprecatedStringList::Iterator it = list.begin(); it != list.end(); ++it)
appendItem(String(*it), ec);
Vector<String>::const_iterator end = vector.end();
for(Vector<String>::const_iterator it = vector.begin(); it != end; ++it)
appendItem(*it, ec);
}
}
......
......@@ -37,7 +37,7 @@ namespace WebCore {
virtual ~SVGStringList();
// Internal
void reset(const DeprecatedString& str);
void reset(const String& str);
};
} // namespace WebCore
......
......@@ -23,7 +23,6 @@
#include "config.h"
#ifdef SVG_SUPPORT
#include "RegularExpression.h"
#include "DeprecatedStringList.h"
#include <wtf/RefPtr.h>
#include "Attr.h"
......@@ -51,13 +50,12 @@ SVGTransformable::~SVGTransformable()
void SVGTransformable::parseTransformAttribute(SVGTransformList *list, const AtomicString& transform)
{
// Split string for handling 1 transform statement at a time
DeprecatedStringList subtransforms = DeprecatedStringList::split(')', transform.deprecatedString().simplifyWhiteSpace());
DeprecatedStringList::ConstIterator it = subtransforms.begin();
DeprecatedStringList::ConstIterator end = subtransforms.end();
for (; it != end; ++it) {
DeprecatedStringList subtransform = DeprecatedStringList::split('(', (*it));
Vector<String> subtransforms = transform.domString().simplifyWhiteSpace().split(')');
Vector<String>::const_iterator end = subtransforms.end();
for (Vector<String>::const_iterator it = subtransforms.begin(); it != end; ++it) {
Vector<String> subtransform = (*it).split('(');
if (subtransform.count() < 2)
if (subtransform.size() < 2)
break; // invalid transform, ignore.
subtransform[0] = subtransform[0].stripWhiteSpace().lower();
......@@ -65,46 +63,46 @@ void SVGTransformable::parseTransformAttribute(SVGTransformList *list, const Ato
RegularExpression reg("([-]?\\d*\\.?\\d+(?:e[-]?\\d+)?)");
int pos = 0;
DeprecatedStringList params;
Vector<String> params;
while (pos >= 0) {
pos = reg.search(subtransform[1], pos);
pos = reg.search(subtransform[1].deprecatedString(), pos);
if (pos != -1) {
params += reg.cap(1);
params.append(reg.cap(1));
pos += reg.matchedLength();
}
}
if (params.count() < 1)
if (params.size() < 1)
break;
if (subtransform[0].startsWith(";") || subtransform[0].startsWith(","))
subtransform[0] = subtransform[0].mid(1).stripWhiteSpace();
subtransform[0] = subtransform[0].substring(1).stripWhiteSpace();
SVGTransform* t = new SVGTransform();
if (subtransform[0] == "rotate") {
if (params.count() == 3)
if (params.size() == 3)
t->setRotate(params[0].toDouble(),
params[1].toDouble(),
params[2].toDouble());
else if (params.count() == 1)
else if (params.size() == 1)
t->setRotate(params[0].toDouble(), 0, 0);
} else if (subtransform[0] == "translate") {
if (params.count() == 2)
if (params.size() == 2)
t->setTranslate(params[0].toDouble(), params[1].toDouble());
else if (params.count() == 1) // Spec: if only one param given, assume 2nd param to be 0
else if (params.size() == 1) // Spec: if only one param given, assume 2nd param to be 0
t->setTranslate(params[0].toDouble(), 0);
} else if (subtransform[0] == "scale") {
if (params.count() == 2)
if (params.size() == 2)
t->setScale(params[0].toDouble(), params[1].toDouble());
else if (params.count() == 1) // Spec: if only one param given, assume uniform scaling
else if (params.size() == 1) // Spec: if only one param given, assume uniform scaling
t->setScale(params[0].toDouble(), params[0].toDouble());
} else if (subtransform[0] == "skewx" && (params.count() == 1))
} else if (subtransform[0] == "skewx" && (params.size() == 1))
t->setSkewX(params[0].toDouble());
else if (subtransform[0] == "skewy" && (params.count() == 1))
else if (subtransform[0] == "skewy" && (params.size() == 1))
t->setSkewY(params[0].toDouble());
else if (subtransform[0] == "matrix" && (params.count() == 6)) {
else if (subtransform[0] == "matrix" && (params.size() == 6)) {
SVGMatrix *ret = new SVGMatrix(params[0].toDouble(),
params[1].toDouble(),
params[2].toDouble(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment