static inline void notifyTargetAndInstancesAboutAnimValChange(SVGElement* targetElement, const QualifiedName& attributeName) { ASSERT(targetElement); if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) return; SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); notifyTargetAboutAnimValChange(targetElement, attributeName); // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement(); const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) notifyTargetAboutAnimValChange(shadowTreeElement, attributeName); } }
void SVGFEGaussianBlurElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeStdDeviationX(); synchronizeStdDeviationY(); synchronizeIn1(); return; } if (attrName == SVGNames::stdDeviationAttr) { synchronizeStdDeviationX(); synchronizeStdDeviationY(); } else if (attrName == SVGNames::inAttr) synchronizeIn1(); }
void SVGPatternElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizePatternUnits(); synchronizePatternContentUnits(); synchronizePatternTransform(); synchronizeX(); synchronizeY(); synchronizeWidth(); synchronizeHeight(); synchronizeExternalResourcesRequired(); synchronizeViewBox(); synchronizePreserveAspectRatio(); synchronizeHref(); SVGTests::synchronizeProperties(this, attrName); return; } if (attrName == SVGNames::patternUnitsAttr) synchronizePatternUnits(); else if (attrName == SVGNames::patternContentUnitsAttr) synchronizePatternContentUnits(); else if (attrName == SVGNames::patternTransformAttr) synchronizePatternTransform(); else if (attrName == SVGNames::xAttr) synchronizeX(); else if (attrName == SVGNames::yAttr) synchronizeY(); else if (attrName == SVGNames::widthAttr) synchronizeWidth(); else if (attrName == SVGNames::heightAttr) synchronizeHeight(); else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); else if (attrName == SVGNames::viewBoxAttr) synchronizeViewBox(); else if (attrName == SVGNames::preserveAspectRatioAttr) synchronizePreserveAspectRatio(); else if (SVGURIReference::isKnownAttribute(attrName)) synchronizeHref(); else if (SVGTests::isKnownAttribute(attrName)) SVGTests::synchronizeProperties(this, attrName); }
void SVGFEBlendElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeMode(); synchronizeIn1(); synchronizeIn2(); return; } if (attrName == SVGNames::modeAttr) synchronizeMode(); else if (attrName == SVGNames::inAttr) synchronizeIn1(); else if (attrName == SVGNames::in2Attr) synchronizeIn2(); }
void SVGAElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledTransformableElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeTarget(); synchronizeHref(); synchronizeExternalResourcesRequired(); return; } if (attrName == SVGNames::targetAttr) synchronizeTarget(); else if (SVGURIReference::isKnownAttribute(attrName)) synchronizeHref(); else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); }
void SVGViewElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeExternalResourcesRequired(); synchronizeViewBox(); synchronizePreserveAspectRatio(); return; } if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); else if (SVGFitToViewBox::isKnownAttribute(attrName)) { synchronizeViewBox(); synchronizePreserveAspectRatio(); } }
void SVGFEImageElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizePreserveAspectRatio(); synchronizeHref(); synchronizeExternalResourcesRequired(); return; } if (attrName == SVGNames::preserveAspectRatioAttr) synchronizePreserveAspectRatio(); else if (SVGURIReference::isKnownAttribute(attrName)) synchronizeHref(); else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); }
static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName) { ASSERT(targetElement); if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) return; CSSPropertyID id = cssPropertyID(attributeName.localName()); SVGElement::InstanceUpdateBlocker blocker(targetElement); removeCSSPropertyFromTarget(targetElement, id); // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. const HeapHashSet<WeakMember<SVGElement>>& instances = targetElement->instancesForElement(); for (SVGElement* shadowTreeElement : instances) { if (shadowTreeElement) removeCSSPropertyFromTarget(shadowTreeElement, id); } }
void SVGFEColorMatrixElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeType(); synchronizeIn1(); synchronizeValues(); return; } if (attrName == SVGNames::typeAttr) synchronizeType(); else if (attrName == SVGNames::inAttr) synchronizeIn1(); else if (attrName == SVGNames::valuesAttr) synchronizeValues(); }
SVGAnimationElement::ShouldApplyAnimation SVGAnimationElement::shouldApplyAnimation(SVGElement* targetElement, const QualifiedName& attributeName) { if (!hasValidAttributeType() || !targetElement || attributeName == anyQName() || !targetElement->inActiveDocument()) return DontApplyAnimation; // Always animate CSS properties, using the ApplyCSSAnimation code path, regardless of the attributeType value. if (isTargetAttributeCSSProperty(targetElement, attributeName)) { if (targetElement->isPresentationAttributeWithSVGDOM(attributeName)) return ApplyXMLandCSSAnimation; return ApplyCSSAnimation; } // If attributeType="CSS" and attributeName doesn't point to a CSS property, ignore the animation. if (attributeType() == AttributeTypeCSS) return DontApplyAnimation; return ApplyXMLAnimation; }
void SVGFEOffsetElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeDx(); synchronizeDy(); synchronizeIn1(); return; } if (attrName == SVGNames::dxAttr) synchronizeDx(); else if (attrName == SVGNames::dyAttr) synchronizeDy(); else if (attrName == SVGNames::inAttr) synchronizeIn1(); }
void SVGPolyElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledTransformableElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeExternalResourcesRequired(); synchronizePoints(); SVGTests::synchronizeProperties(this, attrName); return; } if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); else if (attrName == SVGNames::pointsAttr) synchronizePoints(); else if (SVGTests::isKnownAttribute(attrName)) SVGTests::synchronizeProperties(this, attrName); }
void CSSSelectorParser::rewriteSpecifiersWithElementName(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule) { AtomicString determinedNamespace = namespacePrefix != nullAtom && m_styleSheet ? m_styleSheet->determineNamespace(namespacePrefix) : m_defaultNamespace; QualifiedName tag(namespacePrefix, elementName, determinedNamespace); if (specifiers->crossesTreeScopes()) return rewriteSpecifiersWithElementNameForCustomPseudoElement(tag, elementName, specifiers, tagIsForNamespaceRule); if (specifiers->isContentPseudoElement()) return rewriteSpecifiersWithElementNameForContentPseudoElement(tag, elementName, specifiers, tagIsForNamespaceRule); // *:host never matches, so we can't discard the * otherwise we can't tell the // difference between *:host and just :host. if (tag == anyQName() && !specifiers->hasHostPseudoSelector()) return; if (specifiers->pseudoType() != CSSSelector::PseudoCue) specifiers->prependTagSelector(tag, tagIsForNamespaceRule); }
static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName, const String& valueAsString) { ASSERT(targetElement); if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) return; CSSPropertyID id = cssPropertyID(attributeName.localName()); SVGElement::InstanceUpdateBlocker blocker(targetElement); applyCSSPropertyToTarget(targetElement, id, valueAsString); // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& instances = targetElement->instancesForElement(); const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = instances.end(); for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = instances.begin(); it != end; ++it) { if (SVGElement* shadowTreeElement = *it) applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString); } }
static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName) { ASSERT(targetElement); if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) return; CSSPropertyID id = cssPropertyID(attributeName.localName()); SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); removeCSSPropertyFromTarget(targetElement, id); // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement(); const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) removeCSSPropertyFromTarget(shadowTreeElement, id); } }
String SMILTimeContainer::baseValueFor(ElementAttributePair key) { // FIXME: We wouldn't need to do this if we were keeping base values around properly in DOM. // Currently animation overwrites them so we need to save them somewhere. BaseValueMap::iterator it = m_savedBaseValues.find(key); if (it != m_savedBaseValues.end()) return it->second; SVGElement* targetElement = key.first; QualifiedName attributeName = key.second; ASSERT(targetElement); ASSERT(attributeName != anyQName()); String baseValue; if (SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)) baseValue = computedStyle(targetElement)->getPropertyValue(cssPropertyID(attributeName.localName())); else baseValue = targetElement->getAttribute(attributeName); m_savedBaseValues.add(key, baseValue); return baseValue; }
void CSSSelectorParser::rewriteSpecifiersWithElementNameForContentPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule) { CSSParserSelector* last = specifiers; CSSParserSelector* history = specifiers; while (history->tagHistory()) { history = history->tagHistory(); if (history->isContentPseudoElement() || history->relationIsAffectedByPseudoContent()) last = history; } if (last->tagHistory()) { if (tag != anyQName()) last->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule); return; } // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo combinator has to be used. // We therefore create a new Selector with that combinator here in any case, even if matching any (host) element in any namespace (i.e. '*'). OwnPtr<CSSParserSelector> elementNameSelector = adoptPtr(new CSSParserSelector(tag)); last->setTagHistory(elementNameSelector.release()); }
void SVGLinearGradientElement::synchronizeProperty(const QualifiedName& attrName) { SVGGradientElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeX1(); synchronizeY1(); synchronizeX2(); synchronizeY2(); return; } if (attrName == SVGNames::x1Attr) synchronizeX1(); else if (attrName == SVGNames::y1Attr) synchronizeY1(); else if (attrName == SVGNames::x2Attr) synchronizeX2(); else if (attrName == SVGNames::y2Attr) synchronizeY2(); }
void SVGFEMorphologyElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronize_operator(); synchronizeIn1(); synchronizeRadiusX(); synchronizeRadiusY(); return; } if (attrName == SVGNames::operatorAttr) synchronize_operator(); else if (attrName == SVGNames::inAttr) synchronizeIn1(); else if (attrName == SVGNames::radiusAttr) { synchronizeRadiusX(); synchronizeRadiusY(); } }
void SVGTextPathElement::synchronizeProperty(const QualifiedName& attrName) { SVGTextContentElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeStartOffset(); synchronizeMethod(); synchronizeSpacing(); synchronizeHref(); return; } if (attrName == SVGNames::startOffsetAttr) synchronizeStartOffset(); else if (attrName == SVGNames::methodAttr) synchronizeMethod(); else if (attrName == SVGNames::spacingAttr) synchronizeSpacing(); else if (SVGURIReference::isKnownAttribute(attrName)) synchronizeHref(); }
void SVGCircleElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledTransformableElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeCx(); synchronizeCy(); synchronizeR(); synchronizeExternalResourcesRequired(); return; } if (attrName == SVGNames::cxAttr) synchronizeCx(); else if (attrName == SVGNames::cyAttr) synchronizeCy(); else if (attrName == SVGNames::rAttr) synchronizeR(); else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); }
void SVGFELightElement::synchronizeProperty(const QualifiedName& attrName) { SVGElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeAzimuth(); synchronizeElevation(); synchronizeX(); synchronizeY(); synchronizeZ(); synchronizePointsAtX(); synchronizePointsAtY(); synchronizePointsAtZ(); synchronizeSpecularExponent(); synchronizeLimitingConeAngle(); return; } if (attrName == SVGNames::azimuthAttr) synchronizeAzimuth(); else if (attrName == SVGNames::elevationAttr) synchronizeElevation(); else if (attrName == SVGNames::xAttr) synchronizeX(); else if (attrName == SVGNames::yAttr) synchronizeY(); else if (attrName == SVGNames::zAttr) synchronizeZ(); else if (attrName == SVGNames::pointsAtXAttr) synchronizePointsAtX(); else if (attrName == SVGNames::pointsAtYAttr) synchronizePointsAtY(); else if (attrName == SVGNames::pointsAtZAttr) synchronizePointsAtZ(); else if (attrName == SVGNames::specularExponentAttr) synchronizeSpecularExponent(); else if (attrName == SVGNames::limitingConeAngleAttr) synchronizeLimitingConeAngle(); }
void SVGMarkerElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeMarkerUnits(); synchronizeRefX(); synchronizeRefY(); synchronizeMarkerWidth(); synchronizeMarkerHeight(); synchronizeOrientAngle(); synchronizeOrientType(); synchronizeExternalResourcesRequired(); synchronizeViewBox(); synchronizePreserveAspectRatio(); return; } if (attrName == SVGNames::markerUnitsAttr) synchronizeMarkerUnits(); else if (attrName == SVGNames::refXAttr) synchronizeRefX(); else if (attrName == SVGNames::refYAttr) synchronizeRefY(); else if (attrName == SVGNames::markerWidthAttr) synchronizeMarkerWidth(); else if (attrName == SVGNames::markerHeightAttr) synchronizeMarkerHeight(); else if (attrName == SVGNames::orientAttr) { synchronizeOrientAngle(); synchronizeOrientType(); } else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); else if (SVGFitToViewBox::isKnownAttribute(attrName)) { synchronizeViewBox(); synchronizePreserveAspectRatio(); } }
void SVGFilterElement::synchronizeProperty(const QualifiedName& attrName) { SVGStyledElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeX(); synchronizeY(); synchronizeWidth(); synchronizeHeight(); synchronizeFilterUnits(); synchronizePrimitiveUnits(); synchronizeFilterResX(); synchronizeFilterResY(); synchronizeExternalResourcesRequired(); synchronizeHref(); return; } if (attrName == SVGNames::xAttr) synchronizeX(); else if (attrName == SVGNames::yAttr) synchronizeY(); else if (attrName == SVGNames::widthAttr) synchronizeWidth(); else if (attrName == SVGNames::heightAttr) synchronizeHeight(); else if (attrName == SVGNames::filterUnitsAttr) synchronizeFilterUnits(); else if (attrName == SVGNames::primitiveUnitsAttr) synchronizePrimitiveUnits(); else if (attrName == SVGNames::filterResAttr) { synchronizeFilterResX(); synchronizeFilterResY(); } else if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) synchronizeExternalResourcesRequired(); else if (SVGURIReference::isKnownAttribute(attrName)) synchronizeHref(); }
SVGSMILElement::SVGSMILElement(const QualifiedName& tagName, Document& doc) : SVGElement(tagName, doc) , SVGTests(this) , m_attributeName(anyQName()) , m_targetElement(nullptr) , m_syncBaseConditionsConnected(false) , m_hasEndEventConditions(false) , m_isWaitingForFirstInterval(true) , m_interval(SMILInterval(SMILTime::unresolved(), SMILTime::unresolved())) , m_previousIntervalBegin(SMILTime::unresolved()) , m_activeState(Inactive) , m_lastPercent(0) , m_lastRepeat(0) , m_nextProgressTime(0) , m_documentOrderIndex(0) , m_cachedDur(invalidCachedTime) , m_cachedRepeatDur(invalidCachedTime) , m_cachedRepeatCount(invalidCachedTime) , m_cachedMin(invalidCachedTime) , m_cachedMax(invalidCachedTime) { resolveFirstInterval(); }
void CSSSelectorParser::prependTypeSelectorIfNeeded( const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector* compoundSelector) { if (elementName.isNull() && defaultNamespace() == starAtom && !compoundSelector->needsImplicitShadowCombinatorForMatching()) return; AtomicString determinedElementName = elementName.isNull() ? starAtom : elementName; AtomicString namespaceURI = determineNamespace(namespacePrefix); if (namespaceURI.isNull()) { m_failedParsing = true; return; } AtomicString determinedPrefix = namespacePrefix; if (namespaceURI == defaultNamespace()) determinedPrefix = nullAtom; QualifiedName tag = QualifiedName(determinedPrefix, determinedElementName, namespaceURI); // *:host/*:host-context never matches, so we can't discard the *, // otherwise we can't tell the difference between *:host and just :host. // // Also, selectors where we use a ShadowPseudo combinator between the // element and the pseudo element for matching (custom pseudo elements, // ::cue, ::shadow), we need a universal selector to set the combinator // (relation) on in the cases where there are no simple selectors preceding // the pseudo element. bool explicitForHost = compoundSelector->isHostPseudoSelector() && !elementName.isNull(); if (tag != anyQName() || explicitForHost || compoundSelector->needsImplicitShadowCombinatorForMatching()) compoundSelector->prependTagSelector( tag, determinedPrefix == nullAtom && determinedElementName == starAtom && !explicitForHost); }
void SVGTextPositioningElement::synchronizeProperty(const QualifiedName& attrName) { SVGTextContentElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeX(); synchronizeY(); synchronizeDx(); synchronizeDy(); synchronizeRotate(); return; } if (attrName == SVGNames::xAttr) synchronizeX(); else if (attrName == SVGNames::yAttr) synchronizeY(); else if (attrName == SVGNames::dxAttr) synchronizeDx(); else if (attrName == SVGNames::dyAttr) synchronizeDy(); else if (attrName == SVGNames::rotateAttr) synchronizeRotate(); }
void SVGFilterPrimitiveStandardAttributes::synchronizeProperty(const QualifiedName& attrName) { SVGStyledElement::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeX(); synchronizeY(); synchronizeWidth(); synchronizeHeight(); synchronizeResult(); return; } if (attrName == SVGNames::xAttr) synchronizeX(); else if (attrName == SVGNames::yAttr) synchronizeY(); else if (attrName == SVGNames::widthAttr) synchronizeWidth(); else if (attrName == SVGNames::heightAttr) synchronizeHeight(); else if (attrName == SVGNames::resultAttr) synchronizeResult(); }
void SVGFEDisplacementMapElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeXChannelSelector(); synchronizeYChannelSelector(); synchronizeIn1(); synchronizeIn2(); synchronizeScale(); return; } if (attrName == SVGNames::xChannelSelectorAttr) synchronizeXChannelSelector(); else if (attrName == SVGNames::yChannelSelectorAttr) synchronizeYChannelSelector(); else if (attrName == SVGNames::inAttr) synchronizeIn1(); else if (attrName == SVGNames::in2Attr) synchronizeIn2(); else if (attrName == SVGNames::scaleAttr) synchronizeScale(); }
void SVGFEDiffuseLightingElement::synchronizeProperty(const QualifiedName& attrName) { SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName); if (attrName == anyQName()) { synchronizeIn1(); synchronizeSurfaceScale(); synchronizeDiffuseConstant(); synchronizeKernelUnitLengthX(); synchronizeKernelUnitLengthY(); return; } if (attrName == SVGNames::inAttr) synchronizeIn1(); else if (attrName == SVGNames::surfaceScaleAttr) synchronizeSurfaceScale(); else if (attrName == SVGNames::diffuseConstantAttr) synchronizeDiffuseConstant(); else if (attrName == SVGNames::kernelUnitLengthAttr) { synchronizeKernelUnitLengthX(); synchronizeKernelUnitLengthY(); } }