OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 RenderLayerScrollableArea::~RenderLayerScrollableArea() | 108 RenderLayerScrollableArea::~RenderLayerScrollableArea() |
109 { | 109 { |
110 if (inResizeMode() && !box().documentBeingDestroyed()) { | 110 if (inResizeMode() && !box().documentBeingDestroyed()) { |
111 if (LocalFrame* frame = box().frame()) | 111 if (LocalFrame* frame = box().frame()) |
112 frame->eventHandler().resizeScrollableAreaDestroyed(); | 112 frame->eventHandler().resizeScrollableAreaDestroyed(); |
113 } | 113 } |
114 | 114 |
115 if (LocalFrame* frame = box().frame()) { | 115 if (LocalFrame* frame = box().frame()) { |
116 if (FrameView* frameView = frame->view()) { | 116 if (FrameView* frameView = frame->view()) { |
117 frameView->removeScrollableArea(this); | 117 frameView->removeScrollableArea(this); |
| 118 frameView->removeAnimatingScrollableArea(this); |
118 } | 119 } |
119 } | 120 } |
120 | 121 |
121 if (box().frame() && box().frame()->page()) { | 122 if (box().frame() && box().frame()->page()) { |
122 if (ScrollingCoordinator* scrollingCoordinator = box().frame()->page()->
scrollingCoordinator()) | 123 if (ScrollingCoordinator* scrollingCoordinator = box().frame()->page()->
scrollingCoordinator()) |
123 scrollingCoordinator->willDestroyScrollableArea(this); | 124 scrollingCoordinator->willDestroyScrollableArea(this); |
124 } | 125 } |
125 | 126 |
126 if (!box().documentBeingDestroyed()) { | 127 if (!box().documentBeingDestroyed()) { |
127 Node* node = box().node(); | 128 Node* node = box().node(); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 if (!view) | 495 if (!view) |
495 return false; | 496 return false; |
496 return view->frameView()->scrollbarsCanBeActive(); | 497 return view->frameView()->scrollbarsCanBeActive(); |
497 } | 498 } |
498 | 499 |
499 IntRect RenderLayerScrollableArea::scrollableAreaBoundingBox() const | 500 IntRect RenderLayerScrollableArea::scrollableAreaBoundingBox() const |
500 { | 501 { |
501 return box().absoluteBoundingBoxRect(); | 502 return box().absoluteBoundingBoxRect(); |
502 } | 503 } |
503 | 504 |
| 505 void RenderLayerScrollableArea::registerForAnimation() |
| 506 { |
| 507 if (LocalFrame* frame = box().frame()) { |
| 508 if (FrameView* frameView = frame->view()) |
| 509 frameView->addAnimatingScrollableArea(this); |
| 510 } |
| 511 } |
| 512 |
| 513 void RenderLayerScrollableArea::deregisterForAnimation() |
| 514 { |
| 515 if (LocalFrame* frame = box().frame()) { |
| 516 if (FrameView* frameView = frame->view()) |
| 517 frameView->removeAnimatingScrollableArea(this); |
| 518 } |
| 519 } |
| 520 |
504 bool RenderLayerScrollableArea::userInputScrollable(ScrollbarOrientation orienta
tion) const | 521 bool RenderLayerScrollableArea::userInputScrollable(ScrollbarOrientation orienta
tion) const |
505 { | 522 { |
506 if (box().isIntristicallyScrollable(orientation)) | 523 if (box().isIntristicallyScrollable(orientation)) |
507 return true; | 524 return true; |
508 | 525 |
509 EOverflow overflowStyle = (orientation == HorizontalScrollbar) ? | 526 EOverflow overflowStyle = (orientation == HorizontalScrollbar) ? |
510 box().style()->overflowX() : box().style()->overflowY(); | 527 box().style()->overflowX() : box().style()->overflowY(); |
511 return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle
== OOVERLAY); | 528 return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle
== OOVERLAY); |
512 } | 529 } |
513 | 530 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 m_scrollDimensionsDirty = false; | 582 m_scrollDimensionsDirty = false; |
566 | 583 |
567 m_overflowRect = box().layoutOverflowRect(); | 584 m_overflowRect = box().layoutOverflowRect(); |
568 box().flipForWritingMode(m_overflowRect); | 585 box().flipForWritingMode(m_overflowRect); |
569 | 586 |
570 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box(
).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr
ollbarWidth() : 0); | 587 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box(
).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr
ollbarWidth() : 0); |
571 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); | 588 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); |
572 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); | 589 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); |
573 } | 590 } |
574 | 591 |
575 void RenderLayerScrollableArea::scrollToOffset(const DoubleSize& scrollOffset, S
crollOffsetClamping clamp) | 592 void RenderLayerScrollableArea::scrollToOffset(const DoubleSize& scrollOffset, S
crollOffsetClamping clamp, ScrollBehavior scrollBehavior) |
576 { | 593 { |
| 594 cancelProgrammaticScrollAnimation(); |
577 DoubleSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffse
t(scrollOffset) : scrollOffset; | 595 DoubleSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffse
t(scrollOffset) : scrollOffset; |
578 if (newScrollOffset != adjustedScrollOffset()) { | 596 if (newScrollOffset != adjustedScrollOffset()) { |
| 597 if (scrollBehavior == ScrollBehaviorAuto) |
| 598 scrollBehavior = box().style()->scrollBehavior(); |
579 DoublePoint origin(scrollOrigin()); | 599 DoublePoint origin(scrollOrigin()); |
580 // FIXME: Make scrollToOffsetWithoutAnimation take DoublePoint. crbug.co
m/414283. | 600 if (scrollBehavior == ScrollBehaviorSmooth) { |
581 scrollToOffsetWithoutAnimation(toFloatPoint(-origin + newScrollOffset)); | 601 // FIXME: Make programmaticallyScrollSmoothlyToOffset take DoublePoi
nt. crbug.com/243871. |
| 602 programmaticallyScrollSmoothlyToOffset(toFloatPoint(-origin + newScr
ollOffset)); |
| 603 } else { |
| 604 // FIXME: Make scrollToOffsetWithoutAnimation take DoublePoint. crbu
g.com/414283. |
| 605 scrollToOffsetWithoutAnimation(toFloatPoint(-origin + newScrollOffse
t)); |
| 606 } |
582 } | 607 } |
583 } | 608 } |
584 | 609 |
585 void RenderLayerScrollableArea::updateAfterLayout() | 610 void RenderLayerScrollableArea::updateAfterLayout() |
586 { | 611 { |
587 m_scrollDimensionsDirty = true; | 612 m_scrollDimensionsDirty = true; |
588 DoubleSize originalScrollOffset = adjustedScrollOffset(); | 613 DoubleSize originalScrollOffset = adjustedScrollOffset(); |
589 | 614 |
590 computeScrollDimensions(); | 615 computeScrollDimensions(); |
591 | 616 |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) | 1355 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) |
1331 { | 1356 { |
1332 // We only want to track the topmost scroll child for scrollable areas with | 1357 // We only want to track the topmost scroll child for scrollable areas with |
1333 // overlay scrollbars. | 1358 // overlay scrollbars. |
1334 if (!hasOverlayScrollbars()) | 1359 if (!hasOverlayScrollbars()) |
1335 return; | 1360 return; |
1336 m_nextTopmostScrollChild = scrollChild; | 1361 m_nextTopmostScrollChild = scrollChild; |
1337 } | 1362 } |
1338 | 1363 |
1339 } // namespace blink | 1364 } // namespace blink |
OLD | NEW |