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

Unified Diff: Source/core/rendering/PaintInfo.h

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Fixed Linux compilation (hopefuly Windows too), addressing some reviewer's suggestions. Created 7 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/PaintInfo.h
diff --git a/Source/core/rendering/PaintInfo.h b/Source/core/rendering/PaintInfo.h
index 28338ada6619eb83d528f276b9879db1c6e6f401..25dfc959b3f921a3975378fa7d766d965d08d51f 100644
--- a/Source/core/rendering/PaintInfo.h
+++ b/Source/core/rendering/PaintInfo.h
@@ -49,69 +49,88 @@ typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
* Paint the object and its children, clipped by (x|y|w|h).
* (tx|ty) is the calculated position of the parent
*/
-struct PaintInfo {
+class PaintInfo {
+public:
PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior,
RenderObject* newPaintingRoot = 0, RenderRegion* region = 0, ListHashSet<RenderInline*>* newOutlineObjects = 0,
OverlapTestRequestMap* overlapTestRequests = 0, const RenderLayerModelObject* newPaintContainer = 0)
- : context(newContext)
- , rect(newRect)
- , phase(newPhase)
- , paintBehavior(newPaintBehavior)
- , paintingRoot(newPaintingRoot)
- , renderRegion(region)
- , outlineObjects(newOutlineObjects)
- , overlapTestRequests(overlapTestRequests)
- , paintContainer(newPaintContainer)
+ : m_context(newContext)
+ , m_rect(newRect)
+ , m_phase(newPhase)
+ , m_paintBehavior(newPaintBehavior)
+ , m_paintingRoot(newPaintingRoot)
+ , m_renderRegion(region)
+ , m_outlineObjects(newOutlineObjects)
+ , m_overlapTestRequests(overlapTestRequests)
+ , m_paintContainer(newPaintContainer)
{
}
void updatePaintingRootForChildren(const RenderObject* renderer)
{
- if (!paintingRoot)
+ if (!m_paintingRoot)
return;
// If we're the painting root, kids draw normally, and see root of 0.
- if (paintingRoot == renderer) {
- paintingRoot = 0;
+ if (m_paintingRoot == renderer) {
+ m_paintingRoot = 0;
return;
}
}
bool shouldPaintWithinRoot(const RenderObject* renderer) const
{
- return !paintingRoot || paintingRoot == renderer;
+ return !m_paintingRoot || m_paintingRoot == renderer;
}
- bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlackText; }
+ bool forceBlackText() const { return m_paintBehavior & PaintBehaviorForceBlackText; }
- bool skipRootBackground() const { return paintBehavior & PaintBehaviorSkipRootBackground; }
- bool paintRootBackgroundOnly() const { return paintBehavior & PaintBehaviorRootBackgroundOnly; }
+ bool skipRootBackground() const { return m_paintBehavior & PaintBehaviorSkipRootBackground; }
+ bool paintRootBackgroundOnly() const { return m_paintBehavior & PaintBehaviorRootBackgroundOnly; }
void applyTransform(const AffineTransform& localToAncestorTransform)
{
if (localToAncestorTransform.isIdentity())
return;
- context->concatCTM(localToAncestorTransform);
+ m_context->concatCTM(localToAncestorTransform);
- if (rect == infiniteRect())
+ if (m_rect == infiniteRect())
return;
- rect = localToAncestorTransform.inverse().mapRect(rect);
+ m_rect = localToAncestorTransform.inverse().mapRect(m_rect);
}
static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); }
- // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout rendering/.
- GraphicsContext* context;
- IntRect rect;
- PaintPhase phase;
- PaintBehavior paintBehavior;
- RenderObject* paintingRoot; // used to draw just one element and its visual kids
- RenderRegion* renderRegion;
- ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children
- OverlapTestRequestMap* overlapTestRequests;
- const RenderLayerModelObject* paintContainer; // the layer object that originates the current painting
+ GraphicsContext* getContext() { return m_context; }
do-not-use 2013/08/05 11:16:30 As explained in my previous review, we don't use "
+ void setContext(GraphicsContext* context) { m_context = context; }
+
+ IntRect& getRect() { return m_rect; }
+ void setRect(const IntRect& rect) { m_rect = rect; }
+
+ const PaintPhase& getPhase() const { return m_phase; }
+ void setPhase(const PaintPhase& phase) { m_phase = phase; }
+
+ RenderRegion* getRenderRegion() { return m_renderRegion; }
+ OverlapTestRequestMap* getOverlapTestRequests() { return m_overlapTestRequests; }
+ void setOverlapTestRequests(OverlapTestRequestMap* map) { m_overlapTestRequests = map; }
+
+ ListHashSet<RenderInline*>* getOutlineObjects() { return m_outlineObjects; }
+ void setOutlineObjects(ListHashSet<RenderInline*>* objects) { m_outlineObjects = objects; }
+
+ const RenderLayerModelObject* getPaintContainer() const { return m_paintContainer; }
+
+private:
+ GraphicsContext* m_context;
+ IntRect m_rect;
+ PaintPhase m_phase;
+ PaintBehavior m_paintBehavior;
+ RenderObject* m_paintingRoot; // used to draw just one element and its visual kids
+ RenderRegion* m_renderRegion;
+ ListHashSet<RenderInline*>* m_outlineObjects; // used to list outlines that should be painted by a block with inline children
+ OverlapTestRequestMap* m_overlapTestRequests;
+ const RenderLayerModelObject* m_paintContainer; // the layer object that originates the current painting
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698