| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 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 10 matching lines...) Expand all Loading... |
| 21 #define SVGViewSpec_h | 21 #define SVGViewSpec_h |
| 22 | 22 |
| 23 #include "bindings/core/v8/ScriptWrappable.h" | 23 #include "bindings/core/v8/ScriptWrappable.h" |
| 24 #include "core/svg/SVGFitToViewBox.h" | 24 #include "core/svg/SVGFitToViewBox.h" |
| 25 #include "core/svg/SVGSVGElement.h" | 25 #include "core/svg/SVGSVGElement.h" |
| 26 #include "core/svg/SVGZoomAndPan.h" | 26 #include "core/svg/SVGZoomAndPan.h" |
| 27 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 class SVGViewSpec final : public RefCountedWillBeGarbageCollectedFinalized<SVGVi
ewSpec>, public ScriptWrappable, public SVGZoomAndPan, public SVGFitToViewBox { | 31 class SVGViewSpec final : public GarbageCollectedFinalized<SVGViewSpec>, public
ScriptWrappable, public SVGZoomAndPan, public SVGFitToViewBox { |
| 32 DEFINE_WRAPPERTYPEINFO(); | 32 DEFINE_WRAPPERTYPEINFO(); |
| 33 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGViewSpec); | 33 USING_GARBAGE_COLLECTED_MIXIN(SVGViewSpec); |
| 34 public: | 34 public: |
| 35 #if !ENABLE(OILPAN) | 35 #if !ENABLE(OILPAN) |
| 36 using RefCounted<SVGViewSpec>::ref; | 36 using RefCounted<SVGViewSpec>::ref; |
| 37 using RefCounted<SVGViewSpec>::deref; | 37 using RefCounted<SVGViewSpec>::deref; |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 static PassRefPtrWillBeRawPtr<SVGViewSpec> create(SVGSVGElement* contextElem
ent) | 40 static RawPtr<SVGViewSpec> create(SVGSVGElement* contextElement) |
| 41 { | 41 { |
| 42 return adoptRefWillBeNoop(new SVGViewSpec(contextElement)); | 42 return new SVGViewSpec(contextElement); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool parseViewSpec(const String&); | 45 bool parseViewSpec(const String&); |
| 46 void reset(); | 46 void reset(); |
| 47 void detachContextElement(); | 47 void detachContextElement(); |
| 48 template<typename T> void inheritViewAttributesFromElement(T*); | 48 template<typename T> void inheritViewAttributesFromElement(T*); |
| 49 | 49 |
| 50 // JS API | 50 // JS API |
| 51 SVGTransformList* transform() { return m_transform ? m_transform->baseValue(
) : 0; } | 51 SVGTransformList* transform() { return m_transform ? m_transform->baseValue(
) : 0; } |
| 52 PassRefPtrWillBeRawPtr<SVGTransformListTearOff> transformFromJavascript() {
return m_transform ? m_transform->baseVal() : 0; } | 52 RawPtr<SVGTransformListTearOff> transformFromJavascript() { return m_transfo
rm ? m_transform->baseVal() : 0; } |
| 53 SVGElement* viewTarget() const; | 53 SVGElement* viewTarget() const; |
| 54 String viewBoxString() const; | 54 String viewBoxString() const; |
| 55 String preserveAspectRatioString() const; | 55 String preserveAspectRatioString() const; |
| 56 String transformString() const; | 56 String transformString() const; |
| 57 String viewTargetString() const { return m_viewTargetString; } | 57 String viewTargetString() const { return m_viewTargetString; } |
| 58 // override SVGZoomAndPan.setZoomAndPan so can throw exception on write | 58 // override SVGZoomAndPan.setZoomAndPan so can throw exception on write |
| 59 void setZoomAndPan(unsigned short value) { } // read only | 59 void setZoomAndPan(unsigned short value) { } // read only |
| 60 void setZoomAndPan(unsigned short value, ExceptionState&); | 60 void setZoomAndPan(unsigned short value, ExceptionState&); |
| 61 | 61 |
| 62 DECLARE_VIRTUAL_TRACE(); | 62 DECLARE_VIRTUAL_TRACE(); |
| 63 | 63 |
| 64 SVGSVGElement* contextElement() { return m_contextElement.get(); } | 64 SVGSVGElement* contextElement() { return m_contextElement.get(); } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 explicit SVGViewSpec(SVGSVGElement*); | 67 explicit SVGViewSpec(SVGSVGElement*); |
| 68 | 68 |
| 69 template<typename CharType> | 69 template<typename CharType> |
| 70 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); | 70 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); |
| 71 | 71 |
| 72 RawPtrWillBeMember<SVGSVGElement> m_contextElement; | 72 Member<SVGSVGElement> m_contextElement; |
| 73 RefPtrWillBeMember<SVGAnimatedTransformList> m_transform; | 73 Member<SVGAnimatedTransformList> m_transform; |
| 74 String m_viewTargetString; | 74 String m_viewTargetString; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 template <typename T> | 77 template <typename T> |
| 78 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) | 78 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement) |
| 79 { | 79 { |
| 80 if (!inheritFromElement->hasEmptyViewBox()) | 80 if (!inheritFromElement->hasEmptyViewBox()) |
| 81 viewBox()->baseValue()->setValue(inheritFromElement->viewBox()->currentV
alue()->value()); | 81 viewBox()->baseValue()->setValue(inheritFromElement->viewBox()->currentV
alue()->value()); |
| 82 | 82 |
| 83 if (inheritFromElement->preserveAspectRatio()->isSpecified()) { | 83 if (inheritFromElement->preserveAspectRatio()->isSpecified()) { |
| 84 preserveAspectRatio()->baseValue()->setAlign(inheritFromElement->preserv
eAspectRatio()->currentValue()->align()); | 84 preserveAspectRatio()->baseValue()->setAlign(inheritFromElement->preserv
eAspectRatio()->currentValue()->align()); |
| 85 preserveAspectRatio()->baseValue()->setMeetOrSlice(inheritFromElement->p
reserveAspectRatio()->currentValue()->meetOrSlice()); | 85 preserveAspectRatio()->baseValue()->setMeetOrSlice(inheritFromElement->p
reserveAspectRatio()->currentValue()->meetOrSlice()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) | 88 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr)) |
| 89 setZoomAndPan(inheritFromElement->zoomAndPan()); | 89 setZoomAndPan(inheritFromElement->zoomAndPan()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| 93 | 93 |
| 94 #endif // SVGViewSpec_h | 94 #endif // SVGViewSpec_h |
| OLD | NEW |