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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "platform/scroll/ScrollAnimatorBase.h" | 57 #include "platform/scroll/ScrollAnimatorBase.h" |
58 #include "platform/scroll/ScrollbarTheme.h" | 58 #include "platform/scroll/ScrollbarTheme.h" |
59 #include "platform/tracing/TraceEvent.h" | 59 #include "platform/tracing/TraceEvent.h" |
60 #include "public/platform/Platform.h" | 60 #include "public/platform/Platform.h" |
61 #include "public/platform/WebCompositorSupport.h" | 61 #include "public/platform/WebCompositorSupport.h" |
62 #include "public/platform/WebLayerPositionConstraint.h" | 62 #include "public/platform/WebLayerPositionConstraint.h" |
63 #include "public/platform/WebLayerTreeView.h" | 63 #include "public/platform/WebLayerTreeView.h" |
64 #include "public/platform/WebScrollbarLayer.h" | 64 #include "public/platform/WebScrollbarLayer.h" |
65 #include "public/platform/WebScrollbarThemeGeometry.h" | 65 #include "public/platform/WebScrollbarThemeGeometry.h" |
66 #include "public/platform/WebScrollbarThemePainter.h" | 66 #include "public/platform/WebScrollbarThemePainter.h" |
67 #include "wtf/PtrUtil.h" | |
68 #include "wtf/text/StringBuilder.h" | 67 #include "wtf/text/StringBuilder.h" |
69 #include <memory> | 68 #include <memory> |
| 69 #include <utility> |
70 | 70 |
71 using blink::WebLayer; | 71 using blink::WebLayer; |
72 using blink::WebLayerPositionConstraint; | 72 using blink::WebLayerPositionConstraint; |
73 using blink::WebRect; | 73 using blink::WebRect; |
74 using blink::WebScrollbarLayer; | 74 using blink::WebScrollbarLayer; |
75 using blink::WebVector; | 75 using blink::WebVector; |
76 | 76 |
77 namespace { | 77 namespace { |
78 | 78 |
79 WebLayer* toWebLayer(blink::GraphicsLayer* layer) { | 79 WebLayer* toWebLayer(blink::GraphicsLayer* layer) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 static std::unique_ptr<WebScrollbarLayer> createScrollbarLayer( | 303 static std::unique_ptr<WebScrollbarLayer> createScrollbarLayer( |
304 Scrollbar& scrollbar, | 304 Scrollbar& scrollbar, |
305 float deviceScaleFactor) { | 305 float deviceScaleFactor) { |
306 ScrollbarTheme& theme = scrollbar.theme(); | 306 ScrollbarTheme& theme = scrollbar.theme(); |
307 WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor); | 307 WebScrollbarThemePainter painter(theme, scrollbar, deviceScaleFactor); |
308 std::unique_ptr<WebScrollbarThemeGeometry> geometry( | 308 std::unique_ptr<WebScrollbarThemeGeometry> geometry( |
309 WebScrollbarThemeGeometryNative::create(theme)); | 309 WebScrollbarThemeGeometryNative::create(theme)); |
310 | 310 |
311 std::unique_ptr<WebScrollbarLayer> scrollbarLayer = | 311 std::unique_ptr<WebScrollbarLayer> scrollbarLayer = |
312 wrapUnique(Platform::current()->compositorSupport()->createScrollbarLayer( | 312 Platform::current()->compositorSupport()->createScrollbarLayer( |
313 WebScrollbarImpl::create(&scrollbar), painter, geometry.release())); | 313 WebScrollbarImpl::create(&scrollbar), painter, std::move(geometry)); |
314 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 314 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
315 return scrollbarLayer; | 315 return scrollbarLayer; |
316 } | 316 } |
317 | 317 |
318 std::unique_ptr<WebScrollbarLayer> | 318 std::unique_ptr<WebScrollbarLayer> |
319 ScrollingCoordinator::createSolidColorScrollbarLayer( | 319 ScrollingCoordinator::createSolidColorScrollbarLayer( |
320 ScrollbarOrientation orientation, | 320 ScrollbarOrientation orientation, |
321 int thumbThickness, | 321 int thumbThickness, |
322 int trackStart, | 322 int trackStart, |
323 bool isLeftSideVerticalScrollbar) { | 323 bool isLeftSideVerticalScrollbar) { |
324 WebScrollbar::Orientation webOrientation = | 324 WebScrollbar::Orientation webOrientation = |
325 (orientation == HorizontalScrollbar) ? WebScrollbar::Horizontal | 325 (orientation == HorizontalScrollbar) ? WebScrollbar::Horizontal |
326 : WebScrollbar::Vertical; | 326 : WebScrollbar::Vertical; |
327 std::unique_ptr<WebScrollbarLayer> scrollbarLayer = wrapUnique( | 327 std::unique_ptr<WebScrollbarLayer> scrollbarLayer = |
328 Platform::current()->compositorSupport()->createSolidColorScrollbarLayer( | 328 Platform::current()->compositorSupport()->createSolidColorScrollbarLayer( |
329 webOrientation, thumbThickness, trackStart, | 329 webOrientation, thumbThickness, trackStart, |
330 isLeftSideVerticalScrollbar)); | 330 isLeftSideVerticalScrollbar); |
331 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); | 331 GraphicsLayer::registerContentsLayer(scrollbarLayer->layer()); |
332 return scrollbarLayer; | 332 return scrollbarLayer; |
333 } | 333 } |
334 | 334 |
335 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) { | 335 static void detachScrollbarLayer(GraphicsLayer* scrollbarGraphicsLayer) { |
336 ASSERT(scrollbarGraphicsLayer); | 336 ASSERT(scrollbarGraphicsLayer); |
337 | 337 |
338 scrollbarGraphicsLayer->setContentsToPlatformLayer(nullptr); | 338 scrollbarGraphicsLayer->setContentsToPlatformLayer(nullptr); |
339 scrollbarGraphicsLayer->setDrawsContent(true); | 339 scrollbarGraphicsLayer->setDrawsContent(true); |
340 } | 340 } |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 if (frameIsScrollable != m_wasFrameScrollable) | 1229 if (frameIsScrollable != m_wasFrameScrollable) |
1230 return true; | 1230 return true; |
1231 | 1231 |
1232 if (WebLayer* scrollLayer = | 1232 if (WebLayer* scrollLayer = |
1233 frameView ? toWebLayer(frameView->layerForScrolling()) : nullptr) | 1233 frameView ? toWebLayer(frameView->layerForScrolling()) : nullptr) |
1234 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); | 1234 return WebSize(frameView->contentsSize()) != scrollLayer->bounds(); |
1235 return false; | 1235 return false; |
1236 } | 1236 } |
1237 | 1237 |
1238 } // namespace blink | 1238 } // namespace blink |
OLD | NEW |