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

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

Issue 208313004: Cache the absolute bounding box rect on RenderLayer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove extre line break Created 6 years, 9 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) 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 , m_hasVisibleContent(false) 119 , m_hasVisibleContent(false)
120 , m_visibleDescendantStatusDirty(false) 120 , m_visibleDescendantStatusDirty(false)
121 , m_hasVisibleDescendant(false) 121 , m_hasVisibleDescendant(false)
122 , m_hasVisibleNonLayerContent(false) 122 , m_hasVisibleNonLayerContent(false)
123 , m_isPaginated(false) 123 , m_isPaginated(false)
124 , m_3DTransformedDescendantStatusDirty(true) 124 , m_3DTransformedDescendantStatusDirty(true)
125 , m_has3DTransformedDescendant(false) 125 , m_has3DTransformedDescendant(false)
126 , m_containsDirtyOverlayScrollbars(false) 126 , m_containsDirtyOverlayScrollbars(false)
127 , m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell()) 127 , m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell())
128 , m_hasFilterInfo(false) 128 , m_hasFilterInfo(false)
129 , m_needsToRecomputeBounds(true)
129 , m_renderer(renderer) 130 , m_renderer(renderer)
130 , m_parent(0) 131 , m_parent(0)
131 , m_previous(0) 132 , m_previous(0)
132 , m_next(0) 133 , m_next(0)
133 , m_first(0) 134 , m_first(0)
134 , m_last(0) 135 , m_last(0)
135 , m_staticInlinePosition(0) 136 , m_staticInlinePosition(0)
136 , m_staticBlockPosition(0) 137 , m_staticBlockPosition(0)
137 , m_enclosingPaginationLayer(0) 138 , m_enclosingPaginationLayer(0)
138 , m_3dRenderingContextRoot(0) 139 , m_3dRenderingContextRoot(0)
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 { 1205 {
1205 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent(); 1206 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent();
1206 for (; curr; curr = curr->parent()) { 1207 for (; curr; curr = curr->parent()) {
1207 if (curr->requiresFullLayerImageForFilters()) 1208 if (curr->requiresFullLayerImageForFilters())
1208 return const_cast<RenderLayer*>(curr); 1209 return const_cast<RenderLayer*>(curr);
1209 } 1210 }
1210 1211
1211 return 0; 1212 return 0;
1212 } 1213 }
1213 1214
1215 void RenderLayer::clearNeedsToRecomputeBounds()
1216 {
1217 m_needsToRecomputeBounds = false;
1218 }
1219
1220 void RenderLayer::setAbsoluteBoundingBox(const IntRect& rect)
1221 {
1222 m_absoluteBoundingBox = rect;
1223 clearNeedsToRecomputeBounds();
1224 }
1225
1214 void RenderLayer::setCompositingReasons(CompositingReasons reasons, CompositingR easons mask) 1226 void RenderLayer::setCompositingReasons(CompositingReasons reasons, CompositingR easons mask)
1215 { 1227 {
1216 ASSERT(reasons == (reasons & mask)); 1228 ASSERT(reasons == (reasons & mask));
1217 if ((m_compositingProperties.compositingReasons & mask) == (reasons & mask)) 1229 if ((m_compositingProperties.compositingReasons & mask) == (reasons & mask))
1218 return; 1230 return;
1219 m_compositingProperties.compositingReasons = (reasons & mask) | (m_compositi ngProperties.compositingReasons & ~mask); 1231 m_compositingProperties.compositingReasons = (reasons & mask) | (m_compositi ngProperties.compositingReasons & ~mask);
1220 m_clipper.setCompositingClipRectsDirty(); 1232 m_clipper.setCompositingClipRectsDirty();
1221 } 1233 }
1222 1234
1223 bool RenderLayer::hasAncestorWithFilterOutsets() const 1235 bool RenderLayer::hasAncestorWithFilterOutsets() const
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3411 LayoutPoint delta; 3423 LayoutPoint delta;
3412 if (offsetFromRoot) 3424 if (offsetFromRoot)
3413 delta = *offsetFromRoot; 3425 delta = *offsetFromRoot;
3414 else 3426 else
3415 convertToLayerCoords(ancestorLayer, delta); 3427 convertToLayerCoords(ancestorLayer, delta);
3416 3428
3417 result.moveBy(delta); 3429 result.moveBy(delta);
3418 return result; 3430 return result;
3419 } 3431 }
3420 3432
3421 IntRect RenderLayer::absoluteBoundingBox() const
3422 {
3423 return pixelSnappedIntRect(boundingBox(root()));
3424 }
3425
3426 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c onst LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const 3433 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c onst LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
3427 { 3434 {
3428 if (!isSelfPaintingLayer()) 3435 if (!isSelfPaintingLayer())
3429 return LayoutRect(); 3436 return LayoutRect();
3430 3437
3431 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580). 3438 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580).
3432 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant()) 3439 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant())
3433 return LayoutRect(); 3440 return LayoutRect();
3434 3441
3435 RenderLayerModelObject* renderer = this->renderer(); 3442 RenderLayerModelObject* renderer = this->renderer();
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 didPaintWithFilters = true; 3957 didPaintWithFilters = true;
3951 updateFilters(oldStyle, renderer()->style()); 3958 updateFilters(oldStyle, renderer()->style());
3952 } 3959 }
3953 3960
3954 compositor()->updateStyleDeterminedCompositingReasons(this); 3961 compositor()->updateStyleDeterminedCompositingReasons(this);
3955 3962
3956 // FIXME: Remove incremental compositing updates after fixing the chicken/eg g issues 3963 // FIXME: Remove incremental compositing updates after fixing the chicken/eg g issues
3957 // https://code.google.com/p/chromium/issues/detail?id=343756 3964 // https://code.google.com/p/chromium/issues/detail?id=343756
3958 DisableCompositingQueryAsserts disabler; 3965 DisableCompositingQueryAsserts disabler;
3959 3966
3967 // FIXME: We could avoid doing this ancestor walk by keeping a childNeedsToR ecomputeBounds bit
3968 // and using that along with needsToRecomputeBounds to set this bit in a lat er layer tree walk
3969 // e.g. during assignLayersToBackings or computeCompositingRequirements.
3960 if (RenderLayer* compositingLayer = enclosingCompositingLayer()) 3970 if (RenderLayer* compositingLayer = enclosingCompositingLayer())
3961 compositingLayer->compositedLayerMapping()->setNeedsGeometryUpdate(); 3971 compositingLayer->compositedLayerMapping()->setNeedsGeometryUpdate();
3972 // FIXME: We only need to set this if something changed that can change our absolute bounding rect.
3973 m_needsToRecomputeBounds = true;
3962 3974
3963 const RenderStyle* newStyle = renderer()->style(); 3975 const RenderStyle* newStyle = renderer()->style();
3964 3976
3965 compositor()->updateLayerCompositingState(this, RenderLayerCompositor::UseCh ickenEggHacks); 3977 compositor()->updateLayerCompositingState(this, RenderLayerCompositor::UseCh ickenEggHacks);
3966 // FIXME: this compositing logic should be pushed into the compositing code, not here. 3978 // FIXME: this compositing logic should be pushed into the compositing code, not here.
3967 if (needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 3979 if (needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
3968 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 3980 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
3969 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters) 3981 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)
3970 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) { 3982 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) {
3971 compositor()->setCompositingLayersNeedRebuild(); 3983 compositor()->setCompositingLayersNeedRebuild();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4154 } 4166 }
4155 } 4167 }
4156 4168
4157 void showLayerTree(const WebCore::RenderObject* renderer) 4169 void showLayerTree(const WebCore::RenderObject* renderer)
4158 { 4170 {
4159 if (!renderer) 4171 if (!renderer)
4160 return; 4172 return;
4161 showLayerTree(renderer->enclosingLayer()); 4173 showLayerTree(renderer->enclosingLayer());
4162 } 4174 }
4163 #endif 4175 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/RenderLayerCompositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698