#ifndef HitTestingTransformState_h
#define HitTestingTransformState_h
#include "platform/geometry/FloatQuad.h"
#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/IntSize.h"
#include "platform/transforms/AffineTransform.h"
#include "platform/transforms/TransformationMatrix.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
namespace WebCore {
class HitTestingTransformState : public RefCounted<HitTestingTransformState> {
public:
static PassRefPtr<HitTestingTransformState> create(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area)
{
return adoptRef(new HitTestingTransformState(p, quad, area));
}
static PassRefPtr<HitTestingTransformState> create(const HitTestingTransformState& other)
{
return adoptRef(new HitTestingTransformState(other));
}
enum TransformAccumulation { FlattenTransform, AccumulateTransform };
void translate(int x, int y, TransformAccumulation);
void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation);
FloatPoint mappedPoint() const;
FloatQuad mappedQuad() const;
FloatQuad mappedArea() const;
LayoutRect boundsOfMappedArea() const;
void flatten();
FloatPoint m_lastPlanarPoint;
FloatQuad m_lastPlanarQuad;
FloatQuad m_lastPlanarArea;
TransformationMatrix m_accumulatedTransform;
bool m_accumulatingTransform;
private:
HitTestingTransformState(const FloatPoint& p, const FloatQuad& quad, const FloatQuad& area)
: m_lastPlanarPoint(p)
, m_lastPlanarQuad(quad)
, m_lastPlanarArea(area)
, m_accumulatingTransform(false)
{
}
HitTestingTransformState(const HitTestingTransformState& other)
: RefCounted<HitTestingTransformState>()
, m_lastPlanarPoint(other.m_lastPlanarPoint)
, m_lastPlanarQuad(other.m_lastPlanarQuad)
, m_lastPlanarArea(other.m_lastPlanarArea)
, m_accumulatedTransform(other.m_accumulatedTransform)
, m_accumulatingTransform(other.m_accumulatingTransform)
{
}
void flattenWithTransform(const TransformationMatrix&);
};
}
#endif