| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 ScrollbarTheme& theme = scrollbar.GetTheme(); | 349 ScrollbarTheme& theme = scrollbar.GetTheme(); |
| 350 WebScrollbarThemePainter painter(theme, scrollbar, device_scale_factor); | 350 WebScrollbarThemePainter painter(theme, scrollbar, device_scale_factor); |
| 351 std::unique_ptr<WebScrollbarThemeGeometry> geometry( | 351 std::unique_ptr<WebScrollbarThemeGeometry> geometry( |
| 352 WebScrollbarThemeGeometryNative::Create(theme)); | 352 WebScrollbarThemeGeometryNative::Create(theme)); |
| 353 | 353 |
| 354 std::unique_ptr<WebScrollbarLayer> scrollbar_layer; | 354 std::unique_ptr<WebScrollbarLayer> scrollbar_layer; |
| 355 if (theme.UsesOverlayScrollbars() && theme.UsesNinePatchThumbResource()) { | 355 if (theme.UsesOverlayScrollbars() && theme.UsesNinePatchThumbResource()) { |
| 356 scrollbar_layer = | 356 scrollbar_layer = |
| 357 Platform::Current()->CompositorSupport()->CreateOverlayScrollbarLayer( | 357 Platform::Current()->CompositorSupport()->CreateOverlayScrollbarLayer( |
| 358 WebScrollbarImpl::Create(&scrollbar), painter, std::move(geometry)); | 358 WebScrollbarImpl::Create(&scrollbar), painter, std::move(geometry)); |
| 359 scrollbar_layer->SetElementId(CompositorElementIdFromDOMNodeId( | 359 scrollbar_layer->SetElementId(CompositorElementIdFromScrollbarId( |
| 360 NextScrollbarId(), CompositorElementIdNamespace::kScrollbar)); | 360 NextScrollbarId(), CompositorElementIdNamespace::kScrollbar)); |
| 361 } else { | 361 } else { |
| 362 scrollbar_layer = | 362 scrollbar_layer = |
| 363 Platform::Current()->CompositorSupport()->CreateScrollbarLayer( | 363 Platform::Current()->CompositorSupport()->CreateScrollbarLayer( |
| 364 WebScrollbarImpl::Create(&scrollbar), painter, std::move(geometry)); | 364 WebScrollbarImpl::Create(&scrollbar), painter, std::move(geometry)); |
| 365 scrollbar_layer->SetElementId(CompositorElementIdFromDOMNodeId( | 365 scrollbar_layer->SetElementId(CompositorElementIdFromScrollbarId( |
| 366 NextScrollbarId(), CompositorElementIdNamespace::kScrollbar)); | 366 NextScrollbarId(), CompositorElementIdNamespace::kScrollbar)); |
| 367 } | 367 } |
| 368 GraphicsLayer::RegisterContentsLayer(scrollbar_layer->Layer()); | 368 GraphicsLayer::RegisterContentsLayer(scrollbar_layer->Layer()); |
| 369 return scrollbar_layer; | 369 return scrollbar_layer; |
| 370 } | 370 } |
| 371 | 371 |
| 372 std::unique_ptr<WebScrollbarLayer> | 372 std::unique_ptr<WebScrollbarLayer> |
| 373 ScrollingCoordinator::CreateSolidColorScrollbarLayer( | 373 ScrollingCoordinator::CreateSolidColorScrollbarLayer( |
| 374 ScrollbarOrientation orientation, | 374 ScrollbarOrientation orientation, |
| 375 int thumb_thickness, | 375 int thumb_thickness, |
| 376 int track_start, | 376 int track_start, |
| 377 bool is_left_side_vertical_scrollbar) { | 377 bool is_left_side_vertical_scrollbar) { |
| 378 WebScrollbar::Orientation web_orientation = | 378 WebScrollbar::Orientation web_orientation = |
| 379 (orientation == kHorizontalScrollbar) ? WebScrollbar::kHorizontal | 379 (orientation == kHorizontalScrollbar) ? WebScrollbar::kHorizontal |
| 380 : WebScrollbar::kVertical; | 380 : WebScrollbar::kVertical; |
| 381 std::unique_ptr<WebScrollbarLayer> scrollbar_layer = | 381 std::unique_ptr<WebScrollbarLayer> scrollbar_layer = |
| 382 Platform::Current()->CompositorSupport()->CreateSolidColorScrollbarLayer( | 382 Platform::Current()->CompositorSupport()->CreateSolidColorScrollbarLayer( |
| 383 web_orientation, thumb_thickness, track_start, | 383 web_orientation, thumb_thickness, track_start, |
| 384 is_left_side_vertical_scrollbar); | 384 is_left_side_vertical_scrollbar); |
| 385 scrollbar_layer->SetElementId(CompositorElementIdFromDOMNodeId( | 385 scrollbar_layer->SetElementId(CompositorElementIdFromScrollbarId( |
| 386 NextScrollbarId(), CompositorElementIdNamespace::kScrollbar)); | 386 NextScrollbarId(), CompositorElementIdNamespace::kScrollbar)); |
| 387 GraphicsLayer::RegisterContentsLayer(scrollbar_layer->Layer()); | 387 GraphicsLayer::RegisterContentsLayer(scrollbar_layer->Layer()); |
| 388 return scrollbar_layer; | 388 return scrollbar_layer; |
| 389 } | 389 } |
| 390 | 390 |
| 391 static void DetachScrollbarLayer(GraphicsLayer* scrollbar_graphics_layer) { | 391 static void DetachScrollbarLayer(GraphicsLayer* scrollbar_graphics_layer) { |
| 392 DCHECK(scrollbar_graphics_layer); | 392 DCHECK(scrollbar_graphics_layer); |
| 393 | 393 |
| 394 scrollbar_graphics_layer->SetContentsToPlatformLayer(nullptr); | 394 scrollbar_graphics_layer->SetContentsToPlatformLayer(nullptr); |
| 395 scrollbar_graphics_layer->SetDrawsContent(true); | 395 scrollbar_graphics_layer->SetDrawsContent(true); |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 ->LayerForScrolling()) | 1217 ->LayerForScrolling()) |
| 1218 : nullptr) { | 1218 : nullptr) { |
| 1219 return WebSize( | 1219 return WebSize( |
| 1220 frame_view->LayoutViewportScrollableArea()->ContentsSize()) != | 1220 frame_view->LayoutViewportScrollableArea()->ContentsSize()) != |
| 1221 scroll_layer->Bounds(); | 1221 scroll_layer->Bounds(); |
| 1222 } | 1222 } |
| 1223 return false; | 1223 return false; |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 } // namespace blink | 1226 } // namespace blink |
| OLD | NEW |