void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) { if (SVGURIReference::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); buildPendingResource(); return; } SVGElement::svgAttributeChanged(attrName); }
void SVGGElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (auto renderer = this->renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); }
void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName) { if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::resultAttr) { SVGElement::InvalidationGuard invalidationGuard(this); invalidate(); return; } SVGElement::svgAttributeChanged(attrName); }
void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) { bool isLengthAttribute = attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr; if (isLengthAttribute || attrName == SVGNames::preserveAspectRatioAttr) { SVGElement::InvalidationGuard invalidationGuard(this); if (isLengthAttribute) { invalidateSVGPresentationAttributeStyle(); setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::fromAttribute(attrName)); updateRelativeLengthsInformation(); } LayoutObject* object = this->layoutObject(); if (!object) return; // FIXME: if isLengthAttribute then we should avoid this // call if the viewport didn't change, however since we don't // have the computed style yet we can't use updateImageViewport. // See http://crbug.com/466200. markForLayoutAndParentResourceInvalidation(object); return; } if (SVGURIReference::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); if (inDocument()) imageLoader().updateFromElement(ImageLoader::UpdateIgnorePreviousError); else m_needsLoaderURIUpdate = true; return; } SVGGraphicsElement::svgAttributeChanged(attrName); }
void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) { // Reattach so the isValid() check will be run again during layoutObject creation. if (SVGTests::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); lazyReattachIfAttached(); return; } if (attrName == SVGNames::transformAttr) { LayoutObject* object = layoutObject(); if (!object) return; SVGElement::InvalidationGuard invalidationGuard(this); object->setNeedsTransformUpdate(); markForLayoutAndParentResourceInvalidation(object); return; } SVGElement::svgAttributeChanged(attrName); }
void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElement::InvalidationGuard invalidationGuard(this); RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); if (renderer) renderer->invalidateCacheAndMarkForLayout(); }
void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName) { if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) { SVGElement::InvalidationGuard invalidationGuard(this); invalidate(); return; } SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); }
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElement::InvalidationGuard invalidationGuard(this); // Any change of a cursor specific attribute triggers this recalc. for (const auto& client : m_clients) client->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SVGCursor)); }
void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGradientElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); updateRelativeLengthsInformation(); if (RenderObject* object = renderer()) object->setNeedsLayout(); }
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) { bool updateRelativeLengthsOrViewBox = false; bool widthChanged = attrName == SVGNames::widthAttr; bool heightChanged = attrName == SVGNames::heightAttr; if (widthChanged || heightChanged || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { updateRelativeLengthsOrViewBox = true; updateRelativeLengthsInformation(); invalidateRelativeLengthClients(); // At the SVG/HTML boundary (aka LayoutSVGRoot), the width and // height attributes can affect the replaced size so we need // to mark it for updating. // // FIXME: For width/height animated as XML attributes on SVG // roots, there is an attribute synchronization missing. See // http://crbug.com/364807 if (widthChanged || heightChanged) { LayoutObject* layoutObject = this->layoutObject(); if (layoutObject && layoutObject->isSVGRoot()) { invalidateSVGPresentationAttributeStyle(); setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SVGContainerSizeChange)); } } else { invalidateSVGPresentationAttributeStyle(); setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::fromAttribute(attrName)); } } if (SVGFitToViewBox::isKnownAttribute(attrName)) { updateRelativeLengthsOrViewBox = true; invalidateRelativeLengthClients(); if (LayoutObject* object = layoutObject()) object->setNeedsTransformUpdate(); } if (updateRelativeLengthsOrViewBox || SVGZoomAndPan::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); if (layoutObject()) markForLayoutAndParentResourceInvalidation(layoutObject()); return; } SVGGraphicsElement::svgAttributeChanged(attrName); }
void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); auto renderer = this->renderer(); if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { updateRelativeLengthsInformation(); if (renderer) RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); return; } if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) return; if (SVGURIReference::isKnownAttribute(attrName)) { bool isExternalReference = isExternalURIReference(href(), document()); if (isExternalReference) { URL url = document().completeURL(href()); if (url.hasFragmentIdentifier()) { CachedResourceRequest request(ResourceRequest(url.string())); request.setInitiator(this); setCachedDocument(document().cachedResourceLoader()->requestSVGDocument(request)); } } else setCachedDocument(0); if (!m_wasInsertedByParser) buildPendingResource(); return; } if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { invalidateShadowTree(); return; } ASSERT_NOT_REACHED(); }
void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGradientElement::svgAttributeChanged(attrName); return; } SVGElement::InvalidationGuard invalidationGuard(this); updateRelativeLengthsInformation(); RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); if (renderer) renderer->invalidateCacheAndMarkForLayout(); }
void SVGFETileElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::inAttr) { invalidate(); return; } ASSERT_NOT_REACHED(); }
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElement::InvalidationGuard invalidationGuard(this); // Any change of a cursor specific attribute triggers this recalc. WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = m_clients.begin(); WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = m_clients.end(); for (; it != end; ++it) (*it)->setNeedsStyleRecalc(SubtreeStyleChange); }
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); // Any change of a cursor specific attribute triggers this recalc. HashSet<SVGElement*>::const_iterator it = m_clients.begin(); HashSet<SVGElement*>::const_iterator end = m_clients.end(); for (; it != end; ++it) (*it)->setNeedsStyleRecalc(); }
void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { invalidateSVGPresentationAttributeStyle(); return; } bool isLengthAttribute = attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr; if (isLengthAttribute) updateRelativeLengthsInformation(); if (SVGURIReference::isKnownAttribute(attrName)) { m_imageLoader.updateFromElementIgnoringPreviousError(); return; } auto renderer = this->renderer(); if (!renderer) return; if (isLengthAttribute) { if (toRenderSVGImage(renderer)->updateImageViewport()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); return; } if (attrName == SVGNames::preserveAspectRatioAttr || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); return; } ASSERT_NOT_REACHED(); }
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) { if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || SVGTests::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); // Any change of a cursor specific attribute triggers this recalc. for (const auto& client : m_clients) client->setNeedsStyleRecalc( LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SVGCursor)); return; } SVGElement::svgAttributeChanged(attrName); }
void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::offsetAttr) { if (auto renderer = this->renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); return; } ASSERT_NOT_REACHED(); }
void SVGTRefElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGTextPositioningElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (SVGURIReference::isKnownAttribute(attrName)) { buildPendingResource(); if (auto renderer = this->renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); return; } ASSERT_NOT_REACHED(); }
void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIReference changes // as none of the other properties changes the linking behaviour for our <a> element. if (SVGURIReference::isKnownAttribute(attrName)) { bool wasLink = isLink(); setIsLink(!href().isNull() && !shouldProhibitLinks(this)); if (wasLink != isLink()) setNeedsStyleRecalc(); } }
void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIReference changes // as none of the other properties changes the linking behaviour for our <a> element. if (SVGURIReference::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); bool wasLink = isLink(); setIsLink(!hrefString().isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::LinkColorChange)); return; } SVGGraphicsElement::svgAttributeChanged(attrName); }
void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) updateRelativeLengthsInformation(); if (RenderObject* object = renderer()) object->setNeedsLayout(); }
void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElement::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) updateRelativeLengthsInformation(); RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); if (renderer) renderer->invalidateCacheAndMarkForLayout(); }
void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElement::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::typeAttr || attrName == HTMLNames::onerrorAttr) return; if (SVGURIReference::isKnownAttribute(attrName)) { m_loader->handleSourceAttribute(hrefString()); return; } ASSERT_NOT_REACHED(); }
void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (SVGURIReference::isKnownAttribute(attrName)) { buildPendingResource(); return; } if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) return; ASSERT_NOT_REACHED(); }
void SVGFETurbulenceElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::baseFrequencyAttr || attrName == SVGNames::numOctavesAttr || attrName == SVGNames::seedAttr || attrName == SVGNames::stitchTilesAttr || attrName == SVGNames::typeAttr) { primitiveAttributeChanged(attrName); return; } ASSERT_NOT_REACHED(); }
void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); bool isLengthAttribute = attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr; if (isLengthAttribute) updateRelativeLengthsInformation(); if (auto renderer = this->renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); }
void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) { if (attrName == SVGNames::x1Attr || attrName == SVGNames::y1Attr || attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr) { updateRelativeLengthsInformation(); LayoutSVGShape* layoutObject = toLayoutSVGShape(this->layoutObject()); if (!layoutObject) return; SVGElement::InvalidationGuard invalidationGuard(this); layoutObject->setNeedsShapeUpdate(); markForLayoutAndParentResourceInvalidation(layoutObject); return; } SVGGeometryElement::svgAttributeChanged(attrName); }
void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { invalidateSVGPresentationAttributeStyle(); return; } if (RenderObject* object = renderer()) object->setNeedsLayout(); }
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) { bool updateRelativeLengthsOrViewBox = false; bool widthChanged = attrName == SVGNames::widthAttr; if (widthChanged || attrName == SVGNames::heightAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { updateRelativeLengthsOrViewBox = true; updateRelativeLengthsInformation(); // At the SVG/HTML boundary (aka RenderSVGRoot), the width attribute can // affect the replaced size so we need to mark it for updating. if (widthChanged) { RenderObject* renderObject = renderer(); if (renderObject && renderObject->isSVGRoot()) toRenderSVGRoot(renderObject)->setNeedsLayoutAndPrefWidthsRecalc(); } } if (SVGFitToViewBox::isKnownAttribute(attrName)) { updateRelativeLengthsOrViewBox = true; if (RenderObject* object = renderer()) object->setNeedsTransformUpdate(); } SVGElementInstance::InvalidationGuard invalidationGuard(this); if (SVGTests::handleAttributeChange(this, attrName)) return; if (updateRelativeLengthsOrViewBox || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGZoomAndPan::isKnownAttribute(attrName)) { if (renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer()); return; } SVGStyledElement::svgAttributeChanged(attrName); }