| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BackgroundImageGeometry_h | 5 #ifndef BackgroundImageGeometry_h |
| 6 #define BackgroundImageGeometry_h | 6 #define BackgroundImageGeometry_h |
| 7 | 7 |
| 8 #include "core/paint/PaintPhase.h" | 8 #include "core/paint/PaintPhase.h" |
| 9 #include "platform/geometry/LayoutPoint.h" | 9 #include "platform/geometry/LayoutPoint.h" |
| 10 #include "platform/geometry/LayoutRect.h" | 10 #include "platform/geometry/LayoutRect.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 BackgroundImageGeometry() : m_hasNonLocalGeometry(false) {} | 25 BackgroundImageGeometry() : m_hasNonLocalGeometry(false) {} |
| 26 | 26 |
| 27 void calculate(const LayoutBoxModelObject&, | 27 void calculate(const LayoutBoxModelObject&, |
| 28 const LayoutBoxModelObject* paintContainer, | 28 const LayoutBoxModelObject* paintContainer, |
| 29 const GlobalPaintFlags, | 29 const GlobalPaintFlags, |
| 30 const FillLayer&, | 30 const FillLayer&, |
| 31 const LayoutRect& paintRect); | 31 const LayoutRect& paintRect); |
| 32 | 32 |
| 33 // destRect() is the rect in the space of the containing box into which to |
| 34 // draw the image. |
| 33 const LayoutRect& destRect() const { return m_destRect; } | 35 const LayoutRect& destRect() const { return m_destRect; } |
| 36 // If the image is repeated via tiling, tileSize() is the size |
| 37 // in pixels of the area into which to draw the entire image once. |
| 38 // |
| 39 // tileSize() need not be the same as the intrinsic size of the image; if not, |
| 40 // it means the image will be resized (via an image filter) when painted into |
| 41 // that tile region. This may happen because of CSS background-size and |
| 42 // background-repeat requirements. |
| 34 const LayoutSize& tileSize() const { return m_tileSize; } | 43 const LayoutSize& tileSize() const { return m_tileSize; } |
| 44 // phase() represents the point in the image that will appear at (0,0) in the |
| 45 // destination space. The point is defined in tileSize() coordinates. |
| 35 const LayoutPoint& phase() const { return m_phase; } | 46 const LayoutPoint& phase() const { return m_phase; } |
| 36 // Space-size represents extra width and height that may be added to | 47 // Space-size represents extra width and height that may be added to |
| 37 // the image if used as a pattern with background-repeat: space. | 48 // the image if used as a pattern with background-repeat: space. |
| 38 const LayoutSize& spaceSize() const { return m_repeatSpacing; } | 49 const LayoutSize& spaceSize() const { return m_repeatSpacing; } |
| 39 // Has background-attachment: fixed. Implies that we can't always cheaply | 50 // Has background-attachment: fixed. Implies that we can't always cheaply |
| 40 // compute destRect. | 51 // compute destRect. |
| 41 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } | 52 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } |
| 42 | 53 |
| 43 private: | 54 private: |
| 44 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } | 55 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 LayoutRect m_destRect; | 83 LayoutRect m_destRect; |
| 73 LayoutPoint m_phase; | 84 LayoutPoint m_phase; |
| 74 LayoutSize m_tileSize; | 85 LayoutSize m_tileSize; |
| 75 LayoutSize m_repeatSpacing; | 86 LayoutSize m_repeatSpacing; |
| 76 bool m_hasNonLocalGeometry; | 87 bool m_hasNonLocalGeometry; |
| 77 }; | 88 }; |
| 78 | 89 |
| 79 } // namespace blink | 90 } // namespace blink |
| 80 | 91 |
| 81 #endif // BackgroundImageGeometry_h | 92 #endif // BackgroundImageGeometry_h |
| OLD | NEW |