| 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 public: | 23 public: |
| 24 BackgroundImageGeometry() | 24 BackgroundImageGeometry() |
| 25 : m_hasNonLocalGeometry(false) | 25 : m_hasNonLocalGeometry(false) |
| 26 { } | 26 { } |
| 27 | 27 |
| 28 void calculate(const LayoutBoxModelObject&, const LayoutBoxModelObject* pain
tContainer, | 28 void calculate(const LayoutBoxModelObject&, const LayoutBoxModelObject* pain
tContainer, |
| 29 const GlobalPaintFlags, const FillLayer&, const LayoutRect& paintRect); | 29 const GlobalPaintFlags, const FillLayer&, const LayoutRect& paintRect); |
| 30 | 30 |
| 31 LayoutRect destRect() const { return m_destRect; } | 31 LayoutRect destRect() const { return m_destRect; } |
| 32 LayoutSize tileSize() const { return m_tileSize; } | 32 LayoutSize tileSize() const { return m_tileSize; } |
| 33 LayoutSize imageContainerSize() const { return m_imageContainerSize; } | |
| 34 LayoutPoint phase() const { return m_phase; } | 33 LayoutPoint phase() const { return m_phase; } |
| 35 // Space-size represents extra width and height that may be added to | 34 // Space-size represents extra width and height that may be added to |
| 36 // the image if used as a pattern with background-repeat: space. | 35 // the image if used as a pattern with background-repeat: space. |
| 37 LayoutSize spaceSize() const { return m_repeatSpacing; } | 36 LayoutSize spaceSize() const { return m_repeatSpacing; } |
| 38 // Has background-attachment: fixed. Implies that we can't always cheaply co
mpute destRect. | 37 // Has background-attachment: fixed. Implies that we can't always cheaply co
mpute destRect. |
| 39 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } | 38 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } | 41 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } |
| 43 void setPhase(const LayoutPoint& phase) { m_phase = phase; } | 42 void setPhase(const LayoutPoint& phase) { m_phase = phase; } |
| 44 void setImageContainerSize(const LayoutSize& imageContainerSize) { m_imageCo
ntainerSize = imageContainerSize; } | |
| 45 void setTileSize(const LayoutSize& tileSize) { m_tileSize = tileSize; } | 43 void setTileSize(const LayoutSize& tileSize) { m_tileSize = tileSize; } |
| 46 void setSpaceSize(const LayoutSize& repeatSpacing) { m_repeatSpacing = repea
tSpacing; } | 44 void setSpaceSize(const LayoutSize& repeatSpacing) { m_repeatSpacing = repea
tSpacing; } |
| 47 void setPhaseX(LayoutUnit x) { m_phase.setX(x); } | 45 void setPhaseX(LayoutUnit x) { m_phase.setX(x); } |
| 48 void setPhaseY(LayoutUnit y) { m_phase.setY(y); } | 46 void setPhaseY(LayoutUnit y) { m_phase.setY(y); } |
| 49 void setNoRepeatX(LayoutUnit xOffset); | 47 void setNoRepeatX(LayoutUnit xOffset); |
| 50 void setNoRepeatY(LayoutUnit yOffset); | 48 void setNoRepeatY(LayoutUnit yOffset); |
| 51 | 49 |
| 52 void pixelSnapGeometry(); | |
| 53 | |
| 54 void useFixedAttachment(const LayoutPoint& attachmentPoint); | 50 void useFixedAttachment(const LayoutPoint& attachmentPoint); |
| 55 void clip(const LayoutRect&); | |
| 56 void setHasNonLocalGeometry() { m_hasNonLocalGeometry = true; } | 51 void setHasNonLocalGeometry() { m_hasNonLocalGeometry = true; } |
| 57 | 52 |
| 58 LayoutRect m_destRect; | 53 LayoutRect m_destRect; |
| 59 LayoutPoint m_phase; | 54 LayoutPoint m_phase; |
| 60 LayoutSize m_imageContainerSize; | |
| 61 LayoutSize m_tileSize; | 55 LayoutSize m_tileSize; |
| 62 LayoutSize m_repeatSpacing; | 56 LayoutSize m_repeatSpacing; |
| 63 bool m_hasNonLocalGeometry; | 57 bool m_hasNonLocalGeometry; |
| 64 }; | 58 }; |
| 65 | 59 |
| 66 } // namespace blink | 60 } // namespace blink |
| 67 | 61 |
| 68 #endif // BackgroundImageGeometry_h | 62 #endif // BackgroundImageGeometry_h |
| OLD | NEW |