Chromium Code Reviews| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 point.move(-scrollbarOffset(scrollbar)); | 350 point.move(-scrollbarOffset(scrollbar)); |
| 351 return point; | 351 return point; |
| 352 } | 352 } |
| 353 | 353 |
| 354 int DeprecatedPaintLayerScrollableArea::scrollSize(ScrollbarOrientation orientat ion) const | 354 int DeprecatedPaintLayerScrollableArea::scrollSize(ScrollbarOrientation orientat ion) const |
| 355 { | 355 { |
| 356 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition() ; | 356 IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition() ; |
| 357 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr ollDimensions.height(); | 357 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scr ollDimensions.height(); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void DeprecatedPaintLayerScrollableArea::setScrollOffset(const IntPoint& newScro llOffset) | 360 void DeprecatedPaintLayerScrollableArea::setScrollOffset(const IntPoint& newScro llOffset, ScrollType scrollType) |
| 361 { | 361 { |
| 362 setScrollOffset(DoublePoint(newScrollOffset)); | 362 setScrollOffset(DoublePoint(newScrollOffset), scrollType); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void DeprecatedPaintLayerScrollableArea::setScrollOffset(const DoublePoint& newS crollOffset) | 365 void DeprecatedPaintLayerScrollableArea::setScrollOffset(const DoublePoint& newS crollOffset, ScrollType) |
| 366 { | 366 { |
| 367 // Ensure that the dimensions will be computed if they need to be (for overf low:hidden blocks). | 367 // Ensure that the dimensions will be computed if they need to be (for overf low:hidden blocks). |
| 368 if (m_scrollDimensionsDirty) | 368 if (m_scrollDimensionsDirty) |
| 369 computeScrollDimensions(); | 369 computeScrollDimensions(); |
| 370 | 370 |
| 371 if (scrollOffset() == toDoubleSize(newScrollOffset)) | 371 if (scrollOffset() == toDoubleSize(newScrollOffset)) |
| 372 return; | 372 return; |
| 373 | 373 |
| 374 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); | 374 DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset); |
| 375 m_scrollOffset = toDoubleSize(newScrollOffset); | 375 m_scrollOffset = toDoubleSize(newScrollOffset); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 605 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box( ).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr ollbarWidth() : 0); | 605 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box( ).style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScr ollbarWidth() : 0); |
| 606 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); | 606 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); |
| 607 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); | 607 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void DeprecatedPaintLayerScrollableArea::scrollToOffset(const DoubleSize& scroll Offset, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior) | 610 void DeprecatedPaintLayerScrollableArea::scrollToOffset(const DoubleSize& scroll Offset, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior) |
| 611 { | 611 { |
| 612 cancelProgrammaticScrollAnimation(); | 612 cancelProgrammaticScrollAnimation(); |
| 613 DoubleSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffse t(scrollOffset) : scrollOffset; | 613 DoubleSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffse t(scrollOffset) : scrollOffset; |
| 614 if (newScrollOffset != adjustedScrollOffset()) { | 614 if (newScrollOffset != adjustedScrollOffset()) { |
| 615 if (scrollBehavior == ScrollBehaviorAuto) | |
| 616 scrollBehavior = scrollBehaviorStyle(); | |
| 617 DoublePoint origin(scrollOrigin()); | 615 DoublePoint origin(scrollOrigin()); |
| 618 if (scrollBehavior == ScrollBehaviorSmooth) { | 616 ScrollableArea::setScrollPosition(-origin + newScrollOffset, Programmati cScroll, scrollBehavior); |
| 619 // FIXME: Make programmaticallyScrollSmoothlyToOffset take DoublePoi nt. crbug.com/243871. | |
| 620 programmaticallyScrollSmoothlyToOffset(toFloatPoint(-origin + newScr ollOffset)); | |
| 621 } else { | |
| 622 // FIXME: Make scrollToOffsetWithoutAnimation take DoublePoint. crbu g.com/414283. | |
| 623 scrollToOffsetWithoutAnimation(toFloatPoint(-origin + newScrollOffse t)); | |
| 624 } | |
| 625 } | 617 } |
| 626 } | 618 } |
| 627 | 619 |
| 628 void DeprecatedPaintLayerScrollableArea::updateAfterLayout() | 620 void DeprecatedPaintLayerScrollableArea::updateAfterLayout() |
| 629 { | 621 { |
| 630 ASSERT(box().hasOverflowClip()); | 622 ASSERT(box().hasOverflowClip()); |
| 631 | 623 |
| 632 m_scrollDimensionsDirty = true; | 624 m_scrollDimensionsDirty = true; |
| 633 DoubleSize originalScrollOffset = adjustedScrollOffset(); | 625 DoubleSize originalScrollOffset = adjustedScrollOffset(); |
| 634 | 626 |
| 635 computeScrollDimensions(); | 627 computeScrollDimensions(); |
| 636 | 628 |
| 637 // Layout may cause us to be at an invalid scroll position. In this case we need | 629 // Layout may cause us to be at an invalid scroll position. In this case we need |
| 638 // to pull our scroll offsets back to the max (or push them up to the min). | 630 // to pull our scroll offsets back to the max (or push them up to the min). |
| 639 DoubleSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); | 631 DoubleSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset()); |
| 640 if (clampedScrollOffset != adjustedScrollOffset()) | 632 if (clampedScrollOffset != adjustedScrollOffset()) |
| 641 scrollToOffset(clampedScrollOffset); | 633 scrollToOffset(clampedScrollOffset); |
| 642 | 634 |
| 643 if (originalScrollOffset != adjustedScrollOffset()) { | 635 if (originalScrollOffset != adjustedScrollOffset()) { |
| 644 DoublePoint origin(scrollOrigin()); | 636 DoublePoint origin(scrollOrigin()); |
| 645 scrollToOffsetWithoutAnimation(toFloatPoint(-origin + adjustedScrollOffs et())); | 637 ScrollableArea::setScrollPosition(-origin + adjustedScrollOffset(), Prog rammaticScroll); |
|
skobes
2015/06/04 23:35:47
Why does this call the base class instead of DPLSA
bokan
2015/06/05 15:15:23
DPLSA::setScrollPosition calls scrollToOffset. Tha
| |
| 646 } | 638 } |
| 647 | 639 |
| 648 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); | 640 bool hasHorizontalOverflow = this->hasHorizontalOverflow(); |
| 649 bool hasVerticalOverflow = this->hasVerticalOverflow(); | 641 bool hasVerticalOverflow = this->hasVerticalOverflow(); |
| 650 | 642 |
| 651 { | 643 { |
| 652 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. | 644 // Hits in compositing/overflow/automatically-opt-into-composited-scroll ing-after-style-change.html. |
| 653 DisableCompositingQueryAsserts disabler; | 645 DisableCompositingQueryAsserts disabler; |
| 654 | 646 |
| 655 // overflow:scroll should just enable/disable. | 647 // overflow:scroll should just enable/disable. |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1398 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa yer* scrollChild) | 1390 void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLa yer* scrollChild) |
| 1399 { | 1391 { |
| 1400 // We only want to track the topmost scroll child for scrollable areas with | 1392 // We only want to track the topmost scroll child for scrollable areas with |
| 1401 // overlay scrollbars. | 1393 // overlay scrollbars. |
| 1402 if (!hasOverlayScrollbars()) | 1394 if (!hasOverlayScrollbars()) |
| 1403 return; | 1395 return; |
| 1404 m_nextTopmostScrollChild = scrollChild; | 1396 m_nextTopmostScrollChild = scrollChild; |
| 1405 } | 1397 } |
| 1406 | 1398 |
| 1407 } // namespace blink | 1399 } // namespace blink |
| OLD | NEW |