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

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: add fixme 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 , m_hasVisibleContent(false) 118 , m_hasVisibleContent(false)
119 , m_visibleDescendantStatusDirty(false) 119 , m_visibleDescendantStatusDirty(false)
120 , m_hasVisibleDescendant(false) 120 , m_hasVisibleDescendant(false)
121 , m_hasVisibleNonLayerContent(false) 121 , m_hasVisibleNonLayerContent(false)
122 , m_isPaginated(false) 122 , m_isPaginated(false)
123 , m_3DTransformedDescendantStatusDirty(true) 123 , m_3DTransformedDescendantStatusDirty(true)
124 , m_has3DTransformedDescendant(false) 124 , m_has3DTransformedDescendant(false)
125 , m_containsDirtyOverlayScrollbars(false) 125 , m_containsDirtyOverlayScrollbars(false)
126 , m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell()) 126 , m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell())
127 , m_hasFilterInfo(false) 127 , m_hasFilterInfo(false)
128 , m_needsToRecomputeBounds(true)
128 , m_renderer(renderer) 129 , m_renderer(renderer)
129 , m_parent(0) 130 , m_parent(0)
130 , m_previous(0) 131 , m_previous(0)
131 , m_next(0) 132 , m_next(0)
132 , m_first(0) 133 , m_first(0)
133 , m_last(0) 134 , m_last(0)
134 , m_staticInlinePosition(0) 135 , m_staticInlinePosition(0)
135 , m_staticBlockPosition(0) 136 , m_staticBlockPosition(0)
136 , m_enclosingPaginationLayer(0) 137 , m_enclosingPaginationLayer(0)
137 , m_3dRenderingContextRoot(0) 138 , m_3dRenderingContextRoot(0)
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 { 1171 {
1171 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent(); 1172 const RenderLayer* curr = (includeSelf == IncludeSelf) ? this : parent();
1172 for (; curr; curr = curr->parent()) { 1173 for (; curr; curr = curr->parent()) {
1173 if (curr->requiresFullLayerImageForFilters()) 1174 if (curr->requiresFullLayerImageForFilters())
1174 return const_cast<RenderLayer*>(curr); 1175 return const_cast<RenderLayer*>(curr);
1175 } 1176 }
1176 1177
1177 return 0; 1178 return 0;
1178 } 1179 }
1179 1180
1181 void RenderLayer::clearNeedsToRecomputeBounds()
1182 {
1183 m_needsToRecomputeBounds = false;
1184 }
1185
1186 void RenderLayer::setAbsoluteBoundingBoxForOverlap(const IntRect& rect)
esprehn 2014/03/21 23:28:01 Not having parity with the getter is a little weir
ojan 2014/03/22 00:25:43 Whoops. Missed this in a last minute rename.
1187 {
1188 m_cachedAbsoluteBoundingBox = rect;
1189 clearNeedsToRecomputeBounds();
1190 }
1191
1180 void RenderLayer::setCompositingReasons(CompositingReasons reasons) 1192 void RenderLayer::setCompositingReasons(CompositingReasons reasons)
1181 { 1193 {
1182 if (m_compositingProperties.compositingReasons == reasons) 1194 if (m_compositingProperties.compositingReasons == reasons)
1183 return; 1195 return;
1184 m_compositingProperties.compositingReasons = reasons; 1196 m_compositingProperties.compositingReasons = reasons;
1185 m_clipper.setCompositingClipRectsDirty(); 1197 m_clipper.setCompositingClipRectsDirty();
1186 } 1198 }
1187 1199
1188 bool RenderLayer::hasAncestorWithFilterOutsets() const 1200 bool RenderLayer::hasAncestorWithFilterOutsets() const
1189 { 1201 {
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 LayoutPoint delta; 3373 LayoutPoint delta;
3362 if (offsetFromRoot) 3374 if (offsetFromRoot)
3363 delta = *offsetFromRoot; 3375 delta = *offsetFromRoot;
3364 else 3376 else
3365 convertToLayerCoords(ancestorLayer, delta); 3377 convertToLayerCoords(ancestorLayer, delta);
3366 3378
3367 result.moveBy(delta); 3379 result.moveBy(delta);
3368 return result; 3380 return result;
3369 } 3381 }
3370 3382
3371 IntRect RenderLayer::absoluteBoundingBox() const
3372 {
3373 return pixelSnappedIntRect(boundingBox(root()));
3374 }
3375
3376 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c onst LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const 3383 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, c onst LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
3377 { 3384 {
3378 if (!isSelfPaintingLayer()) 3385 if (!isSelfPaintingLayer())
3379 return LayoutRect(); 3386 return LayoutRect();
3380 3387
3381 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580). 3388 // FIXME: This could be improved to do a check like hasVisibleNonCompositing DescendantLayers() (bug 92580).
3382 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant()) 3389 if ((flags & ExcludeHiddenDescendants) && this != ancestorLayer && !hasVisib leContent() && !hasVisibleDescendant())
3383 return LayoutRect(); 3390 return LayoutRect();
3384 3391
3385 RenderLayerModelObject* renderer = this->renderer(); 3392 RenderLayerModelObject* renderer = this->renderer();
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
3893 DisableCompositingQueryAsserts disabler; 3900 DisableCompositingQueryAsserts disabler;
3894 if (paintsWithFilters()) 3901 if (paintsWithFilters())
3895 didPaintWithFilters = true; 3902 didPaintWithFilters = true;
3896 updateFilters(oldStyle, renderer()->style()); 3903 updateFilters(oldStyle, renderer()->style());
3897 } 3904 }
3898 3905
3899 // FIXME: Remove incremental compositing updates after fixing the chicken/eg g issues 3906 // FIXME: Remove incremental compositing updates after fixing the chicken/eg g issues
3900 // https://code.google.com/p/chromium/issues/detail?id=343756 3907 // https://code.google.com/p/chromium/issues/detail?id=343756
3901 DisableCompositingQueryAsserts disabler; 3908 DisableCompositingQueryAsserts disabler;
3902 3909
3910 // FIXME: We could avoid doing this ancestor walk by keeping a childNeedsToR ecomputeBounds bit
3911 // and using that along with needsToRecomputeBounds to set this bit in a lat er layer tree walk
3912 // e.g. during assignLayersToBackings or computeCompositingRequirements.
3903 if (RenderLayer* compositingLayer = enclosingCompositingLayer()) 3913 if (RenderLayer* compositingLayer = enclosingCompositingLayer())
3904 compositingLayer->compositedLayerMapping()->setNeedsGeometryUpdate(); 3914 compositingLayer->compositedLayerMapping()->setNeedsGeometryUpdate();
3915 // FIXME: We only need to set this if something changed that can change our absolute bounding rect.
3916 m_needsToRecomputeBounds = true;
3905 3917
3906 const RenderStyle* newStyle = renderer()->style(); 3918 const RenderStyle* newStyle = renderer()->style();
3907 3919
3908 compositor()->updateLayerCompositingState(this, RenderLayerCompositor::UseCh ickenEggHacks); 3920 compositor()->updateLayerCompositingState(this, RenderLayerCompositor::UseCh ickenEggHacks);
3909 // FIXME: this compositing logic should be pushed into the compositing code, not here. 3921 // FIXME: this compositing logic should be pushed into the compositing code, not here.
3910 if (needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 3922 if (needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
3911 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 3923 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
3912 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters) 3924 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)
3913 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) { 3925 || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) {
3914 compositor()->setCompositingLayersNeedRebuild(); 3926 compositor()->setCompositingLayersNeedRebuild();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
4068 } 4080 }
4069 } 4081 }
4070 4082
4071 void showLayerTree(const WebCore::RenderObject* renderer) 4083 void showLayerTree(const WebCore::RenderObject* renderer)
4072 { 4084 {
4073 if (!renderer) 4085 if (!renderer)
4074 return; 4086 return;
4075 showLayerTree(renderer->enclosingLayer()); 4087 showLayerTree(renderer->enclosingLayer());
4076 } 4088 }
4077 #endif 4089 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698