OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // ViewportAnchor provides a way to anchor a viewport origin to a DOM node. | 48 // ViewportAnchor provides a way to anchor a viewport origin to a DOM node. |
49 // In particular, the user supplies the current viewport (in CSS coordinates) | 49 // In particular, the user supplies the current viewport (in CSS coordinates) |
50 // and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, | 50 // and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, |
51 // (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM | 51 // (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM |
52 // node; as the node moves or the view is resized, the viewport anchor maintains | 52 // node; as the node moves or the view is resized, the viewport anchor maintains |
53 // its orientation relative to the node, and the viewport origin maintains its | 53 // its orientation relative to the node, and the viewport origin maintains its |
54 // orientation relative to the anchor. | 54 // orientation relative to the anchor. |
55 class ViewportAnchor { | 55 class ViewportAnchor { |
56 WTF_MAKE_NONCOPYABLE(ViewportAnchor); | 56 WTF_MAKE_NONCOPYABLE(ViewportAnchor); |
57 public: | 57 public: |
58 explicit ViewportAnchor(WebCore::EventHandler* eventHandler); | 58 explicit ViewportAnchor(HANDLE_FORMAL(WebCore::EventHandler) eventHandler); |
59 | 59 |
60 void setAnchor(const WebCore::IntRect& viewRect, const WebCore::FloatSize& a
nchorInViewCoords); | 60 void setAnchor(const WebCore::IntRect& viewRect, const WebCore::FloatSize& a
nchorInViewCoords); |
61 | 61 |
62 WebCore::IntPoint computeOrigin(const WebCore::IntSize& currentViewSize) con
st; | 62 WebCore::IntPoint computeOrigin(const WebCore::IntSize& currentViewSize) con
st; |
63 | 63 |
64 private: | 64 private: |
| 65 // FIXME(oilpan): This should be a strong pointer. |
65 WebCore::EventHandler* m_eventHandler; | 66 WebCore::EventHandler* m_eventHandler; |
66 | 67 |
67 WebCore::IntRect m_viewRect; | 68 WebCore::IntRect m_viewRect; |
68 | 69 |
69 ANNOTATED_FIELD(WebCore::Persistent<WebCore::Node>, m_anchorNode); | 70 ANNOTATED_FIELD(WebCore::Persistent<WebCore::Node>, m_anchorNode); |
70 WebCore::LayoutRect m_anchorNodeBounds; | 71 WebCore::LayoutRect m_anchorNodeBounds; |
71 | 72 |
72 WebCore::FloatSize m_anchorInViewCoords; | 73 WebCore::FloatSize m_anchorInViewCoords; |
73 WebCore::FloatSize m_anchorInNodeCoords; | 74 WebCore::FloatSize m_anchorInNodeCoords; |
74 }; | 75 }; |
75 | 76 |
76 } // namespace WebKit | 77 } // namespace WebKit |
77 | 78 |
78 #endif | 79 #endif |
OLD | NEW |