void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute* attr) { if (attr->name() == SVGNames::transformAttr) { SVGTransformList* localTransforms = transformBaseValue(); ExceptionCode ec = 0; localTransforms->clear(ec); if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value())) localTransforms->clear(ec); else setTransformBaseValue(localTransforms); } else SVGStyledLocatableElement::parseMappedAttribute(attr); }
void SVGGradientElement::parseMappedAttribute(MappedAttribute* attr) { if (attr->name() == SVGNames::gradientUnitsAttr) { if (attr->value() == "userSpaceOnUse") setGradientUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); else if (attr->value() == "objectBoundingBox") setGradientUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); } else if (attr->name() == SVGNames::gradientTransformAttr) { SVGTransformList* gradientTransforms = gradientTransformBaseValue(); if (!SVGTransformable::parseTransformAttribute(gradientTransforms, attr->value())) { ExceptionCode ec = 0; gradientTransforms->clear(ec); } } else if (attr->name() == SVGNames::spreadMethodAttr) { if (attr->value() == "reflect") setSpreadMethodBaseValue(SpreadMethodReflect); else if (attr->value() == "repeat") setSpreadMethodBaseValue(SpreadMethodRepeat); else if (attr->value() == "pad") setSpreadMethodBaseValue(SpreadMethodPad); } else { if (SVGURIReference::parseMappedAttribute(attr)) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; SVGStyledElement::parseMappedAttribute(attr); } }
bool SVGTransformable::parseTransformAttribute(SVGTransformList& list, const UChar*& currTransform, const UChar* end, TransformParsingMode mode) { if (mode == ClearList) list.clear(); bool delimParsed = false; while (currTransform < end) { delimParsed = false; SVGTransform::SVGTransformType type = SVGTransform::SVG_TRANSFORM_UNKNOWN; skipOptionalSVGSpaces(currTransform, end); if (!parseAndSkipType(currTransform, end, type)) return false; SVGTransform transform; if (!parseTransformValue(type, currTransform, end, transform)) return false; list.append(transform); skipOptionalSVGSpaces(currTransform, end); if (currTransform < end && *currTransform == ',') { delimParsed = true; ++currTransform; } skipOptionalSVGSpaces(currTransform, end); } return !delimParsed; }
void SVGGradientElement::parseMappedAttribute(Attribute* attr) { if (attr->name() == SVGNames::gradientUnitsAttr) { if (attr->value() == "userSpaceOnUse") setGradientUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); else if (attr->value() == "objectBoundingBox") setGradientUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); } else if (attr->name() == SVGNames::gradientTransformAttr) { SVGTransformList newList; if (!SVGTransformable::parseTransformAttribute(newList, attr->value())) newList.clear(); detachAnimatedGradientTransformListWrappers(newList.size()); setGradientTransformBaseValue(newList); } else if (attr->name() == SVGNames::spreadMethodAttr) { if (attr->value() == "reflect") setSpreadMethodBaseValue(SpreadMethodReflect); else if (attr->value() == "repeat") setSpreadMethodBaseValue(SpreadMethodRepeat); else if (attr->value() == "pad") setSpreadMethodBaseValue(SpreadMethodPad); } else { if (SVGURIReference::parseMappedAttribute(attr)) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; SVGStyledElement::parseMappedAttribute(attr); } }
void SVGTextElement::parseMappedAttribute(MappedAttribute* attr) { if (attr->name() == SVGNames::transformAttr) { SVGTransformList* localTransforms = transformBaseValue(); ExceptionCode ec = 0; localTransforms->clear(ec); if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value())) localTransforms->clear(ec); else { setTransformBaseValue(localTransforms); if (renderer()) renderer()->setNeedsLayout(true); // should be in setTransformBaseValue } } else SVGTextPositioningElement::parseMappedAttribute(attr); }
void SVGStyledTransformableElement::parseMappedAttribute(Attribute* attr) { if (SVGTransformable::isKnownAttribute(attr->name())) { SVGTransformList newList; if (!SVGTransformable::parseTransformAttribute(newList, attr->value())) newList.clear(); detachAnimatedTransformListWrappers(newList.size()); setTransformBaseValue(newList); } else SVGStyledLocatableElement::parseMappedAttribute(attr); }
void SVGStyledTransformableElement::parseMappedAttribute(MappedAttribute* attr) { if (SVGTransformable::isKnownAttribute(attr->name())) { SVGTransformList* localTransforms = transformBaseValue(); if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value())) { ExceptionCode ec = 0; localTransforms->clear(ec); } } else SVGStyledLocatableElement::parseMappedAttribute(attr); }
void SVGTextElement::parseMappedAttribute(MappedAttribute *attr) { if (attr->name() == SVGNames::transformAttr) { SVGTransformList *localTransforms = transform()->baseVal(); localTransforms->clear(); SVGTransformable::parseTransformAttribute(localTransforms, attr->value()); updateLocalTransform(localTransforms); } else SVGTextPositioningElement::parseMappedAttribute(attr); }
JSValue* JSSVGTransformList::clear(ExecState* exec, const List&) { ExceptionCode ec = 0; SVGTransformList* imp = static_cast<SVGTransformList*>(impl()); imp->clear(ec); setDOMException(exec, ec); m_context->svgAttributeChanged(imp->associatedAttributeName()); return jsUndefined(); }
void SVGPatternElement::parseMappedAttribute(Attribute* attr) { if (attr->name() == SVGNames::patternUnitsAttr) { if (attr->value() == "userSpaceOnUse") setPatternUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); else if (attr->value() == "objectBoundingBox") setPatternUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); } else if (attr->name() == SVGNames::patternContentUnitsAttr) { if (attr->value() == "userSpaceOnUse") setPatternContentUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE); else if (attr->value() == "objectBoundingBox") setPatternContentUnitsBaseValue(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); } else if (attr->name() == SVGNames::patternTransformAttr) { SVGTransformList newList; if (!SVGTransformable::parseTransformAttribute(newList, attr->value())) newList.clear(); detachAnimatedPatternTransformListWrappers(newList.size()); setPatternTransformBaseValue(newList); } else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength(LengthModeWidth, attr->value())); else if (attr->name() == SVGNames::yAttr) setYBaseValue(SVGLength(LengthModeHeight, attr->value())); else if (attr->name() == SVGNames::widthAttr) { setWidthBaseValue(SVGLength(LengthModeWidth, attr->value())); if (widthBaseValue().value(this) < 0.0) document()->accessSVGExtensions()->reportError("A negative value for pattern attribute <width> is not allowed"); } else if (attr->name() == SVGNames::heightAttr) { setHeightBaseValue(SVGLength(LengthModeHeight, attr->value())); if (heightBaseValue().value(this) < 0.0) document()->accessSVGExtensions()->reportError("A negative value for pattern attribute <height> is not allowed"); } else { if (SVGURIReference::parseMappedAttribute(attr)) return; if (SVGTests::parseMappedAttribute(attr)) return; if (SVGLangSpace::parseMappedAttribute(attr)) return; if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return; if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) return; SVGStyledElement::parseMappedAttribute(attr); } }
JSValue* JSSVGTransformListPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSSVGTransformList::info)) return throwError(exec, TypeError); SVGTransformList* imp = static_cast<SVGTransformList*>(static_cast<JSSVGTransformList*>(thisObj)->impl()); switch (id) { case JSSVGTransformList::ClearFuncNum: { ExceptionCode ec = 0; imp->clear(ec); setDOMException(exec, ec); return jsUndefined(); } case JSSVGTransformList::InitializeFuncNum: { ExceptionCode ec = 0; SVGTransform item = toSVGTransform(args[0]); KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->initialize(item, ec))); setDOMException(exec, ec); return result; } case JSSVGTransformList::GetItemFuncNum: { ExceptionCode ec = 0; bool indexOk; unsigned index = args[0]->toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->getItem(index, ec))); setDOMException(exec, ec); return result; } case JSSVGTransformList::InsertItemBeforeFuncNum: { ExceptionCode ec = 0; SVGTransform item = toSVGTransform(args[0]); bool indexOk; unsigned index = args[1]->toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->insertItemBefore(item, index, ec))); setDOMException(exec, ec); return result; } case JSSVGTransformList::ReplaceItemFuncNum: { ExceptionCode ec = 0; SVGTransform item = toSVGTransform(args[0]); bool indexOk; unsigned index = args[1]->toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->replaceItem(item, index, ec))); setDOMException(exec, ec); return result; } case JSSVGTransformList::RemoveItemFuncNum: { ExceptionCode ec = 0; bool indexOk; unsigned index = args[0]->toInt32(exec, indexOk); if (!indexOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->removeItem(index, ec))); setDOMException(exec, ec); return result; } case JSSVGTransformList::AppendItemFuncNum: { ExceptionCode ec = 0; SVGTransform item = toSVGTransform(args[0]); KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->appendItem(item, ec))); setDOMException(exec, ec); return result; } case JSSVGTransformList::CreateSVGTransformFromMatrixFuncNum: { AffineTransform matrix = toSVGMatrix(args[0]); KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->createSVGTransformFromMatrix(matrix))); return result; } case JSSVGTransformList::ConsolidateFuncNum: { KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGTransform>(imp->consolidate())); return result; } } return 0; }