Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 // and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, | 49 // and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, |
| 50 // (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM | 50 // (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM |
| 51 // node; as the node moves or the view is resized, the viewport anchor maintains | 51 // node; as the node moves or the view is resized, the viewport anchor maintains |
| 52 // its orientation relative to the node, and the viewport origin maintains its | 52 // its orientation relative to the node, and the viewport origin maintains its |
| 53 // orientation relative to the anchor. | 53 // orientation relative to the anchor. |
| 54 class ViewportAnchor { | 54 class ViewportAnchor { |
| 55 STACK_ALLOCATED(); | 55 STACK_ALLOCATED(); |
| 56 public: | 56 public: |
| 57 explicit ViewportAnchor(EventHandler*); | 57 explicit ViewportAnchor(EventHandler*); |
| 58 | 58 |
| 59 void setAnchor(const IntRect& viewRect, const FloatSize& anchorInViewCoords) ; | 59 void setAnchor(const IntRect& outerViewRect, const IntRect& innerViewRect, c onst FloatSize& anchorInViewCoords); |
|
bokan
2014/09/12 20:53:07
The inner rect has scale applied to it so it shoul
timav
2014/09/12 23:33:35
Acknowledged.
| |
| 60 | 60 |
| 61 IntPoint computeOrigin(const IntSize& currentViewSize) const; | 61 void computeOrigins(const IntSize& outerSize, const IntSize& innerSize, |
| 62 IntPoint* mainFrameOffset, FloatPoint* pinchViewportOffset) const; | |
| 63 | |
| 64 private: | |
| 65 FloatPoint getInnerOrigin(const IntSize& innerSize) const; | |
| 62 | 66 |
| 63 private: | 67 private: |
| 64 RawPtrWillBeMember<EventHandler> m_eventHandler; | 68 RawPtrWillBeMember<EventHandler> m_eventHandler; |
| 65 | 69 |
| 66 IntRect m_viewRect; | 70 // Inner viewport origin in the reference frame of the document in CSS pixel s |
| 71 FloatPoint m_pinchViewportInDocument; | |
| 72 | |
| 73 // Inner viewport origin in the reference frame of the outer viewport | |
| 74 // normalized to the outer viewport size. | |
| 75 FloatSize m_normalizedPinchViewportOffset; | |
| 67 | 76 |
| 68 RefPtrWillBeMember<Node> m_anchorNode; | 77 RefPtrWillBeMember<Node> m_anchorNode; |
| 69 LayoutRect m_anchorNodeBounds; | 78 LayoutRect m_anchorNodeBounds; |
| 70 | 79 |
| 71 FloatSize m_anchorInViewCoords; | 80 FloatSize m_anchorInInnerViewCoords; |
| 72 FloatSize m_anchorInNodeCoords; | 81 FloatSize m_anchorInNodeCoords; |
| 73 }; | 82 }; |
| 74 | 83 |
| 75 } // namespace blink | 84 } // namespace blink |
| 76 | 85 |
| 77 #endif | 86 #endif |
| OLD | NEW |