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

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

Issue 2803013005: Deduplicating compositing scrollingCoordinator helper (Closed)
Patch Set: 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 TRACE_LAYER_INVALIDATION( 263 TRACE_LAYER_INVALIDATION(
264 layer, 264 layer,
265 InspectorLayerInvalidationTrackingEvent::RemovedFromSquashingLayer); 265 InspectorLayerInvalidationTrackingEvent::RemovedFromSquashingLayer);
266 layersNeedingPaintInvalidation.push_back(layer); 266 layersNeedingPaintInvalidation.push_back(layer);
267 m_layersChanged = true; 267 m_layersChanged = true;
268 268
269 layer->setLostGroupedMapping(false); 269 layer->setLostGroupedMapping(false);
270 } 270 }
271 } 271 }
272 272
273 static ScrollingCoordinator* scrollingCoordinatorFromLayer(PaintLayer& layer) {
274 Page* page = layer.layoutObject().frame()->page();
275 return (!page) ? nullptr : page->scrollingCoordinator();
276 }
277
278 void CompositingLayerAssigner::assignLayersToBackingsInternal( 273 void CompositingLayerAssigner::assignLayersToBackingsInternal(
279 PaintLayer* layer, 274 PaintLayer* layer,
280 SquashingState& squashingState, 275 SquashingState& squashingState,
281 Vector<PaintLayer*>& layersNeedingPaintInvalidation) { 276 Vector<PaintLayer*>& layersNeedingPaintInvalidation) {
282 if (requiresSquashing(layer->getCompositingReasons())) { 277 if (requiresSquashing(layer->getCompositingReasons())) {
283 SquashingDisallowedReasons reasonsPreventingSquashing = 278 SquashingDisallowedReasons reasonsPreventingSquashing =
284 getReasonsPreventingSquashing(layer, squashingState); 279 getReasonsPreventingSquashing(layer, squashingState);
285 if (reasonsPreventingSquashing) { 280 if (reasonsPreventingSquashing) {
286 layer->setCompositingReasons(layer->getCompositingReasons() | 281 layer->setCompositingReasons(layer->getCompositingReasons() |
287 CompositingReasonSquashingDisallowed); 282 CompositingReasonSquashingDisallowed);
288 layer->setSquashingDisallowedReasons(reasonsPreventingSquashing); 283 layer->setSquashingDisallowedReasons(reasonsPreventingSquashing);
289 } 284 }
290 } 285 }
291 286
292 CompositingStateTransitionType compositedLayerUpdate = 287 CompositingStateTransitionType compositedLayerUpdate =
293 computeCompositedLayerUpdate(layer); 288 computeCompositedLayerUpdate(layer);
294 289
295 if (m_compositor->allocateOrClearCompositedLayerMapping( 290 if (m_compositor->allocateOrClearCompositedLayerMapping(
296 layer, compositedLayerUpdate)) { 291 layer, compositedLayerUpdate)) {
297 TRACE_LAYER_INVALIDATION( 292 TRACE_LAYER_INVALIDATION(
298 layer, InspectorLayerInvalidationTrackingEvent::NewCompositedLayer); 293 layer, InspectorLayerInvalidationTrackingEvent::NewCompositedLayer);
299 layersNeedingPaintInvalidation.push_back(layer); 294 layersNeedingPaintInvalidation.push_back(layer);
300 m_layersChanged = true; 295 m_layersChanged = true;
301 if (ScrollingCoordinator* scrollingCoordinator = 296 if (ScrollingCoordinator* scrollingCoordinator =
302 scrollingCoordinatorFromLayer(*layer)) { 297 CompositedLayerMapping::scrollingCoordinatorFromLayer(*layer)) {
303 if (layer->layoutObject().style()->hasViewportConstrainedPosition()) { 298 if (layer->layoutObject().style()->hasViewportConstrainedPosition()) {
304 scrollingCoordinator->frameViewFixedObjectsDidChange( 299 scrollingCoordinator->frameViewFixedObjectsDidChange(
305 layer->layoutObject().view()->frameView()); 300 layer->layoutObject().view()->frameView());
306 } 301 }
307 } 302 }
308 } 303 }
309 304
310 // Add this layer to a squashing backing if needed. 305 // Add this layer to a squashing backing if needed.
311 updateSquashingAssignment(layer, squashingState, compositedLayerUpdate, 306 updateSquashingAssignment(layer, squashingState, compositedLayerUpdate,
312 layersNeedingPaintInvalidation); 307 layersNeedingPaintInvalidation);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 while (PaintLayerStackingNode* curNode = iterator.next()) 345 while (PaintLayerStackingNode* curNode = iterator.next())
351 assignLayersToBackingsInternal(curNode->layer(), squashingState, 346 assignLayersToBackingsInternal(curNode->layer(), squashingState,
352 layersNeedingPaintInvalidation); 347 layersNeedingPaintInvalidation);
353 348
354 if (squashingState.hasMostRecentMapping && 349 if (squashingState.hasMostRecentMapping &&
355 &squashingState.mostRecentMapping->owningLayer() == layer) 350 &squashingState.mostRecentMapping->owningLayer() == layer)
356 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; 351 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true;
357 } 352 }
358 353
359 } // namespace blink 354 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698