Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: Source/platform/scroll/ScrollView.cpp

Issue 383603002: Update scrollbar layer opacity when scrollbar theme changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update test expectations Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/scroll/ScrollView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 IntPoint ScrollView::adjustScrollPositionWithinRange(const IntPoint& scrollPoint ) const 233 IntPoint ScrollView::adjustScrollPositionWithinRange(const IntPoint& scrollPoint ) const
234 { 234 {
235 if (!constrainsScrollingToContentEdge()) 235 if (!constrainsScrollingToContentEdge())
236 return scrollPoint; 236 return scrollPoint;
237 237
238 IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition()); 238 IntPoint newScrollPosition = scrollPoint.shrunkTo(maximumScrollPosition());
239 newScrollPosition = newScrollPosition.expandedTo(minimumScrollPosition()); 239 newScrollPosition = newScrollPosition.expandedTo(minimumScrollPosition());
240 return newScrollPosition; 240 return newScrollPosition;
241 } 241 }
242 242
243 void ScrollView::adjustScrollbarOpacity()
244 {
245 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) {
246 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar();
247 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar);
248 }
249 if (m_verticalScrollbar && layerForVerticalScrollbar()) {
250 bool isOpaqueScrollbar = !m_verticalScrollbar->isOverlayScrollbar();
251 layerForVerticalScrollbar()->setContentsOpaque(isOpaqueScrollbar);
252 }
253 }
254
243 int ScrollView::scrollSize(ScrollbarOrientation orientation) const 255 int ScrollView::scrollSize(ScrollbarOrientation orientation) const
244 { 256 {
245 Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_horizontalS crollbar : m_verticalScrollbar).get(); 257 Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_horizontalS crollbar : m_verticalScrollbar).get();
246 258
247 // If no scrollbars are present, the content may still be scrollable. 259 // If no scrollbars are present, the content may still be scrollable.
248 if (!scrollbar) { 260 if (!scrollbar) {
249 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); 261 IntSize scrollSize = m_contentsSize - visibleContentRect().size();
250 scrollSize.clampNegativeToZero(); 262 scrollSize.clampNegativeToZero();
251 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height(); 263 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height();
252 } 264 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 return cornerRect; 817 return cornerRect;
806 } 818 }
807 819
808 bool ScrollView::isScrollCornerVisible() const 820 bool ScrollView::isScrollCornerVisible() const
809 { 821 {
810 return !scrollCornerRect().isEmpty(); 822 return !scrollCornerRect().isEmpty();
811 } 823 }
812 824
813 void ScrollView::scrollbarStyleChanged() 825 void ScrollView::scrollbarStyleChanged()
814 { 826 {
827 adjustScrollbarOpacity();
815 contentsResized(); 828 contentsResized();
816 updateScrollbars(scrollOffset()); 829 updateScrollbars(scrollOffset());
817 positionScrollbarLayers(); 830 positionScrollbarLayers();
818 } 831 }
819 832
820 void ScrollView::updateScrollCorner() 833 void ScrollView::updateScrollCorner()
821 { 834 {
822 } 835 }
823 836
824 void ScrollView::paintScrollCorner(GraphicsContext* context, const IntRect& corn erRect) 837 void ScrollView::paintScrollCorner(GraphicsContext* context, const IntRect& corn erRect)
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 return; 1130 return;
1118 1131
1119 ScrollableArea::setScrollOrigin(origin); 1132 ScrollableArea::setScrollOrigin(origin);
1120 1133
1121 // Update if the scroll origin changes, since our position will be different if the content size did not change. 1134 // Update if the scroll origin changes, since our position will be different if the content size did not change.
1122 if (updatePositionAtAll && updatePositionSynchronously) 1135 if (updatePositionAtAll && updatePositionSynchronously)
1123 updateScrollbars(scrollOffset()); 1136 updateScrollbars(scrollOffset());
1124 } 1137 }
1125 1138
1126 } // namespace WebCore 1139 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698