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

Side by Side Diff: Source/core/rendering/compositing/RenderLayerCompositor.cpp

Issue 311813005: Issue repaints for RenderLayers that get new composited backings after (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merged. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo sitingPropertyUpdater::DoNotForceUpdate; 372 CompositingPropertyUpdater::UpdateType compositingPropertyUpdateType = Compo sitingPropertyUpdater::DoNotForceUpdate;
373 373
374 // FIXME: Teach non-style compositing updates how to do partial tree walks. 374 // FIXME: Teach non-style compositing updates how to do partial tree walks.
375 if (updateType >= CompositingUpdateAfterLayout) { 375 if (updateType >= CompositingUpdateAfterLayout) {
376 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate; 376 graphicsLayerUpdateType = GraphicsLayerUpdater::ForceUpdate;
377 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; 377 compositingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate;
378 } 378 }
379 379
380 RenderLayer* updateRoot = rootRenderLayer(); 380 RenderLayer* updateRoot = rootRenderLayer();
381 381
382 Vector<RenderLayer*> layersNeedingRepaint;
383
382 if (updateType >= CompositingUpdateAfterCompositingInputChange) { 384 if (updateType >= CompositingUpdateAfterCompositingInputChange) {
383 bool layersChanged = false; 385 bool layersChanged = false;
384
385 { 386 {
386 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties"); 387 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA ncestorDependentProperties");
387 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, compositingPropertyUpdateType); 388 CompositingPropertyUpdater(updateRoot).updateAncestorDependentProper ties(updateRoot, compositingPropertyUpdateType);
388 #if ASSERT_ENABLED 389 #if ASSERT_ENABLED
389 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot); 390 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp ertiesBitsCleared(updateRoot);
390 #endif 391 #endif
391 } 392 }
392 393
393 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot); 394 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot);
394 395
395 { 396 {
396 TRACE_EVENT0("blink_rendering", "CompositingLayerAssigner::assign"); 397 TRACE_EVENT0("blink_rendering", "CompositingLayerAssigner::assign");
397 CompositingLayerAssigner(this).assign(updateRoot, layersChanged); 398 CompositingLayerAssigner(this).assign(updateRoot, layersChanged, lay ersNeedingRepaint);
398 } 399 }
399 400
400 { 401 {
401 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateAfterC ompositingChange"); 402 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateAfterC ompositingChange");
402 if (const FrameView::ScrollableAreaSet* scrollableAreas = m_renderVi ew.frameView()->scrollableAreas()) { 403 if (const FrameView::ScrollableAreaSet* scrollableAreas = m_renderVi ew.frameView()->scrollableAreas()) {
403 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas ->begin(); it != scrollableAreas->end(); ++it) 404 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas ->begin(); it != scrollableAreas->end(); ++it)
404 (*it)->updateAfterCompositingChange(); 405 (*it)->updateAfterCompositingChange();
405 } 406 }
406 } 407 }
407 408
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 m_needsUpdateFixedBackground = false; 446 m_needsUpdateFixedBackground = false;
446 } 447 }
447 448
448 ASSERT(updateRoot || !compositingLayersNeedRebuild()); 449 ASSERT(updateRoot || !compositingLayersNeedRebuild());
449 450
450 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function. 451 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function.
451 needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoor dinator()->needsToUpdateAfterCompositingChange(); 452 needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoor dinator()->needsToUpdateAfterCompositingChange();
452 if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode()) 453 if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode())
453 scrollingCoordinator()->updateAfterCompositingChange(); 454 scrollingCoordinator()->updateAfterCompositingChange();
454 455
456 for (unsigned i = 0; i < layersNeedingRepaint.size(); i++) {
457 RenderLayer* layer = layersNeedingRepaint[i];
458 layer->repainter().computeRepaintRectsIncludingDescendants();
459
460 repaintOnCompositingChange(layer);
461 }
462
455 // Inform the inspector that the layer tree has changed. 463 // Inform the inspector that the layer tree has changed.
456 if (m_renderView.frame()->isMainFrame()) 464 if (m_renderView.frame()->isMainFrame())
457 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame()); 465 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame());
458 } 466 }
459 467
460 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate) 468 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate)
461 { 469 {
462 bool compositedLayerMappingChanged = false; 470 bool compositedLayerMappingChanged = false;
463 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer); 471 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer);
464 472
(...skipping 16 matching lines...) Expand all
481 // If we need to repaint, do so before allocating the compositedLayerMap ping 489 // If we need to repaint, do so before allocating the compositedLayerMap ping
482 repaintOnCompositingChange(layer); 490 repaintOnCompositingChange(layer);
483 layer->ensureCompositedLayerMapping(); 491 layer->ensureCompositedLayerMapping();
484 compositedLayerMappingChanged = true; 492 compositedLayerMappingChanged = true;
485 493
486 // At this time, the ScrollingCooridnator only supports the top-level fr ame. 494 // At this time, the ScrollingCooridnator only supports the top-level fr ame.
487 if (layer->isRootLayer() && m_renderView.frame()->isMainFrame()) { 495 if (layer->isRootLayer() && m_renderView.frame()->isMainFrame()) {
488 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator()) 496 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator())
489 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f rameView()); 497 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f rameView());
490 } 498 }
491
492 // FIXME: it seems premature to compute this before all compositing stat e has been updated?
493 // This layer and all of its descendants have cached repaints rects that are relative to
494 // the repaint container, so change when compositing changes; we need to update them here.
495 if (layer->parent())
496 layer->repainter().computeRepaintRectsIncludingDescendants();
497
498 break; 499 break;
499 case RemoveOwnCompositedLayerMapping: 500 case RemoveOwnCompositedLayerMapping:
500 // PutInSquashingLayer means you might have to remove the composited layer m apping first. 501 // PutInSquashingLayer means you might have to remove the composited layer m apping first.
501 case PutInSquashingLayer: 502 case PutInSquashingLayer:
502 if (layer->hasCompositedLayerMapping()) { 503 if (layer->hasCompositedLayerMapping()) {
503 // If we're removing the compositedLayerMapping from a reflection, c lear the source GraphicsLayer's pointer to 504 // If we're removing the compositedLayerMapping from a reflection, c lear the source GraphicsLayer's pointer to
504 // its replica GraphicsLayer. In practice this should never happen b ecause reflectee and reflection 505 // its replica GraphicsLayer. In practice this should never happen b ecause reflectee and reflection
505 // are both either composited, or not composited. 506 // are both either composited, or not composited.
506 if (layer->isReflection()) { 507 if (layer->isReflection()) {
507 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->rende rer()->parent())->layer(); 508 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->rende rer()->parent())->layer();
508 if (sourceLayer->hasCompositedLayerMapping()) { 509 if (sourceLayer->hasCompositedLayerMapping()) {
509 ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLa yer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); 510 ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLa yer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer());
510 sourceLayer->compositedLayerMapping()->mainGraphicsLayer()-> setReplicatedByLayer(0); 511 sourceLayer->compositedLayerMapping()->mainGraphicsLayer()-> setReplicatedByLayer(0);
511 } 512 }
512 } 513 }
513 514
514 layer->clearCompositedLayerMapping(); 515 layer->clearCompositedLayerMapping();
515 compositedLayerMappingChanged = true; 516 compositedLayerMappingChanged = true;
516
517 // This layer and all of its descendants have cached repaints rects that are relative to
518 // the repaint container, so change when compositing changes; we nee d to update them here.
519 layer->repainter().computeRepaintRectsIncludingDescendants();
520
521 // If we need to repaint, do so now that we've removed the composite dLayerMapping
522 repaintOnCompositingChange(layer);
523 } 517 }
524 518
525 break; 519 break;
526 case RemoveFromSquashingLayer: 520 case RemoveFromSquashingLayer:
527 case NoCompositingStateChange: 521 case NoCompositingStateChange:
528 // Do nothing. 522 // Do nothing.
529 break; 523 break;
530 } 524 }
531 525
532 if (layer->hasCompositedLayerMapping() && layer->compositedLayerMapping()->u pdateRequiresOwnBackingStoreForIntrinsicReasons()) 526 if (layer->hasCompositedLayerMapping() && layer->compositedLayerMapping()->u pdateRequiresOwnBackingStoreForIntrinsicReasons())
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 } else if (graphicsLayer == m_scrollLayer.get()) { 1360 } else if (graphicsLayer == m_scrollLayer.get()) {
1367 name = "LocalFrame Scrolling Layer"; 1361 name = "LocalFrame Scrolling Layer";
1368 } else { 1362 } else {
1369 ASSERT_NOT_REACHED(); 1363 ASSERT_NOT_REACHED();
1370 } 1364 }
1371 1365
1372 return name; 1366 return name;
1373 } 1367 }
1374 1368
1375 } // namespace WebCore 1369 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698