Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SVGNumberList_h | 31 #ifndef SVGPath_h |
| 32 #define SVGNumberList_h | 32 #define SVGPath_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "core/svg/properties/SVGAnimatedProperty.h" |
| 35 #include "core/svg/SVGNumber.h" | |
| 36 #include "core/svg/properties/SVGListPropertyHelper.h" | |
| 37 | 35 |
| 38 namespace blink { | 36 namespace blink { |
| 39 | 37 |
| 40 class SVGNumberListTearOff; | 38 class SVGPathByteStream; |
| 41 | 39 |
| 42 class SVGNumberList final : public SVGListPropertyHelper<SVGNumberList, SVGNumbe r> { | 40 class SVGPath : public SVGPropertyBase { |
| 43 public: | 41 public: |
| 44 typedef SVGNumberListTearOff TearOffType; | 42 typedef void TearOffType; |
|
pdr.
2015/10/23 04:40:55
Is this needed?
fs
2015/10/23 09:12:33
Not required, but the alternative would be to have
| |
| 45 | 43 |
| 46 static PassRefPtrWillBeRawPtr<SVGNumberList> create() | 44 static PassRefPtrWillBeRawPtr<SVGPath> create() |
| 47 { | 45 { |
| 48 return adoptRefWillBeNoop(new SVGNumberList()); | 46 return adoptRefWillBeNoop(new SVGPath()); |
| 49 } | 47 } |
| 50 | 48 |
| 51 ~SVGNumberList() override; | 49 ~SVGPath() override; |
| 52 | 50 |
| 53 void setValueAsString(const String&, ExceptionState&); | 51 const SVGPathByteStream& byteStream() const; |
| 52 SVGPathByteStream& mutableByteStream(); | |
| 54 | 53 |
| 55 // SVGPropertyBase: | 54 // SVGPropertyBase: |
| 55 PassRefPtrWillBeRawPtr<SVGPath> clone() const; | |
| 56 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con st override; | |
| 56 String valueAsString() const override; | 57 String valueAsString() const override; |
| 58 void setValueAsString(const String&, ExceptionState&); | |
| 57 | 59 |
| 58 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; | 60 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
| 59 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillB eRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEn dOfDurationValue, SVGElement*) override; | 61 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillB eRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEn dOfDurationValue, SVGElement*) override; |
| 60 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt*) override; | 62 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt*) override; |
| 61 | 63 |
| 62 static AnimatedPropertyType classType() { return AnimatedNumberList; } | 64 static AnimatedPropertyType classType() { return AnimatedPath; } |
| 63 | |
| 64 Vector<float> toFloatVector() const; | |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 SVGNumberList(); | 67 SVGPath(); |
| 68 explicit SVGPath(PassOwnPtr<SVGPathByteStream>); | |
| 68 | 69 |
| 69 template <typename CharType> | 70 mutable OwnPtr<SVGPathByteStream> m_byteStream; |
|
pdr.
2015/10/23 04:40:55
Does this need to be mutable?
fs
2015/10/23 09:12:33
Should cancel out with the const_cast, so no. Drop
| |
| 70 bool parse(const CharType*& ptr, const CharType* end); | |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 inline PassRefPtrWillBeRawPtr<SVGPath> toSVGPath(PassRefPtrWillBeRawPtr<SVGPrope rtyBase> passBase) | |
| 74 { | |
| 75 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; | |
| 76 ASSERT(base->type() == SVGPath::classType()); | |
| 77 return static_pointer_cast<SVGPath>(base.release()); | |
| 78 } | |
| 79 | |
| 73 } // namespace blink | 80 } // namespace blink |
| 74 | 81 |
| 75 #endif // SVGNumberList_h | 82 #endif |
| OLD | NEW |