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@gmail.com> | 9 * Christian Biesinger <cbiesinger@gmail.com> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 int PaintLayerScrollableArea::pixelSnappedScrollWidth() const | 580 int PaintLayerScrollableArea::pixelSnappedScrollWidth() const |
| 581 { | 581 { |
| 582 return snapSizeToPixel(scrollWidth(), box().clientLeft() + box().location(). x()); | 582 return snapSizeToPixel(scrollWidth(), box().clientLeft() + box().location(). x()); |
| 583 } | 583 } |
| 584 | 584 |
| 585 int PaintLayerScrollableArea::pixelSnappedScrollHeight() const | 585 int PaintLayerScrollableArea::pixelSnappedScrollHeight() const |
| 586 { | 586 { |
| 587 return snapSizeToPixel(scrollHeight(), box().clientTop() + box().location(). y()); | 587 return snapSizeToPixel(scrollHeight(), box().clientTop() + box().location(). y()); |
| 588 } | 588 } |
| 589 | 589 |
| 590 IntSize PaintLayerScrollableArea::originAdjustmentForScrollbars() const | |
|
leviw_travelin_and_unemployed
2016/04/28 22:12:12
This deserves a big description about why it exist
| |
| 591 { | |
| 592 IntSize size; | |
| 593 int verticalScrollbarWidth = box().verticalScrollbarWidth(); | |
| 594 int horizontalScrollbarHeight = box().horizontalScrollbarHeight(); | |
| 595 | |
| 596 if (box().hasFlippedBlocksWritingMode()) { | |
| 597 if (box().isFlexibleBox()) { | |
|
leviw_travelin_and_unemployed
2016/04/28 22:12:12
It seems like it may be easier/clearer to handle t
| |
| 598 EFlexDirection flexDirection = box().style()->flexDirection(); | |
| 599 if (flexDirection != FlowColumnReverse) | |
| 600 size.expand(verticalScrollbarWidth, 0); | |
| 601 if (flexDirection == FlowRowReverse) | |
| 602 size.expand(0, horizontalScrollbarHeight); | |
| 603 } else { | |
| 604 size.expand(verticalScrollbarWidth, 0); | |
| 605 } | |
| 606 } else if (box().isHorizontalWritingMode()) { | |
| 607 if (box().isFlexibleBox()) { | |
| 608 EFlexDirection flexDirection = box().style()->flexDirection(); | |
| 609 if (flexDirection == FlowRowReverse) | |
| 610 size.expand(verticalScrollbarWidth, 0); | |
| 611 else if (flexDirection == FlowColumnReverse) | |
| 612 size.expand(0, horizontalScrollbarHeight); | |
| 613 } else if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | |
| 614 size.expand(verticalScrollbarWidth, 0); | |
| 615 } | |
| 616 } else if (box().isFlexibleBox()) { | |
| 617 EFlexDirection flexDirection = box().style()->flexDirection(); | |
| 618 if (flexDirection == FlowColumnReverse) | |
| 619 size.expand(verticalScrollbarWidth, 0); | |
| 620 else if (flexDirection == FlowRowReverse) | |
| 621 size.expand(0, horizontalScrollbarHeight); | |
| 622 } | |
| 623 return size; | |
| 624 } | |
| 625 | |
| 590 void PaintLayerScrollableArea::computeScrollDimensions() | 626 void PaintLayerScrollableArea::computeScrollDimensions() |
| 591 { | 627 { |
| 592 m_overflowRect = box().layoutOverflowRect(); | 628 m_overflowRect = box().layoutOverflowRect(); |
| 593 box().flipForWritingMode(m_overflowRect); | 629 box().flipForWritingMode(m_overflowRect); |
| 594 | 630 |
| 595 int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box( ).shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScrollbarWid th() : 0); | 631 LayoutPoint scrollableOverflow = m_overflowRect.location() - LayoutSize(box( ).borderLeft(), box().borderTop()); |
| 596 int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); | 632 setScrollOrigin(flooredIntPoint(-scrollableOverflow) + originAdjustmentForSc rollbars()); |
| 597 setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); | |
| 598 } | 633 } |
| 599 | 634 |
| 600 void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPositio n, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior, ScrollType scrollT ype) | 635 void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPositio n, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior, ScrollType scrollT ype) |
| 601 { | 636 { |
| 602 cancelProgrammaticScrollAnimation(); | 637 cancelProgrammaticScrollAnimation(); |
| 603 | 638 |
| 604 DoublePoint newScrollPosition = clamp == ScrollOffsetClamped ? clampScrollPo sition(scrollPosition) : scrollPosition; | 639 DoublePoint newScrollPosition = clamp == ScrollOffsetClamped ? clampScrollPo sition(scrollPosition) : scrollPosition; |
| 605 if (newScrollPosition != scrollPositionDouble()) | 640 if (newScrollPosition != scrollPositionDouble()) |
| 606 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollB ehavior); | 641 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollB ehavior); |
| 607 } | 642 } |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1609 } | 1644 } |
| 1610 | 1645 |
| 1611 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) | 1646 DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager) |
| 1612 { | 1647 { |
| 1613 visitor->trace(m_scrollableArea); | 1648 visitor->trace(m_scrollableArea); |
| 1614 visitor->trace(m_hBar); | 1649 visitor->trace(m_hBar); |
| 1615 visitor->trace(m_vBar); | 1650 visitor->trace(m_vBar); |
| 1616 } | 1651 } |
| 1617 | 1652 |
| 1618 } // namespace blink | 1653 } // namespace blink |
| OLD | NEW |