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

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

Issue 449723003: Simply rules for compositing fixed position elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Deleted 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
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 367
368 // Inform the inspector that the layer tree has changed. 368 // Inform the inspector that the layer tree has changed.
369 if (m_renderView.frame()->isMainFrame()) 369 if (m_renderView.frame()->isMainFrame())
370 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame()); 370 InspectorInstrumentation::layerTreeDidChange(m_renderView.frame());
371 } 371 }
372 372
373 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate) 373 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l ayer, const CompositingStateTransitionType compositedLayerUpdate)
374 { 374 {
375 bool compositedLayerMappingChanged = false; 375 bool compositedLayerMappingChanged = false;
376 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer);
377 376
378 // FIXME: It would be nice to directly use the layer's compositing reason, 377 // FIXME: It would be nice to directly use the layer's compositing reason,
379 // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing 378 // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing
380 // requirements fully. 379 // requirements fully.
381 switch (compositedLayerUpdate) { 380 switch (compositedLayerUpdate) {
382 case AllocateOwnCompositedLayerMapping: 381 case AllocateOwnCompositedLayerMapping:
383 ASSERT(!layer->hasCompositedLayerMapping()); 382 ASSERT(!layer->hasCompositedLayerMapping());
384 setCompositingModeEnabled(true); 383 setCompositingModeEnabled(true);
385 384
386 // If we need to repaint, do so before allocating the compositedLayerMap ping and clearing out the groupedMapping. 385 // If we need to repaint, do so before allocating the compositedLayerMap ping and clearing out the groupedMapping.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 RenderLayerCompositor* innerCompositor = frameContentsCompositor(toRende rPart(layer->renderer())); 435 RenderLayerCompositor* innerCompositor = frameContentsCompositor(toRende rPart(layer->renderer()));
437 if (innerCompositor && innerCompositor->staleInCompositingMode()) 436 if (innerCompositor && innerCompositor->staleInCompositingMode())
438 innerCompositor->updateRootLayerAttachment(); 437 innerCompositor->updateRootLayerAttachment();
439 } 438 }
440 439
441 if (compositedLayerMappingChanged) 440 if (compositedLayerMappingChanged)
442 layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects); 441 layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects);
443 442
444 // If a fixed position layer gained/lost a compositedLayerMapping or the rea son not compositing it changed, 443 // If a fixed position layer gained/lost a compositedLayerMapping or the rea son not compositing it changed,
445 // the scrolling coordinator needs to recalculate whether it can do fast scr olling. 444 // the scrolling coordinator needs to recalculate whether it can do fast scr olling.
446 if (compositedLayerMappingChanged || nonCompositedReasonChanged) { 445 if (compositedLayerMappingChanged) {
447 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 446 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
448 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr ameView()); 447 scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView.fr ameView());
449 } 448 }
450 449
451 return compositedLayerMappingChanged || nonCompositedReasonChanged; 450 return compositedLayerMappingChanged;
452 }
453
454 bool RenderLayerCompositor::updateLayerIfViewportConstrained(RenderLayer* layer)
455 {
456 RenderLayer::ViewportConstrainedNotCompositedReason viewportConstrainedNotCo mpositedReason = RenderLayer::NoNotCompositedReason;
457 m_compositingReasonFinder.requiresCompositingForPositionFixed(layer->rendere r(), layer, &viewportConstrainedNotCompositedReason);
458
459 if (layer->viewportConstrainedNotCompositedReason() != viewportConstrainedNo tCompositedReason) {
460 ASSERT(viewportConstrainedNotCompositedReason == RenderLayer::NoNotCompo sitedReason || layer->renderer()->style()->position() == FixedPosition);
461 layer->setViewportConstrainedNotCompositedReason(viewportConstrainedNotC ompositedReason);
462 return true;
463 }
464 return false;
465 } 451 }
466 452
467 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer) 453 void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer)
468 { 454 {
469 // If the renderer is not attached yet, no need to repaint. 455 // If the renderer is not attached yet, no need to repaint.
470 if (layer->renderer() != &m_renderView && !layer->renderer()->parent()) 456 if (layer->renderer() != &m_renderView && !layer->renderer()->parent())
471 return; 457 return;
472 458
473 layer->repainter().repaintIncludingNonCompositingDescendants(); 459 layer->repainter().repaintIncludingNonCompositingDescendants();
474 } 460 }
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 } else if (graphicsLayer == m_scrollLayer.get()) { 1148 } else if (graphicsLayer == m_scrollLayer.get()) {
1163 name = "LocalFrame Scrolling Layer"; 1149 name = "LocalFrame Scrolling Layer";
1164 } else { 1150 } else {
1165 ASSERT_NOT_REACHED(); 1151 ASSERT_NOT_REACHED();
1166 } 1152 }
1167 1153
1168 return name; 1154 return name;
1169 } 1155 }
1170 1156
1171 } // namespace blink 1157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698