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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.cpp

Issue 2803013005: Deduplicating compositing scrollingCoordinator helper (Closed)
Patch Set: Rebased post blink rename Created 3 years, 8 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) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Google Inc. All rights reserved. 3 * Copyright (C) 2014 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 TRACE_LAYER_INVALIDATION( 266 TRACE_LAYER_INVALIDATION(
267 layer, 267 layer,
268 InspectorLayerInvalidationTrackingEvent::kRemovedFromSquashingLayer); 268 InspectorLayerInvalidationTrackingEvent::kRemovedFromSquashingLayer);
269 layers_needing_paint_invalidation.push_back(layer); 269 layers_needing_paint_invalidation.push_back(layer);
270 layers_changed_ = true; 270 layers_changed_ = true;
271 271
272 layer->SetLostGroupedMapping(false); 272 layer->SetLostGroupedMapping(false);
273 } 273 }
274 } 274 }
275 275
276 static ScrollingCoordinator* ScrollingCoordinatorFromLayer(PaintLayer& layer) {
277 Page* page = layer.GetLayoutObject().GetFrame()->GetPage();
278 return (!page) ? nullptr : page->GetScrollingCoordinator();
279 }
280
281 void CompositingLayerAssigner::AssignLayersToBackingsInternal( 276 void CompositingLayerAssigner::AssignLayersToBackingsInternal(
282 PaintLayer* layer, 277 PaintLayer* layer,
283 SquashingState& squashing_state, 278 SquashingState& squashing_state,
284 Vector<PaintLayer*>& layers_needing_paint_invalidation) { 279 Vector<PaintLayer*>& layers_needing_paint_invalidation) {
285 if (RequiresSquashing(layer->GetCompositingReasons())) { 280 if (RequiresSquashing(layer->GetCompositingReasons())) {
286 SquashingDisallowedReasons reasons_preventing_squashing = 281 SquashingDisallowedReasons reasons_preventing_squashing =
287 GetReasonsPreventingSquashing(layer, squashing_state); 282 GetReasonsPreventingSquashing(layer, squashing_state);
288 if (reasons_preventing_squashing) { 283 if (reasons_preventing_squashing) {
289 layer->SetCompositingReasons(layer->GetCompositingReasons() | 284 layer->SetCompositingReasons(layer->GetCompositingReasons() |
290 kCompositingReasonSquashingDisallowed); 285 kCompositingReasonSquashingDisallowed);
291 layer->SetSquashingDisallowedReasons(reasons_preventing_squashing); 286 layer->SetSquashingDisallowedReasons(reasons_preventing_squashing);
292 } 287 }
293 } 288 }
294 289
295 CompositingStateTransitionType composited_layer_update = 290 CompositingStateTransitionType composited_layer_update =
296 ComputeCompositedLayerUpdate(layer); 291 ComputeCompositedLayerUpdate(layer);
297 292
298 if (compositor_->AllocateOrClearCompositedLayerMapping( 293 if (compositor_->AllocateOrClearCompositedLayerMapping(
299 layer, composited_layer_update)) { 294 layer, composited_layer_update)) {
300 TRACE_LAYER_INVALIDATION( 295 TRACE_LAYER_INVALIDATION(
301 layer, InspectorLayerInvalidationTrackingEvent::kNewCompositedLayer); 296 layer, InspectorLayerInvalidationTrackingEvent::kNewCompositedLayer);
302 layers_needing_paint_invalidation.push_back(layer); 297 layers_needing_paint_invalidation.push_back(layer);
303 layers_changed_ = true; 298 layers_changed_ = true;
304 if (ScrollingCoordinator* scrolling_coordinator = 299 if (ScrollingCoordinator* scrolling_coordinator =
305 ScrollingCoordinatorFromLayer(*layer)) { 300 layer->GetScrollingCoordinator()) {
306 if (layer->GetLayoutObject().Style()->HasViewportConstrainedPosition()) { 301 if (layer->GetLayoutObject().Style()->HasViewportConstrainedPosition()) {
307 scrolling_coordinator->FrameViewFixedObjectsDidChange( 302 scrolling_coordinator->FrameViewFixedObjectsDidChange(
308 layer->GetLayoutObject().View()->GetFrameView()); 303 layer->GetLayoutObject().View()->GetFrameView());
309 } 304 }
310 } 305 }
311 } 306 }
312 307
313 // Add this layer to a squashing backing if needed. 308 // Add this layer to a squashing backing if needed.
314 UpdateSquashingAssignment(layer, squashing_state, composited_layer_update, 309 UpdateSquashingAssignment(layer, squashing_state, composited_layer_update,
315 layers_needing_paint_invalidation); 310 layers_needing_paint_invalidation);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 AssignLayersToBackingsInternal(cur_node->Layer(), squashing_state, 349 AssignLayersToBackingsInternal(cur_node->Layer(), squashing_state,
355 layers_needing_paint_invalidation); 350 layers_needing_paint_invalidation);
356 351
357 if (squashing_state.has_most_recent_mapping && 352 if (squashing_state.has_most_recent_mapping &&
358 &squashing_state.most_recent_mapping->OwningLayer() == layer) 353 &squashing_state.most_recent_mapping->OwningLayer() == layer)
359 squashing_state.have_assigned_backings_to_entire_squashing_layer_subtree = 354 squashing_state.have_assigned_backings_to_entire_squashing_layer_subtree =
360 true; 355 true;
361 } 356 }
362 357
363 } // namespace blink 358 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698