Chromium Code Reviews| 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(); |
| } |