#ifndef LinkHighlight_h
#define LinkHighlight_h
#include "platform/geometry/FloatPoint.h"
#include "platform/geometry/IntPoint.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/graphics/Path.h"
#include "public/platform/WebAnimationDelegate.h"
#include "public/platform/WebContentLayer.h"
#include "public/platform/WebContentLayerClient.h"
#include "public/platform/WebLayer.h"
#include "wtf/OwnPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
class RenderLayer;
class RenderObject;
class Node;
}
namespace blink {
struct WebFloatRect;
struct WebRect;
class WebViewImpl;
class LinkHighlight FINAL : public WebContentLayerClient, public WebAnimationDelegate, WebCore::LinkHighlightClient {
public:
static PassOwnPtr<LinkHighlight> create(WebCore::Node*, WebViewImpl*);
virtual ~LinkHighlight();
WebContentLayer* contentLayer();
WebLayer* clipLayer();
void startHighlightAnimationIfNeeded();
void updateGeometry();
virtual void paintContents(WebCanvas*, const WebRect& clipRect, bool canPaintLCDText, WebFloatRect& opaque) OVERRIDE;
virtual void notifyAnimationStarted(double monotonicTime, blink::WebAnimation::TargetProperty) OVERRIDE;
virtual void notifyAnimationFinished(double monotonicTime, blink::WebAnimation::TargetProperty) OVERRIDE;
virtual void invalidate() OVERRIDE;
virtual WebLayer* layer() OVERRIDE;
virtual void clearCurrentGraphicsLayer() OVERRIDE;
WebCore::GraphicsLayer* currentGraphicsLayerForTesting() const { return m_currentGraphicsLayer; }
private:
LinkHighlight(WebCore::Node*, WebViewImpl*);
void releaseResources();
void computeQuads(WebCore::Node*, WTF::Vector<WebCore::FloatQuad>&) const;
WebCore::RenderLayer* computeEnclosingCompositingLayer();
void clearGraphicsLayerLinkHighlightPointer();
bool computeHighlightLayerPathAndPosition(WebCore::RenderLayer*);
OwnPtr<WebContentLayer> m_contentLayer;
OwnPtr<WebLayer> m_clipLayer;
WebCore::Path m_path;
RefPtr<WebCore::Node> m_node;
WebViewImpl* m_owningWebViewImpl;
WebCore::GraphicsLayer* m_currentGraphicsLayer;
bool m_geometryNeedsUpdate;
bool m_isAnimating;
double m_startTime;
};
}
#endif