2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
#include "nsSMILParserUtils.h"
|
2013-11-25 23:46:20 +04:00
|
|
|
#include "nsSMILKeySpline.h"
|
2009-01-15 07:38:07 +03:00
|
|
|
#include "nsISMILAttr.h"
|
|
|
|
#include "nsSMILValue.h"
|
|
|
|
#include "nsSMILTimeValue.h"
|
2010-01-12 23:00:49 +03:00
|
|
|
#include "nsSMILTimeValueSpecParams.h"
|
2009-01-15 07:38:07 +03:00
|
|
|
#include "nsSMILTypes.h"
|
|
|
|
#include "nsSMILRepeatCount.h"
|
2010-01-12 23:00:49 +03:00
|
|
|
#include "nsContentUtils.h"
|
2010-05-04 18:43:48 +04:00
|
|
|
#include "nsCharSeparatedTokenizer.h"
|
2013-11-25 23:46:20 +04:00
|
|
|
#include "SVGContentUtils.h"
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
using namespace mozilla;
|
2013-03-19 07:18:45 +04:00
|
|
|
using namespace mozilla::dom;
|
2009-01-15 07:38:07 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2010-01-12 23:00:49 +03:00
|
|
|
// Helper functions and Constants
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint32_t MSEC_PER_SEC = 1000;
|
|
|
|
const uint32_t MSEC_PER_MIN = 1000 * 60;
|
|
|
|
const uint32_t MSEC_PER_HOUR = 1000 * 60 * 60;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2010-08-28 10:41:05 +04:00
|
|
|
#define ACCESSKEY_PREFIX_LC NS_LITERAL_STRING("accesskey(") // SMIL2+
|
|
|
|
#define ACCESSKEY_PREFIX_CC NS_LITERAL_STRING("accessKey(") // SVG/SMIL ANIM
|
2010-01-12 23:00:49 +03:00
|
|
|
#define REPEAT_PREFIX NS_LITERAL_STRING("repeat(")
|
|
|
|
#define WALLCLOCK_PREFIX NS_LITERAL_STRING("wallclock(")
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool
|
2014-01-04 19:02:17 +04:00
|
|
|
SkipWhitespace(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
while (aIter != aEnd) {
|
|
|
|
if (!IsSVGWhitespace(*aIter)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
++aIter;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
inline bool
|
2014-01-04 19:02:17 +04:00
|
|
|
ParseColon(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd)
|
2010-01-12 23:00:49 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
if (aIter == aEnd || *aIter != ':') {
|
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
++aIter;
|
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
/*
|
|
|
|
* Exactly two digits in the range 00 - 59 are expected.
|
|
|
|
*/
|
|
|
|
bool
|
2014-01-04 19:02:17 +04:00
|
|
|
ParseSecondsOrMinutes(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd,
|
2013-11-25 23:46:20 +04:00
|
|
|
uint32_t& aValue)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
if (aIter == aEnd || !SVGContentUtils::IsDigit(*aIter)) {
|
|
|
|
return false;
|
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> iter(aIter);
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (++iter == aEnd || !SVGContentUtils::IsDigit(*iter)) {
|
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
uint32_t value = 10 * SVGContentUtils::DecimalDigitValue(*aIter) +
|
|
|
|
SVGContentUtils::DecimalDigitValue(*iter);
|
|
|
|
if (value > 59) {
|
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
if (++iter != aEnd && SVGContentUtils::IsDigit(*iter)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2013-11-25 23:46:20 +04:00
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
aValue = value;
|
|
|
|
aIter = iter;
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool
|
2014-01-04 19:02:17 +04:00
|
|
|
ParseClockMetric(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd,
|
2013-11-25 23:46:20 +04:00
|
|
|
uint32_t& aMultiplier)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
if (aIter == aEnd) {
|
|
|
|
aMultiplier = MSEC_PER_SEC;
|
|
|
|
return true;
|
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
switch (*aIter) {
|
|
|
|
case 'h':
|
|
|
|
if (++aIter == aEnd) {
|
|
|
|
aMultiplier = MSEC_PER_HOUR;
|
|
|
|
return true;
|
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2013-11-25 23:46:20 +04:00
|
|
|
case 'm':
|
|
|
|
{
|
|
|
|
const nsAString& metric = Substring(aIter.get(), aEnd.get());
|
|
|
|
if (metric.EqualsLiteral("min")) {
|
|
|
|
aMultiplier = MSEC_PER_MIN;
|
|
|
|
aIter = aEnd;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (metric.EqualsLiteral("ms")) {
|
|
|
|
aMultiplier = 1;
|
|
|
|
aIter = aEnd;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case 's':
|
|
|
|
if (++aIter == aEnd) {
|
|
|
|
aMultiplier = MSEC_PER_SEC;
|
|
|
|
return true;
|
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
/**
|
|
|
|
* See http://www.w3.org/TR/SVG/animate.html#ClockValueSyntax
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2014-01-04 19:02:17 +04:00
|
|
|
ParseClockValue(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd,
|
2013-11-25 23:46:20 +04:00
|
|
|
nsSMILTimeValue* aResult)
|
2010-01-12 23:00:49 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
if (aIter == aEnd) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2013-11-25 23:46:20 +04:00
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
// TIMECOUNT_VALUE ::= Timecount ("." Fraction)? (Metric)?
|
|
|
|
// PARTIAL_CLOCK_VALUE ::= Minutes ":" Seconds ("." Fraction)?
|
|
|
|
// FULL_CLOCK_VALUE ::= Hours ":" Minutes ":" Seconds ("." Fraction)?
|
|
|
|
enum ClockType {
|
|
|
|
TIMECOUNT_VALUE,
|
|
|
|
PARTIAL_CLOCK_VALUE,
|
|
|
|
FULL_CLOCK_VALUE
|
|
|
|
};
|
|
|
|
|
|
|
|
int32_t clockType = TIMECOUNT_VALUE;
|
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> iter(aIter);
|
2013-11-25 23:46:20 +04:00
|
|
|
|
|
|
|
// Determine which type of clock value we have by counting the number
|
|
|
|
// of colons in the string.
|
|
|
|
do {
|
|
|
|
switch (*iter) {
|
|
|
|
case ':':
|
|
|
|
if (clockType == FULL_CLOCK_VALUE) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
++clockType;
|
|
|
|
break;
|
|
|
|
case 'e':
|
|
|
|
case 'E':
|
|
|
|
case '-':
|
|
|
|
case '+':
|
|
|
|
// Exclude anything invalid (for clock values)
|
|
|
|
// that number parsing might otherwise allow.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
++iter;
|
|
|
|
} while (iter != aEnd);
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
iter = aIter;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
int32_t hours = 0, timecount;
|
|
|
|
double fraction = 0.0;
|
|
|
|
uint32_t minutes, seconds, multiplier;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
switch (clockType) {
|
|
|
|
case FULL_CLOCK_VALUE:
|
|
|
|
if (!SVGContentUtils::ParseInteger(iter, aEnd, hours) ||
|
|
|
|
!ParseColon(iter, aEnd)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// intentional fall through
|
|
|
|
case PARTIAL_CLOCK_VALUE:
|
|
|
|
if (!ParseSecondsOrMinutes(iter, aEnd, minutes) ||
|
|
|
|
!ParseColon(iter, aEnd) ||
|
|
|
|
!ParseSecondsOrMinutes(iter, aEnd, seconds)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (iter != aEnd &&
|
|
|
|
(*iter != '.' ||
|
|
|
|
!SVGContentUtils::ParseNumber(iter, aEnd, fraction))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aResult->SetMillis(nsSMILTime(hours) * MSEC_PER_HOUR +
|
|
|
|
minutes * MSEC_PER_MIN +
|
|
|
|
seconds * MSEC_PER_SEC +
|
|
|
|
NS_round(fraction * MSEC_PER_SEC));
|
|
|
|
aIter = iter;
|
|
|
|
return true;
|
|
|
|
case TIMECOUNT_VALUE:
|
|
|
|
if (!SVGContentUtils::ParseInteger(iter, aEnd, timecount)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (iter != aEnd && *iter == '.' &&
|
|
|
|
!SVGContentUtils::ParseNumber(iter, aEnd, fraction)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!ParseClockMetric(iter, aEnd, multiplier)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aResult->SetMillis(nsSMILTime(timecount) * multiplier +
|
|
|
|
NS_round(fraction * multiplier));
|
|
|
|
aIter = iter;
|
|
|
|
return true;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2014-01-04 19:02:17 +04:00
|
|
|
ParseOffsetValue(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd,
|
2013-11-25 23:46:20 +04:00
|
|
|
nsSMILTimeValue* aResult)
|
2010-01-12 23:00:49 +03:00
|
|
|
{
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> iter(aIter);
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
int32_t sign;
|
|
|
|
if (!SVGContentUtils::ParseOptionalSign(iter, aEnd, sign) ||
|
|
|
|
!SkipWhitespace(iter, aEnd) ||
|
|
|
|
!ParseClockValue(iter, aEnd, aResult)) {
|
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
if (sign == -1) {
|
|
|
|
aResult->SetMillis(-aResult->GetMillis());
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
aIter = iter;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ParseOffsetValue(const nsAString& aSpec,
|
|
|
|
nsSMILTimeValue* aResult)
|
|
|
|
{
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> iter(SVGContentUtils::GetStartRangedPtr(aSpec));
|
|
|
|
const RangedPtr<const char16_t> end(SVGContentUtils::GetEndRangedPtr(aSpec));
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return ParseOffsetValue(iter, end, aResult) && iter == end;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2014-01-04 19:02:17 +04:00
|
|
|
ParseOptionalOffset(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd,
|
2013-11-25 23:46:20 +04:00
|
|
|
nsSMILTimeValue* aResult)
|
2010-01-12 23:00:49 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
if (aIter == aEnd) {
|
|
|
|
aResult->SetMillis(0L);
|
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return SkipWhitespace(aIter, aEnd) &&
|
|
|
|
ParseOffsetValue(aIter, aEnd, aResult);
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2010-01-12 23:00:49 +03:00
|
|
|
ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult)
|
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) ||
|
|
|
|
StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC),
|
|
|
|
"Calling ParseAccessKey on non-accesskey-type spec");
|
2010-01-12 23:00:49 +03:00
|
|
|
|
|
|
|
nsSMILTimeValueSpecParams result;
|
|
|
|
result.mType = nsSMILTimeValueSpecParams::ACCESSKEY;
|
|
|
|
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(),
|
|
|
|
"Case variations for accesskey prefix differ in length");
|
2013-11-25 23:46:20 +04:00
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> iter(SVGContentUtils::GetStartRangedPtr(aSpec));
|
|
|
|
RangedPtr<const char16_t> end(SVGContentUtils::GetEndRangedPtr(aSpec));
|
2013-11-25 23:46:20 +04:00
|
|
|
|
|
|
|
iter += ACCESSKEY_PREFIX_LC.Length();
|
2010-01-12 23:00:49 +03:00
|
|
|
|
|
|
|
// Expecting at least <accesskey> + ')'
|
2013-11-25 23:46:20 +04:00
|
|
|
if (end - iter < 2)
|
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
uint32_t c = *iter++;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
|
|
|
// Process 32-bit codepoints
|
|
|
|
if (NS_IS_HIGH_SURROGATE(c)) {
|
2013-11-25 23:46:20 +04:00
|
|
|
if (end - iter < 2) // Expecting at least low-surrogate + ')'
|
|
|
|
return false;
|
|
|
|
uint32_t lo = *iter++;
|
2010-01-12 23:00:49 +03:00
|
|
|
if (!NS_IS_LOW_SURROGATE(lo))
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
c = SURROGATE_TO_UCS4(c, lo);
|
|
|
|
// XML 1.1 says that 0xFFFE and 0xFFFF are not valid characters
|
|
|
|
} else if (NS_IS_LOW_SURROGATE(c) || c == 0xFFFE || c == 0xFFFF) {
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
result.mRepeatIterationOrAccessKey = c;
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (*iter++ != ')')
|
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (!ParseOptionalOffset(iter, end, &result.mOffset) || iter != end) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
aResult = result;
|
2013-11-25 23:46:20 +04:00
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
void
|
2014-01-04 19:02:17 +04:00
|
|
|
MoveToNextToken(RangedPtr<const char16_t>& aIter,
|
|
|
|
const RangedPtr<const char16_t>& aEnd,
|
2013-11-25 23:46:20 +04:00
|
|
|
bool aBreakOnDot,
|
|
|
|
bool& aIsAnyCharEscaped)
|
2010-01-12 23:00:49 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
aIsAnyCharEscaped = false;
|
|
|
|
|
|
|
|
bool isCurrentCharEscaped = false;
|
|
|
|
|
|
|
|
while (aIter != aEnd && !IsSVGWhitespace(*aIter)) {
|
|
|
|
if (isCurrentCharEscaped) {
|
|
|
|
isCurrentCharEscaped = false;
|
|
|
|
} else {
|
|
|
|
if (*aIter == '+' || *aIter == '-' ||
|
|
|
|
(aBreakOnDot && *aIter == '.')) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (*aIter == '\\') {
|
|
|
|
isCurrentCharEscaped = true;
|
|
|
|
aIsAnyCharEscaped = true;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
++aIter;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
already_AddRefed<nsIAtom>
|
|
|
|
ConvertUnescapedTokenToAtom(const nsAString& aToken)
|
|
|
|
{
|
|
|
|
// Whether the token is an id-ref or event-symbol it should be a valid NCName
|
|
|
|
if (aToken.IsEmpty() || NS_FAILED(nsContentUtils::CheckQName(aToken, false)))
|
|
|
|
return nullptr;
|
|
|
|
return do_GetAtom(aToken);
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsIAtom>
|
|
|
|
ConvertTokenToAtom(const nsAString& aToken,
|
|
|
|
bool aUnescapeToken)
|
2010-01-12 23:00:49 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
// Unescaping involves making a copy of the string which we'd like to avoid if possible
|
|
|
|
if (!aUnescapeToken) {
|
|
|
|
return ConvertUnescapedTokenToAtom(aToken);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString token(aToken);
|
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t* read = token.BeginReading();
|
|
|
|
const char16_t* const end = token.EndReading();
|
|
|
|
char16_t* write = token.BeginWriting();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool escape = false;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
|
|
|
while (read != end) {
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(write <= read, "Writing past where we've read");
|
2010-01-12 23:00:49 +03:00
|
|
|
if (!escape && *read == '\\') {
|
2011-10-17 18:59:28 +04:00
|
|
|
escape = true;
|
2010-01-12 23:00:49 +03:00
|
|
|
++read;
|
|
|
|
} else {
|
|
|
|
*write++ = *read++;
|
2011-10-17 18:59:28 +04:00
|
|
|
escape = false;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
token.Truncate(write - token.BeginReading());
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return ConvertUnescapedTokenToAtom(token);
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2010-01-12 23:00:49 +03:00
|
|
|
ParseElementBaseTimeValueSpec(const nsAString& aSpec,
|
|
|
|
nsSMILTimeValueSpecParams& aResult)
|
|
|
|
{
|
|
|
|
nsSMILTimeValueSpecParams result;
|
|
|
|
|
|
|
|
//
|
|
|
|
// The spec will probably look something like one of these
|
|
|
|
//
|
|
|
|
// element-name.begin
|
|
|
|
// element-name.event-name
|
|
|
|
// event-name
|
|
|
|
// element-name.repeat(3)
|
|
|
|
// event\.name
|
|
|
|
//
|
2010-08-18 14:20:24 +04:00
|
|
|
// Technically `repeat(3)' is permitted but the behaviour in this case is not
|
|
|
|
// defined (for SMIL Animation) so we don't support it here.
|
|
|
|
//
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> start(SVGContentUtils::GetStartRangedPtr(aSpec));
|
|
|
|
RangedPtr<const char16_t> end(SVGContentUtils::GetEndRangedPtr(aSpec));
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (start == end) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> tokenEnd(start);
|
2013-11-25 23:46:20 +04:00
|
|
|
|
|
|
|
bool requiresUnescaping;
|
|
|
|
MoveToNextToken(tokenEnd, end, true, requiresUnescaping);
|
|
|
|
|
|
|
|
nsRefPtr<nsIAtom> atom =
|
|
|
|
ConvertTokenToAtom(Substring(start.get(), tokenEnd.get()),
|
|
|
|
requiresUnescaping);
|
|
|
|
if (atom == nullptr) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
|
|
|
|
// Parse the second token if there is one
|
2013-11-25 23:46:20 +04:00
|
|
|
if (tokenEnd != end && *tokenEnd == '.') {
|
|
|
|
result.mDependentElemID = atom;
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
++tokenEnd;
|
|
|
|
start = tokenEnd;
|
|
|
|
MoveToNextToken(tokenEnd, end, false, requiresUnescaping);
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
const nsAString& token2 = Substring(start.get(), tokenEnd.get());
|
2010-01-12 23:00:49 +03:00
|
|
|
|
|
|
|
// element-name.begin
|
2013-11-25 23:46:20 +04:00
|
|
|
if (token2.EqualsLiteral("begin")) {
|
2010-01-12 23:00:49 +03:00
|
|
|
result.mType = nsSMILTimeValueSpecParams::SYNCBASE;
|
2011-10-17 18:59:28 +04:00
|
|
|
result.mSyncBegin = true;
|
2010-01-12 23:00:49 +03:00
|
|
|
// element-name.end
|
2013-11-25 23:46:20 +04:00
|
|
|
} else if (token2.EqualsLiteral("end")) {
|
2010-01-12 23:00:49 +03:00
|
|
|
result.mType = nsSMILTimeValueSpecParams::SYNCBASE;
|
2011-10-17 18:59:28 +04:00
|
|
|
result.mSyncBegin = false;
|
2010-01-12 23:00:49 +03:00
|
|
|
// element-name.repeat(digit+)
|
2013-11-25 23:46:20 +04:00
|
|
|
} else if (StringBeginsWith(token2, REPEAT_PREFIX)) {
|
|
|
|
start += REPEAT_PREFIX.Length();
|
|
|
|
int32_t repeatValue;
|
|
|
|
if (start == tokenEnd || *start == '+' || *start == '-' ||
|
|
|
|
!SVGContentUtils::ParseInteger(start, tokenEnd, repeatValue)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (start == tokenEnd || *start != ')') {
|
|
|
|
return false;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
result.mType = nsSMILTimeValueSpecParams::REPEAT;
|
2013-11-25 23:46:20 +04:00
|
|
|
result.mRepeatIterationOrAccessKey = repeatValue;
|
2010-01-12 23:00:49 +03:00
|
|
|
// element-name.event-symbol
|
|
|
|
} else {
|
2013-11-25 23:46:20 +04:00
|
|
|
atom = ConvertTokenToAtom(token2, requiresUnescaping);
|
|
|
|
if (atom == nullptr) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-01-12 23:00:49 +03:00
|
|
|
result.mType = nsSMILTimeValueSpecParams::EVENT;
|
2013-11-25 23:46:20 +04:00
|
|
|
result.mEventSymbol = atom;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// event-symbol
|
|
|
|
result.mType = nsSMILTimeValueSpecParams::EVENT;
|
2013-11-25 23:46:20 +04:00
|
|
|
result.mEventSymbol = atom;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// We've reached the end of the token, so we should now be either looking at
|
2013-11-25 23:46:20 +04:00
|
|
|
// a '+', '-' (possibly with whitespace before it), or the end.
|
|
|
|
if (!ParseOptionalOffset(tokenEnd, end, &result.mOffset) || tokenEnd != end) {
|
|
|
|
return false;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
aResult = result;
|
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2009-01-15 07:38:07 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
const nsDependentSubstring
|
|
|
|
nsSMILParserUtils::TrimWhitespace(const nsAString& aString)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
nsAString::const_iterator start, end;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
aString.BeginReading(start);
|
|
|
|
aString.EndReading(end);
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
// Skip whitespace characters at the beginning
|
|
|
|
while (start != end && IsSVGWhitespace(*start)) {
|
|
|
|
++start;
|
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
// Skip whitespace characters at the end.
|
|
|
|
while (end != start) {
|
|
|
|
--end;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (!IsSVGWhitespace(*end)) {
|
|
|
|
// Step back to the last non-whitespace character.
|
|
|
|
++end;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return Substring(start, end);
|
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
|
|
|
nsSMILParserUtils::ParseKeySplines(const nsAString& aSpec,
|
|
|
|
FallibleTArray<nsSMILKeySpline>& aKeySplines)
|
|
|
|
{
|
|
|
|
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> controlPointTokenizer(aSpec, ';');
|
|
|
|
while (controlPointTokenizer.hasMoreTokens()) {
|
|
|
|
|
|
|
|
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
|
|
|
|
tokenizer(controlPointTokenizer.nextToken(), ',',
|
|
|
|
nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
|
|
|
|
|
|
|
|
double values[4];
|
|
|
|
for (int i = 0 ; i < 4; i++) {
|
|
|
|
if (!tokenizer.hasMoreTokens() ||
|
|
|
|
!SVGContentUtils::ParseNumber(tokenizer.nextToken(), values[i]) ||
|
|
|
|
values[i] > 1.0 || values[i] < 0.0) {
|
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
if (tokenizer.hasMoreTokens() ||
|
|
|
|
tokenizer.separatorAfterCurrentToken() ||
|
|
|
|
!aKeySplines.AppendElement(nsSMILKeySpline(values[0],
|
|
|
|
values[1],
|
|
|
|
values[2],
|
2015-05-28 21:07:44 +03:00
|
|
|
values[3]),
|
|
|
|
fallible)) {
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return !aKeySplines.IsEmpty();
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2010-04-29 03:00:54 +04:00
|
|
|
nsSMILParserUtils::ParseSemicolonDelimitedProgressList(const nsAString& aSpec,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aNonDecreasing,
|
2013-11-25 23:46:20 +04:00
|
|
|
FallibleTArray<double>& aArray)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> tokenizer(aSpec, ';');
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
double previousValue = -1.0;
|
|
|
|
|
2013-09-05 16:08:47 +04:00
|
|
|
while (tokenizer.hasMoreTokens()) {
|
2013-11-25 23:46:20 +04:00
|
|
|
double value;
|
|
|
|
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), value)) {
|
|
|
|
return false;
|
2013-09-05 16:08:47 +04:00
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2010-04-29 03:00:54 +04:00
|
|
|
if (value > 1.0 || value < 0.0 ||
|
|
|
|
(aNonDecreasing && value < previousValue)) {
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2015-05-28 21:07:44 +03:00
|
|
|
if (!aArray.AppendElement(value, fallible)) {
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
previousValue = value;
|
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return !aArray.IsEmpty();
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2010-04-29 03:00:53 +04:00
|
|
|
// Helper class for ParseValues
|
2013-11-25 23:46:20 +04:00
|
|
|
class MOZ_STACK_CLASS SMILValueParser :
|
|
|
|
public nsSMILParserUtils::GenericValueParser
|
2010-04-29 03:00:53 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-03-19 07:18:45 +04:00
|
|
|
SMILValueParser(const SVGAnimationElement* aSrcElement,
|
2010-04-29 03:00:53 +04:00
|
|
|
const nsISMILAttr* aSMILAttr,
|
2013-11-25 23:46:20 +04:00
|
|
|
FallibleTArray<nsSMILValue>* aValuesArray,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* aPreventCachingOfSandwich) :
|
2010-04-29 03:00:53 +04:00
|
|
|
mSrcElement(aSrcElement),
|
|
|
|
mSMILAttr(aSMILAttr),
|
|
|
|
mValuesArray(aValuesArray),
|
2010-06-24 04:30:55 +04:00
|
|
|
mPreventCachingOfSandwich(aPreventCachingOfSandwich)
|
2010-04-29 03:00:53 +04:00
|
|
|
{}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool Parse(const nsAString& aValueStr) override {
|
2010-04-29 03:00:53 +04:00
|
|
|
nsSMILValue newValue;
|
2012-02-13 22:24:51 +04:00
|
|
|
bool tmpPreventCachingOfSandwich = false;
|
2013-11-25 23:46:20 +04:00
|
|
|
if (NS_FAILED(mSMILAttr->ValueFromString(aValueStr, mSrcElement, newValue,
|
|
|
|
tmpPreventCachingOfSandwich)))
|
|
|
|
return false;
|
2010-04-29 03:00:53 +04:00
|
|
|
|
2015-05-28 21:07:44 +03:00
|
|
|
if (!mValuesArray->AppendElement(newValue, fallible)) {
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2010-04-29 03:00:53 +04:00
|
|
|
}
|
2010-06-24 04:30:55 +04:00
|
|
|
if (tmpPreventCachingOfSandwich) {
|
2011-10-17 18:59:28 +04:00
|
|
|
*mPreventCachingOfSandwich = true;
|
2010-04-29 03:00:53 +04:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
return true;
|
2010-04-29 03:00:53 +04:00
|
|
|
}
|
|
|
|
protected:
|
2013-03-19 07:18:45 +04:00
|
|
|
const SVGAnimationElement* mSrcElement;
|
2010-04-29 03:00:53 +04:00
|
|
|
const nsISMILAttr* mSMILAttr;
|
2013-11-25 23:46:20 +04:00
|
|
|
FallibleTArray<nsSMILValue>* mValuesArray;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* mPreventCachingOfSandwich;
|
2010-04-29 03:00:53 +04:00
|
|
|
};
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2009-01-15 07:38:07 +03:00
|
|
|
nsSMILParserUtils::ParseValues(const nsAString& aSpec,
|
2013-03-19 07:18:45 +04:00
|
|
|
const SVGAnimationElement* aSrcElement,
|
2009-07-15 22:33:31 +04:00
|
|
|
const nsISMILAttr& aAttribute,
|
2013-11-25 23:46:20 +04:00
|
|
|
FallibleTArray<nsSMILValue>& aValuesArray,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool& aPreventCachingOfSandwich)
|
2010-04-29 03:00:53 +04:00
|
|
|
{
|
|
|
|
// Assume all results can be cached, until we find one that can't.
|
2011-10-17 18:59:28 +04:00
|
|
|
aPreventCachingOfSandwich = false;
|
2010-04-29 03:00:53 +04:00
|
|
|
SMILValueParser valueParser(aSrcElement, &aAttribute,
|
2010-06-24 04:30:55 +04:00
|
|
|
&aValuesArray, &aPreventCachingOfSandwich);
|
2010-04-29 03:00:53 +04:00
|
|
|
return ParseValuesGeneric(aSpec, valueParser);
|
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2010-04-29 03:00:53 +04:00
|
|
|
nsSMILParserUtils::ParseValuesGeneric(const nsAString& aSpec,
|
|
|
|
GenericValueParser& aParser)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> tokenizer(aSpec, ';');
|
2010-05-04 18:43:48 +04:00
|
|
|
if (!tokenizer.hasMoreTokens()) { // Empty list
|
2013-11-25 23:46:20 +04:00
|
|
|
return false;
|
2010-05-04 18:43:48 +04:00
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2010-05-04 18:43:48 +04:00
|
|
|
while (tokenizer.hasMoreTokens()) {
|
2013-11-25 23:46:20 +04:00
|
|
|
if (!aParser.Parse(tokenizer.nextToken())) {
|
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
2010-05-04 18:43:48 +04:00
|
|
|
}
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return true;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2009-01-15 07:38:07 +03:00
|
|
|
nsSMILParserUtils::ParseRepeatCount(const nsAString& aSpec,
|
|
|
|
nsSMILRepeatCount& aResult)
|
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
const nsAString& spec =
|
|
|
|
nsSMILParserUtils::TrimWhitespace(aSpec);
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (spec.EqualsLiteral("indefinite")) {
|
|
|
|
aResult.SetIndefinite();
|
|
|
|
return true;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
double value;
|
|
|
|
if (!SVGContentUtils::ParseNumber(spec, value) || value <= 0.0) {
|
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
aResult = value;
|
|
|
|
return true;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2010-01-12 23:00:49 +03:00
|
|
|
nsSMILParserUtils::ParseTimeValueSpecParams(const nsAString& aSpec,
|
|
|
|
nsSMILTimeValueSpecParams& aResult)
|
|
|
|
{
|
2013-11-25 23:46:20 +04:00
|
|
|
const nsAString& spec = TrimWhitespace(aSpec);
|
2010-01-12 23:00:49 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
if (spec.EqualsLiteral("indefinite")) {
|
|
|
|
aResult.mType = nsSMILTimeValueSpecParams::INDEFINITE;
|
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
2013-11-25 23:46:20 +04:00
|
|
|
|
|
|
|
// offset type
|
|
|
|
if (ParseOffsetValue(spec, &aResult.mOffset)) {
|
|
|
|
aResult.mType = nsSMILTimeValueSpecParams::OFFSET;
|
|
|
|
return true;
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// wallclock type
|
2013-11-25 23:46:20 +04:00
|
|
|
if (StringBeginsWith(spec, WALLCLOCK_PREFIX)) {
|
|
|
|
return false; // Wallclock times not implemented
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// accesskey type
|
2013-11-25 23:46:20 +04:00
|
|
|
if (StringBeginsWith(spec, ACCESSKEY_PREFIX_LC) ||
|
|
|
|
StringBeginsWith(spec, ACCESSKEY_PREFIX_CC)) {
|
|
|
|
return ParseAccessKey(spec, aResult);
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// event, syncbase, or repeat
|
2013-11-25 23:46:20 +04:00
|
|
|
return ParseElementBaseTimeValueSpec(spec, aResult);
|
2010-01-12 23:00:49 +03:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
bool
|
2009-01-15 07:38:07 +03:00
|
|
|
nsSMILParserUtils::ParseClockValue(const nsAString& aSpec,
|
2013-11-25 23:46:20 +04:00
|
|
|
nsSMILTimeValue* aResult)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
2014-01-04 19:02:17 +04:00
|
|
|
RangedPtr<const char16_t> iter(SVGContentUtils::GetStartRangedPtr(aSpec));
|
|
|
|
RangedPtr<const char16_t> end(SVGContentUtils::GetEndRangedPtr(aSpec));
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2013-11-25 23:46:20 +04:00
|
|
|
return ::ParseClockValue(iter, end, aResult) && iter == end;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t
|
2009-10-03 01:37:25 +04:00
|
|
|
nsSMILParserUtils::CheckForNegativeNumber(const nsAString& aStr)
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t absValLocation = -1;
|
2009-10-03 01:37:25 +04:00
|
|
|
|
|
|
|
nsAString::const_iterator start, end;
|
|
|
|
aStr.BeginReading(start);
|
|
|
|
aStr.EndReading(end);
|
|
|
|
|
|
|
|
// Skip initial whitespace
|
2013-11-25 23:46:20 +04:00
|
|
|
while (start != end && IsSVGWhitespace(*start)) {
|
|
|
|
++start;
|
|
|
|
}
|
2009-10-03 01:37:25 +04:00
|
|
|
|
|
|
|
// Check for dash
|
|
|
|
if (start != end && *start == '-') {
|
|
|
|
++start;
|
|
|
|
// Check for numeric character
|
2013-11-25 23:46:20 +04:00
|
|
|
if (start != end && SVGContentUtils::IsDigit(*start)) {
|
2009-10-03 01:37:25 +04:00
|
|
|
absValLocation = start.get() - start.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return absValLocation;
|
|
|
|
}
|