Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Unified Diff: Source/core/svg/SVGViewSpec.h

Issue 1015743003: [svg] Make svgView override existing data selectively (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: compilefix Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698