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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 58543002: Use a boolean hasCompositedLayerMapping() accessor instead of the pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment for hasCompositedLayerMapping Created 7 years, 1 month 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/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.cpp » ('j') | 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint); 284 repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint);
285 285
286 // Go ahead and update the reflection's position and size. 286 // Go ahead and update the reflection's position and size.
287 if (m_reflectionInfo) 287 if (m_reflectionInfo)
288 m_reflectionInfo->reflection()->layout(); 288 m_reflectionInfo->reflection()->layout();
289 289
290 // Clear the IsCompositingUpdateRoot flag once we've found the first composi ting layer in this update. 290 // Clear the IsCompositingUpdateRoot flag once we've found the first composi ting layer in this update.
291 bool isUpdateRoot = (flags & IsCompositingUpdateRoot); 291 bool isUpdateRoot = (flags & IsCompositingUpdateRoot);
292 if (compositedLayerMapping()) 292 if (hasCompositedLayerMapping())
293 flags &= ~IsCompositingUpdateRoot; 293 flags &= ~IsCompositingUpdateRoot;
294 294
295 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { 295 if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) {
296 updatePagination(); 296 updatePagination();
297 flags |= UpdatePagination; 297 flags |= UpdatePagination;
298 } 298 }
299 299
300 if (renderer()->hasColumns()) 300 if (renderer()->hasColumns())
301 flags |= UpdatePagination; 301 flags |= UpdatePagination;
302 302
303 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 303 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
304 child->updateLayerPositions(geometryMap, flags); 304 child->updateLayerPositions(geometryMap, flags);
305 305
306 if ((flags & UpdateCompositingLayers) && compositedLayerMapping()) { 306 if ((flags & UpdateCompositingLayers) && hasCompositedLayerMapping()) {
307 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly; 307 CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedL ayerMapping::CompositingChildrenOnly;
308 if (flags & NeedsFullRepaintInBacking) 308 if (flags & NeedsFullRepaintInBacking)
309 updateFlags |= CompositedLayerMapping::NeedsFullRepaint; 309 updateFlags |= CompositedLayerMapping::NeedsFullRepaint;
310 if (isUpdateRoot) 310 if (isUpdateRoot)
311 updateFlags |= CompositedLayerMapping::IsUpdateRoot; 311 updateFlags |= CompositedLayerMapping::IsUpdateRoot;
312 compositedLayerMapping()->updateAfterLayout(updateFlags); 312 compositedLayerMapping()->updateAfterLayout(updateFlags);
313 } 313 }
314 314
315 if (geometryMap) 315 if (geometryMap)
316 geometryMap->popMappingsToAncestor(parent()); 316 geometryMap->popMappingsToAncestor(parent());
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 bool hadBlendMode = m_blendMode != BlendModeNormal; 529 bool hadBlendMode = m_blendMode != BlendModeNormal;
530 BlendMode newBlendMode = renderer()->style()->blendMode(); 530 BlendMode newBlendMode = renderer()->style()->blendMode();
531 if (newBlendMode != m_blendMode) { 531 if (newBlendMode != m_blendMode) {
532 m_blendMode = newBlendMode; 532 m_blendMode = newBlendMode;
533 533
534 // Only update the flag if a blend mode is set or unset. 534 // Only update the flag if a blend mode is set or unset.
535 if (!hadBlendMode || !hasBlendMode()) 535 if (!hadBlendMode || !hasBlendMode())
536 dirtyAncestorChainBlendedDescendantStatus(); 536 dirtyAncestorChainBlendedDescendantStatus();
537 537
538 if (compositedLayerMapping()) 538 if (hasCompositedLayerMapping())
539 compositedLayerMapping()->setBlendMode(newBlendMode); 539 compositedLayerMapping()->setBlendMode(newBlendMode);
540 } 540 }
541 } 541 }
542 542
543 void RenderLayer::updateTransform() 543 void RenderLayer::updateTransform()
544 { 544 {
545 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 545 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
546 // so check style too. 546 // so check style too.
547 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); 547 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform();
548 bool had3DTransform = has3DTransform(); 548 bool had3DTransform = has3DTransform();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 { 635 {
636 const Settings* settings = renderer()->document().settings(); 636 const Settings* settings = renderer()->document().settings();
637 return settings && settings->regionBasedColumnsEnabled(); 637 return settings && settings->regionBasedColumnsEnabled();
638 } 638 }
639 639
640 void RenderLayer::updatePagination() 640 void RenderLayer::updatePagination()
641 { 641 {
642 m_isPaginated = false; 642 m_isPaginated = false;
643 m_enclosingPaginationLayer = 0; 643 m_enclosingPaginationLayer = 0;
644 644
645 if (compositedLayerMapping() || !parent()) 645 if (hasCompositedLayerMapping() || !parent())
646 return; // FIXME: We will have to deal with paginated compositing layers someday. 646 return; // FIXME: We will have to deal with paginated compositing layers someday.
647 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. 647 // FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though.
648 648
649 // The main difference between the paginated booleans for the old column cod e and the new column code 649 // The main difference between the paginated booleans for the old column cod e and the new column code
650 // is that each paginated layer has to paint on its own with the new code. T here is no 650 // is that each paginated layer has to paint on its own with the new code. T here is no
651 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on 651 // recurring into child layers. This means that the m_isPaginated bits for t he new column code can't just be set on
652 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and 652 // "roots" that get split and paint all their descendants. Instead each laye r has to be checked individually and
653 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant 653 // genuinely know if it is going to have to split itself up when painting on ly its contents (and not any other descendant
654 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back 654 // layers). We track an enclosingPaginationLayer instead of using a simple b it, since we want to be able to get back
655 // to that layer easily. 655 // to that layer easily.
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 if (positionedParent->renderer()->hasOverflowClip()) { 986 if (positionedParent->renderer()->hasOverflowClip()) {
987 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset(); 987 LayoutSize offset = positionedParent->renderBox()->scrolledContentOf fset();
988 localPoint -= offset; 988 localPoint -= offset;
989 } 989 }
990 990
991 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) { 991 if (renderer()->isOutOfFlowPositioned() && positionedParent->renderer()- >isInFlowPositioned() && positionedParent->renderer()->isRenderInline()) {
992 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer())); 992 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(toRenderBox(renderer()));
993 localPoint += offset; 993 localPoint += offset;
994 } 994 }
995 } else if (parent()) { 995 } else if (parent()) {
996 if (compositedLayerMapping()) { 996 if (hasCompositedLayerMapping()) {
997 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. 997 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
998 // They won't split across columns properly. 998 // They won't split across columns properly.
999 LayoutSize columnOffset; 999 LayoutSize columnOffset;
1000 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns()) 1000 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isR oot() && renderer()->view()->hasColumns())
1001 renderer()->view()->adjustForColumns(columnOffset, localPoint); 1001 renderer()->view()->adjustForColumns(columnOffset, localPoint);
1002 else 1002 else
1003 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ; 1003 parent()->renderer()->adjustForColumns(columnOffset, localPoint) ;
1004 1004
1005 localPoint += columnOffset; 1005 localPoint += columnOffset;
1006 } 1006 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 { 1106 {
1107 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0); 1107 return layer->stackingNode()->isNormalFlowOnly() ? layer->parent() : (layer- >stackingNode()->ancestorStackingContainerNode() ? layer->stackingNode()->ancest orStackingContainerNode()->layer() : 0);
1108 } 1108 }
1109 1109
1110 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint 1110 // FIXME: having two different functions named enclosingCompositingLayer and enc losingCompositingLayerForRepaint
1111 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with 1111 // is error-prone and misleading for reading code that uses these functions - es pecially compounded with
1112 // the includeSelf option. It is very likely that some call sites of this functi on actually mean to use 1112 // the includeSelf option. It is very likely that some call sites of this functi on actually mean to use
1113 // enclosingCompositingLayerForRepaint(). 1113 // enclosingCompositingLayerForRepaint().
1114 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const 1114 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
1115 { 1115 {
1116 if (includeSelf && compositedLayerMapping()) 1116 if (includeSelf && hasCompositedLayerMapping())
1117 return const_cast<RenderLayer*>(this); 1117 return const_cast<RenderLayer*>(this);
1118 1118
1119 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) { 1119 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp ositingContainer(curr)) {
1120 if (curr->compositedLayerMapping()) 1120 if (curr->hasCompositedLayerMapping())
1121 return const_cast<RenderLayer*>(curr); 1121 return const_cast<RenderLayer*>(curr);
1122 } 1122 }
1123 1123
1124 return 0; 1124 return 0;
1125 } 1125 }
1126 1126
1127 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const 1127 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const
1128 { 1128 {
1129 if (includeSelf && compositingState() == PaintsIntoOwnBacking) 1129 if (includeSelf && compositingState() == PaintsIntoOwnBacking)
1130 return const_cast<RenderLayer*>(this); 1130 return const_cast<RenderLayer*>(this);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 for (const RenderLayer* curr = this; curr; curr = curr->parent()) { 1184 for (const RenderLayer* curr = this; curr; curr = curr->parent()) {
1185 RenderLayerModelObject* renderer = curr->renderer(); 1185 RenderLayerModelObject* renderer = curr->renderer();
1186 if (renderer->style()->hasFilterOutsets()) 1186 if (renderer->style()->hasFilterOutsets())
1187 return true; 1187 return true;
1188 } 1188 }
1189 return false; 1189 return false;
1190 } 1190 }
1191 1191
1192 RenderLayer* RenderLayer::clippingRootForPainting() const 1192 RenderLayer* RenderLayer::clippingRootForPainting() const
1193 { 1193 {
1194 if (compositedLayerMapping()) 1194 if (hasCompositedLayerMapping())
1195 return const_cast<RenderLayer*>(this); 1195 return const_cast<RenderLayer*>(this);
1196 1196
1197 const RenderLayer* current = this; 1197 const RenderLayer* current = this;
1198 while (current) { 1198 while (current) {
1199 if (current->isRootLayer()) 1199 if (current->isRootLayer())
1200 return const_cast<RenderLayer*>(current); 1200 return const_cast<RenderLayer*>(current);
1201 1201
1202 current = compositingContainer(current); 1202 current = compositingContainer(current);
1203 ASSERT(current); 1203 ASSERT(current);
1204 if (current->transform() 1204 if (current->transform()
(...skipping 18 matching lines...) Expand all
1223 bool RenderLayer::isTransparent() const 1223 bool RenderLayer::isTransparent() const
1224 { 1224 {
1225 if (renderer()->node() && renderer()->node()->isSVGElement()) 1225 if (renderer()->node() && renderer()->node()->isSVGElement())
1226 return false; 1226 return false;
1227 1227
1228 return renderer()->isTransparent() || renderer()->hasMask(); 1228 return renderer()->isTransparent() || renderer()->hasMask();
1229 } 1229 }
1230 1230
1231 RenderLayer* RenderLayer::transparentPaintingAncestor() 1231 RenderLayer* RenderLayer::transparentPaintingAncestor()
1232 { 1232 {
1233 if (compositedLayerMapping()) 1233 if (hasCompositedLayerMapping())
1234 return 0; 1234 return 0;
1235 1235
1236 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { 1236 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
1237 if (curr->compositedLayerMapping()) 1237 if (curr->hasCompositedLayerMapping())
1238 return 0; 1238 return 0;
1239 if (curr->isTransparent()) 1239 if (curr->isTransparent())
1240 return curr; 1240 return curr;
1241 } 1241 }
1242 return 0; 1242 return 0;
1243 } 1243 }
1244 1244
1245 enum TransparencyClipBoxBehavior { 1245 enum TransparencyClipBoxBehavior {
1246 PaintingTransparencyClipBox, 1246 PaintingTransparencyClipBox,
1247 HitTestingTransparencyClipBox 1247 HitTestingTransparencyClipBox
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 void RenderLayer::updateScrollableArea() 1757 void RenderLayer::updateScrollableArea()
1758 { 1758 {
1759 if (requiresScrollableArea()) 1759 if (requiresScrollableArea())
1760 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox())); 1760 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox()));
1761 else 1761 else
1762 m_scrollableArea = nullptr; 1762 m_scrollableArea = nullptr;
1763 } 1763 }
1764 1764
1765 PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const 1765 PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const
1766 { 1766 {
1767 if (CompositedLayerMapping* mapping = compositedLayerMapping()) 1767 if (hasCompositedLayerMapping())
1768 return mapping->collectTrackedRepaintRects(); 1768 return compositedLayerMapping()->collectTrackedRepaintRects();
1769 return nullptr; 1769 return nullptr;
1770 } 1770 }
1771 1771
1772 bool RenderLayer::hasOverflowControls() const 1772 bool RenderLayer::hasOverflowControls() const
1773 { 1773 {
1774 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); 1774 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE);
1775 } 1775 }
1776 1776
1777 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags) 1777 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, P aintLayerFlags paintFlags)
1778 { 1778 {
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3576 } 3576 }
3577 } 3577 }
3578 3578
3579 // FIXME: should probably just pass 'flags' down to descendants. 3579 // FIXME: should probably just pass 'flags' down to descendants.
3580 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants); 3580 CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants) | (flags & IncludeCompositedDescendants);
3581 3581
3582 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); 3582 const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
3583 3583
3584 if (m_reflectionInfo) { 3584 if (m_reflectionInfo) {
3585 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer(); 3585 RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer();
3586 if (!reflectionLayer->compositedLayerMapping()) { 3586 if (!reflectionLayer->hasCompositedLayerMapping()) {
3587 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags); 3587 IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(thi s, 0, descendantFlags);
3588 unionBounds.unite(childUnionBounds); 3588 unionBounds.unite(childUnionBounds);
3589 } 3589 }
3590 } 3590 }
3591 3591
3592 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size())); 3592 ASSERT(m_stackingNode->isStackingContainer() || (!m_stackingNode->posZOrderL ist() || !m_stackingNode->posZOrderList()->size()));
3593 3593
3594 #if !ASSERT_DISABLED 3594 #if !ASSERT_DISABLED
3595 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode()); 3595 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->st ackingNode());
3596 #endif 3596 #endif
3597 3597
3598 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own 3598 // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own
3599 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute. 3599 // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute.
3600 // This applies to all z-order lists below. 3600 // This applies to all z-order lists below.
3601 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ; 3601 RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren) ;
3602 while (RenderLayerStackingNode* node = iterator.next()) { 3602 while (RenderLayerStackingNode* node = iterator.next()) {
3603 if (flags & IncludeCompositedDescendants || !node->layer()->compositedLa yerMapping()) { 3603 if (flags & IncludeCompositedDescendants || !node->layer()->hasComposite dLayerMapping()) {
3604 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags); 3604 IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags);
3605 unionBounds.unite(childUnionBounds); 3605 unionBounds.unite(childUnionBounds);
3606 } 3606 }
3607 } 3607 }
3608 3608
3609 // FIXME: We can optimize the size of the composited layers, by not enlargin g 3609 // FIXME: We can optimize the size of the composited layers, by not enlargin g
3610 // filtered areas with the outsets if we know that the filter is going to re nder in hardware. 3610 // filtered areas with the outsets if we know that the filter is going to re nder in hardware.
3611 // https://bugs.webkit.org/show_bug.cgi?id=81239 3611 // https://bugs.webkit.org/show_bug.cgi?id=81239
3612 if (flags & IncludeLayerFilterOutsets) 3612 if (flags & IncludeLayerFilterOutsets)
3613 renderer->style()->filterOutsets().expandRect(unionBounds); 3613 renderer->style()->filterOutsets().expandRect(unionBounds);
(...skipping 22 matching lines...) Expand all
3636 if (!m_compositedLayerMapping) 3636 if (!m_compositedLayerMapping)
3637 return NotComposited; 3637 return NotComposited;
3638 3638
3639 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor()) 3639 if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoComposit edAncestor())
3640 return HasOwnBackingButPaintsIntoAncestor; 3640 return HasOwnBackingButPaintsIntoAncestor;
3641 3641
3642 ASSERT(m_compositedLayerMapping); 3642 ASSERT(m_compositedLayerMapping);
3643 return PaintsIntoOwnBacking; 3643 return PaintsIntoOwnBacking;
3644 } 3644 }
3645 3645
3646 CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping() 3646 CompositedLayerMappingPtr RenderLayer::ensureCompositedLayerMapping()
3647 { 3647 {
3648 if (!m_compositedLayerMapping) { 3648 if (!m_compositedLayerMapping) {
3649 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this)); 3649 m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this));
3650 compositor()->layerBecameComposited(this); 3650 compositor()->layerBecameComposited(this);
3651 3651
3652 updateOrRemoveFilterEffectRenderer(); 3652 updateOrRemoveFilterEffectRenderer();
3653 3653
3654 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 3654 if (RuntimeEnabledFeatures::cssCompositingEnabled())
3655 compositedLayerMapping()->setBlendMode(m_blendMode); 3655 compositedLayerMapping()->setBlendMode(m_blendMode);
3656 } 3656 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3723 || listBackgroundIsKnownToBeOpaqueInRect(m_stackingNode->normalFlowList( ), localRect); 3723 || listBackgroundIsKnownToBeOpaqueInRect(m_stackingNode->normalFlowList( ), localRect);
3724 } 3724 }
3725 3725
3726 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer StackingNode*>* list, const LayoutRect& localRect) const 3726 bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer StackingNode*>* list, const LayoutRect& localRect) const
3727 { 3727 {
3728 if (!list || list->isEmpty()) 3728 if (!list || list->isEmpty())
3729 return false; 3729 return false;
3730 3730
3731 for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->r begin(); iter != list->rend(); ++iter) { 3731 for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->r begin(); iter != list->rend(); ++iter) {
3732 const RenderLayer* childLayer = (*iter)->layer(); 3732 const RenderLayer* childLayer = (*iter)->layer();
3733 if (childLayer->compositedLayerMapping()) 3733 if (childLayer->hasCompositedLayerMapping())
3734 continue; 3734 continue;
3735 3735
3736 if (!childLayer->canUseConvertToLayerCoords()) 3736 if (!childLayer->canUseConvertToLayerCoords())
3737 continue; 3737 continue;
3738 3738
3739 LayoutPoint childOffset; 3739 LayoutPoint childOffset;
3740 LayoutRect childLocalRect(localRect); 3740 LayoutRect childLocalRect(localRect);
3741 childLayer->convertToLayerCoords(this, childOffset); 3741 childLayer->convertToLayerCoords(this, childOffset);
3742 childLocalRect.moveBy(-childOffset); 3742 childLocalRect.moveBy(-childOffset);
3743 3743
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 3896
3897 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const 3897 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const
3898 { 3898 {
3899 ASSERT(newStyle); 3899 ASSERT(newStyle);
3900 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip()); 3900 return oldStyle && (oldStyle->clip() != newStyle->clip() || oldStyle->hasCli p() != newStyle->hasClip());
3901 } 3901 }
3902 3902
3903 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const 3903 inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderSt yle* oldStyle, const RenderStyle* newStyle) const
3904 { 3904 {
3905 ASSERT(newStyle); 3905 ASSERT(newStyle);
3906 return !compositedLayerMapping() && oldStyle && (oldStyle->overflowX() != ne wStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->layer() ->hasCompositingDescendant(); 3906 return !hasCompositedLayerMapping() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->laye r()->hasCompositingDescendant();
3907 } 3907 }
3908 3908
3909 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const 3909 inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderSty le* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const
3910 { 3910 {
3911 if (!hasOrHadFilters(oldStyle, newStyle)) 3911 if (!hasOrHadFilters(oldStyle, newStyle))
3912 return false; 3912 return false;
3913 3913
3914 if (renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer (), CSSPropertyWebkitFilter)) { 3914 if (renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer (), CSSPropertyWebkitFilter)) {
3915 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers. 3915 // When the compositor is performing the filter animation, we shouldn't touch the compositing layers.
3916 // All of the layers above us should have been promoted to compositing l ayers already. 3916 // All of the layers above us should have been promoted to compositing l ayers already.
(...skipping 23 matching lines...) Expand all
3940 } 3940 }
3941 3941
3942 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle) 3942 void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle)
3943 { 3943 {
3944 if (!hasOrHadFilters(oldStyle, newStyle)) 3944 if (!hasOrHadFilters(oldStyle, newStyle))
3945 return; 3945 return;
3946 3946
3947 updateOrRemoveFilterClients(); 3947 updateOrRemoveFilterClients();
3948 // During an accelerated animation, both WebKit and the compositor animate p roperties. 3948 // During an accelerated animation, both WebKit and the compositor animate p roperties.
3949 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. 3949 // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation.
3950 bool shouldUpdateFilters = compositedLayerMapping() && !renderer()->animatio n().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter) ; 3950 bool shouldUpdateFilters = hasCompositedLayerMapping() && !renderer()->anima tion().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilt er);
3951 if (shouldUpdateFilters) 3951 if (shouldUpdateFilters)
3952 compositedLayerMapping()->updateFilters(renderer()->style()); 3952 compositedLayerMapping()->updateFilters(renderer()->style());
3953 updateOrRemoveFilterEffectRenderer(); 3953 updateOrRemoveFilterEffectRenderer();
3954 } 3954 }
3955 3955
3956 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) 3956 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
3957 { 3957 {
3958 m_stackingNode->updateIsNormalFlowOnly(); 3958 m_stackingNode->updateIsNormalFlowOnly();
3959 3959
3960 if (m_scrollableArea) 3960 if (m_scrollableArea)
(...skipping 18 matching lines...) Expand all
3979 if (paintsWithFilters()) 3979 if (paintsWithFilters())
3980 didPaintWithFilters = true; 3980 didPaintWithFilters = true;
3981 updateFilters(oldStyle, renderer()->style()); 3981 updateFilters(oldStyle, renderer()->style());
3982 3982
3983 const RenderStyle* newStyle = renderer()->style(); 3983 const RenderStyle* newStyle = renderer()->style();
3984 if (compositor()->updateLayerCompositingState(this) 3984 if (compositor()->updateLayerCompositingState(this)
3985 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 3985 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
3986 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 3986 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
3987 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) 3987 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters))
3988 compositor()->setCompositingLayersNeedRebuild(); 3988 compositor()->setCompositingLayersNeedRebuild();
3989 else if (compositedLayerMapping()) 3989 else if (hasCompositedLayerMapping())
3990 compositedLayerMapping()->updateGraphicsLayerGeometry(); 3990 compositedLayerMapping()->updateGraphicsLayerGeometry();
3991 } 3991 }
3992 3992
3993 bool RenderLayer::scrollsOverflow() const 3993 bool RenderLayer::scrollsOverflow() const
3994 { 3994 {
3995 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea()) 3995 if (RenderLayerScrollableArea* scrollableArea = this->scrollableArea())
3996 return scrollableArea->scrollsOverflow(); 3996 return scrollableArea->scrollsOverflow();
3997 3997
3998 return false; 3998 return false;
3999 } 3999 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 } 4157 }
4158 } 4158 }
4159 4159
4160 void showLayerTree(const WebCore::RenderObject* renderer) 4160 void showLayerTree(const WebCore::RenderObject* renderer)
4161 { 4161 {
4162 if (!renderer) 4162 if (!renderer)
4163 return; 4163 return;
4164 showLayerTree(renderer->enclosingLayer()); 4164 showLayerTree(renderer->enclosingLayer());
4165 } 4165 }
4166 #endif 4166 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698