#include "core/CSSPropertyNames.h"
#include "core/SVGNames.h"
#include "core/css/CSSComputedStyleDeclaration.h"
-#include "core/css/parser/BisonCSSParser.h"
+#include "core/css/parser/CSSParser.h"
#include "core/frame/UseCounter.h"
#include "core/svg/SVGAnimateElement.h"
#include "core/svg/SVGElement.h"
}
template<typename CharType>
-static void parseKeySplinesInternal(const String& string, Vector<UnitBezier>& result)
+static bool parseKeySplinesInternal(const String& string, Vector<UnitBezier>& result)
{
const CharType* ptr = string.getCharacters<CharType>();
const CharType* end = ptr + string.length();
skipOptionalSVGSpaces(ptr, end);
- bool delimParsed = false;
while (ptr < end) {
- delimParsed = false;
float posA = 0;
- if (!parseNumber(ptr, end, posA)) {
- result.clear();
- return;
- }
+ if (!parseNumber(ptr, end, posA))
+ return false;
float posB = 0;
- if (!parseNumber(ptr, end, posB)) {
- result.clear();
- return;
- }
+ if (!parseNumber(ptr, end, posB))
+ return false;
float posC = 0;
- if (!parseNumber(ptr, end, posC)) {
- result.clear();
- return;
- }
+ if (!parseNumber(ptr, end, posC))
+ return false;
float posD = 0;
- if (!parseNumber(ptr, end, posD, DisallowWhitespace)) {
- result.clear();
- return;
- }
+ if (!parseNumber(ptr, end, posD, DisallowWhitespace))
+ return false;
skipOptionalSVGSpaces(ptr, end);
- if (ptr < end && *ptr == ';') {
- delimParsed = true;
+ if (ptr < end && *ptr == ';')
ptr++;
- }
skipOptionalSVGSpaces(ptr, end);
result.append(UnitBezier(posA, posB, posC, posD));
}
- if (!(ptr == end && !delimParsed))
- result.clear();
+
+ return ptr == end;
}
-static void parseKeySplines(const String& string, Vector<UnitBezier>& result)
+static bool parseKeySplines(const String& string, Vector<UnitBezier>& result)
{
result.clear();
if (string.isEmpty())
- return;
+ return true;
+ bool parsed = true;
if (string.is8Bit())
- parseKeySplinesInternal<LChar>(string, result);
+ parsed = parseKeySplinesInternal<LChar>(string, result);
else
- parseKeySplinesInternal<UChar>(string, result);
+ parsed = parseKeySplinesInternal<UChar>(string, result);
+ if (!parsed) {
+ result.clear();
+ return false;
+ }
+ return true;
}
bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName)
}
if (name == SVGNames::keySplinesAttr) {
- parseKeySplines(value, m_keySplines);
+ if (!parseKeySplines(value, m_keySplines))
+ reportAttributeParsingError(ParsingAttributeFailedError, name, value);
return;
}
String by = byValue();
if (animationMode == NoAnimation)
return;
+ if ((animationMode == FromToAnimation || animationMode == FromByAnimation || animationMode == ToAnimation || animationMode == ByAnimation)
+ && (fastHasAttribute(SVGNames::keyPointsAttr) && fastHasAttribute(SVGNames::keyTimesAttr) && (m_keyTimes.size() < 2 || m_keyTimes.size() != m_keyPoints.size())))
+ return;
if (animationMode == FromToAnimation)
m_animationValid = calculateFromAndToValues(from, to);
else if (animationMode == ToAnimation) {