| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "web/RotationViewportAnchor.h" | 6 #include "web/RotationViewportAnchor.h" |
| 7 | 7 |
| 8 #include "core/dom/ContainerNode.h" | 8 #include "core/dom/ContainerNode.h" |
| 9 #include "core/dom/Node.h" | 9 #include "core/dom/Node.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 outer.setLocation(outerOrigin); | 60 outer.setLocation(outerOrigin); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void moveIntoRect(FloatRect& inner, const IntRect& outer) | 63 void moveIntoRect(FloatRect& inner, const IntRect& outer) |
| 64 { | 64 { |
| 65 FloatPoint minimumPosition = FloatPoint(outer.location()); | 65 FloatPoint minimumPosition = FloatPoint(outer.location()); |
| 66 FloatPoint maximumPosition = minimumPosition + outer.size() - inner.size(); | 66 FloatPoint maximumPosition = minimumPosition + outer.size() - inner.size(); |
| 67 | 67 |
| 68 // Adjust maximumPosition to the nearest lower integer because | 68 // Adjust maximumPosition to the nearest lower integer because |
| 69 // VisualViewport::maximumScrollPosition() does the same. | 69 // VisualViewport::maximumScrollPosition() does the same. |
| 70 // The value of minumumPosition is already adjusted since it is | 70 // The value of minimumPosition is already adjusted since it is |
| 71 // constructed from an integer point. | 71 // constructed from an integer point. |
| 72 maximumPosition = flooredIntPoint(maximumPosition); | 72 maximumPosition = flooredIntPoint(maximumPosition); |
| 73 | 73 |
| 74 FloatPoint innerOrigin = inner.location(); | 74 FloatPoint innerOrigin = inner.location(); |
| 75 innerOrigin = innerOrigin.expandedTo(minimumPosition); | 75 innerOrigin = innerOrigin.expandedTo(minimumPosition); |
| 76 innerOrigin = innerOrigin.shrunkTo(maximumPosition); | 76 innerOrigin = innerOrigin.shrunkTo(maximumPosition); |
| 77 | 77 |
| 78 inner.setLocation(innerOrigin); | 78 inner.setLocation(innerOrigin); |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); | 205 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); |
| 206 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; | 206 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; |
| 207 | 207 |
| 208 // Compute the new origin point relative to the new anchor point | 208 // Compute the new origin point relative to the new anchor point |
| 209 FloatSize anchorOffsetFromOrigin = innerSize; | 209 FloatSize anchorOffsetFromOrigin = innerSize; |
| 210 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); | 210 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); |
| 211 return anchorPoint - anchorOffsetFromOrigin; | 211 return anchorPoint - anchorOffsetFromOrigin; |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |