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

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

Issue 1015743003: [svg] Make svgView override existing data selectively (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« Source/core/svg/SVGSVGElement.cpp ('K') | « 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.cpp
diff --git a/Source/core/svg/SVGViewSpec.cpp b/Source/core/svg/SVGViewSpec.cpp
index 071e969517c018f1d43211232641f648faee73ba..512dd2a8af1094b1d024d4feb1c789f6b3ffdee9 100644
--- a/Source/core/svg/SVGViewSpec.cpp
+++ b/Source/core/svg/SVGViewSpec.cpp
@@ -71,12 +71,35 @@ bool SVGViewSpec::parseViewSpec(const String& spec)
void SVGViewSpec::reset()
{
- resetZoomAndPan();
- m_transform->baseValue()->clear();
- updateViewBox(FloatRect());
- ASSERT(preserveAspectRatio());
- preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID);
- preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
+ if (m_contextElement) {
fs 2015/03/18 13:43:08 This is pretty similar to inheritViewAttributes in
+ m_transform->baseValue()->clear();
+
+ if (m_contextElement->hasAttribute(SVGNames::viewBoxAttr))
+ updateViewBox(m_contextElement->viewBox()->currentValue()->value());
+ else
+ updateViewBox(FloatRect());
+
+ if (m_contextElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) {
+ preserveAspectRatio()->baseValue()->setAlign(m_contextElement->preserveAspectRatio()->currentValue()->align());
+ preserveAspectRatio()->baseValue()->setMeetOrSlice(m_contextElement->preserveAspectRatio()->currentValue()->meetOrSlice());
+ } else {
+ preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID);
+ preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
+ }
+
+ if (m_contextElement->hasAttribute(SVGNames::zoomAndPanAttr))
+ setZoomAndPan(m_contextElement->zoomAndPan());
+ else
+ resetZoomAndPan();
+ } else {
+ resetZoomAndPan();
+ m_transform->baseValue()->clear();
+ updateViewBox(FloatRect());
+ ASSERT(preserveAspectRatio());
+ preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID);
+ preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::SVG_MEETORSLICE_MEET);
+ }
+
m_viewTargetString = emptyString();
}
« Source/core/svg/SVGSVGElement.cpp ('K') | « Source/core/svg/SVGSVGElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698