OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 684 |
685 // overflow:scroll should just enable/disable. | 685 // overflow:scroll should just enable/disable. |
686 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) | 686 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) |
687 horizontalScrollbar()->setEnabled(hasHorizontalOverflow); | 687 horizontalScrollbar()->setEnabled(hasHorizontalOverflow); |
688 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) | 688 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) |
689 verticalScrollbar()->setEnabled(hasVerticalOverflow); | 689 verticalScrollbar()->setEnabled(hasVerticalOverflow); |
690 } | 690 } |
691 | 691 |
692 // We need to layout again if scrollbars are added or removed by | 692 // We need to layout again if scrollbars are added or removed by |
693 // overflow:auto, or by changing between native and custom. | 693 // overflow:auto, or by changing between native and custom. |
| 694 DCHECK(box().frame()->settings()); |
694 bool horizontalScrollbarShouldChange = | 695 bool horizontalScrollbarShouldChange = |
695 (box().hasAutoHorizontalScrollbar() && | 696 ((box().hasAutoHorizontalScrollbar() && |
696 (hasHorizontalScrollbar() != shouldHaveAutoHorizontalScrollbar)) || | 697 (hasHorizontalScrollbar() != shouldHaveAutoHorizontalScrollbar)) || |
697 (box().style()->overflowX() == OverflowScroll && !horizontalScrollbar()); | 698 (box().style()->overflowX() == OverflowScroll && |
| 699 !horizontalScrollbar())) && |
| 700 (!box().frame()->settings()->hideScrollbars() || |
| 701 hasHorizontalScrollbar()); |
698 bool verticalScrollbarShouldChange = | 702 bool verticalScrollbarShouldChange = |
699 (box().hasAutoVerticalScrollbar() && | 703 ((box().hasAutoVerticalScrollbar() && |
700 (hasVerticalScrollbar() != shouldHaveAutoVerticalScrollbar)) || | 704 (hasVerticalScrollbar() != shouldHaveAutoVerticalScrollbar)) || |
701 (box().style()->overflowY() == OverflowScroll && !verticalScrollbar()); | 705 (box().style()->overflowY() == OverflowScroll && |
| 706 !verticalScrollbar())) && |
| 707 (!box().frame()->settings()->hideScrollbars() || hasVerticalScrollbar()); |
702 bool scrollbarsWillChange = | 708 bool scrollbarsWillChange = |
703 !scrollbarsAreFrozen && !visualViewportSuppliesScrollbars() && | 709 !scrollbarsAreFrozen && !visualViewportSuppliesScrollbars() && |
704 (horizontalScrollbarShouldChange || verticalScrollbarShouldChange); | 710 (horizontalScrollbarShouldChange || verticalScrollbarShouldChange); |
705 | 711 |
706 if (scrollbarsWillChange) { | 712 if (scrollbarsWillChange) { |
707 bool hadHorizontalScrollbar = hasHorizontalScrollbar(); | 713 bool hadHorizontalScrollbar = hasHorizontalScrollbar(); |
708 bool hadVerticalScrollbar = hasVerticalScrollbar(); | 714 bool hadVerticalScrollbar = hasVerticalScrollbar(); |
709 if (box().hasAutoHorizontalScrollbar()) | 715 if (box().hasAutoHorizontalScrollbar()) |
710 setHasHorizontalScrollbar(shouldHaveAutoHorizontalScrollbar); | 716 setHasHorizontalScrollbar(shouldHaveAutoHorizontalScrollbar); |
711 else if (box().style()->overflowX() == OverflowScroll) | 717 else if (box().style()->overflowX() == OverflowScroll) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 needsVerticalScrollbar = true; | 937 needsVerticalScrollbar = true; |
932 } | 938 } |
933 } | 939 } |
934 } | 940 } |
935 | 941 |
936 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 942 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
937 setHasVerticalScrollbar(needsVerticalScrollbar); | 943 setHasVerticalScrollbar(needsVerticalScrollbar); |
938 | 944 |
939 // With overflow: scroll, scrollbars are always visible but may be disabled. | 945 // With overflow: scroll, scrollbars are always visible but may be disabled. |
940 // When switching to another value, we need to re-enable them (see bug 11985). | 946 // When switching to another value, we need to re-enable them (see bug 11985). |
941 if (needsHorizontalScrollbar && oldStyle && | 947 if (hasHorizontalScrollbar() && oldStyle && |
942 oldStyle->overflowX() == OverflowScroll && overflowX != OverflowScroll) { | 948 oldStyle->overflowX() == OverflowScroll && overflowX != OverflowScroll) { |
943 ASSERT(hasHorizontalScrollbar()); | |
944 horizontalScrollbar()->setEnabled(true); | 949 horizontalScrollbar()->setEnabled(true); |
945 } | 950 } |
946 | 951 |
947 if (needsVerticalScrollbar && oldStyle && | 952 if (hasVerticalScrollbar() && oldStyle && |
948 oldStyle->overflowY() == OverflowScroll && overflowY != OverflowScroll) { | 953 oldStyle->overflowY() == OverflowScroll && overflowY != OverflowScroll) { |
949 ASSERT(hasVerticalScrollbar()); | |
950 verticalScrollbar()->setEnabled(true); | 954 verticalScrollbar()->setEnabled(true); |
951 } | 955 } |
952 | 956 |
953 // FIXME: Need to detect a swap from custom to native scrollbars (and vice | 957 // FIXME: Need to detect a swap from custom to native scrollbars (and vice |
954 // versa). | 958 // versa). |
955 if (horizontalScrollbar()) | 959 if (horizontalScrollbar()) |
956 horizontalScrollbar()->styleChanged(); | 960 horizontalScrollbar()->styleChanged(); |
957 if (verticalScrollbar()) | 961 if (verticalScrollbar()) |
958 verticalScrollbar()->styleChanged(); | 962 verticalScrollbar()->styleChanged(); |
959 | 963 |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 | 1984 |
1981 void PaintLayerScrollableArea::DelayScrollPositionClampScope:: | 1985 void PaintLayerScrollableArea::DelayScrollPositionClampScope:: |
1982 clampScrollableAreas() { | 1986 clampScrollableAreas() { |
1983 for (auto& scrollableArea : *s_needsClamp) | 1987 for (auto& scrollableArea : *s_needsClamp) |
1984 scrollableArea->clampScrollPositionsAfterLayout(); | 1988 scrollableArea->clampScrollPositionsAfterLayout(); |
1985 delete s_needsClamp; | 1989 delete s_needsClamp; |
1986 s_needsClamp = nullptr; | 1990 s_needsClamp = nullptr; |
1987 } | 1991 } |
1988 | 1992 |
1989 } // namespace blink | 1993 } // namespace blink |
OLD | NEW |