#pragma once
#include "AffineTransform.h"
#include "ExceptionOr.h"
namespace WebCore {
class FloatRect;
class SVGElement;
class SVGMatrix;
class SVGLocatable {
public:
virtual ~SVGLocatable() = default;
virtual SVGElement* nearestViewportElement() const = 0;
virtual SVGElement* farthestViewportElement() const = 0;
enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate };
virtual FloatRect getBBox(StyleUpdateStrategy) = 0;
virtual AffineTransform getCTM(StyleUpdateStrategy) = 0;
virtual AffineTransform getScreenCTM(StyleUpdateStrategy) = 0;
ExceptionOr<Ref<SVGMatrix>> getTransformToElement(SVGElement*, StyleUpdateStrategy = AllowStyleUpdate);
static SVGElement* nearestViewportElement(const SVGElement*);
static SVGElement* farthestViewportElement(const SVGElement*);
enum CTMScope {
NearestViewportScope, ScreenScope };
protected:
virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return AffineTransform(); }
static FloatRect getBBox(SVGElement*, StyleUpdateStrategy);
static AffineTransform computeCTM(SVGElement*, CTMScope, StyleUpdateStrategy);
};
}