Index: Source/core/svg/SVGViewSpec.h |
diff --git a/Source/core/svg/SVGViewSpec.h b/Source/core/svg/SVGViewSpec.h |
index e40e37ff73c650419514d973036feb3a81d4eb48..c4a393eab97c355924da48e86a69952ce9fd0283 100644 |
--- a/Source/core/svg/SVGViewSpec.h |
+++ b/Source/core/svg/SVGViewSpec.h |
@@ -45,6 +45,7 @@ public: |
bool parseViewSpec(const String&); |
void reset(); |
void detachContextElement(); |
+ template<typename T> void inheritViewAttributesFromElement(T*); |
// JS API |
SVGTransformList* transform() { return m_transform ? m_transform->baseValue() : 0; } |
@@ -73,6 +74,21 @@ private: |
String m_viewTargetString; |
}; |
+template <typename T> |
+void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) |
+{ |
+ if (inheritFromElement->hasAttribute(SVGNames::viewBoxAttr)) |
+ viewBox()->baseValue()->setValue(inheritFromElement->viewBox()->currentValue()->value()); |
+ |
+ if (inheritFromElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) { |
+ preserveAspectRatio()->baseValue()->setAlign(inheritFromElement->preserveAspectRatio()->currentValue()->align()); |
+ preserveAspectRatio()->baseValue()->setMeetOrSlice(inheritFromElement->preserveAspectRatio()->currentValue()->meetOrSlice()); |
+ } |
+ |
+ if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) |
+ setZoomAndPan(inheritFromElement->zoomAndPan()); |
+} |
+ |
} // namespace blink |
#endif // SVGViewSpec_h |