OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 class ShapeValue : public RefCounted<ShapeValue> { | 41 class ShapeValue : public RefCounted<ShapeValue> { |
42 public: | 42 public: |
43 enum ShapeValueType { | 43 enum ShapeValueType { |
44 // The Auto value is defined by a null ShapeValue* | 44 // The Auto value is defined by a null ShapeValue* |
45 Shape, | 45 Shape, |
46 Box, | 46 Box, |
47 Outside, | |
48 Image | 47 Image |
49 }; | 48 }; |
50 | 49 |
51 static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape,
CSSBoxType cssBox) | 50 static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape,
CSSBoxType cssBox) |
52 { | 51 { |
53 return adoptRef(new ShapeValue(shape, cssBox)); | 52 return adoptRef(new ShapeValue(shape, cssBox)); |
54 } | 53 } |
55 | 54 |
56 static PassRefPtr<ShapeValue> createOutsideValue() | |
57 { | |
58 return adoptRef(new ShapeValue(Outside)); | |
59 } | |
60 | |
61 static PassRefPtr<ShapeValue> createBoxShapeValue(CSSBoxType cssBox) | 55 static PassRefPtr<ShapeValue> createBoxShapeValue(CSSBoxType cssBox) |
62 { | 56 { |
63 return adoptRef(new ShapeValue(cssBox)); | 57 return adoptRef(new ShapeValue(cssBox)); |
64 } | 58 } |
65 | 59 |
66 static PassRefPtr<ShapeValue> createImageValue(PassRefPtr<StyleImage> image) | 60 static PassRefPtr<ShapeValue> createImageValue(PassRefPtr<StyleImage> image) |
67 { | 61 { |
68 return adoptRef(new ShapeValue(image)); | 62 return adoptRef(new ShapeValue(image)); |
69 } | 63 } |
70 | 64 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 inline bool ShapeValue::operator==(const ShapeValue& other) const | 111 inline bool ShapeValue::operator==(const ShapeValue& other) const |
118 { | 112 { |
119 if (type() != other.type()) | 113 if (type() != other.type()) |
120 return false; | 114 return false; |
121 | 115 |
122 switch (type()) { | 116 switch (type()) { |
123 case Shape: | 117 case Shape: |
124 return shape() == other.shape() && cssBox() == other.cssBox(); | 118 return shape() == other.shape() && cssBox() == other.cssBox(); |
125 case Box: | 119 case Box: |
126 return cssBox() == other.cssBox(); | 120 return cssBox() == other.cssBox(); |
127 case Outside: | |
128 return true; | |
129 case Image: | 121 case Image: |
130 return image() == other.image(); | 122 return image() == other.image(); |
131 } | 123 } |
132 | 124 |
133 ASSERT_NOT_REACHED(); | 125 ASSERT_NOT_REACHED(); |
134 return false; | 126 return false; |
135 } | 127 } |
136 | 128 |
137 } | 129 } |
138 | 130 |
139 #endif | 131 #endif |
OLD | NEW |