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

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

Issue 2890953002: [SPv1] Always set a CompositorElementId on main graphics layers; use PaintLayer id. (Closed)
Patch Set: none Created 3 years, 7 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
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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 ->LayerForScrolling()) 1214 ->LayerForScrolling())
1215 : nullptr) { 1215 : nullptr) {
1216 return WebSize( 1216 return WebSize(
1217 frame_view->LayoutViewportScrollableArea()->ContentsSize()) != 1217 frame_view->LayoutViewportScrollableArea()->ContentsSize()) !=
1218 scroll_layer->Bounds(); 1218 scroll_layer->Bounds();
1219 } 1219 }
1220 return false; 1220 return false;
1221 } 1221 }
1222 1222
1223 } // namespace blink 1223 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698