Chromium Code Reviews| 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. If the image is repeated via tiling, tileSize() is the size | |
| 35 // in pixels of the box to draw the image once. | |
|
Stephen Chennney
2016/10/17 14:31:30
"... is the size of each instance of the image, in
chrishtr
2016/10/19 03:51:36
Isn't it in destination space though? So it isn't
Stephen Chennney
2016/10/19 14:48:15
Right, my comment wasn't clear either. I also real
chrishtr
2016/10/19 16:56:07
I added a sentence referencing CSS as an example,
| |
| 36 // | |
| 37 // tileSize() need not be the same as the intrinsic size of the image; if not, | |
| 38 // it means the image will be resized (via an image filter) when painted into | |
| 39 // that tile region. | |
|
Stephen Chennney
2016/10/19 14:48:15
Then this comment stays to make it clear we will r
chrishtr
2016/10/19 16:56:07
Ack.
| |
| 40 // | |
| 41 // spaceSize().width in the horizontal and spaceSize().height in the vertical | |
| 42 // direction are the spaces between tiles, if the image is tiled. | |
|
Stephen Chennney
2016/10/19 14:48:15
There's already a comment below on spaceSize(). I
chrishtr
2016/10/19 16:56:06
Removed.
| |
| 33 const LayoutRect& destRect() const { return m_destRect; } | 43 const LayoutRect& destRect() const { return m_destRect; } |
| 34 const LayoutSize& tileSize() const { return m_tileSize; } | 44 const LayoutSize& tileSize() const { return m_tileSize; } |
| 35 const LayoutPoint& phase() const { return m_phase; } | 45 const LayoutPoint& phase() const { return m_phase; } |
|
Stephen Chennney
2016/10/19 14:48:15
If we want to comment all of them, this one is "ph
chrishtr
2016/10/19 16:56:06
Done.
| |
| 36 // Space-size represents extra width and height that may be added to | 46 // Space-size represents extra width and height that may be added to |
| 37 // the image if used as a pattern with background-repeat: space. | 47 // the image if used as a pattern with background-repeat: space. |
| 38 const LayoutSize& spaceSize() const { return m_repeatSpacing; } | 48 const LayoutSize& spaceSize() const { return m_repeatSpacing; } |
| 39 // Has background-attachment: fixed. Implies that we can't always cheaply | 49 // Has background-attachment: fixed. Implies that we can't always cheaply |
| 40 // compute destRect. | 50 // compute destRect. |
| 41 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } | 51 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } |
| 42 | 52 |
| 43 private: | 53 private: |
| 44 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } | 54 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } |
| 45 void setPhase(const LayoutPoint& phase) { m_phase = phase; } | 55 void setPhase(const LayoutPoint& phase) { m_phase = phase; } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 72 LayoutRect m_destRect; | 82 LayoutRect m_destRect; |
| 73 LayoutPoint m_phase; | 83 LayoutPoint m_phase; |
| 74 LayoutSize m_tileSize; | 84 LayoutSize m_tileSize; |
| 75 LayoutSize m_repeatSpacing; | 85 LayoutSize m_repeatSpacing; |
| 76 bool m_hasNonLocalGeometry; | 86 bool m_hasNonLocalGeometry; |
| 77 }; | 87 }; |
| 78 | 88 |
| 79 } // namespace blink | 89 } // namespace blink |
| 80 | 90 |
| 81 #endif // BackgroundImageGeometry_h | 91 #endif // BackgroundImageGeometry_h |
| OLD | NEW |