Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 23 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
| 24 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 24 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 25 * SUCH DAMAGE. | 25 * SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef DOMPath_h | 28 #ifndef DOMPath_h |
| 29 #define DOMPath_h | 29 #define DOMPath_h |
| 30 | 30 |
| 31 #include "bindings/v8/ScriptWrappable.h" | 31 #include "bindings/v8/ScriptWrappable.h" |
| 32 #include "core/html/canvas/CanvasPathMethods.h" | 32 #include "core/html/canvas/CanvasPathMethods.h" |
| 33 #include "core/svg/SVGMatrix.h" | |
| 33 #include "core/svg/SVGPathUtilities.h" | 34 #include "core/svg/SVGPathUtilities.h" |
| 34 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 35 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 36 | 37 |
| 37 namespace WebCore { | 38 namespace WebCore { |
| 38 | 39 |
| 39 class DOMPath FINAL : public RefCounted<DOMPath>, public CanvasPathMethods, publ ic ScriptWrappable { | 40 class DOMPath FINAL : public RefCounted<DOMPath>, public CanvasPathMethods, publ ic ScriptWrappable { |
| 40 WTF_MAKE_NONCOPYABLE(DOMPath); WTF_MAKE_FAST_ALLOCATED; | 41 WTF_MAKE_NONCOPYABLE(DOMPath); WTF_MAKE_FAST_ALLOCATED; |
| 41 public: | 42 public: |
| 42 static PassRefPtr<DOMPath> create() { return adoptRef(new DOMPath); } | 43 static PassRefPtr<DOMPath> create() { return adoptRef(new DOMPath); } |
| 43 static PassRefPtr<DOMPath> create(const String& pathData) { return adoptRef( new DOMPath(pathData)); } | 44 static PassRefPtr<DOMPath> create(const String& pathData) { return adoptRef( new DOMPath(pathData)); } |
| 44 static PassRefPtr<DOMPath> create(DOMPath* path) { return adoptRef(new DOMPa th(path)); } | 45 static PassRefPtr<DOMPath> create(DOMPath* path) { return adoptRef(new DOMPa th(path)); } |
| 45 | 46 |
| 46 static PassRefPtr<DOMPath> create(const Path& path) { return adoptRef(new DO MPath(path)); } | 47 static PassRefPtr<DOMPath> create(const Path& path) { return adoptRef(new DO MPath(path)); } |
| 47 | 48 |
| 48 const Path& path() const { return m_path; } | 49 const Path& path() const { return m_path; } |
| 49 | 50 |
| 51 DOMPath(DOMPath* path) | |
|
Justin Novosad
2014/02/18 16:09:29
This is weird. This is kind of like a public copy
pals
2014/02/19 11:47:22
Done. Reverted this change.
| |
| 52 : CanvasPathMethods() | |
| 53 { | |
| 54 ScriptWrappable::init(this); | |
| 55 m_path = path->path(); | |
|
rwlbuis
2014/02/18 15:59:59
You can put this in the initialization list, it is
pals
2014/02/19 11:47:22
Done.
| |
| 56 } | |
| 57 | |
| 50 virtual ~DOMPath() { } | 58 virtual ~DOMPath() { } |
| 59 | |
| 60 void addPath(const DOMPath& path, const SVGMatrix& transform) | |
| 61 { | |
| 62 Path src = path.path(); | |
| 63 m_path.addPath(src, transform); | |
| 64 } | |
| 51 private: | 65 private: |
| 52 DOMPath() : CanvasPathMethods() | 66 DOMPath() : CanvasPathMethods() |
| 53 { | 67 { |
| 54 ScriptWrappable::init(this); | 68 ScriptWrappable::init(this); |
| 55 } | 69 } |
| 56 | 70 |
| 57 DOMPath(const Path& path) | 71 DOMPath(const Path& path) |
| 58 : CanvasPathMethods() | 72 : CanvasPathMethods() |
| 59 { | 73 { |
| 60 ScriptWrappable::init(this); | 74 ScriptWrappable::init(this); |
| 61 m_path = path; | 75 m_path = path; |
| 62 } | 76 } |
| 63 | 77 |
| 64 DOMPath(DOMPath* path) | |
| 65 : CanvasPathMethods() | |
| 66 { | |
| 67 ScriptWrappable::init(this); | |
| 68 m_path = path->path(); | |
| 69 } | |
| 70 | |
| 71 DOMPath(const String& pathData) | 78 DOMPath(const String& pathData) |
| 72 : CanvasPathMethods() | 79 : CanvasPathMethods() |
| 73 { | 80 { |
| 74 ScriptWrappable::init(this); | 81 ScriptWrappable::init(this); |
| 75 buildPathFromString(pathData, m_path); | 82 buildPathFromString(pathData, m_path); |
| 76 } | 83 } |
| 77 }; | 84 }; |
| 78 | 85 |
| 79 } | 86 } |
| 80 #endif | 87 #endif |
| OLD | NEW |