| 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 16 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| 285 OwnPtr<WebScrollbarLayer> webScrollbarLayer; |
| 286 if (settings->useSolidColorScrollbars()) { |
| 287 ASSERT(settings->usesOverlayScrollbars()); |
| 288 webScrollbarLayer = createSolidColorScrollbarLayer(orientation,
-1); |
| 289 } else { |
| 290 webScrollbarLayer = createScrollbarLayer(scrollbar); |
| 291 } |
| 292 scrollbarLayer = addWebScrollbarLayer(scrollableArea, orientation, w
ebScrollbarLayer.release()); |
| 293 } |
| 276 | 294 |
| 277 // Root layer non-overlay scrollbars should be marked opaque to disable | 295 // Root layer non-overlay scrollbars should be marked opaque to disable |
| 278 // blending. | 296 // blending. |
| 279 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); | 297 bool isOpaqueScrollbar = !scrollbar->isOverlayScrollbar(); |
| 280 if (!scrollbarGraphicsLayer->contentsOpaque()) | 298 if (!scrollbarGraphicsLayer->contentsOpaque()) |
| 281 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScr
ollbar); | 299 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScr
ollbar); |
| 282 scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaqu
e()); | 300 scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaqu
e()); |
| 283 | 301 |
| 284 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollingWeb
LayerForScrollableArea(scrollableArea)); | 302 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollingWeb
LayerForScrollableArea(scrollableArea)); |
| 285 } else | 303 } else |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 stringBuilder.resize(stringBuilder.length() - 2); | 826 stringBuilder.resize(stringBuilder.length() - 2); |
| 809 return stringBuilder.toString(); | 827 return stringBuilder.toString(); |
| 810 } | 828 } |
| 811 | 829 |
| 812 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 830 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
| 813 { | 831 { |
| 814 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); | 832 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); |
| 815 } | 833 } |
| 816 | 834 |
| 817 } // namespace WebCore | 835 } // namespace WebCore |
| OLD | NEW |