コード例 #1
0
void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName)
{
    if (attrName == SVGNames::azimuthAttr
        || attrName == SVGNames::elevationAttr
        || attrName == SVGNames::xAttr
        || attrName == SVGNames::yAttr
        || attrName == SVGNames::zAttr
        || attrName == SVGNames::pointsAtXAttr
        || attrName == SVGNames::pointsAtYAttr
        || attrName == SVGNames::pointsAtZAttr
        || attrName == SVGNames::specularExponentAttr
        || attrName == SVGNames::limitingConeAngleAttr) {
        ContainerNode* parent = parentNode();
        if (!parent)
            return;

        LayoutObject* layoutObject = parent->layoutObject();
        if (!layoutObject || !layoutObject->isSVGResourceFilterPrimitive())
            return;

        SVGElement::InvalidationGuard invalidationGuard(this);
        if (isSVGFEDiffuseLightingElement(*parent)) {
            toSVGFEDiffuseLightingElement(*parent).lightElementAttributeChanged(this, attrName);
            return;
        }
        if (isSVGFESpecularLightingElement(*parent)) {
            toSVGFESpecularLightingElement(*parent).lightElementAttributeChanged(this, attrName);
            return;
        }

        ASSERT_NOT_REACHED();
    }

    SVGElement::svgAttributeChanged(attrName);
}
コード例 #2
0
void RenderSVGResourceFilterPrimitive::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
    RenderSVGHiddenContainer::styleDidChange(diff, oldStyle);

    RenderObject* filter = parent();
    if (!filter)
        return;
    ASSERT(filter->isSVGResourceFilter());

    if (!oldStyle)
        return;

    const SVGRenderStyle* newStyle = this->style()->svgStyle();
    ASSERT(element());
    if (isSVGFEFloodElement(*element())) {
        if (newStyle->floodColor() != oldStyle->svgStyle()->floodColor())
            toRenderSVGResourceFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_colorAttr);
        if (newStyle->floodOpacity() != oldStyle->svgStyle()->floodOpacity())
            toRenderSVGResourceFilter(filter)->primitiveAttributeChanged(this, SVGNames::flood_opacityAttr);
    } else if (isSVGFEDiffuseLightingElement(*element()) || isSVGFESpecularLightingElement(*element())) {
        if (newStyle->lightingColor() != oldStyle->svgStyle()->lightingColor())
            toRenderSVGResourceFilter(filter)->primitiveAttributeChanged(this, SVGNames::lighting_colorAttr);
    }
}