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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } | 754 } |
755 | 755 |
756 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble
()); | 756 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble
()); |
757 if (clampedScrollPosition != scrollPositionDouble()) | 757 if (clampedScrollPosition != scrollPositionDouble()) |
758 ScrollableArea::setScrollPosition(clampedScrollPosition, ProgrammaticScr
oll); | 758 ScrollableArea::setScrollPosition(clampedScrollPosition, ProgrammaticScr
oll); |
759 else if (scrollOriginChanged()) | 759 else if (scrollOriginChanged()) |
760 scrollPositionChanged(clampedScrollPosition, ProgrammaticScroll); | 760 scrollPositionChanged(clampedScrollPosition, ProgrammaticScroll); |
761 | 761 |
762 setNeedsScrollPositionClamp(false); | 762 setNeedsScrollPositionClamp(false); |
763 resetScrollOriginChanged(); | 763 resetScrollOriginChanged(); |
| 764 m_scrollbarManager.destroyDetachedScrollbars(); |
764 } | 765 } |
765 | 766 |
766 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const | 767 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const |
767 { | 768 { |
768 return box().style()->getScrollBehavior(); | 769 return box().style()->getScrollBehavior(); |
769 } | 770 } |
770 | 771 |
771 bool PaintLayerScrollableArea::hasHorizontalOverflow() const | 772 bool PaintLayerScrollableArea::hasHorizontalOverflow() const |
772 { | 773 { |
773 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); | 774 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 if (!m_hBar) { | 1571 if (!m_hBar) { |
1571 m_hBar = createScrollbar(HorizontalScrollbar); | 1572 m_hBar = createScrollbar(HorizontalScrollbar); |
1572 m_hBarIsAttached = 1; | 1573 m_hBarIsAttached = 1; |
1573 if (!m_hBar->isCustomScrollbar()) | 1574 if (!m_hBar->isCustomScrollbar()) |
1574 m_scrollableArea->didAddScrollbar(*m_hBar, HorizontalScrollbar); | 1575 m_scrollableArea->didAddScrollbar(*m_hBar, HorizontalScrollbar); |
1575 } else { | 1576 } else { |
1576 m_hBarIsAttached = 1; | 1577 m_hBarIsAttached = 1; |
1577 } | 1578 } |
1578 } else { | 1579 } else { |
1579 m_hBarIsAttached = 0; | 1580 m_hBarIsAttached = 0; |
1580 destroyScrollbar(HorizontalScrollbar); | 1581 if (!DelayScrollPositionClampScope::clampingIsDelayed()) |
| 1582 destroyScrollbar(HorizontalScrollbar); |
1581 } | 1583 } |
1582 } | 1584 } |
1583 | 1585 |
1584 void PaintLayerScrollableArea::ScrollbarManager::setHasVerticalScrollbar(bool ha
sScrollbar) | 1586 void PaintLayerScrollableArea::ScrollbarManager::setHasVerticalScrollbar(bool ha
sScrollbar) |
1585 { | 1587 { |
1586 if (hasScrollbar) { | 1588 if (hasScrollbar) { |
1587 DisableCompositingQueryAsserts disabler; | 1589 DisableCompositingQueryAsserts disabler; |
1588 if (!m_vBar) { | 1590 if (!m_vBar) { |
1589 m_vBar = createScrollbar(VerticalScrollbar); | 1591 m_vBar = createScrollbar(VerticalScrollbar); |
1590 m_vBarIsAttached = 1; | 1592 m_vBarIsAttached = 1; |
1591 if (!m_vBar->isCustomScrollbar()) | 1593 if (!m_vBar->isCustomScrollbar()) |
1592 m_scrollableArea->didAddScrollbar(*m_vBar, VerticalScrollbar); | 1594 m_scrollableArea->didAddScrollbar(*m_vBar, VerticalScrollbar); |
1593 } else { | 1595 } else { |
1594 m_vBarIsAttached = 1; | 1596 m_vBarIsAttached = 1; |
1595 } | 1597 } |
1596 } else { | 1598 } else { |
1597 m_vBarIsAttached = 0; | 1599 m_vBarIsAttached = 0; |
1598 destroyScrollbar(VerticalScrollbar); | 1600 if (!DelayScrollPositionClampScope::clampingIsDelayed()) |
| 1601 destroyScrollbar(VerticalScrollbar); |
1599 } | 1602 } |
1600 } | 1603 } |
1601 | 1604 |
1602 Scrollbar* PaintLayerScrollableArea::ScrollbarManager::createScrollbar(Scrollbar
Orientation orientation) | 1605 Scrollbar* PaintLayerScrollableArea::ScrollbarManager::createScrollbar(Scrollbar
Orientation orientation) |
1603 { | 1606 { |
1604 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAtt
ached); | 1607 ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAtt
ached); |
1605 Scrollbar* scrollbar = nullptr; | 1608 Scrollbar* scrollbar = nullptr; |
1606 const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollab
leArea->box()); | 1609 const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollab
leArea->box()); |
1607 bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObj
ect.styleRef().hasPseudoStyle(PseudoIdScrollbar); | 1610 bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObj
ect.styleRef().hasPseudoStyle(PseudoIdScrollbar); |
1608 if (hasCustomScrollbarStyle) { | 1611 if (hasCustomScrollbarStyle) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 | 1721 |
1719 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre
as() | 1722 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre
as() |
1720 { | 1723 { |
1721 for (auto& scrollableArea : *s_needsClamp) | 1724 for (auto& scrollableArea : *s_needsClamp) |
1722 scrollableArea->clampScrollPositionsAfterLayout(); | 1725 scrollableArea->clampScrollPositionsAfterLayout(); |
1723 delete s_needsClamp; | 1726 delete s_needsClamp; |
1724 s_needsClamp = nullptr; | 1727 s_needsClamp = nullptr; |
1725 } | 1728 } |
1726 | 1729 |
1727 } // namespace blink | 1730 } // namespace blink |
OLD | NEW |