PageViewportController.h [plain text]
#ifndef PageViewportController_h
#define PageViewportController_h
#if USE(ACCELERATED_COMPOSITING)
#include <WebCore/FloatPoint.h>
#include <WebCore/FloatRect.h>
#include <WebCore/FloatSize.h>
#include <WebCore/ViewportArguments.h>
namespace WebCore {
class IntPoint;
class IntSize;
}
namespace WebKit {
class WebPageProxy;
class PageViewportController;
class PageViewportControllerClient;
class PageViewportController {
WTF_MAKE_NONCOPYABLE(PageViewportController);
public:
PageViewportController(WebKit::WebPageProxy*, PageViewportControllerClient*);
virtual ~PageViewportController() { }
float innerBoundedViewportScale(float) const;
float outerBoundedViewportScale(float) const;
WebCore::FloatPoint pixelAlignedFloatPoint(const WebCore::FloatPoint&);
WebCore::FloatPoint boundContentsPosition(const WebCore::FloatPoint&);
WebCore::FloatPoint boundContentsPositionAtScale(const WebCore::FloatPoint&, float scale);
WebCore::FloatSize visibleContentsSize() const;
bool hadUserInteraction() const { return m_hadUserInteraction; }
bool allowsUserScaling() const { return m_allowsUserScaling; }
WebCore::FloatSize contentsLayoutSize() const { return m_rawAttributes.layoutSize; }
float deviceScaleFactor() const;
float minimumScale() const { return m_minimumScaleToFit; }
float maximumScale() const { return m_rawAttributes.maximumScale; }
float currentScale() const { return m_pageScaleFactor; }
void setHadUserInteraction(bool didUserInteract) { m_hadUserInteraction = didUserInteract; }
void didChangeViewportSize(const WebCore::FloatSize& newSize);
void didChangeContentsVisibility(const WebCore::FloatPoint&, float scale, const WebCore::FloatPoint& trajectoryVector = WebCore::FloatPoint::zero());
void didCommitLoad();
void didChangeContentsSize(const WebCore::IntSize& newSize);
void didChangeViewportAttributes(const WebCore::ViewportAttributes&);
void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
void pageTransitionViewportReady();
void pageDidRequestScroll(const WebCore::IntPoint& cssPosition);
private:
void syncVisibleContents(const WebCore::FloatPoint &trajectoryVector = WebCore::FloatPoint::zero());
void applyScaleAfterRenderingContents(float scale);
void applyPositionAfterRenderingContents(const WebCore::FloatPoint& pos);
bool updateMinimumScaleToFit(bool userInitiatedUpdate);
WebPageProxy* const m_webPageProxy;
PageViewportControllerClient* m_client;
WebCore::ViewportAttributes m_rawAttributes;
bool m_allowsUserScaling;
float m_minimumScaleToFit;
bool m_initiallyFitToViewport;
bool m_hadUserInteraction;
WebCore::FloatPoint m_contentsPosition;
WebCore::FloatSize m_contentsSize;
WebCore::FloatSize m_viewportSize;
WebCore::IntSize m_clientContentsSize;
float m_pageScaleFactor;
bool m_pendingPositionChange;
bool m_pendingScaleChange;
WebCore::FloatRect m_lastFrameCoveredRect;
};
bool fuzzyCompare(float, float, float epsilon);
}
#endif // USE(ACCELERATED_COMPOSITING)
#endif // PageViewportController_h