Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Side by Side Diff: third_party/WebKit/Source/core/paint/BackgroundImageGeometry.h

Issue 1456813002: Calculate Background Image Geometries using sub-pixel values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: MOAR expectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/IntPoint.h" 9 #include "platform/geometry/LayoutPoint.h"
10 #include "platform/geometry/IntRect.h" 10 #include "platform/geometry/LayoutRect.h"
11 #include "platform/geometry/IntSize.h" 11 #include "platform/geometry/LayoutSize.h"
12 #include "wtf/Allocator.h" 12 #include "wtf/Allocator.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class FillLayer; 16 class FillLayer;
17 class LayoutBoxModelObject; 17 class LayoutBoxModelObject;
18 class LayoutObject; 18 class LayoutObject;
19 class LayoutRect; 19 class LayoutRect;
20 20
21 class BackgroundImageGeometry { 21 class BackgroundImageGeometry {
22 STACK_ALLOCATED(); 22 STACK_ALLOCATED();
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 IntRect destRect() const { return m_destRect; } 31 LayoutRect destRect() const { return m_destRect; }
32 IntSize tileSize() const { return m_tileSize; } 32 LayoutSize tileSize() const { return m_tileSize; }
33 IntSize imageContainerSize() const { return m_imageContainerSize; } 33 LayoutSize imageContainerSize() const { return m_imageContainerSize; }
34 IntPoint phase() const { return m_phase; } 34 LayoutPoint phase() const { return m_phase; }
35 // Space-size represents extra width and height that may be added to 35 // Space-size represents extra width and height that may be added to
36 // the image if used as a pattern with background-repeat: space. 36 // the image if used as a pattern with background-repeat: space.
37 IntSize spaceSize() const { return m_repeatSpacing; } 37 LayoutSize spaceSize() const { return m_repeatSpacing; }
38 // Has background-attachment: fixed. Implies that we can't always cheaply co mpute destRect. 38 // Has background-attachment: fixed. Implies that we can't always cheaply co mpute destRect.
39 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } 39 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
40 40
41 private: 41 private:
42 void setDestRect(const IntRect& destRect) { m_destRect = destRect; } 42 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; }
43 void setPhase(const IntPoint& phase) { m_phase = phase; } 43 void setPhase(const LayoutPoint& phase) { m_phase = phase; }
44 void setImageContainerSize(const IntSize& imageContainerSize) { m_imageConta inerSize = imageContainerSize; } 44 void setImageContainerSize(const LayoutSize& imageContainerSize) { m_imageCo ntainerSize = imageContainerSize; }
45 void setTileSize(const IntSize& tileSize) { m_tileSize = tileSize; } 45 void setTileSize(const LayoutSize& tileSize) { m_tileSize = tileSize; }
46 void setSpaceSize(const IntSize& repeatSpacing) { m_repeatSpacing = repeatSp acing; } 46 void setSpaceSize(const LayoutSize& repeatSpacing) { m_repeatSpacing = repea tSpacing; }
47 void setPhaseX(int x) { m_phase.setX(x); } 47 void setPhaseX(LayoutUnit x) { m_phase.setX(x); }
48 void setPhaseY(int y) { m_phase.setY(y); } 48 void setPhaseY(LayoutUnit y) { m_phase.setY(y); }
49 void setNoRepeatX(int xOffset); 49 void setNoRepeatX(LayoutUnit xOffset);
50 void setNoRepeatY(int yOffset); 50 void setNoRepeatY(LayoutUnit yOffset);
51 51
52 void useFixedAttachment(const IntPoint& attachmentPoint); 52 void pixelSnapGeometry();
53 void clip(const IntRect&); 53
54 void useFixedAttachment(const LayoutPoint& attachmentPoint);
55 void clip(const LayoutRect&);
54 void setHasNonLocalGeometry() { m_hasNonLocalGeometry = true; } 56 void setHasNonLocalGeometry() { m_hasNonLocalGeometry = true; }
55 57
56 IntRect m_destRect; 58 LayoutRect m_destRect;
57 IntPoint m_phase; 59 LayoutPoint m_phase;
58 IntSize m_imageContainerSize; 60 LayoutSize m_imageContainerSize;
59 IntSize m_tileSize; 61 LayoutSize m_tileSize;
60 IntSize m_repeatSpacing; 62 LayoutSize m_repeatSpacing;
61 bool m_hasNonLocalGeometry; 63 bool m_hasNonLocalGeometry;
62 }; 64 };
63 65
64 } // namespace blink 66 } // namespace blink
65 67
66 #endif // BackgroundImageGeometry_h 68 #endif // BackgroundImageGeometry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698