Example #1
0
SVGPropertyBase* SVGLength::cloneForAnimation(const String& value) const
{
    SVGLength* length = create();
    length->m_unitMode = m_unitMode;

    if (length->setValueAsString(value) != SVGParseStatus::NoError)
        length->m_value = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::UserUnits);

    return length;
}
static void valueAsStringAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGLength.valueAsString._set");
    V8SVGPODTypeWrapper<SVGLength>* wrapper = V8SVGPODTypeWrapper<SVGLength>::toNative(info.Holder());
    SVGLength impInstance = *wrapper;
    SVGLength* imp = &impInstance;
    V8Parameter<WithNullCheck> v = value;
    imp->setValueAsString(v);
    wrapper->commitChange(*imp, V8Proxy::svgContext(wrapper));
    return;
}
Example #3
0
SVGParsingError SVGLengthList::parseInternal(const CharType*& ptr,
                                             const CharType* end) {
  const CharType* listStart = ptr;
  while (ptr < end) {
    const CharType* start = ptr;
    // TODO(shanmuga.m): Enable calc for SVGLengthList
    while (ptr < end && *ptr != ',' && !isHTMLSpace<CharType>(*ptr))
      ptr++;
    if (ptr == start)
      break;
    String valueString(start, ptr - start);
    if (valueString.isEmpty())
      break;

    SVGLength* length = SVGLength::create(m_mode);
    SVGParsingError lengthParseStatus = length->setValueAsString(valueString);
    if (lengthParseStatus != SVGParseStatus::NoError)
      return lengthParseStatus.offsetWith(start - listStart);
    append(length);
    skipOptionalSVGSpacesOrDelimiter(ptr, end);
  }
  return SVGParseStatus::NoError;
}