Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org> |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 const LChar* end = ptr + spec.length(); | 64 const LChar* end = ptr + spec.length(); |
| 65 return parseViewSpecInternal(ptr, end); | 65 return parseViewSpecInternal(ptr, end); |
| 66 } | 66 } |
| 67 const UChar* ptr = spec.characters16(); | 67 const UChar* ptr = spec.characters16(); |
| 68 const UChar* end = ptr + spec.length(); | 68 const UChar* end = ptr + spec.length(); |
| 69 return parseViewSpecInternal(ptr, end); | 69 return parseViewSpecInternal(ptr, end); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SVGViewSpec::reset() | 72 void SVGViewSpec::reset() |
| 73 { | 73 { |
| 74 resetZoomAndPan(); | 74 if (m_contextElement) { |
|
fs
2015/03/18 13:43:08
This is pretty similar to inheritViewAttributes in
| |
| 75 m_transform->baseValue()->clear(); | 75 m_transform->baseValue()->clear(); |
| 76 updateViewBox(FloatRect()); | 76 |
| 77 ASSERT(preserveAspectRatio()); | 77 if (m_contextElement->hasAttribute(SVGNames::viewBoxAttr)) |
| 78 preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG_PRE SERVEASPECTRATIO_XMIDYMID); | 78 updateViewBox(m_contextElement->viewBox()->currentValue()->value()); |
| 79 preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRatio::S VG_MEETORSLICE_MEET); | 79 else |
| 80 updateViewBox(FloatRect()); | |
| 81 | |
| 82 if (m_contextElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) { | |
| 83 preserveAspectRatio()->baseValue()->setAlign(m_contextElement->prese rveAspectRatio()->currentValue()->align()); | |
| 84 preserveAspectRatio()->baseValue()->setMeetOrSlice(m_contextElement- >preserveAspectRatio()->currentValue()->meetOrSlice()); | |
| 85 } else { | |
| 86 preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio: :SVG_PRESERVEASPECTRATIO_XMIDYMID); | |
| 87 preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspect Ratio::SVG_MEETORSLICE_MEET); | |
| 88 } | |
| 89 | |
| 90 if (m_contextElement->hasAttribute(SVGNames::zoomAndPanAttr)) | |
| 91 setZoomAndPan(m_contextElement->zoomAndPan()); | |
| 92 else | |
| 93 resetZoomAndPan(); | |
| 94 } else { | |
| 95 resetZoomAndPan(); | |
| 96 m_transform->baseValue()->clear(); | |
| 97 updateViewBox(FloatRect()); | |
| 98 ASSERT(preserveAspectRatio()); | |
| 99 preserveAspectRatio()->baseValue()->setAlign(SVGPreserveAspectRatio::SVG _PRESERVEASPECTRATIO_XMIDYMID); | |
| 100 preserveAspectRatio()->baseValue()->setMeetOrSlice(SVGPreserveAspectRati o::SVG_MEETORSLICE_MEET); | |
| 101 } | |
| 102 | |
| 80 m_viewTargetString = emptyString(); | 103 m_viewTargetString = emptyString(); |
| 81 } | 104 } |
| 82 | 105 |
| 83 void SVGViewSpec::detachContextElement() | 106 void SVGViewSpec::detachContextElement() |
| 84 { | 107 { |
| 85 m_transform = nullptr; | 108 m_transform = nullptr; |
| 86 clearViewBox(); | 109 clearViewBox(); |
| 87 clearPreserveAspectRatio(); | 110 clearPreserveAspectRatio(); |
| 88 m_contextElement = nullptr; | 111 m_contextElement = nullptr; |
| 89 } | 112 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 ptr++; | 235 ptr++; |
| 213 } | 236 } |
| 214 | 237 |
| 215 if (ptr >= end || *ptr != ')') | 238 if (ptr >= end || *ptr != ')') |
| 216 return false; | 239 return false; |
| 217 | 240 |
| 218 return true; | 241 return true; |
| 219 } | 242 } |
| 220 | 243 |
| 221 } | 244 } |
| OLD | NEW |