1 /*
2  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
4  *           (C) 2000 Dirk Mueller (mueller@kde.org)
5  * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6  * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  */
24 
25 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_REFLECTION_H_
26 #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_REFLECTION_H_
27 
28 #include "third_party/blink/renderer/core/css/css_reflection_direction.h"
29 #include "third_party/blink/renderer/core/style/nine_piece_image.h"
30 #include "third_party/blink/renderer/platform/geometry/length.h"
31 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
32 #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
33 
34 namespace blink {
35 
36 class StyleReflection : public RefCounted<StyleReflection> {
37   USING_FAST_MALLOC(StyleReflection);
38 
39  public:
Create()40   static scoped_refptr<StyleReflection> Create() {
41     return base::AdoptRef(new StyleReflection);
42   }
43 
44   bool operator==(const StyleReflection& o) const {
45     return direction_ == o.direction_ && offset_ == o.offset_ &&
46            mask_ == o.mask_;
47   }
48   bool operator!=(const StyleReflection& o) const { return !(*this == o); }
49 
Direction()50   CSSReflectionDirection Direction() const { return direction_; }
Offset()51   const Length& Offset() const { return offset_; }
Mask()52   const NinePieceImage& Mask() const { return mask_; }
53 
SetDirection(CSSReflectionDirection dir)54   void SetDirection(CSSReflectionDirection dir) { direction_ = dir; }
SetOffset(const Length & length)55   void SetOffset(const Length& length) { offset_ = length; }
SetMask(const NinePieceImage & image)56   void SetMask(const NinePieceImage& image) { mask_ = image; }
57 
58  private:
StyleReflection()59   StyleReflection()
60       : direction_(kReflectionBelow),
61         offset_(Length::Fixed(0)),
62         mask_(NinePieceImage::MaskDefaults()) {}
63 
64   CSSReflectionDirection direction_;
65   Length offset_;
66   NinePieceImage mask_;
67 };
68 
69 }  // namespace blink
70 
71 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_REFLECTION_H_
72