#ifndef PaintInfo_h
#define PaintInfo_h
#if ENABLE(SVG)
#include "AffineTransform.h"
#endif
#include "GraphicsContext.h"
#include "IntRect.h"
#include "LayoutRect.h"
#include "PaintPhase.h"
#include <limits>
#include <wtf/HashMap.h>
#include <wtf/ListHashSet.h>
namespace WebCore {
class OverlapTestRequestClient;
class RenderInline;
class RenderLayerModelObject;
class RenderObject;
class RenderRegion;
typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
struct PaintInfo {
PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior,
RenderObject* newSubtreePaintRoot = 0, RenderRegion* region = 0, ListHashSet<RenderInline*>* newOutlineObjects = 0,
OverlapTestRequestMap* overlapTestRequests = 0, const RenderLayerModelObject* newPaintContainer = 0)
: context(newContext)
, rect(newRect)
, phase(newPhase)
, paintBehavior(newPaintBehavior)
, subtreePaintRoot(newSubtreePaintRoot)
, renderRegion(region)
, outlineObjects(newOutlineObjects)
, overlapTestRequests(overlapTestRequests)
, paintContainer(newPaintContainer)
{
}
void updateSubtreePaintRootForChildren(const RenderObject* renderer)
{
if (!subtreePaintRoot)
return;
if (subtreePaintRoot == renderer) {
subtreePaintRoot = 0;
return;
}
}
bool shouldPaintWithinRoot(const RenderObject* renderer) const
{
return !subtreePaintRoot || subtreePaintRoot == renderer;
}
bool forceBlackText() const { return paintBehavior & PaintBehaviorForceBlackText; }
bool skipRootBackground() const { return paintBehavior & PaintBehaviorSkipRootBackground; }
bool paintRootBackgroundOnly() const { return paintBehavior & PaintBehaviorRootBackgroundOnly; }
#if ENABLE(SVG)
void applyTransform(const AffineTransform& localToAncestorTransform)
{
if (localToAncestorTransform.isIdentity())
return;
context->concatCTM(localToAncestorTransform);
if (rect == infiniteRect())
return;
rect = localToAncestorTransform.inverse().mapRect(rect);
}
#endif
static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); }
GraphicsContext* context;
IntRect rect;
PaintPhase phase;
PaintBehavior paintBehavior;
RenderObject* subtreePaintRoot; RenderRegion* renderRegion;
ListHashSet<RenderInline*>* outlineObjects; OverlapTestRequestMap* overlapTestRequests;
const RenderLayerModelObject* paintContainer; };
}
#endif // PaintInfo_h