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

Side by Side Diff: Source/core/rendering/style/ExclusionShapeValue.h

Issue 16358010: [CSS Exclusions] Add CSS parsing support for image URI shape-inside and shape-outside values (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 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 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 13 matching lines...) Expand all
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef ExclusionShapeValue_h 30 #ifndef ExclusionShapeValue_h
31 #define ExclusionShapeValue_h 31 #define ExclusionShapeValue_h
32 32
33 #include "core/rendering/style/BasicShapes.h" 33 #include "core/rendering/style/BasicShapes.h"
34 #include <wtf/PassRefPtr.h> 34 #include "core/rendering/style/StyleImage.h"
35 #include "wtf/PassRefPtr.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 class ExclusionShapeValue : public RefCounted<ExclusionShapeValue> { 39 class ExclusionShapeValue : public RefCounted<ExclusionShapeValue> {
39 public: 40 public:
40 enum ExclusionShapeValueType { 41 enum ExclusionShapeValueType {
41 // The AUTO value is defined by a null ExclusionShapeValue* 42 // The Auto value is defined by a null ExclusionShapeValue*
42 SHAPE, 43 Shape,
43 OUTSIDE 44 Outside,
45 Image
44 }; 46 };
45 47
46 static PassRefPtr<ExclusionShapeValue> createShapeValue(PassRefPtr<BasicShap e> shape) 48 static PassRefPtr<ExclusionShapeValue> createShapeValue(PassRefPtr<BasicShap e> shape)
47 { 49 {
48 return adoptRef(new ExclusionShapeValue(shape)); 50 return adoptRef(new ExclusionShapeValue(shape));
49 } 51 }
50 52
51 static PassRefPtr<ExclusionShapeValue> createOutsideValue() 53 static PassRefPtr<ExclusionShapeValue> createOutsideValue()
52 { 54 {
53 return adoptRef(new ExclusionShapeValue(OUTSIDE)); 55 return adoptRef(new ExclusionShapeValue(Outside));
56 }
57
58 static PassRefPtr<ExclusionShapeValue> createImageValue(PassRefPtr<StyleImag e> image)
59 {
60 return adoptRef(new ExclusionShapeValue(image));
54 } 61 }
55 62
56 ExclusionShapeValueType type() const { return m_type; } 63 ExclusionShapeValueType type() const { return m_type; }
57 BasicShape* shape() const { return m_shape.get(); } 64 BasicShape* shape() const { return m_shape.get(); }
65 StyleImage* image() const { return m_image.get(); }
66 void setImage(PassRefPtr<StyleImage> image)
67 {
68 if (m_image != image)
eseidel 2013/06/04 18:10:36 Why bother avoiding?
69 m_image = image;
70 }
58 bool operator==(const ExclusionShapeValue& other) const { return type() == o ther.type(); } 71 bool operator==(const ExclusionShapeValue& other) const { return type() == o ther.type(); }
59 72
60 private: 73 private:
61 ExclusionShapeValue(PassRefPtr<BasicShape> shape) : m_type(SHAPE), m_shape(s hape) { } 74 ExclusionShapeValue(PassRefPtr<BasicShape> shape)
62 ExclusionShapeValue(ExclusionShapeValueType type) : m_type(type) { } 75 : m_type(Shape)
76 , m_shape(shape)
77 {
78 }
79 ExclusionShapeValue(ExclusionShapeValueType type)
80 : m_type(type)
81 {
82 }
83 ExclusionShapeValue(PassRefPtr<StyleImage> image)
84 : m_type(Image)
85 , m_image(image)
86 {
87 }
63 ExclusionShapeValueType m_type; 88 ExclusionShapeValueType m_type;
64 RefPtr<BasicShape> m_shape; 89 RefPtr<BasicShape> m_shape;
90 RefPtr<StyleImage> m_image;
65 }; 91 };
66 92
67 } 93 }
68 94
69 #endif 95 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698