Chromium Code Reviews| Index: Source/WebKit/chromium/src/ViewportAnchor.h |
| diff --git a/Source/WebKit/chromium/public/WebUserGestureToken.h b/Source/WebKit/chromium/src/ViewportAnchor.h |
| similarity index 55% |
| copy from Source/WebKit/chromium/public/WebUserGestureToken.h |
| copy to Source/WebKit/chromium/src/ViewportAnchor.h |
| index e81b6262b819b9fbbabb6659f94e648a9096105c..b3797e3a0317961cf4f426adec66982f8c1f8cce 100644 |
| --- a/Source/WebKit/chromium/public/WebUserGestureToken.h |
| +++ b/Source/WebKit/chromium/src/ViewportAnchor.h |
| @@ -28,46 +28,53 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef WebUserGestureToken_h |
| -#define WebUserGestureToken_h |
| +#ifndef ViewportAnchor_h |
| +#define ViewportAnchor_h |
| -#include "../../../Platform/chromium/public/WebPrivatePtr.h" |
| +#include "FloatSize.h" |
| +#include "IntPoint.h" |
| +#include "IntRect.h" |
| +#include "LayoutRect.h" |
| +#include <wtf/RefCounted.h> |
| namespace WebCore { |
| -class UserGestureToken; |
| +class EventHandler; |
| +class IntSize; |
| +class Node; |
| } |
| namespace WebKit { |
| -// A WebUserGestureToken allows for storing the user gesture state of the |
| -// currently active context and reinstantiating it later on to continue |
| -// processing the user gesture in case it was not consumed meanwhile. |
| -class WebUserGestureToken { |
| +// ViewportAnchor provides a way to anchor a viewport origin to a DOM node. |
| +// In particular, the user supplies the current viewport (in CSS coordinates) |
| +// and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, |
| +// (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM |
| +// node; as the node moves or the view is resized, the viewport anchor maintains |
| +// its orientation relative to the node, and the viewport origin maintains its |
| +// orientation relative to the anchor. |
| +#if ENABLE(VIEWPORT) |
| +class ViewportAnchor { |
|
abarth-chromium
2013/04/18 05:33:04
This object seems to deal entirely in terms of Web
jdduke (slow)
2013/04/18 16:20:07
That's hard for me to say. This was originally in
|
| + WTF_MAKE_NONCOPYABLE(ViewportAnchor); |
| public: |
| - WebUserGestureToken() { } |
| - WebUserGestureToken(const WebUserGestureToken& other) { assign(other); } |
| - WebUserGestureToken& operator=(const WebUserGestureToken& other) |
| - { |
| - assign(other); |
| - return *this; |
| - } |
| - ~WebUserGestureToken() { reset(); } |
| + explicit ViewportAnchor(WebCore::EventHandler* eventHandler); |
| - WEBKIT_EXPORT bool hasGestures() const; |
| - bool isNull() const { return m_token.isNull(); } |
| + void setAnchor(const WebCore::IntRect& viewRect, const WebCore::FloatSize& anchorInViewCoords); |
| -#if WEBKIT_IMPLEMENTATION |
| - explicit WebUserGestureToken(PassRefPtr<WebCore::UserGestureToken>); |
| - operator PassRefPtr<WebCore::UserGestureToken>() const; |
| -#endif |
| + WebCore::IntPoint computeOrigin(const WebCore::IntSize& currentViewSize) const; |
| private: |
| - WEBKIT_EXPORT void assign(const WebUserGestureToken&); |
| - WEBKIT_EXPORT void reset(); |
| + WebCore::EventHandler* m_eventHandler; |
| - WebPrivatePtr<WebCore::UserGestureToken> m_token; |
| + WebCore::IntRect m_viewRect; |
| + |
| + RefPtr<WebCore::Node> m_anchorNode; |
| + WebCore::LayoutRect m_anchorNodeBounds; |
| + |
| + WebCore::FloatSize m_anchorInViewCoords; |
| + WebCore::FloatSize m_anchorInNodeCoords; |
| }; |
| +#endif // ENABLE(VIEWPORT) |
| } // namespace WebKit |
| -#endif // WebUserGestureToken_h |
| + #endif |