| 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 "web/RotationViewportAnchor.h" | 5 #include "web/RotationViewportAnchor.h" |
| 6 | 6 |
| 7 #include "core/dom/ContainerNode.h" | 7 #include "core/dom/ContainerNode.h" |
| 8 #include "core/dom/Node.h" | 8 #include "core/dom/Node.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 outerRect.setLocation(m_rootFrameView->layoutViewportScrollableArea()->clamp
ScrollPosition(outerRect.location())); | 185 outerRect.setLocation(m_rootFrameView->layoutViewportScrollableArea()->clamp
ScrollPosition(outerRect.location())); |
| 186 | 186 |
| 187 moveIntoRect(innerRect, outerRect); | 187 moveIntoRect(innerRect, outerRect); |
| 188 | 188 |
| 189 mainFrameOffset = outerRect.location(); | 189 mainFrameOffset = outerRect.location(); |
| 190 visualViewportOffset = FloatPoint(innerRect.location() - outerRect.location(
)); | 190 visualViewportOffset = FloatPoint(innerRect.location() - outerRect.location(
)); |
| 191 } | 191 } |
| 192 | 192 |
| 193 FloatPoint RotationViewportAnchor::getInnerOrigin(const FloatSize& innerSize) co
nst | 193 FloatPoint RotationViewportAnchor::getInnerOrigin(const FloatSize& innerSize) co
nst |
| 194 { | 194 { |
| 195 if (!m_anchorNode || !m_anchorNode->inShadowIncludingDocument()) | 195 if (!m_anchorNode || !m_anchorNode->isConnected()) |
| 196 return m_visualViewportInDocument; | 196 return m_visualViewportInDocument; |
| 197 | 197 |
| 198 const LayoutRect currentNodeBounds = m_anchorNode->boundingBox(); | 198 const LayoutRect currentNodeBounds = m_anchorNode->boundingBox(); |
| 199 if (m_anchorNodeBounds == currentNodeBounds) | 199 if (m_anchorNodeBounds == currentNodeBounds) |
| 200 return m_visualViewportInDocument; | 200 return m_visualViewportInDocument; |
| 201 | 201 |
| 202 // Compute the new anchor point relative to the node position | 202 // Compute the new anchor point relative to the node position |
| 203 FloatSize anchorOffsetFromNode(currentNodeBounds.size()); | 203 FloatSize anchorOffsetFromNode(currentNodeBounds.size()); |
| 204 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); | 204 anchorOffsetFromNode.scale(m_anchorInNodeCoords.width(), m_anchorInNodeCoord
s.height()); |
| 205 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; | 205 FloatPoint anchorPoint = FloatPoint(currentNodeBounds.location()) + anchorOf
fsetFromNode; |
| 206 | 206 |
| 207 // Compute the new origin point relative to the new anchor point | 207 // Compute the new origin point relative to the new anchor point |
| 208 FloatSize anchorOffsetFromOrigin = innerSize; | 208 FloatSize anchorOffsetFromOrigin = innerSize; |
| 209 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); | 209 anchorOffsetFromOrigin.scale(m_anchorInInnerViewCoords.width(), m_anchorInIn
nerViewCoords.height()); |
| 210 return anchorPoint - anchorOffsetFromOrigin; | 210 return anchorPoint - anchorOffsetFromOrigin; |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace blink | 213 } // namespace blink |
| OLD | NEW |