| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #ifndef SVGFitToViewBox_h | 22 #ifndef SVGFitToViewBox_h |
| 23 #define SVGFitToViewBox_h | 23 #define SVGFitToViewBox_h |
| 24 | 24 |
| 25 #include "core/SVGNames.h" | 25 #include "core/SVGNames.h" |
| 26 #include "core/dom/QualifiedName.h" | |
| 27 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" | 26 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" |
| 28 #include "core/svg/SVGAnimatedRect.h" | 27 #include "core/svg/SVGAnimatedRect.h" |
| 29 #include "core/svg/SVGPreserveAspectRatio.h" | 28 #include "core/svg/SVGPreserveAspectRatio.h" |
| 30 #include "core/svg/SVGRect.h" | 29 #include "core/svg/SVGRect.h" |
| 31 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 32 | 31 |
| 33 namespace blink { | 32 namespace blink { |
| 34 | 33 |
| 35 class AffineTransform; | 34 class AffineTransform; |
| 35 class QualifiedName; |
| 36 | 36 |
| 37 class SVGFitToViewBox : public GarbageCollectedMixin { | 37 class SVGFitToViewBox : public GarbageCollectedMixin { |
| 38 public: | 38 public: |
| 39 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, | 39 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, |
| 40 SVGPreserveAspectRatio*, | 40 SVGPreserveAspectRatio*, |
| 41 float viewWidth, | 41 float viewWidth, |
| 42 float viewHeight); | 42 float viewHeight); |
| 43 | 43 |
| 44 static bool isKnownAttribute(const QualifiedName&); | 44 static bool isKnownAttribute(const QualifiedName&); |
| 45 | 45 |
| 46 bool hasValidViewBox() const { return m_viewBox->currentValue()->isValid(); } |
| 46 bool hasEmptyViewBox() const { | 47 bool hasEmptyViewBox() const { |
| 47 return m_viewBox->currentValue()->isValid() && | 48 return m_viewBox->currentValue()->isValid() && |
| 48 m_viewBox->currentValue()->value().isEmpty(); | 49 m_viewBox->currentValue()->value().isEmpty(); |
| 49 } | 50 } |
| 50 | 51 |
| 51 // JS API | 52 // JS API |
| 52 SVGAnimatedRect* viewBox() const { return m_viewBox.get(); } | 53 SVGAnimatedRect* viewBox() const { return m_viewBox.get(); } |
| 53 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() const { | 54 SVGAnimatedPreserveAspectRatio* preserveAspectRatio() const { |
| 54 return m_preserveAspectRatio.get(); | 55 return m_preserveAspectRatio.get(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 DECLARE_VIRTUAL_TRACE(); | 58 DECLARE_VIRTUAL_TRACE(); |
| 58 | 59 |
| 59 protected: | 60 protected: |
| 60 explicit SVGFitToViewBox(SVGElement*); | 61 explicit SVGFitToViewBox(SVGElement*); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 Member<SVGAnimatedRect> m_viewBox; | 64 Member<SVGAnimatedRect> m_viewBox; |
| 64 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; | 65 Member<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio; |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 } // namespace blink | 68 } // namespace blink |
| 68 | 69 |
| 69 #endif // SVGFitToViewBox_h | 70 #endif // SVGFitToViewBox_h |
| OLD | NEW |