void SVGPathElement::synchronizeD(SVGElement* contextElement) { ASSERT(contextElement); SVGPathElement* ownerType = toSVGPathElement(contextElement); if (!ownerType->m_pathSegList.shouldSynchronize) return; ownerType->m_pathSegList.synchronize(ownerType, dPropertyInfo()->attributeName, ownerType->m_pathSegList.value.valueAsString()); }
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); }
PassRefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement) { ASSERT(contextElement); SVGPathElement* ownerType = toSVGPathElement(contextElement); if (SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(ownerType, dPropertyInfo())) return property; // Build initial SVGPathSegList. buildSVGPathSegListFromByteStream(ownerType->m_pathByteStream.get(), ownerType, ownerType->m_pathSegList.value, UnalteredParsing); return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegList> (ownerType, dPropertyInfo(), ownerType->m_pathSegList.value); }
Path LayoutSVGTextPath::layoutPath() const { SVGTextPathElement* textPathElement = toSVGTextPathElement(node()); Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href()->currentValue()->value(), textPathElement->treeScope()); if (!isSVGPathElement(targetElement)) return Path(); SVGPathElement& pathElement = toSVGPathElement(*targetElement); Path pathData = pathElement.asPath(); // Spec: The transform attribute on the referenced 'path' element represents a // supplemental transformation relative to the current user coordinate system for // the current 'text' element, including any adjustments to the current user coordinate // system due to a possible transform attribute on the current 'text' element. // http://www.w3.org/TR/SVG/text.html#TextPathElement pathData.transform(pathElement.calculateAnimatedLocalTransform()); return pathData; }
static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) { writePositionAndStyle(ts, shape); ASSERT(shape.node()->isSVGElement()); SVGElement* svgElement = toSVGElement(shape.node()); SVGLengthContext lengthContext(svgElement); if (svgElement->hasTagName(SVGNames::rectTag)) { SVGRectElement* element = static_cast<SVGRectElement*>(svgElement); writeNameValuePair(ts, "x", element->x().value(lengthContext)); writeNameValuePair(ts, "y", element->y().value(lengthContext)); writeNameValuePair(ts, "width", element->width().value(lengthContext)); writeNameValuePair(ts, "height", element->height().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::lineTag)) { SVGLineElement* element = static_cast<SVGLineElement*>(svgElement); writeNameValuePair(ts, "x1", element->x1().value(lengthContext)); writeNameValuePair(ts, "y1", element->y1().value(lengthContext)); writeNameValuePair(ts, "x2", element->x2().value(lengthContext)); writeNameValuePair(ts, "y2", element->y2().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::ellipseTag)) { SVGEllipseElement* element = static_cast<SVGEllipseElement*>(svgElement); writeNameValuePair(ts, "cx", element->cx().value(lengthContext)); writeNameValuePair(ts, "cy", element->cy().value(lengthContext)); writeNameValuePair(ts, "rx", element->rx().value(lengthContext)); writeNameValuePair(ts, "ry", element->ry().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::circleTag)) { SVGCircleElement* element = static_cast<SVGCircleElement*>(svgElement); writeNameValuePair(ts, "cx", element->cx().value(lengthContext)); writeNameValuePair(ts, "cy", element->cy().value(lengthContext)); writeNameValuePair(ts, "r", element->r().value(lengthContext)); } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTagName(SVGNames::polylineTag)) { SVGPolyElement* element = static_cast<SVGPolyElement*>(svgElement); writeNameAndQuotedValue(ts, "points", element->pointList().valueAsString()); } else if (svgElement->hasTagName(SVGNames::pathTag)) { SVGPathElement* element = toSVGPathElement(svgElement); String pathString; // FIXME: We should switch to UnalteredParsing here - this will affect the path dumping output of dozens of tests. buildStringFromByteStream(element->pathByteStream(), pathString, NormalizedParsing); writeNameAndQuotedValue(ts, "data", pathString); } else ASSERT_NOT_REACHED(); return ts; }
static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) { writePositionAndStyle(ts, shape); SVGElement* svgElement = shape.element(); ASSERT(svgElement); SVGLengthContext lengthContext(svgElement); if (isSVGRectElement(*svgElement)) { SVGRectElement& element = toSVGRectElement(*svgElement); writeNameValuePair(ts, "x", element.x()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "y", element.y()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "width", element.width()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "height", element.height()->currentValue()->value(lengthContext)); } else if (isSVGLineElement(*svgElement)) { SVGLineElement& element = toSVGLineElement(*svgElement); writeNameValuePair(ts, "x1", element.x1()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "y1", element.y1()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "x2", element.x2()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "y2", element.y2()->currentValue()->value(lengthContext)); } else if (isSVGEllipseElement(*svgElement)) { SVGEllipseElement& element = toSVGEllipseElement(*svgElement); writeNameValuePair(ts, "cx", element.cx()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "cy", element.cy()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "rx", element.rx()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "ry", element.ry()->currentValue()->value(lengthContext)); } else if (isSVGCircleElement(*svgElement)) { SVGCircleElement& element = toSVGCircleElement(*svgElement); writeNameValuePair(ts, "cx", element.cx()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "cy", element.cy()->currentValue()->value(lengthContext)); writeNameValuePair(ts, "r", element.r()->currentValue()->value(lengthContext)); } else if (isSVGPolyElement(*svgElement)) { writeNameAndQuotedValue(ts, "points", toSVGPolyElement(*svgElement).points()->currentValue()->valueAsString()); } else if (isSVGPathElement(*svgElement)) { String pathString; // FIXME: We should switch to UnalteredParsing here - this will affect the path dumping output of dozens of tests. buildStringFromByteStream(*toSVGPathElement(*svgElement).pathByteStream(), pathString, NormalizedParsing); writeNameAndQuotedValue(ts, "data", pathString); } else { ASSERT_NOT_REACHED(); } return ts; }
Path RenderSVGTextPath::layoutPath() const { Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement().href(), document()); if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag)) return Path(); SVGPathElement* pathElement = toSVGPathElement(targetElement); Path pathData; updatePathFromGraphicsElement(pathElement, pathData); // Spec: The transform attribute on the referenced 'path' element represents a // supplemental transformation relative to the current user coordinate system for // the current 'text' element, including any adjustments to the current user coordinate // system due to a possible transform attribute on the current 'text' element. // http://www.w3.org/TR/SVG/text.html#TextPathElement pathData.transform(pathElement->animatedLocalTransform()); return pathData; }
static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) { writePositionAndStyle(ts, shape); SVGGraphicsElement& svgElement = shape.graphicsElement(); SVGLengthContext lengthContext(&svgElement); if (isSVGRectElement(svgElement)) { const SVGRectElement& element = toSVGRectElement(svgElement); writeNameValuePair(ts, "x", element.x().value(lengthContext)); writeNameValuePair(ts, "y", element.y().value(lengthContext)); writeNameValuePair(ts, "width", element.width().value(lengthContext)); writeNameValuePair(ts, "height", element.height().value(lengthContext)); } else if (isSVGLineElement(svgElement)) { const SVGLineElement& element = toSVGLineElement(svgElement); writeNameValuePair(ts, "x1", element.x1().value(lengthContext)); writeNameValuePair(ts, "y1", element.y1().value(lengthContext)); writeNameValuePair(ts, "x2", element.x2().value(lengthContext)); writeNameValuePair(ts, "y2", element.y2().value(lengthContext)); } else if (isSVGEllipseElement(svgElement)) { const SVGEllipseElement& element = toSVGEllipseElement(svgElement); writeNameValuePair(ts, "cx", element.cx().value(lengthContext)); writeNameValuePair(ts, "cy", element.cy().value(lengthContext)); writeNameValuePair(ts, "rx", element.rx().value(lengthContext)); writeNameValuePair(ts, "ry", element.ry().value(lengthContext)); } else if (isSVGCircleElement(svgElement)) { const SVGCircleElement& element = toSVGCircleElement(svgElement); writeNameValuePair(ts, "cx", element.cx().value(lengthContext)); writeNameValuePair(ts, "cy", element.cy().value(lengthContext)); writeNameValuePair(ts, "r", element.r().value(lengthContext)); } else if (svgElement.hasTagName(SVGNames::polygonTag) || svgElement.hasTagName(SVGNames::polylineTag)) { const SVGPolyElement& element = toSVGPolyElement(svgElement); writeNameAndQuotedValue(ts, "points", element.pointList().valueAsString()); } else if (isSVGPathElement(svgElement)) { const SVGPathElement& element = toSVGPathElement(svgElement); String pathString; // FIXME: We should switch to UnalteredParsing here - this will affect the path dumping output of dozens of tests. buildStringFromByteStream(element.pathByteStream(), pathString, NormalizedParsing); writeNameAndQuotedValue(ts, "data", pathString); } else ASSERT_NOT_REACHED(); return ts; }
std::unique_ptr<PathPositionMapper> LayoutSVGTextPath::layoutPath() const { const SVGTextPathElement& textPathElement = toSVGTextPathElement(*node()); Element* targetElement = SVGURIReference::targetElementFromIRIString( textPathElement.hrefString(), treeScopeForIdResolution(textPathElement)); if (!isSVGPathElement(targetElement)) return nullptr; SVGPathElement& pathElement = toSVGPathElement(*targetElement); Path pathData = pathElement.asPath(); if (pathData.isEmpty()) return nullptr; // Spec: The transform attribute on the referenced 'path' element represents a // supplemental transformation relative to the current user coordinate system for // the current 'text' element, including any adjustments to the current user coordinate // system due to a possible transform attribute on the current 'text' element. // http://www.w3.org/TR/SVG/text.html#TextPathElement pathData.transform(pathElement.calculateAnimatedLocalTransform()); return PathPositionMapper::create(pathData); }
void SVGPathSegList::commitChange(SVGElement* contextElement, ListModification listModification) { ASSERT(contextElement); toSVGPathElement(contextElement)->pathSegListChanged(m_role, listModification); }
SVGPathElement* SVGMPathElement::pathElement() { Element* target = targetElementFromIRIString(hrefString(), treeScope()); return isSVGPathElement(target) ? toSVGPathElement(target) : 0; }
static void updatePathFromPathElement(SVGElement* element, Path& path) { buildPathFromByteStream(toSVGPathElement(element)->pathByteStream(), path); }
SVGPathElement* SVGPathSegListPropertyTearOff::contextElement() const { SVGElement* contextElement = m_animatedProperty->contextElement(); ASSERT(contextElement); return toSVGPathElement(contextElement); }
PassRefPtrWillBeRawPtr<SVGPropertyBase> PathSVGInterpolation::interpolatedValue(SVGElement& element) const { return fromInterpolableValue(*m_cachedValue, m_pathSegTypes, toSVGPathElement(&element)); }