| 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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 // really mess things up if an anchor scroll comes at a bad moment. | 1479 // really mess things up if an anchor scroll comes at a bad moment. |
| 1480 m_frame->document()->updateLayoutTreeIfNeeded(); | 1480 m_frame->document()->updateLayoutTreeIfNeeded(); |
| 1481 // Only do a layout if changes have occurred that make it necessary. | 1481 // Only do a layout if changes have occurred that make it necessary. |
| 1482 LayoutView* layoutView = this->layoutView(); | 1482 LayoutView* layoutView = this->layoutView(); |
| 1483 if (layoutView && layoutView->needsLayout()) | 1483 if (layoutView && layoutView->needsLayout()) |
| 1484 layout(); | 1484 layout(); |
| 1485 else | 1485 else |
| 1486 scrollToAnchor(); | 1486 scrollToAnchor(); |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollBehavior
scrollBehavior) | 1489 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr
ollType, ScrollBehavior scrollBehavior) |
| 1490 { | 1490 { |
| 1491 cancelProgrammaticScrollAnimation(); | 1491 cancelProgrammaticScrollAnimation(); |
| 1492 m_maintainScrollPositionAnchor = nullptr; | 1492 m_maintainScrollPositionAnchor = nullptr; |
| 1493 | 1493 |
| 1494 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; | 1494 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; |
| 1495 if (newScrollPosition == scrollPositionDouble()) | 1495 if (newScrollPosition == scrollPositionDouble()) |
| 1496 return; | 1496 return; |
| 1497 | 1497 |
| 1498 if (scrollBehavior == ScrollBehaviorAuto) | 1498 if (scrollBehavior == ScrollBehaviorAuto) |
| 1499 scrollBehavior = scrollBehaviorStyle(); | 1499 scrollBehavior = scrollBehaviorStyle(); |
| 1500 | 1500 |
| 1501 if (scrollBehavior == ScrollBehaviorInstant) { | 1501 if (scrollBehavior == ScrollBehaviorInstant) { |
| 1502 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); | 1502 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); |
| 1503 // TODO(bokan): Why do we need to go through updateScrollbars? If not, w
e can |
| 1504 // just delete this whole method and use the base version. |
| 1503 updateScrollbars(newOffset); | 1505 updateScrollbars(newOffset); |
| 1504 } else { | 1506 } else { |
| 1505 programmaticallyScrollSmoothlyToOffset(toFloatPoint(newScrollPosition)); | 1507 ScrollableArea::setScrollPosition(newScrollPosition, ProgrammaticScroll,
ScrollBehaviorSmooth); |
| 1506 } | 1508 } |
| 1507 } | 1509 } |
| 1508 | 1510 |
| 1509 void FrameView::setElasticOverscroll(const FloatSize& elasticOverscroll) | 1511 void FrameView::setElasticOverscroll(const FloatSize& elasticOverscroll) |
| 1510 { | 1512 { |
| 1511 m_elasticOverscroll = elasticOverscroll; | 1513 m_elasticOverscroll = elasticOverscroll; |
| 1512 if (m_horizontalScrollbar) { | 1514 if (m_horizontalScrollbar) { |
| 1513 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); | 1515 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); |
| 1514 if (delta != 0) { | 1516 if (delta != 0) { |
| 1515 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width(
)); | 1517 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width(
)); |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 // If no scrollbars are present, the content may still be scrollable. | 3195 // If no scrollbars are present, the content may still be scrollable. |
| 3194 if (!scrollbar) { | 3196 if (!scrollbar) { |
| 3195 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); | 3197 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); |
| 3196 scrollSize.clampNegativeToZero(); | 3198 scrollSize.clampNegativeToZero(); |
| 3197 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS
ize.height(); | 3199 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS
ize.height(); |
| 3198 } | 3200 } |
| 3199 | 3201 |
| 3200 return scrollbar->totalSize() - scrollbar->visibleSize(); | 3202 return scrollbar->totalSize() - scrollbar->visibleSize(); |
| 3201 } | 3203 } |
| 3202 | 3204 |
| 3203 void FrameView::setScrollOffset(const IntPoint& offset) | 3205 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType) |
| 3204 { | 3206 { |
| 3205 scrollTo(DoublePoint(adjustScrollPositionWithinRange(offset))); | 3207 scrollTo(DoublePoint(adjustScrollPositionWithinRange(offset))); |
| 3206 } | 3208 } |
| 3207 | 3209 |
| 3208 void FrameView::setScrollOffset(const DoublePoint& offset) | 3210 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType) |
| 3209 { | 3211 { |
| 3210 scrollTo(adjustScrollPositionWithinRange(offset)); | 3212 scrollTo(adjustScrollPositionWithinRange(offset)); |
| 3211 } | 3213 } |
| 3212 | 3214 |
| 3213 void FrameView::windowResizerRectChanged() | 3215 void FrameView::windowResizerRectChanged() |
| 3214 { | 3216 { |
| 3215 updateScrollbars(scrollOffsetDouble()); | 3217 updateScrollbars(scrollOffsetDouble()); |
| 3216 } | 3218 } |
| 3217 | 3219 |
| 3218 bool FrameView::hasOverlayScrollbars() const | 3220 bool FrameView::hasOverlayScrollbars() const |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3440 setScrollOffsetFromUpdateScrollbars(desiredOffset); | 3442 setScrollOffsetFromUpdateScrollbars(desiredOffset); |
| 3441 } | 3443 } |
| 3442 | 3444 |
| 3443 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) | 3445 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) |
| 3444 { | 3446 { |
| 3445 DoublePoint adjustedScrollPosition = DoublePoint(offset); | 3447 DoublePoint adjustedScrollPosition = DoublePoint(offset); |
| 3446 | 3448 |
| 3447 adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosit
ion); | 3449 adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosit
ion); |
| 3448 | 3450 |
| 3449 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { | 3451 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { |
| 3450 ScrollableArea::scrollToOffsetWithoutAnimation(toFloatPoint(adjustedScro
llPosition)); | 3452 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc
roll); |
| 3451 resetScrollOriginChanged(); | 3453 resetScrollOriginChanged(); |
| 3452 } | 3454 } |
| 3453 } | 3455 } |
| 3454 | 3456 |
| 3455 const int panIconSizeLength = 16; | 3457 const int panIconSizeLength = 16; |
| 3456 | 3458 |
| 3457 IntRect FrameView::rectToCopyOnScroll() const | 3459 IntRect FrameView::rectToCopyOnScroll() const |
| 3458 { | 3460 { |
| 3459 IntRect scrollViewRect = convertToContainingWindow(IntRect((shouldPlaceVerti
calScrollbarOnLeft() && verticalScrollbar()) ? verticalScrollbar()->width() : 0,
0, visibleWidth(), visibleHeight())); | 3461 IntRect scrollViewRect = convertToContainingWindow(IntRect((shouldPlaceVerti
calScrollbarOnLeft() && verticalScrollbar()) ? verticalScrollbar()->width() : 0,
0, visibleWidth(), visibleHeight())); |
| 3460 if (hasOverlayScrollbars()) { | 3462 if (hasOverlayScrollbars()) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3726 } | 3728 } |
| 3727 | 3729 |
| 3728 LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, const Scro
llAlignment& alignX, const ScrollAlignment& alignY) | 3730 LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, const Scro
llAlignment& alignX, const ScrollAlignment& alignY) |
| 3729 { | 3731 { |
| 3730 LayoutRect viewRect(visibleContentRect()); | 3732 LayoutRect viewRect(visibleContentRect()); |
| 3731 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(viewRect, rectInCon
tent, alignX, alignY); | 3733 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(viewRect, rectInCon
tent, alignX, alignY); |
| 3732 | 3734 |
| 3733 double xOffset = exposeRect.x(); | 3735 double xOffset = exposeRect.x(); |
| 3734 double yOffset = exposeRect.y(); | 3736 double yOffset = exposeRect.y(); |
| 3735 | 3737 |
| 3736 setScrollPosition(DoublePoint(xOffset, yOffset)); | 3738 setScrollPosition(DoublePoint(xOffset, yOffset), ProgrammaticScroll); |
| 3737 | 3739 |
| 3738 // Scrolling the FrameView cannot change the input rect's location relative
to the document. | 3740 // Scrolling the FrameView cannot change the input rect's location relative
to the document. |
| 3739 return rectInContent; | 3741 return rectInContent; |
| 3740 } | 3742 } |
| 3741 | 3743 |
| 3742 IntRect FrameView::scrollCornerRect() const | 3744 IntRect FrameView::scrollCornerRect() const |
| 3743 { | 3745 { |
| 3744 IntRect cornerRect; | 3746 IntRect cornerRect; |
| 3745 | 3747 |
| 3746 if (hasOverlayScrollbars()) | 3748 if (hasOverlayScrollbars()) |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4007 | 4009 |
| 4008 if (!graphicsLayer) | 4010 if (!graphicsLayer) |
| 4009 return; | 4011 return; |
| 4010 | 4012 |
| 4011 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); | 4013 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); |
| 4012 | 4014 |
| 4013 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 4015 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
| 4014 } | 4016 } |
| 4015 | 4017 |
| 4016 } // namespace blink | 4018 } // namespace blink |
| OLD | NEW |