OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 class RenderLayerModelObject; | 42 class RenderLayerModelObject; |
43 class RenderObject; | 43 class RenderObject; |
44 class RenderRegion; | 44 class RenderRegion; |
45 | 45 |
46 typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap; | 46 typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap; |
47 | 47 |
48 /* | 48 /* |
49 * Paint the object and its children, clipped by (x|y|w|h). | 49 * Paint the object and its children, clipped by (x|y|w|h). |
50 * (tx|ty) is the calculated position of the parent | 50 * (tx|ty) is the calculated position of the parent |
51 */ | 51 */ |
52 struct PaintInfo { | 52 class PaintInfo { |
53 public: | |
53 PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase ne wPhase, PaintBehavior newPaintBehavior, | 54 PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase ne wPhase, PaintBehavior newPaintBehavior, |
54 RenderObject* newPaintingRoot = 0, RenderRegion* region = 0, ListHashSet <RenderInline*>* newOutlineObjects = 0, | 55 RenderObject* newPaintingRoot = 0, RenderRegion* region = 0, ListHashSet <RenderInline*>* newOutlineObjects = 0, |
55 OverlapTestRequestMap* overlapTestRequests = 0, const RenderLayerModelOb ject* newPaintContainer = 0) | 56 OverlapTestRequestMap* overlapTestRequests = 0, const RenderLayerModelOb ject* newPaintContainer = 0) |
56 : context(newContext) | 57 : m_context(newContext) |
57 , rect(newRect) | 58 , m_rect(newRect) |
58 , phase(newPhase) | 59 , m_phase(newPhase) |
59 , paintBehavior(newPaintBehavior) | 60 , m_paintBehavior(newPaintBehavior) |
60 , paintingRoot(newPaintingRoot) | 61 , m_paintingRoot(newPaintingRoot) |
61 , renderRegion(region) | 62 , m_renderRegion(region) |
62 , outlineObjects(newOutlineObjects) | 63 , m_outlineObjects(newOutlineObjects) |
63 , overlapTestRequests(overlapTestRequests) | 64 , m_overlapTestRequests(overlapTestRequests) |
64 , paintContainer(newPaintContainer) | 65 , m_paintContainer(newPaintContainer) |
65 { | 66 { |
66 } | 67 } |
67 | 68 |
68 void updatePaintingRootForChildren(const RenderObject* renderer) | 69 void updatePaintingRootForChildren(const RenderObject* renderer) |
69 { | 70 { |
70 if (!paintingRoot) | 71 if (!m_paintingRoot) |
71 return; | 72 return; |
72 | 73 |
73 // If we're the painting root, kids draw normally, and see root of 0. | 74 // If we're the painting root, kids draw normally, and see root of 0. |
74 if (paintingRoot == renderer) { | 75 if (m_paintingRoot == renderer) { |
75 paintingRoot = 0; | 76 m_paintingRoot = 0; |
76 return; | 77 return; |
77 } | 78 } |
78 } | 79 } |
79 | 80 |
80 bool shouldPaintWithinRoot(const RenderObject* renderer) const | 81 bool shouldPaintWithinRoot(const RenderObject* renderer) const |
81 { | 82 { |
82 return !paintingRoot || paintingRoot == renderer; | 83 return !m_paintingRoot || m_paintingRoot == renderer; |
83 } | 84 } |
84 | 85 |
85 bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlack Text; } | 86 bool forceBlackText() const { return m_paintBehavior & PaintBehaviorForceBla ckText; } |
86 | 87 |
87 bool skipRootBackground() const { return paintBehavior & PaintBehaviorSkipRo otBackground; } | 88 bool skipRootBackground() const { return m_paintBehavior & PaintBehaviorSkip RootBackground; } |
88 bool paintRootBackgroundOnly() const { return paintBehavior & PaintBehaviorR ootBackgroundOnly; } | 89 bool paintRootBackgroundOnly() const { return m_paintBehavior & PaintBehavio rRootBackgroundOnly; } |
89 | 90 |
90 void applyTransform(const AffineTransform& localToAncestorTransform) | 91 void applyTransform(const AffineTransform& localToAncestorTransform) |
91 { | 92 { |
92 if (localToAncestorTransform.isIdentity()) | 93 if (localToAncestorTransform.isIdentity()) |
93 return; | 94 return; |
94 | 95 |
95 context->concatCTM(localToAncestorTransform); | 96 m_context->concatCTM(localToAncestorTransform); |
96 | 97 |
97 if (rect == infiniteRect()) | 98 if (m_rect == infiniteRect()) |
98 return; | 99 return; |
99 | 100 |
100 rect = localToAncestorTransform.inverse().mapRect(rect); | 101 m_rect = localToAncestorTransform.inverse().mapRect(m_rect); |
101 } | 102 } |
102 | 103 |
103 static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); } | 104 static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); } |
104 | 105 |
105 // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout rendering/. | 106 GraphicsContext* getContext() { return m_context; } |
do-not-use
2013/08/05 11:16:30
As explained in my previous review, we don't use "
| |
106 GraphicsContext* context; | 107 void setContext(GraphicsContext* context) { m_context = context; } |
107 IntRect rect; | 108 |
108 PaintPhase phase; | 109 IntRect& getRect() { return m_rect; } |
109 PaintBehavior paintBehavior; | 110 void setRect(const IntRect& rect) { m_rect = rect; } |
110 RenderObject* paintingRoot; // used to draw just one element and its visual kids | 111 |
111 RenderRegion* renderRegion; | 112 const PaintPhase& getPhase() const { return m_phase; } |
112 ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that sh ould be painted by a block with inline children | 113 void setPhase(const PaintPhase& phase) { m_phase = phase; } |
113 OverlapTestRequestMap* overlapTestRequests; | 114 |
114 const RenderLayerModelObject* paintContainer; // the layer object that origi nates the current painting | 115 RenderRegion* getRenderRegion() { return m_renderRegion; } |
116 OverlapTestRequestMap* getOverlapTestRequests() { return m_overlapTestReques ts; } | |
117 void setOverlapTestRequests(OverlapTestRequestMap* map) { m_overlapTestReque sts = map; } | |
118 | |
119 ListHashSet<RenderInline*>* getOutlineObjects() { return m_outlineObjects; } | |
120 void setOutlineObjects(ListHashSet<RenderInline*>* objects) { m_outlineObjec ts = objects; } | |
121 | |
122 const RenderLayerModelObject* getPaintContainer() const { return m_paintCont ainer; } | |
123 | |
124 private: | |
125 GraphicsContext* m_context; | |
126 IntRect m_rect; | |
127 PaintPhase m_phase; | |
128 PaintBehavior m_paintBehavior; | |
129 RenderObject* m_paintingRoot; // used to draw just one element and its visua l kids | |
130 RenderRegion* m_renderRegion; | |
131 ListHashSet<RenderInline*>* m_outlineObjects; // used to list outlines that should be painted by a block with inline children | |
132 OverlapTestRequestMap* m_overlapTestRequests; | |
133 const RenderLayerModelObject* m_paintContainer; // the layer object that ori ginates the current painting | |
115 }; | 134 }; |
116 | 135 |
117 } // namespace WebCore | 136 } // namespace WebCore |
118 | 137 |
119 #endif // PaintInfo_h | 138 #endif // PaintInfo_h |
OLD | NEW |