| 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 850 } |
| 851 | 851 |
| 852 void PaintLayerScrollableArea::updateAfterStyleChange( | 852 void PaintLayerScrollableArea::updateAfterStyleChange( |
| 853 const ComputedStyle* oldStyle) { | 853 const ComputedStyle* oldStyle) { |
| 854 // Don't do this on first style recalc, before layout has ever happened. | 854 // Don't do this on first style recalc, before layout has ever happened. |
| 855 if (!overflowRect().size().isZero()) { | 855 if (!overflowRect().size().isZero()) { |
| 856 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || | 856 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || |
| 857 hasScrollableVerticalOverflow()); | 857 hasScrollableVerticalOverflow()); |
| 858 } | 858 } |
| 859 | 859 |
| 860 // Whenever background changes on the scrollable element, the scroll bar |
| 861 // overlay style might need to be changed to have contrast against the |
| 862 // background. |
| 863 // Skip the need scrollbar check, because we dont know do we need a scrollbar |
| 864 // when this method get called. |
| 865 Color oldBackground; |
| 866 if (oldStyle) { |
| 867 oldBackground = oldStyle->visitedDependentColor(CSSPropertyBackgroundColor); |
| 868 } |
| 869 Color newBackground = |
| 870 box().style()->visitedDependentColor(CSSPropertyBackgroundColor); |
| 871 |
| 872 if (newBackground != oldBackground) { |
| 873 recalculateScrollbarOverlayColorTheme(newBackground); |
| 874 } |
| 875 |
| 860 bool needsHorizontalScrollbar; | 876 bool needsHorizontalScrollbar; |
| 861 bool needsVerticalScrollbar; | 877 bool needsVerticalScrollbar; |
| 862 // We add auto scrollbars only during layout to prevent spurious activations. | 878 // We add auto scrollbars only during layout to prevent spurious activations. |
| 863 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar, | 879 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar, |
| 864 ForbidAddingAutoBars); | 880 ForbidAddingAutoBars); |
| 865 | 881 |
| 866 // Avoid some unnecessary computation if there were and will be no scrollbars. | 882 // Avoid some unnecessary computation if there were and will be no scrollbars. |
| 867 if (!hasScrollbar() && !needsHorizontalScrollbar && !needsVerticalScrollbar) | 883 if (!hasScrollbar() && !needsHorizontalScrollbar && !needsVerticalScrollbar) |
| 868 return; | 884 return; |
| 869 | 885 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 887 // FIXME: Need to detect a swap from custom to native scrollbars (and vice | 903 // FIXME: Need to detect a swap from custom to native scrollbars (and vice |
| 888 // versa). | 904 // versa). |
| 889 if (horizontalScrollbar()) | 905 if (horizontalScrollbar()) |
| 890 horizontalScrollbar()->styleChanged(); | 906 horizontalScrollbar()->styleChanged(); |
| 891 if (verticalScrollbar()) | 907 if (verticalScrollbar()) |
| 892 verticalScrollbar()->styleChanged(); | 908 verticalScrollbar()->styleChanged(); |
| 893 | 909 |
| 894 updateScrollCornerStyle(); | 910 updateScrollCornerStyle(); |
| 895 updateResizerAreaSet(); | 911 updateResizerAreaSet(); |
| 896 updateResizerStyle(); | 912 updateResizerStyle(); |
| 897 | |
| 898 // Whenever background changes on the scrollable element, the scroll bar | |
| 899 // overlay style might need to be changed to have contrast against the | |
| 900 // background. | |
| 901 Color oldBackground; | |
| 902 if (oldStyle) { | |
| 903 oldBackground = oldStyle->visitedDependentColor(CSSPropertyBackgroundColor); | |
| 904 } | |
| 905 Color newBackground = | |
| 906 box().style()->visitedDependentColor(CSSPropertyBackgroundColor); | |
| 907 | |
| 908 if (newBackground != oldBackground) { | |
| 909 recalculateScrollbarOverlayStyle(newBackground); | |
| 910 } | |
| 911 } | 913 } |
| 912 | 914 |
| 913 bool PaintLayerScrollableArea::updateAfterCompositingChange() { | 915 bool PaintLayerScrollableArea::updateAfterCompositingChange() { |
| 914 layer()->updateScrollingStateAfterCompositingChange(); | 916 layer()->updateScrollingStateAfterCompositingChange(); |
| 915 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; | 917 const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild; |
| 916 m_topmostScrollChild = m_nextTopmostScrollChild; | 918 m_topmostScrollChild = m_nextTopmostScrollChild; |
| 917 m_nextTopmostScrollChild = nullptr; | 919 m_nextTopmostScrollChild = nullptr; |
| 918 return layersChanged; | 920 return layersChanged; |
| 919 } | 921 } |
| 920 | 922 |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 | 1953 |
| 1952 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 1954 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 1953 clampScrollableAreas() { | 1955 clampScrollableAreas() { |
| 1954 for (auto& scrollableArea : *s_needsClamp) | 1956 for (auto& scrollableArea : *s_needsClamp) |
| 1955 scrollableArea->clampScrollOffsetsAfterLayout(); | 1957 scrollableArea->clampScrollOffsetsAfterLayout(); |
| 1956 delete s_needsClamp; | 1958 delete s_needsClamp; |
| 1957 s_needsClamp = nullptr; | 1959 s_needsClamp = nullptr; |
| 1958 } | 1960 } |
| 1959 | 1961 |
| 1960 } // namespace blink | 1962 } // namespace blink |
| OLD | NEW |