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 18 matching lines...) Expand all Loading... | |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SVGPath_h | 31 #ifndef SVGPath_h |
| 32 #define SVGPath_h | 32 #define SVGPath_h |
| 33 | 33 |
| 34 #include "core/svg/properties/SVGProperty.h" | 34 #include "core/svg/properties/SVGProperty.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class ExceptionState; | 38 class ExceptionState; |
| 39 class Path; | |
| 39 class SVGPathByteStream; | 40 class SVGPathByteStream; |
| 40 | 41 |
| 41 class SVGPath : public SVGPropertyBase { | 42 class SVGPath : public SVGPropertyBase { |
| 42 public: | 43 public: |
| 43 typedef void TearOffType; | 44 typedef void TearOffType; |
| 44 | 45 |
| 45 static PassRefPtrWillBeRawPtr<SVGPath> create() | 46 static PassRefPtrWillBeRawPtr<SVGPath> create() |
| 46 { | 47 { |
| 47 return adoptRefWillBeNoop(new SVGPath()); | 48 return adoptRefWillBeNoop(new SVGPath()); |
| 48 } | 49 } |
| 49 | 50 |
| 50 ~SVGPath() override; | 51 ~SVGPath() override; |
| 51 | 52 |
| 53 const Path& path() const; | |
| 54 | |
| 52 const SVGPathByteStream& byteStream() const; | 55 const SVGPathByteStream& byteStream() const; |
| 53 SVGPathByteStream& mutableByteStream(); | 56 SVGPathByteStream& mutableByteStream(); |
| 54 | 57 |
| 55 // SVGPropertyBase: | 58 // SVGPropertyBase: |
| 56 PassRefPtrWillBeRawPtr<SVGPath> clone() const; | 59 PassRefPtrWillBeRawPtr<SVGPath> clone() const; |
| 57 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con st override; | 60 PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const String&) con st override; |
| 58 String valueAsString() const override; | 61 String valueAsString() const override; |
| 59 void setValueAsString(const String&, ExceptionState&); | 62 void setValueAsString(const String&, ExceptionState&); |
| 60 | 63 |
| 61 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; | 64 void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) override; |
| 62 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillB eRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEn dOfDurationValue, SVGElement*) override; | 65 void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillB eRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEn dOfDurationValue, SVGElement*) override; |
| 63 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt*) override; | 66 float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGEleme nt*) override; |
| 64 | 67 |
| 65 static AnimatedPropertyType classType() { return AnimatedPath; } | 68 static AnimatedPropertyType classType() { return AnimatedPath; } |
| 66 | 69 |
| 67 private: | 70 private: |
| 68 SVGPath(); | 71 SVGPath(); |
| 69 explicit SVGPath(PassOwnPtr<SVGPathByteStream>); | 72 explicit SVGPath(PassOwnPtr<SVGPathByteStream>); |
| 70 | 73 |
| 74 SVGPathByteStream& ensureByteStream(); | |
| 75 void byteStreamWillChange(); | |
| 76 | |
| 71 OwnPtr<SVGPathByteStream> m_byteStream; | 77 OwnPtr<SVGPathByteStream> m_byteStream; |
|
pdr.
2015/10/30 16:46:01
I hope we can combine the byte stream and skpath a
| |
| 78 mutable OwnPtr<Path> m_cachedPath; | |
| 72 }; | 79 }; |
| 73 | 80 |
| 74 inline PassRefPtrWillBeRawPtr<SVGPath> toSVGPath(PassRefPtrWillBeRawPtr<SVGPrope rtyBase> passBase) | 81 inline PassRefPtrWillBeRawPtr<SVGPath> toSVGPath(PassRefPtrWillBeRawPtr<SVGPrope rtyBase> passBase) |
| 75 { | 82 { |
| 76 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; | 83 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
| 77 ASSERT(base->type() == SVGPath::classType()); | 84 ASSERT(base->type() == SVGPath::classType()); |
| 78 return static_pointer_cast<SVGPath>(base.release()); | 85 return static_pointer_cast<SVGPath>(base.release()); |
| 79 } | 86 } |
| 80 | 87 |
| 81 } // namespace blink | 88 } // namespace blink |
| 82 | 89 |
| 83 #endif | 90 #endif |
| OLD | NEW |