| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 LayoutRect bounds = element->boundingBox(); | 1407 LayoutRect bounds = element->boundingBox(); |
| 1408 int centeringOffsetX = (targetRect.width() - bounds.width()) / 2; | 1408 int centeringOffsetX = (targetRect.width() - bounds.width()) / 2; |
| 1409 int centeringOffsetY = (targetRect.height() - bounds.height()) / 2; | 1409 int centeringOffsetY = (targetRect.height() - bounds.height()) / 2; |
| 1410 | 1410 |
| 1411 IntPoint targetOffset( | 1411 IntPoint targetOffset( |
| 1412 bounds.x() - centeringOffsetX - targetRect.x(), | 1412 bounds.x() - centeringOffsetX - targetRect.x(), |
| 1413 bounds.y() - centeringOffsetY - targetRect.y()); | 1413 bounds.y() - centeringOffsetY - targetRect.y()); |
| 1414 | 1414 |
| 1415 setScrollPosition(targetOffset); | 1415 setScrollPosition(DoublePoint(targetOffset)); |
| 1416 | 1416 |
| 1417 if (pinchVirtualViewportEnabled) { | 1417 if (pinchVirtualViewportEnabled) { |
| 1418 IntPoint remainder = IntPoint(targetOffset - scrollPosition()); | 1418 IntPoint remainder = IntPoint(targetOffset - scrollPosition()); |
| 1419 m_frame->page()->frameHost().pinchViewport().move(remainder); | 1419 m_frame->page()->frameHost().pinchViewport().move(remainder); |
| 1420 } | 1420 } |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior sc
rollBehavior) | 1423 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollBehavior
scrollBehavior) |
| 1424 { | 1424 { |
| 1425 cancelProgrammaticScrollAnimation(); | 1425 cancelProgrammaticScrollAnimation(); |
| 1426 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 1426 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
| 1427 m_maintainScrollPositionAnchor = nullptr; | 1427 m_maintainScrollPositionAnchor = nullptr; |
| 1428 | 1428 |
| 1429 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 1429 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; |
| 1430 | 1430 |
| 1431 if (newScrollPosition == scrollPosition()) | 1431 if (newScrollPosition == scrollPositionDouble()) |
| 1432 return; | 1432 return; |
| 1433 | 1433 |
| 1434 if (scrollBehavior == ScrollBehaviorAuto) { | 1434 if (scrollBehavior == ScrollBehaviorAuto) { |
| 1435 RenderObject* renderer = m_frame->document()->documentElement() ? m_fram
e->document()->documentElement()->renderer() : 0; | 1435 RenderObject* renderer = m_frame->document()->documentElement() ? m_fram
e->document()->documentElement()->renderer() : 0; |
| 1436 if (renderer) | 1436 if (renderer) |
| 1437 scrollBehavior = renderer->style()->scrollBehavior(); | 1437 scrollBehavior = renderer->style()->scrollBehavior(); |
| 1438 else | 1438 else |
| 1439 scrollBehavior = ScrollBehaviorInstant; | 1439 scrollBehavior = ScrollBehaviorInstant; |
| 1440 } | 1440 } |
| 1441 ScrollView::setScrollPosition(newScrollPosition, scrollBehavior); | 1441 ScrollView::setScrollPosition(newScrollPosition, scrollBehavior); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 return IntRect(); | 2123 return IntRect(); |
| 2124 return page->chrome().windowResizerRect(); | 2124 return page->chrome().windowResizerRect(); |
| 2125 } | 2125 } |
| 2126 | 2126 |
| 2127 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) | 2127 void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) |
| 2128 { | 2128 { |
| 2129 if (m_visibleContentScaleFactor == visibleContentScaleFactor) | 2129 if (m_visibleContentScaleFactor == visibleContentScaleFactor) |
| 2130 return; | 2130 return; |
| 2131 | 2131 |
| 2132 m_visibleContentScaleFactor = visibleContentScaleFactor; | 2132 m_visibleContentScaleFactor = visibleContentScaleFactor; |
| 2133 updateScrollbars(scrollOffset()); | 2133 updateScrollbars(scrollOffsetDouble()); |
| 2134 } | 2134 } |
| 2135 | 2135 |
| 2136 void FrameView::setInputEventsTransformForEmulation(const IntSize& offset, float
contentScaleFactor) | 2136 void FrameView::setInputEventsTransformForEmulation(const IntSize& offset, float
contentScaleFactor) |
| 2137 { | 2137 { |
| 2138 m_inputEventsOffsetForEmulation = offset; | 2138 m_inputEventsOffsetForEmulation = offset; |
| 2139 m_inputEventsScaleFactorForEmulation = contentScaleFactor; | 2139 m_inputEventsScaleFactorForEmulation = contentScaleFactor; |
| 2140 } | 2140 } |
| 2141 | 2141 |
| 2142 IntSize FrameView::inputEventsOffsetForEmulation() const | 2142 IntSize FrameView::inputEventsOffsetForEmulation() const |
| 2143 { | 2143 { |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3037 IntSize visibleSize = expandedIntSize(visibleContentSizeF); | 3037 IntSize visibleSize = expandedIntSize(visibleContentSizeF); |
| 3038 | 3038 |
| 3039 IntPoint maximumOffset( | 3039 IntPoint maximumOffset( |
| 3040 contentsWidth() - visibleSize.width() - scrollOrigin().x(), | 3040 contentsWidth() - visibleSize.width() - scrollOrigin().x(), |
| 3041 contentsHeight() - visibleSize.height() - scrollOrigin().y()); | 3041 contentsHeight() - visibleSize.height() - scrollOrigin().y()); |
| 3042 maximumOffset.clampNegativeToZero(); | 3042 maximumOffset.clampNegativeToZero(); |
| 3043 return maximumOffset; | 3043 return maximumOffset; |
| 3044 } | 3044 } |
| 3045 | 3045 |
| 3046 } // namespace blink | 3046 } // namespace blink |
| OLD | NEW |