diff options
Diffstat (limited to 'WebCore/rendering/style/FillLayer.h')
-rw-r--r-- | WebCore/rendering/style/FillLayer.h | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h index c3944ad..fb928b6 100644 --- a/WebCore/rendering/style/FillLayer.h +++ b/WebCore/rendering/style/FillLayer.h @@ -34,6 +34,31 @@ namespace WebCore { +struct FillSize { + FillSize() + : type(SizeLength) + { + } + + FillSize(EFillSizeType t, LengthSize l) + : type(t) + , size(l) + { + } + + bool operator==(const FillSize& o) const + { + return type == o.type && size == o.size; + } + bool operator!=(const FillSize& o) const + { + return !(*this == o); + } + + EFillSizeType type; + LengthSize size; +}; + struct FillLayer { public: FillLayer(EFillLayerType); @@ -45,9 +70,11 @@ public: EFillAttachment attachment() const { return static_cast<EFillAttachment>(m_attachment); } EFillBox clip() const { return static_cast<EFillBox>(m_clip); } EFillBox origin() const { return static_cast<EFillBox>(m_origin); } - EFillRepeat repeat() const { return static_cast<EFillRepeat>(m_repeat); } + EFillRepeat repeatX() const { return static_cast<EFillRepeat>(m_repeatX); } + EFillRepeat repeatY() const { return static_cast<EFillRepeat>(m_repeatY); } CompositeOperator composite() const { return static_cast<CompositeOperator>(m_composite); } - LengthSize size() const { return m_size; } + LengthSize sizeLength() const { return m_sizeLength; } + FillSize size() const { return FillSize(static_cast<EFillSizeType>(m_sizeType), m_sizeLength); } const FillLayer* next() const { return m_next; } FillLayer* next() { return m_next; } @@ -58,19 +85,23 @@ public: bool isAttachmentSet() const { return m_attachmentSet; } bool isClipSet() const { return m_clipSet; } bool isOriginSet() const { return m_originSet; } - bool isRepeatSet() const { return m_repeatSet; } + bool isRepeatXSet() const { return m_repeatXSet; } + bool isRepeatYSet() const { return m_repeatYSet; } bool isCompositeSet() const { return m_compositeSet; } - bool isSizeSet() const { return m_sizeSet; } + bool isSizeSet() const { return m_sizeType != SizeNone; } void setImage(StyleImage* i) { m_image = i; m_imageSet = true; } - void setXPosition(const Length& l) { m_xPosition = l; m_xPosSet = true; } - void setYPosition(const Length& l) { m_yPosition = l; m_yPosSet = true; } + void setXPosition(Length l) { m_xPosition = l; m_xPosSet = true; } + void setYPosition(Length l) { m_yPosition = l; m_yPosSet = true; } void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; } void setClip(EFillBox b) { m_clip = b; m_clipSet = true; } void setOrigin(EFillBox b) { m_origin = b; m_originSet = true; } - void setRepeat(EFillRepeat r) { m_repeat = r; m_repeatSet = true; } + void setRepeatX(EFillRepeat r) { m_repeatX = r; m_repeatXSet = true; } + void setRepeatY(EFillRepeat r) { m_repeatY = r; m_repeatYSet = true; } void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; } - void setSize(const LengthSize& b) { m_size = b; m_sizeSet = true; } + void setSizeType(EFillSizeType b) { m_sizeType = b; } + void setSizeLength(LengthSize l) { m_sizeLength = l; } + void setSize(FillSize f) { m_sizeType = f.type; m_sizeLength = f.size; } void clearImage() { m_imageSet = false; } void clearXPosition() { m_xPosSet = false; } @@ -78,9 +109,10 @@ public: void clearAttachment() { m_attachmentSet = false; } void clearClip() { m_clipSet = false; } void clearOrigin() { m_originSet = false; } - void clearRepeat() { m_repeatSet = false; } + void clearRepeatX() { m_repeatXSet = false; } + void clearRepeatY() { m_repeatYSet = false; } void clearComposite() { m_compositeSet = false; } - void clearSize() { m_sizeSet = false; } + void clearSize() { m_sizeType = SizeNone; } void setNext(FillLayer* n) { if (m_next != n) { delete m_next; m_next = n; } } @@ -117,9 +149,12 @@ public: static EFillAttachment initialFillAttachment(EFillLayerType) { return ScrollBackgroundAttachment; } static EFillBox initialFillClip(EFillLayerType) { return BorderFillBox; } static EFillBox initialFillOrigin(EFillLayerType type) { return type == BackgroundFillLayer ? PaddingFillBox : BorderFillBox; } - static EFillRepeat initialFillRepeat(EFillLayerType) { return RepeatFill; } + static EFillRepeat initialFillRepeatX(EFillLayerType) { return RepeatFill; } + static EFillRepeat initialFillRepeatY(EFillLayerType) { return RepeatFill; } static CompositeOperator initialFillComposite(EFillLayerType) { return CompositeSourceOver; } - static LengthSize initialFillSize(EFillLayerType) { return LengthSize(); } + static EFillSizeType initialFillSizeType(EFillLayerType) { return SizeLength; } + static LengthSize initialFillSizeLength(EFillLayerType) { return LengthSize(); } + static FillSize initialFillSize(EFillLayerType) { return FillSize(); } static Length initialFillXPosition(EFillLayerType) { return Length(0.0, Percent); } static Length initialFillYPosition(EFillLayerType) { return Length(0.0, Percent); } static StyleImage* initialFillImage(EFillLayerType) { return 0; } @@ -136,20 +171,22 @@ public: unsigned m_attachment : 2; // EFillAttachment unsigned m_clip : 2; // EFillBox unsigned m_origin : 2; // EFillBox - unsigned m_repeat : 2; // EFillRepeat + unsigned m_repeatX : 3; // EFillRepeat + unsigned m_repeatY : 3; // EFillRepeat unsigned m_composite : 4; // CompositeOperator - - LengthSize m_size; + unsigned m_sizeType : 2; // EFillSizeType + + LengthSize m_sizeLength; bool m_imageSet : 1; bool m_attachmentSet : 1; bool m_clipSet : 1; bool m_originSet : 1; - bool m_repeatSet : 1; + bool m_repeatXSet : 1; + bool m_repeatYSet : 1; bool m_xPosSet : 1; bool m_yPosSet : 1; bool m_compositeSet : 1; - bool m_sizeSet : 1; unsigned m_type : 1; // EFillLayerType |