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.
5 #ifndef BackgroundImageGeometry_h
6 #define BackgroundImageGeometry_h
8 #include "platform/geometry/IntPoint.h"
9 #include "platform/geometry/IntRect.h"
10 #include "platform/geometry/IntSize.h"
14 class BackgroundImageGeometry {
16 BackgroundImageGeometry()
17 : m_hasNonLocalGeometry(false)
20 IntRect destRect() const { return m_destRect; }
21 void setDestRect(const IntRect& destRect)
23 m_destRect = destRect;
26 IntPoint phase() const { return m_phase; }
27 void setPhase(const IntPoint& phase)
32 IntSize tileSize() const { return m_tileSize; }
33 void setTileSize(const IntSize& tileSize)
35 m_tileSize = tileSize;
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)
43 m_repeatSpacing = repeatSpacing;
46 void setPhaseX(int x) { m_phase.setX(x); }
47 void setPhaseY(int y) { m_phase.setY(y); }
49 void setNoRepeatX(int xOffset);
50 void setNoRepeatY(int yOffset);
52 void useFixedAttachment(const IntPoint& attachmentPoint);
54 void clip(const IntRect&);
56 void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonLocalGeometry = hasNonLocalGeometry; }
57 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
63 IntSize m_repeatSpacing;
64 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
69 #endif // BackgroundImageGeometry_h