| 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL
&& overflowX != OSCROLL) { | 673 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL
&& overflowX != OSCROLL) { |
| 674 ASSERT(hasHorizontalScrollbar()); | 674 ASSERT(hasHorizontalScrollbar()); |
| 675 m_hBar->setEnabled(true); | 675 m_hBar->setEnabled(true); |
| 676 } | 676 } |
| 677 | 677 |
| 678 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL &
& overflowY != OSCROLL) { | 678 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL &
& overflowY != OSCROLL) { |
| 679 ASSERT(hasVerticalScrollbar()); | 679 ASSERT(hasVerticalScrollbar()); |
| 680 m_vBar->setEnabled(true); | 680 m_vBar->setEnabled(true); |
| 681 } | 681 } |
| 682 | 682 |
| 683 // FIXME: Need to detect a swap from custom to native scrollbars (and vice v
ersa). | |
| 684 if (m_hBar) | |
| 685 m_hBar->styleChanged(); | |
| 686 if (m_vBar) | |
| 687 m_vBar->styleChanged(); | |
| 688 | |
| 689 updateResizerAreaSet(); | 683 updateResizerAreaSet(); |
| 690 } | 684 } |
| 691 | 685 |
| 692 bool RenderLayerScrollableArea::updateAfterCompositingChange() | 686 bool RenderLayerScrollableArea::updateAfterCompositingChange() |
| 693 { | 687 { |
| 694 layer()->updateScrollingStateAfterCompositingChange(); | 688 layer()->updateScrollingStateAfterCompositingChange(); |
| 695 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; | 689 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; |
| 696 m_topmostScrollChild = m_nextTopmostScrollChild; | 690 m_topmostScrollChild = m_nextTopmostScrollChild; |
| 697 m_nextTopmostScrollChild = nullptr; | 691 m_nextTopmostScrollChild = nullptr; |
| 698 return layersChanged; | 692 return layersChanged; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 didAddScrollbar(widget.get(), VerticalScrollbar); | 784 didAddScrollbar(widget.get(), VerticalScrollbar); |
| 791 return widget.release(); | 785 return widget.release(); |
| 792 } | 786 } |
| 793 | 787 |
| 794 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio
n) | 788 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio
n) |
| 795 { | 789 { |
| 796 RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar :
m_vBar; | 790 RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar :
m_vBar; |
| 797 if (!scrollbar) | 791 if (!scrollbar) |
| 798 return; | 792 return; |
| 799 | 793 |
| 800 if (!scrollbar->isCustomScrollbar()) | 794 willRemoveScrollbar(scrollbar.get(), orientation); |
| 801 willRemoveScrollbar(scrollbar.get(), orientation); | |
| 802 | 795 |
| 803 scrollbar->disconnectFromScrollableArea(); | 796 scrollbar->disconnectFromScrollableArea(); |
| 804 scrollbar = nullptr; | 797 scrollbar = nullptr; |
| 805 } | 798 } |
| 806 | 799 |
| 807 void RenderLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar) | 800 void RenderLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar) |
| 808 { | 801 { |
| 809 if (hasScrollbar == hasHorizontalScrollbar()) | 802 if (hasScrollbar == hasHorizontalScrollbar()) |
| 810 return; | 803 return; |
| 811 | 804 |
| 812 if (hasScrollbar) { | 805 if (hasScrollbar) { |
| 813 // This doesn't hit in any tests, but since the equivalent code in setHa
sVerticalScrollbar | 806 // This doesn't hit in any tests, but since the equivalent code in setHa
sVerticalScrollbar |
| 814 // does, presumably this code does as well. | 807 // does, presumably this code does as well. |
| 815 DisableCompositingQueryAsserts disabler; | 808 DisableCompositingQueryAsserts disabler; |
| 816 m_hBar = createScrollbar(HorizontalScrollbar); | 809 m_hBar = createScrollbar(HorizontalScrollbar); |
| 817 } else { | 810 } else { |
| 818 destroyScrollbar(HorizontalScrollbar); | 811 destroyScrollbar(HorizontalScrollbar); |
| 819 } | 812 } |
| 820 | |
| 821 // Destroying or creating one bar can cause our scrollbar corner to come and
go. We need to update the opposite scrollbar's style. | |
| 822 if (m_hBar) | |
| 823 m_hBar->styleChanged(); | |
| 824 if (m_vBar) | |
| 825 m_vBar->styleChanged(); | |
| 826 } | 813 } |
| 827 | 814 |
| 828 void RenderLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar) | 815 void RenderLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar) |
| 829 { | 816 { |
| 830 if (hasScrollbar == hasVerticalScrollbar()) | 817 if (hasScrollbar == hasVerticalScrollbar()) |
| 831 return; | 818 return; |
| 832 | 819 |
| 833 if (hasScrollbar) { | 820 if (hasScrollbar) { |
| 834 // Hits in compositing/overflow/automatically-opt-into-composited-scroll
ing-after-style-change.html | 821 // Hits in compositing/overflow/automatically-opt-into-composited-scroll
ing-after-style-change.html |
| 835 DisableCompositingQueryAsserts disabler; | 822 DisableCompositingQueryAsserts disabler; |
| 836 m_vBar = createScrollbar(VerticalScrollbar); | 823 m_vBar = createScrollbar(VerticalScrollbar); |
| 837 } else { | 824 } else { |
| 838 destroyScrollbar(VerticalScrollbar); | 825 destroyScrollbar(VerticalScrollbar); |
| 839 } | 826 } |
| 840 | |
| 841 // Destroying or creating one bar can cause our scrollbar corner to come and
go. We need to update the opposite scrollbar's style. | |
| 842 if (m_hBar) | |
| 843 m_hBar->styleChanged(); | |
| 844 if (m_vBar) | |
| 845 m_vBar->styleChanged(); | |
| 846 } | 827 } |
| 847 | 828 |
| 848 int RenderLayerScrollableArea::verticalScrollbarWidth(OverlayScrollbarSizeReleva
ncy relevancy) const | 829 int RenderLayerScrollableArea::verticalScrollbarWidth(OverlayScrollbarSizeReleva
ncy relevancy) const |
| 849 { | 830 { |
| 850 if (!m_vBar || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS
crollbarSize || !m_vBar->shouldParticipateInHitTesting()))) | 831 if (!m_vBar || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayS
crollbarSize || !m_vBar->shouldParticipateInHitTesting()))) |
| 851 return 0; | 832 return 0; |
| 852 return m_vBar->width(); | 833 return m_vBar->width(); |
| 853 } | 834 } |
| 854 | 835 |
| 855 int RenderLayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRel
evancy relevancy) const | 836 int RenderLayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRel
evancy relevancy) const |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) | 1299 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) |
| 1319 { | 1300 { |
| 1320 // We only want to track the topmost scroll child for scrollable areas with | 1301 // We only want to track the topmost scroll child for scrollable areas with |
| 1321 // overlay scrollbars. | 1302 // overlay scrollbars. |
| 1322 if (!hasOverlayScrollbars()) | 1303 if (!hasOverlayScrollbars()) |
| 1323 return; | 1304 return; |
| 1324 m_nextTopmostScrollChild = scrollChild; | 1305 m_nextTopmostScrollChild = scrollChild; |
| 1325 } | 1306 } |
| 1326 | 1307 |
| 1327 } // namespace blink | 1308 } // namespace blink |
| OLD | NEW |