Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / paint / BackgroundImageGeometry.h
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BackgroundImageGeometry_h
6 #define BackgroundImageGeometry_h
7
8 #include "platform/geometry/IntPoint.h"
9 #include "platform/geometry/IntRect.h"
10 #include "platform/geometry/IntSize.h"
11
12 namespace blink {
13
14 class BackgroundImageGeometry {
15 public:
16     BackgroundImageGeometry()
17         : m_hasNonLocalGeometry(false)
18     { }
19
20     IntRect destRect() const { return m_destRect; }
21     void setDestRect(const IntRect& destRect)
22     {
23         m_destRect = destRect;
24     }
25
26     IntPoint phase() const { return m_phase; }
27     void setPhase(const IntPoint& phase)
28     {
29         m_phase = phase;
30     }
31
32     IntSize tileSize() const { return m_tileSize; }
33     void setTileSize(const IntSize& tileSize)
34     {
35         m_tileSize = tileSize;
36     }
37
38     // Space-size represents extra width and height that may be added to
39     // the image if used as a pattern with repeat: space
40     IntSize spaceSize() const { return m_repeatSpacing; }
41     void setSpaceSize(const IntSize& repeatSpacing)
42     {
43         m_repeatSpacing = repeatSpacing;
44     }
45
46     void setPhaseX(int x) { m_phase.setX(x); }
47     void setPhaseY(int y) { m_phase.setY(y); }
48
49     void setNoRepeatX(int xOffset);
50     void setNoRepeatY(int yOffset);
51
52     void useFixedAttachment(const IntPoint& attachmentPoint);
53
54     void clip(const IntRect&);
55
56     void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonLocalGeometry = hasNonLocalGeometry; }
57     bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
58
59 private:
60     IntRect m_destRect;
61     IntPoint m_phase;
62     IntSize m_tileSize;
63     IntSize m_repeatSpacing;
64     bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
65 };
66
67 } // namespace blink
68
69 #endif // BackgroundImageGeometry_h