Ejemplo n.º 1
0
void SVGSVGElement::collectStyleForPresentationAttribute(
    const QualifiedName& name,
    const AtomicString& value,
    MutableStylePropertySet* style) {
  SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
  if (property == m_x) {
    addPropertyToPresentationAttributeStyle(style, CSSPropertyX,
                                            m_x->cssValue());
  } else if (property == m_y) {
    addPropertyToPresentationAttributeStyle(style, CSSPropertyY,
                                            m_y->cssValue());
  } else if (isOutermostSVGSVGElement() &&
             (property == m_width || property == m_height)) {
    if (property == m_width) {
      addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth,
                                              m_width->cssValue());
    } else if (property == m_height) {
      addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight,
                                              m_height->cssValue());
    }
  } else {
    SVGGraphicsElement::collectStyleForPresentationAttribute(name, value,
                                                             style);
  }
}
Ejemplo n.º 2
0
void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value)
{
    if (SVGAnimatedPropertyBase* property = propertyFromAttribute(name)) {
        SVGParsingError parseError = property->setBaseValueAsString(value);
        reportAttributeParsingError(parseError, name, value);
        return;
    }

    if (name == HTMLNames::classAttr) {
        // SVG animation has currently requires special storage of values so we set
        // the className here. svgAttributeChanged actually causes the resulting
        // style updates (instead of Element::parseAttribute). We don't
        // tell Element about the change to avoid parsing the class list twice
        SVGParsingError parseError = m_className->setBaseValueAsString(value);
        reportAttributeParsingError(parseError, name, value);
    } else if (name == tabindexAttr) {
        Element::parseAttribute(name, oldValue, value);
    } else {
        // standard events
        const AtomicString& eventName = HTMLElement::eventNameForAttributeName(name);
        if (!eventName.isNull())
            setAttributeEventListener(eventName, createAttributeEventListener(this, name, value, eventParameterName()));
        else
            Element::parseAttribute(name, oldValue, value);
    }
}
Ejemplo n.º 3
0
void SVGRectElement::collectStyleForPresentationAttribute(
    const QualifiedName& name,
    const AtomicString& value,
    MutableStylePropertySet* style) {
  SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
  if (property == m_x)
    addPropertyToPresentationAttributeStyle(
        style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue());
  else if (property == m_y)
    addPropertyToPresentationAttributeStyle(
        style, CSSPropertyY, m_y->currentValue()->asCSSPrimitiveValue());
  else if (property == m_width)
    addPropertyToPresentationAttributeStyle(
        style, CSSPropertyWidth,
        m_width->currentValue()->asCSSPrimitiveValue());
  else if (property == m_height)
    addPropertyToPresentationAttributeStyle(
        style, CSSPropertyHeight,
        m_height->currentValue()->asCSSPrimitiveValue());
  else if (property == m_rx)
    addPropertyToPresentationAttributeStyle(
        style, CSSPropertyRx, m_rx->currentValue()->asCSSPrimitiveValue());
  else if (property == m_ry)
    addPropertyToPresentationAttributeStyle(
        style, CSSPropertyRy, m_ry->currentValue()->asCSSPrimitiveValue());
  else
    SVGGeometryElement::collectStyleForPresentationAttribute(name, value,
                                                             style);
}
Ejemplo n.º 4
0
void SVGUseElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
    SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
    if (property == m_x)
        addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue());
    else if (property == m_y)
        addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->currentValue()->asCSSPrimitiveValue());
    else
        SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
}
Ejemplo n.º 5
0
void SVGElement::applyActiveWebAnimations()
{
    ActiveInterpolationsMap activeInterpolationsMap = AnimationStack::activeInterpolations(
        &elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect::DefaultPriority, isSVGAttributeHandle);
    for (auto& entry : activeInterpolationsMap) {
        const QualifiedName& attribute = entry.key.svgAttribute();
        InterpolationEnvironment environment(*this, propertyFromAttribute(attribute)->baseValueBase());
        InvalidatableInterpolation::applyStack(entry.value, environment);
    }
    svgRareData()->setWebAnimatedAttributesDirty(false);
}
Ejemplo n.º 6
0
void SVGCircleElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
    SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
    if (property == m_cx)
        addPropertyToPresentationAttributeStyle(style, CSSPropertyCx, m_cx->currentValue()->asCSSPrimitiveValue());
    else if (property == m_cy)
        addPropertyToPresentationAttributeStyle(style, CSSPropertyCy, m_cy->currentValue()->asCSSPrimitiveValue());
    else if (property == m_r)
        addPropertyToPresentationAttributeStyle(style, CSSPropertyR, m_r->currentValue()->asCSSPrimitiveValue());
    else
        SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
}
Ejemplo n.º 7
0
void SVGPathElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
    SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
    if (property == m_path) {
        SVGAnimatedPath* path = this->path();
        // If this is a <use> instance, return the referenced path to maximize geometry sharing.
        if (const SVGElement* element = correspondingElement())
            path = toSVGPathElement(element)->path();
        addPropertyToPresentationAttributeStyle(style, CSSPropertyD, path->currentValue()->pathValue());
        return;
    }
    SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
}
Ejemplo n.º 8
0
void SVGElement::parseAttributeNew(const QualifiedName& name, const AtomicString& value)
{
    RefPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
    if (property) {
        SVGParsingError parseError = NoError;
        property->setBaseValueAsString(value, parseError);
        reportAttributeParsingError(parseError, name, value);

        return;
    }

    SVGElement::parseAttribute(name, value);
}
Ejemplo n.º 9
0
void SVGEllipseElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
    RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
    if (property == m_cx)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCx, *m_cx->currentValue());
    else if (property == m_cy)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCy, *m_cy->currentValue());
    else if (property == m_rx)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *m_rx->currentValue());
    else if (property == m_ry)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *m_ry->currentValue());
    else
        SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
}
Ejemplo n.º 10
0
void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
    RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
    if (property == m_x)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m_x->currentValue());
    else if (property == m_y)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m_y->currentValue());
    else if (property == m_width)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, *m_width->currentValue());
    else if (property == m_height)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, *m_height->currentValue());
    else if (property == m_rx)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, *m_rx->currentValue());
    else if (property == m_ry)
        addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, *m_ry->currentValue());
    else
        SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
}