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

Side by Side Diff: Source/core/svg/SVGViewSpec.h

Issue 1015743003: [svg] Make svgView override existing data selectively (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: compilefix 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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 #endif 38 #endif
39 39
40 static PassRefPtrWillBeRawPtr<SVGViewSpec> create(SVGSVGElement* contextElem ent) 40 static PassRefPtrWillBeRawPtr<SVGViewSpec> create(SVGSVGElement* contextElem ent)
41 { 41 {
42 return adoptRefWillBeNoop(new SVGViewSpec(contextElement)); 42 return adoptRefWillBeNoop(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 49
49 // JS API 50 // JS API
50 SVGTransformList* transform() { return m_transform ? m_transform->baseValue( ) : 0; } 51 SVGTransformList* transform() { return m_transform ? m_transform->baseValue( ) : 0; }
51 PassRefPtrWillBeRawPtr<SVGTransformListTearOff> transformFromJavascript() { return m_transform ? m_transform->baseVal() : 0; } 52 PassRefPtrWillBeRawPtr<SVGTransformListTearOff> transformFromJavascript() { return m_transform ? m_transform->baseVal() : 0; }
52 SVGElement* viewTarget() const; 53 SVGElement* viewTarget() const;
53 String viewBoxString() const; 54 String viewBoxString() const;
54 String preserveAspectRatioString() const; 55 String preserveAspectRatioString() const;
55 String transformString() const; 56 String transformString() const;
56 String viewTargetString() const { return m_viewTargetString; } 57 String viewTargetString() const { return m_viewTargetString; }
57 // override SVGZoomAndPan.setZoomAndPan so can throw exception on write 58 // override SVGZoomAndPan.setZoomAndPan so can throw exception on write
58 void setZoomAndPan(unsigned short value) { } // read only 59 void setZoomAndPan(unsigned short value) { } // read only
59 void setZoomAndPan(unsigned short value, ExceptionState&); 60 void setZoomAndPan(unsigned short value, ExceptionState&);
60 61
61 DECLARE_VIRTUAL_TRACE(); 62 DECLARE_VIRTUAL_TRACE();
62 63
63 SVGSVGElement* contextElement() { return m_contextElement.get(); } 64 SVGSVGElement* contextElement() { return m_contextElement.get(); }
64 65
65 private: 66 private:
66 explicit SVGViewSpec(SVGSVGElement*); 67 explicit SVGViewSpec(SVGSVGElement*);
67 68
68 template<typename CharType> 69 template<typename CharType>
69 bool parseViewSpecInternal(const CharType* ptr, const CharType* end); 70 bool parseViewSpecInternal(const CharType* ptr, const CharType* end);
70 71
71 RawPtrWillBeMember<SVGSVGElement> m_contextElement; 72 RawPtrWillBeMember<SVGSVGElement> m_contextElement;
72 RefPtrWillBeMember<SVGAnimatedTransformList> m_transform; 73 RefPtrWillBeMember<SVGAnimatedTransformList> m_transform;
73 String m_viewTargetString; 74 String m_viewTargetString;
74 }; 75 };
75 76
77 template <typename T>
78 void SVGViewSpec::inheritViewAttributesFromElement(T* inheritFromElement)
79 {
80 if (inheritFromElement->hasAttribute(SVGNames::viewBoxAttr))
81 viewBox()->baseValue()->setValue(inheritFromElement->viewBox()->currentV alue()->value());
82
83 if (inheritFromElement->hasAttribute(SVGNames::preserveAspectRatioAttr)) {
84 preserveAspectRatio()->baseValue()->setAlign(inheritFromElement->preserv eAspectRatio()->currentValue()->align());
85 preserveAspectRatio()->baseValue()->setMeetOrSlice(inheritFromElement->p reserveAspectRatio()->currentValue()->meetOrSlice());
86 }
87
88 if (inheritFromElement->hasAttribute(SVGNames::zoomAndPanAttr))
89 setZoomAndPan(inheritFromElement->zoomAndPan());
90 }
91
76 } // namespace blink 92 } // namespace blink
77 93
78 #endif // SVGViewSpec_h 94 #endif // SVGViewSpec_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698