OLD | NEW |
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 { | 240 { |
241 ScrollbarTheme* theme = scrollbar->theme(); | 241 ScrollbarTheme* theme = scrollbar->theme(); |
242 blink::WebScrollbarThemePainter painter(theme, scrollbar); | 242 blink::WebScrollbarThemePainter painter(theme, scrollbar); |
243 OwnPtr<blink::WebScrollbarThemeGeometry> geometry(blink::WebScrollbarThemeGe
ometryNative::create(theme)); | 243 OwnPtr<blink::WebScrollbarThemeGeometry> geometry(blink::WebScrollbarThemeGe
ometryNative::create(theme)); |
244 | 244 |
245 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current
()->compositorSupport()->createScrollbarLayer(new blink::WebScrollbarImpl(scroll
bar), painter, geometry.leakPtr())); | 245 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current
()->compositorSupport()->createScrollbarLayer(new blink::WebScrollbarImpl(scroll
bar), painter, geometry.leakPtr())); |
246 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 246 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
247 return scrollbarLayer.release(); | 247 return scrollbarLayer.release(); |
248 } | 248 } |
249 | 249 |
250 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay
er(ScrollbarOrientation orientation, int thumbThickness, bool isLeftSideVertical
Scrollbar) | 250 PassOwnPtr<WebScrollbarLayer> ScrollingCoordinator::createSolidColorScrollbarLay
er(ScrollbarOrientation orientation, int thumbThickness, int trackStart, bool is
LeftSideVerticalScrollbar) |
251 { | 251 { |
252 blink::WebScrollbar::Orientation webOrientation = (orientation == Horizontal
Scrollbar) ? blink::WebScrollbar::Horizontal : blink::WebScrollbar::Vertical; | 252 blink::WebScrollbar::Orientation webOrientation = (orientation == Horizontal
Scrollbar) ? blink::WebScrollbar::Horizontal : blink::WebScrollbar::Vertical; |
253 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current
()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThi
ckness, isLeftSideVerticalScrollbar)); | 253 OwnPtr<WebScrollbarLayer> scrollbarLayer = adoptPtr(blink::Platform::current
()->compositorSupport()->createSolidColorScrollbarLayer(webOrientation, thumbThi
ckness, trackStart, isLeftSideVerticalScrollbar)); |
254 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 254 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
255 return scrollbarLayer.release(); | 255 return scrollbarLayer.release(); |
256 } | 256 } |
257 | 257 |
258 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) | 258 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) |
259 { | 259 { |
260 ASSERT(scrollbarGraphicsLayer); | 260 ASSERT(scrollbarGraphicsLayer); |
261 | 261 |
262 scrollbarGraphicsLayer->setContentsToPlatformLayer(0); | 262 scrollbarGraphicsLayer->setContentsToPlatformLayer(0); |
263 scrollbarGraphicsLayer->setDrawsContent(true); | 263 scrollbarGraphicsLayer->setDrawsContent(true); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 return; | 321 return; |
322 } | 322 } |
323 | 323 |
324 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
orientation); | 324 WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea,
orientation); |
325 if (!scrollbarLayer) { | 325 if (!scrollbarLayer) { |
326 Settings* settings = m_page->mainFrame()->document()->settings(); | 326 Settings* settings = m_page->mainFrame()->document()->settings(); |
327 | 327 |
328 OwnPtr<WebScrollbarLayer> webScrollbarLayer; | 328 OwnPtr<WebScrollbarLayer> webScrollbarLayer; |
329 if (settings->useSolidColorScrollbars()) { | 329 if (settings->useSolidColorScrollbars()) { |
330 ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); | 330 ASSERT(RuntimeEnabledFeatures::overlayScrollbarsEnabled()); |
331 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
scrollbar->theme()->thumbThickness(scrollbar), scrollableArea->shouldPlaceVertic
alScrollbarOnLeft()); | 331 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
scrollbar->theme()->thumbThickness(scrollbar), scrollbar->theme()->trackPosition
(scrollbar), scrollableArea->shouldPlaceVerticalScrollbarOnLeft()); |
332 } else { | 332 } else { |
333 webScrollbarLayer = createScrollbarLayer(scrollbar); | 333 webScrollbarLayer = createScrollbarLayer(scrollbar); |
334 } | 334 } |
335 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); | 335 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); |
336 } | 336 } |
337 | 337 |
338 // Root layer non-overlay scrollbars should be marked opaque to disable | 338 // Root layer non-overlay scrollbars should be marked opaque to disable |
339 // blending. | 339 // blending. |
340 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); | 340 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); |
341 if (!scrollbarGraphicsLayer->contentsOpaque()) | 341 if (!scrollbarGraphicsLayer->contentsOpaque()) |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 bool frameIsScrollable = frameView && frameView->isScrollable(); | 956 bool frameIsScrollable = frameView && frameView->isScrollable(); |
957 if (frameIsScrollable != m_wasFrameScrollable) | 957 if (frameIsScrollable != m_wasFrameScrollable) |
958 return true; | 958 return true; |
959 | 959 |
960 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 960 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
961 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 961 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
962 return false; | 962 return false; |
963 } | 963 } |
964 | 964 |
965 } // namespace WebCore | 965 } // namespace WebCore |
OLD | NEW |