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

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

Issue 468343002: Rename repaint to paintInvalidation in core/rendering/compositing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix invalidator spelling Created 6 years, 4 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 namespace blink { 61 namespace blink {
62 62
63 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) 63 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView)
64 : m_renderView(renderView) 64 : m_renderView(renderView)
65 , m_compositingReasonFinder(renderView) 65 , m_compositingReasonFinder(renderView)
66 , m_pendingUpdateType(CompositingUpdateNone) 66 , m_pendingUpdateType(CompositingUpdateNone)
67 , m_hasAcceleratedCompositing(true) 67 , m_hasAcceleratedCompositing(true)
68 , m_compositing(false) 68 , m_compositing(false)
69 , m_rootShouldAlwaysCompositeDirty(true) 69 , m_rootShouldAlwaysCompositeDirty(true)
70 , m_needsUpdateFixedBackground(false) 70 , m_needsUpdateFixedBackground(false)
71 , m_isTrackingRepaints(false) 71 , m_isTrackingPaintInvalidations(false)
72 , m_rootLayerAttachment(RootLayerUnattached) 72 , m_rootLayerAttachment(RootLayerUnattached)
73 , m_inOverlayFullscreenVideo(false) 73 , m_inOverlayFullscreenVideo(false)
74 { 74 {
75 updateAcceleratedCompositingSettings(); 75 updateAcceleratedCompositingSettings();
76 } 76 }
77 77
78 RenderLayerCompositor::~RenderLayerCompositor() 78 RenderLayerCompositor::~RenderLayerCompositor()
79 { 79 {
80 ASSERT(m_rootLayerAttachment == RootLayerUnattached); 80 ASSERT(m_rootLayerAttachment == RootLayerUnattached);
81 } 81 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 if (!hasAcceleratedCompositing()) { 304 if (!hasAcceleratedCompositing()) {
305 updateWithoutAcceleratedCompositing(updateType); 305 updateWithoutAcceleratedCompositing(updateType);
306 return; 306 return;
307 } 307 }
308 308
309 if (updateType == CompositingUpdateNone) 309 if (updateType == CompositingUpdateNone)
310 return; 310 return;
311 311
312 RenderLayer* updateRoot = rootRenderLayer(); 312 RenderLayer* updateRoot = rootRenderLayer();
313 313
314 Vector<RenderLayer*> layersNeedingRepaint; 314 Vector<RenderLayer*> layersNeedingPaintInvalidation;
315 315
316 if (updateType >= CompositingUpdateAfterCompositingInputChange) { 316 if (updateType >= CompositingUpdateAfterCompositingInputChange) {
317 CompositingInputsUpdater(updateRoot).update(); 317 CompositingInputsUpdater(updateRoot).update();
318 318
319 #if ENABLE(ASSERT) 319 #if ENABLE(ASSERT)
320 // FIXME: Move this check to the end of the compositing update. 320 // FIXME: Move this check to the end of the compositing update.
321 CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared( updateRoot); 321 CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared( updateRoot);
322 #endif 322 #endif
323 323
324 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot); 324 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder). update(updateRoot);
325 325
326 CompositingLayerAssigner layerAssigner(this); 326 CompositingLayerAssigner layerAssigner(this);
327 layerAssigner.assign(updateRoot, layersNeedingRepaint); 327 layerAssigner.assign(updateRoot, layersNeedingPaintInvalidation);
328 328
329 bool layersChanged = layerAssigner.layersChanged(); 329 bool layersChanged = layerAssigner.layersChanged();
330 330
331 { 331 {
332 TRACE_EVENT0("blink", "RenderLayerCompositor::updateAfterCompositing Change"); 332 TRACE_EVENT0("blink", "RenderLayerCompositor::updateAfterCompositing Change");
333 if (const FrameView::ScrollableAreaSet* scrollableAreas = m_renderVi ew.frameView()->scrollableAreas()) { 333 if (const FrameView::ScrollableAreaSet* scrollableAreas = m_renderVi ew.frameView()->scrollableAreas()) {
334 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas ->begin(); it != scrollableAreas->end(); ++it) 334 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas ->begin(); it != scrollableAreas->end(); ++it)
335 layersChanged |= (*it)->updateAfterCompositingChange(); 335 layersChanged |= (*it)->updateAfterCompositingChange();
336 } 336 }
337 } 337 }
338 338
339 if (layersChanged) 339 if (layersChanged)
340 updateType = std::max(updateType, CompositingUpdateRebuildTree); 340 updateType = std::max(updateType, CompositingUpdateRebuildTree);
341 } 341 }
342 342
343 if (updateType != CompositingUpdateNone) { 343 if (updateType != CompositingUpdateNone) {
344 GraphicsLayerUpdater updater; 344 GraphicsLayerUpdater updater;
345 updater.update(*updateRoot, layersNeedingRepaint); 345 updater.update(*updateRoot, layersNeedingPaintInvalidation);
346 346
347 if (updater.needsRebuildTree()) 347 if (updater.needsRebuildTree())
348 updateType = std::max(updateType, CompositingUpdateRebuildTree); 348 updateType = std::max(updateType, CompositingUpdateRebuildTree);
349 349
350 #if ENABLE(ASSERT) 350 #if ENABLE(ASSERT)
351 // FIXME: Move this check to the end of the compositing update. 351 // FIXME: Move this check to the end of the compositing update.
352 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat eRoot); 352 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat eRoot);
353 #endif 353 #endif
354 } 354 }
355 355
(...skipping 13 matching lines...) Expand all
369 369
370 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) 370 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled())
371 applyOverlayFullscreenVideoAdjustment(); 371 applyOverlayFullscreenVideoAdjustment();
372 } 372 }
373 373
374 if (m_needsUpdateFixedBackground) { 374 if (m_needsUpdateFixedBackground) {
375 rootFixedBackgroundsChanged(); 375 rootFixedBackgroundsChanged();
376 m_needsUpdateFixedBackground = false; 376 m_needsUpdateFixedBackground = false;
377 } 377 }
378 378
379 for (unsigned i = 0; i < layersNeedingRepaint.size(); i++) { 379 for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++) {
380 RenderLayer* layer = layersNeedingRepaint[i]; 380 RenderLayer* layer = layersNeedingPaintInvalidation[i];
381 layer->repainter().computeRepaintRectsIncludingNonCompositingDescendants (); 381 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo sitingDescendants();
382 382
383 repaintOnCompositingChange(layer); 383 paintInvalidationOnCompositingChange(layer);
384 } 384 }
385 385
386 // Inform the inspector that the layer tree has changed. 386 // Inform the inspector that the layer tree has changed.
387 if (m_renderView.frame()->isMainFrame()) 387 if (m_renderView.frame()->isMainFrame())
388 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame()); 388 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame());
389 } 389 }
390 390
391 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate) 391 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate)
392 { 392 {
393 bool compositedLayerMappingChanged = false; 393 bool compositedLayerMappingChanged = false;
394 394
395 // FIXME: It would be nice to directly use the layer's compositing reason, 395 // FIXME: It would be nice to directly use the layer's compositing reason,
396 // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing 396 // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing
397 // requirements fully. 397 // requirements fully.
398 switch (compositedLayerUpdate) { 398 switch (compositedLayerUpdate) {
399 case AllocateOwnCompositedLayerMapping: 399 case AllocateOwnCompositedLayerMapping:
400 ASSERT(!layer->hasCompositedLayerMapping()); 400 ASSERT(!layer->hasCompositedLayerMapping());
401 setCompositingModeEnabled(true); 401 setCompositingModeEnabled(true);
402 402
403 // If we need to repaint, do so before allocating the compositedLayerMap ping and clearing out the groupedMapping. 403 // If we need to issue paint invalidations, do so before allocating the compositedLayerMapping and clearing out the groupedMapping.
404 repaintOnCompositingChange(layer); 404 paintInvalidationOnCompositingChange(layer);
405 405
406 // If this layer was previously squashed, we need to remove its referenc e to a groupedMapping right away, so 406 // If this layer was previously squashed, we need to remove its referenc e to a groupedMapping right away, so
407 // that computing repaint rects will know the layer's correct compositin gState. 407 // that computing paint invalidation rects will know the layer's correct compositingState.
408 // FIXME: do we need to also remove the layer from it's location in the squashing list of its groupedMapping? 408 // FIXME: do we need to also remove the layer from it's location in the squashing list of its groupedMapping?
409 // Need to create a test where a squashed layer pops into compositing. A nd also to cover all other 409 // Need to create a test where a squashed layer pops into compositing. A nd also to cover all other
410 // sorts of compositingState transitions. 410 // sorts of compositingState transitions.
411 layer->setLostGroupedMapping(false); 411 layer->setLostGroupedMapping(false);
412 layer->setGroupedMapping(0); 412 layer->setGroupedMapping(0);
413 413
414 layer->ensureCompositedLayerMapping(); 414 layer->ensureCompositedLayerMapping();
415 compositedLayerMappingChanged = true; 415 compositedLayerMappingChanged = true;
416 416
417 // At this time, the ScrollingCooridnator only supports the top-level fr ame. 417 // At this time, the ScrollingCooridnator only supports the top-level fr ame.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // If a fixed position layer gained/lost a compositedLayerMapping or the rea son not compositing it changed, 461 // If a fixed position layer gained/lost a compositedLayerMapping or the rea son not compositing it changed,
462 // the scrolling coordinator needs to recalculate whether it can do fast scr olling. 462 // the scrolling coordinator needs to recalculate whether it can do fast scr olling.
463 if (compositedLayerMappingChanged) { 463 if (compositedLayerMappingChanged) {
464 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 464 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
465 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr ameView()); 465 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr ameView());
466 } 466 }
467 467
468 return compositedLayerMappingChanged; 468 return compositedLayerMappingChanged;
469 } 469 }
470 470
471 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) 471 void RenderLayerCompositor::paintInvalidationOnCompositingChange(RenderLayer* la yer)
472 { 472 {
473 // If the renderer is not attached yet, no need to repaint. 473 // If the renderer is not attached yet, no need to issue paint invalidations .
474 if (layer->renderer() != &m_renderView && !layer->renderer()->parent()) 474 if (layer->renderer() != &m_renderView && !layer->renderer()->parent())
475 return; 475 return;
476 476
477 layer->repainter().repaintIncludingNonCompositingDescendants(); 477 layer->paintInvalidator().paintInvalidationIncludingNonCompositingDescendant s();
478 } 478 }
479 479
480 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO ffset) 480 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO ffset)
481 { 481 {
482 if (m_overflowControlsHostLayer) 482 if (m_overflowControlsHostLayer)
483 m_overflowControlsHostLayer->setPosition(contentsOffset); 483 m_overflowControlsHostLayer->setPosition(contentsOffset);
484 } 484 }
485 485
486 void RenderLayerCompositor::frameViewDidChangeSize() 486 void RenderLayerCompositor::frameViewDidChangeSize()
487 { 487 {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // We skip dumping the scroll and clip layers to keep layerTreeAsText output 576 // We skip dumping the scroll and clip layers to keep layerTreeAsText output
577 // similar between platforms (unless we explicitly request dumping from the 577 // similar between platforms (unless we explicitly request dumping from the
578 // root. 578 // root.
579 GraphicsLayer* rootLayer = m_rootContentLayer.get(); 579 GraphicsLayer* rootLayer = m_rootContentLayer.get();
580 if (flags & LayerTreeIncludesRootLayer) 580 if (flags & LayerTreeIncludesRootLayer)
581 rootLayer = rootGraphicsLayer(); 581 rootLayer = rootGraphicsLayer();
582 582
583 String layerTreeText = rootLayer->layerTreeAsText(flags); 583 String layerTreeText = rootLayer->layerTreeAsText(flags);
584 584
585 // The true root layer is not included in the dump, so if we want to report 585 // The true root layer is not included in the dump, so if we want to report
586 // its repaint rects, they must be included here. 586 // its paint invalidation rects, they must be included here.
587 if (flags & LayerTreeIncludesRepaintRects) 587 if (flags & LayerTreeIncludesPaintInvalidationRects)
588 return m_renderView.frameView()->trackedPaintInvalidationRectsAsText() + layerTreeText; 588 return m_renderView.frameView()->trackedPaintInvalidationRectsAsText() + layerTreeText;
589 589
590 return layerTreeText; 590 return layerTreeText;
591 } 591 }
592 592
593 RenderLayerCompositor* RenderLayerCompositor::frameContentsCompositor(RenderPart * renderer) 593 RenderLayerCompositor* RenderLayerCompositor::frameContentsCompositor(RenderPart * renderer)
594 { 594 {
595 if (!renderer->node()->isFrameOwnerElement()) 595 if (!renderer->node()->isFrameOwnerElement())
596 return 0; 596 return 0;
597 597
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 RenderLayer* viewLayer = m_renderView.layer(); 810 RenderLayer* viewLayer = m_renderView.layer();
811 if (!viewLayer) 811 if (!viewLayer)
812 return 0; 812 return 0;
813 813
814 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp ositedLayerMapping()->backgroundLayerPaintsFixedRootBackground()) 814 if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->comp ositedLayerMapping()->backgroundLayerPaintsFixedRootBackground())
815 return viewLayer->compositedLayerMapping()->backgroundLayer(); 815 return viewLayer->compositedLayerMapping()->backgroundLayer();
816 816
817 return 0; 817 return 0;
818 } 818 }
819 819
820 static void resetTrackedRepaintRectsRecursive(GraphicsLayer* graphicsLayer) 820 static void resetTrackedPaintInvalidationRectsRecursive(GraphicsLayer* graphicsL ayer)
821 { 821 {
822 if (!graphicsLayer) 822 if (!graphicsLayer)
823 return; 823 return;
824 824
825 graphicsLayer->resetTrackedRepaints(); 825 graphicsLayer->resetTrackedPaintInvalidations();
826 826
827 for (size_t i = 0; i < graphicsLayer->children().size(); ++i) 827 for (size_t i = 0; i < graphicsLayer->children().size(); ++i)
828 resetTrackedRepaintRectsRecursive(graphicsLayer->children()[i]); 828 resetTrackedPaintInvalidationRectsRecursive(graphicsLayer->children()[i] );
829 829
830 if (GraphicsLayer* replicaLayer = graphicsLayer->replicaLayer()) 830 if (GraphicsLayer* replicaLayer = graphicsLayer->replicaLayer())
831 resetTrackedRepaintRectsRecursive(replicaLayer); 831 resetTrackedPaintInvalidationRectsRecursive(replicaLayer);
832 832
833 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) 833 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer())
834 resetTrackedRepaintRectsRecursive(maskLayer); 834 resetTrackedPaintInvalidationRectsRecursive(maskLayer);
835 835
836 if (GraphicsLayer* clippingMaskLayer = graphicsLayer->contentsClippingMaskLa yer()) 836 if (GraphicsLayer* clippingMaskLayer = graphicsLayer->contentsClippingMaskLa yer())
837 resetTrackedRepaintRectsRecursive(clippingMaskLayer); 837 resetTrackedPaintInvalidationRectsRecursive(clippingMaskLayer);
838 } 838 }
839 839
840 void RenderLayerCompositor::resetTrackedRepaintRects() 840 void RenderLayerCompositor::resetTrackedPaintInvalidationRects()
841 { 841 {
842 if (GraphicsLayer* rootLayer = rootGraphicsLayer()) 842 if (GraphicsLayer* rootLayer = rootGraphicsLayer())
843 resetTrackedRepaintRectsRecursive(rootLayer); 843 resetTrackedPaintInvalidationRectsRecursive(rootLayer);
844 } 844 }
845 845
846 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) 846 void RenderLayerCompositor::setTracksPaintInvalidations(bool tracksPaintInvalida tions)
847 { 847 {
848 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 848 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
849 m_isTrackingRepaints = tracksRepaints; 849 m_isTrackingPaintInvalidations = tracksPaintInvalidations;
850 } 850 }
851 851
852 bool RenderLayerCompositor::isTrackingRepaints() const 852 bool RenderLayerCompositor::isTrackingPaintInvalidations() const
853 { 853 {
854 return m_isTrackingRepaints; 854 return m_isTrackingPaintInvalidations;
855 } 855 }
856 856
857 static bool shouldCompositeOverflowControls(FrameView* view) 857 static bool shouldCompositeOverflowControls(FrameView* view)
858 { 858 {
859 if (Page* page = view->frame().page()) { 859 if (Page* page = view->frame().page()) {
860 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 860 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
861 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) 861 if (scrollingCoordinator->coordinatesScrollingForFrameView(view))
862 return true; 862 return true;
863 } 863 }
864 864
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 } else if (graphicsLayer == m_scrollLayer.get()) { 1166 } else if (graphicsLayer == m_scrollLayer.get()) {
1167 name = "LocalFrame Scrolling Layer"; 1167 name = "LocalFrame Scrolling Layer";
1168 } else { 1168 } else {
1169 ASSERT_NOT_REACHED(); 1169 ASSERT_NOT_REACHED();
1170 } 1170 }
1171 1171
1172 return name; 1172 return name;
1173 } 1173 }
1174 1174
1175 } // namespace blink 1175 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | Source/platform/graphics/GraphicsLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698