diff options
| author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
|---|---|---|
| committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
| commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
| tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/rendering/style/ShapeValue.h | |
| parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
| download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz | |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/rendering/style/ShapeValue.h')
| -rw-r--r-- | Source/WebCore/rendering/style/ShapeValue.h | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/Source/WebCore/rendering/style/ShapeValue.h b/Source/WebCore/rendering/style/ShapeValue.h index f54678d71..53c11a7e8 100644 --- a/Source/WebCore/rendering/style/ShapeValue.h +++ b/Source/WebCore/rendering/style/ShapeValue.h @@ -32,6 +32,7 @@ #include "BasicShapes.h" #include "CSSValueKeywords.h" +#include "CachedImage.h" #include "StyleImage.h" #include <wtf/PassRefPtr.h> @@ -39,76 +40,77 @@ namespace WebCore { class ShapeValue : public RefCounted<ShapeValue> { public: - enum class Type { + enum ShapeValueType { // The None value is defined by a null ShapeValue* Shape, Box, + Outside, Image }; - static Ref<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox) + static PassRefPtr<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, LayoutBox layoutBox) { - return adoptRef(*new ShapeValue(shape, cssBox)); + return adoptRef(new ShapeValue(shape, layoutBox)); } - static Ref<ShapeValue> createBoxShapeValue(CSSBoxType boxShape) + static PassRefPtr<ShapeValue> createLayoutBoxValue(LayoutBox layoutBox) { - return adoptRef(*new ShapeValue(boxShape)); + return adoptRef(new ShapeValue(layoutBox)); } - static Ref<ShapeValue> createImageValue(PassRefPtr<StyleImage> image) + static PassRefPtr<ShapeValue> createOutsideValue() { - return adoptRef(*new ShapeValue(image)); + return adoptRef(new ShapeValue(Outside)); } - Type type() const { return m_type; } + static PassRefPtr<ShapeValue> createImageValue(PassRefPtr<StyleImage> image) + { + return adoptRef(new ShapeValue(image)); + } + + ShapeValueType type() const { return m_type; } BasicShape* shape() const { return m_shape.get(); } - CSSBoxType cssBox() const { return m_cssBox; } + LayoutBox layoutBox() const { return m_layoutBox; } StyleImage* image() const { return m_image.get(); } - - bool isImageValid() const; - + bool isImageValid() const { return image() && image()->cachedImage() && image()->cachedImage()->hasImage(); } void setImage(PassRefPtr<StyleImage> image) { - ASSERT(type() == Type::Image); + ASSERT(type() == Image); if (m_image != image) m_image = image; } - bool operator==(const ShapeValue&) const; - bool operator!=(const ShapeValue& other) const - { - return !(*this == other); - } + bool operator==(const ShapeValue& other) const { return type() == other.type(); } private: - ShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox) - : m_type(Type::Shape) + ShapeValue(PassRefPtr<BasicShape> shape, LayoutBox layoutBox) + : m_type(Shape) , m_shape(shape) - , m_cssBox(cssBox) + , m_layoutBox(layoutBox) { } - ShapeValue(Type type) + ShapeValue(ShapeValueType type) : m_type(type) + , m_layoutBox(BoxMissing) { } ShapeValue(PassRefPtr<StyleImage> image) - : m_type(Type::Image) + : m_type(Image) , m_image(image) + , m_layoutBox(BoxMissing) { } - - ShapeValue(CSSBoxType cssBox) - : m_type(Type::Box) - , m_cssBox(cssBox) + ShapeValue(LayoutBox layoutBox) + : m_type(Box) + , m_layoutBox(layoutBox) { } - Type m_type; + ShapeValueType m_type; RefPtr<BasicShape> m_shape; RefPtr<StyleImage> m_image; - CSSBoxType m_cssBox { BoxMissing }; + LayoutBox m_layoutBox; }; } |
