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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 23620023: Add ability to create solid color scrollbars in ScrollingCoordinator. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 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 16 matching lines...) Expand all
27 27
28 #include "core/page/scrolling/ScrollingCoordinator.h" 28 #include "core/page/scrolling/ScrollingCoordinator.h"
29 29
30 #include "RuntimeEnabledFeatures.h" 30 #include "RuntimeEnabledFeatures.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/Node.h" 32 #include "core/dom/Node.h"
33 #include "core/html/HTMLElement.h" 33 #include "core/html/HTMLElement.h"
34 #include "core/page/Frame.h" 34 #include "core/page/Frame.h"
35 #include "core/page/FrameView.h" 35 #include "core/page/FrameView.h"
36 #include "core/page/Page.h" 36 #include "core/page/Page.h"
37 #include "core/page/Settings.h"
37 #include "core/platform/PlatformWheelEvent.h" 38 #include "core/platform/PlatformWheelEvent.h"
38 #include "core/platform/ScrollAnimator.h" 39 #include "core/platform/ScrollAnimator.h"
39 #include "core/platform/ScrollbarTheme.h" 40 #include "core/platform/ScrollbarTheme.h"
40 #include "core/platform/chromium/TraceEvent.h" 41 #include "core/platform/chromium/TraceEvent.h"
41 #include "core/platform/chromium/support/WebScrollbarImpl.h" 42 #include "core/platform/chromium/support/WebScrollbarImpl.h"
42 #include "core/platform/chromium/support/WebScrollbarThemeGeometryNative.h" 43 #include "core/platform/chromium/support/WebScrollbarThemeGeometryNative.h"
43 #include "core/platform/graphics/GraphicsLayer.h" 44 #include "core/platform/graphics/GraphicsLayer.h"
44 #include "core/platform/graphics/IntRect.h" 45 #include "core/platform/graphics/IntRect.h"
45 #include "core/platform/graphics/Region.h" 46 #include "core/platform/graphics/Region.h"
46 #include "core/platform/graphics/transforms/TransformState.h" 47 #include "core/platform/graphics/transforms/TransformState.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { 202 {
202 ScrollbarTheme* theme = scrollbar->theme(); 203 ScrollbarTheme* theme = scrollbar->theme();
203 WebKit::WebScrollbarThemePainter painter(theme, scrollbar); 204 WebKit::WebScrollbarThemePainter painter(theme, scrollbar);
204 OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarTheme GeometryNative::create(theme)); 205 OwnPtr<WebKit::WebScrollbarThemeGeometry> geometry(WebKit::WebScrollbarTheme GeometryNative::create(theme));
205 206
206 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebKit::Platform::curren t()->compositorSupport()->createScrollbarLayer(new WebKit::WebScrollbarImpl(scro llbar), painter, geometry.leakPtr())); 207 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebKit::Platform::curren t()->compositorSupport()->createScrollbarLayer(new WebKit::WebScrollbarImpl(scro llbar), painter, geometry.leakPtr()));
207 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); 208 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer());
208 return scrollbarLayer.release(); 209 return scrollbarLayer.release();
209 } 210 }
210 211
212 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay er(ScrollbarOrientation orientation, int thumbThickness)
213 {
214 WebKit::WebScrollbar::Orientation webOrientation = (orientation == Horizonta lScrollbar) ? WebKit::WebScrollbar::Horizontal : WebKit::WebScrollbar::Vertical;
215 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(WebKit::Platform::curren t()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbTh ickness));
216 return scrollbarLayer.release();
217 }
218
211 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) 219 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer)
212 { 220 {
213 ASSERT(scrollbarGraphicsLayer); 221 ASSERT(scrollbarGraphicsLayer);
214 222
215 scrollbarGraphicsLayer->setContentsToPlatformLayer(0); 223 scrollbarGraphicsLayer->setContentsToPlatformLayer(0);
216 scrollbarGraphicsLayer->setDrawsContent(true); 224 scrollbarGraphicsLayer->setDrawsContent(true);
217 } 225 }
218 226
219 static void setupScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer, WebScroll barLayer* scrollbarLayer, WebLayer* scrollLayer) 227 static void setupScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer, WebScroll barLayer* scrollbarLayer, WebLayer* scrollLayer)
220 { 228 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 272
265 GraphicsLayer* scrollbarGraphicsLayer = orientation == HorizontalScrollbar ? horizontalScrollbarLayerForScrollableArea(scrollableArea) : verticalScrollbarLa yerForScrollableArea(scrollableArea); 273 GraphicsLayer* scrollbarGraphicsLayer = orientation == HorizontalScrollbar ? horizontalScrollbarLayerForScrollableArea(scrollableArea) : verticalScrollbarLa yerForScrollableArea(scrollableArea);
266 if (scrollbarGraphicsLayer) { 274 if (scrollbarGraphicsLayer) {
267 Scrollbar* scrollbar = orientation == HorizontalScrollbar ? scrollableAr ea->horizontalScrollbar() : scrollableArea->verticalScrollbar(); 275 Scrollbar* scrollbar = orientation == HorizontalScrollbar ? scrollableAr ea->horizontalScrollbar() : scrollableArea->verticalScrollbar();
268 if (scrollbar->isCustomScrollbar()) { 276 if (scrollbar->isCustomScrollbar()) {
269 detachScrollbarLayer(scrollbarGraphicsLayer); 277 detachScrollbarLayer(scrollbarGraphicsLayer);
270 return; 278 return;
271 } 279 }
272 280
273 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, orientation); 281 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, orientation);
274 if (!scrollbarLayer) 282 if (!scrollbarLayer) {
275 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, c reateScrollbarLayer(scrollbar)); 283 Settings* settings = m_page->mainFrame()->document()->settings();
284 bool shouldCreateSolidColorScrollbar = settings->useSolidColorScroll bars() && settings->usesOverlayScrollbars();
jamesr 2013/09/03 23:06:19 why are you checking usesSolidColor... *and* usesO
enne (OOO) 2013/09/03 23:47:33 My thought was that Android would set both of thes
wjmaclean 2013/09/04 13:27:59 I can confirm that Android does currently set both
jamesr 2013/09/04 20:41:17 I think either would be fine - either say that one
285
286 OwnPtr<WebScrollbarLayer> webScrollbarLayer;
287 if (shouldCreateSolidColorScrollbar)
288 webScrollbarLayer = createSolidColorScrollbarLayer(orientation, -1);
289 else
290 webScrollbarLayer = createScrollbarLayer(scrollbar);
291 addWebScrollbarLayer(scrollableArea, orientation, webScrollbarLayer. release());
292 }
276 293
277 // Root layer non-overlay scrollbars should be marked opaque to disable 294 // Root layer non-overlay scrollbars should be marked opaque to disable
278 // blending. 295 // blending.
279 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); 296 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar();
280 if (!scrollbarGraphicsLayer->contentsOpaque()) 297 if (!scrollbarGraphicsLayer->contentsOpaque())
281 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScr ollbar); 298 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScr ollbar);
282 scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaqu e()); 299 scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaqu e());
283 300
284 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollingWeb LayerForScrollableArea(scrollableArea)); 301 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollingWeb LayerForScrollableArea(scrollableArea));
285 } else 302 } else
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 stringBuilder.resize(stringBuilder.length() - 2); 825 stringBuilder.resize(stringBuilder.length() - 2);
809 return stringBuilder.toString(); 826 return stringBuilder.toString();
810 } 827 }
811 828
812 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const 829 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
813 { 830 {
814 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); 831 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
815 } 832 }
816 833
817 } // namespace WebCore 834 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698