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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h

Issue 1441973003: Use recomputed interest rect only if it changed enough (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix release builds Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex); 147 void finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex);
148 void updateRenderingContext(); 148 void updateRenderingContext();
149 void updateShouldFlattenTransform(); 149 void updateShouldFlattenTransform();
150 150
151 // GraphicsLayerClient interface 151 // GraphicsLayerClient interface
152 void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime, int group) override; 152 void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime, int group) override;
153 void notifyFirstPaint() override; 153 void notifyFirstPaint() override;
154 void notifyFirstTextPaint() override; 154 void notifyFirstTextPaint() override;
155 void notifyFirstImagePaint() override; 155 void notifyFirstImagePaint() override;
156 156
157 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain tingPhase, const IntRect* clip) const override; 157 IntRect computeInterestRect(const GraphicsLayer*, const IntRect& previousInt erestRect) const override;
158 bool needsRepaint() const override;
159 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain tingPhase, const IntRect& interestRect) const override;
160
158 bool isTrackingPaintInvalidations() const override; 161 bool isTrackingPaintInvalidations() const override;
159 162
160 #if ENABLE(ASSERT) 163 #if ENABLE(ASSERT)
161 void verifyNotPainting() override; 164 void verifyNotPainting() override;
162 #endif 165 #endif
163 166
164 LayoutRect contentsBox() const; 167 LayoutRect contentsBox() const;
165 168
166 GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizo ntalScrollbar.get(); } 169 GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizo ntalScrollbar.get(); }
167 GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVertical Scrollbar.get(); } 170 GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVertical Scrollbar.get(); }
(...skipping 19 matching lines...) Expand all
187 bool needsGraphicsLayerUpdate() { return m_pendingUpdateScope > GraphicsLaye rUpdateNone; } 190 bool needsGraphicsLayerUpdate() { return m_pendingUpdateScope > GraphicsLaye rUpdateNone; }
188 void setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateScope scope) { m_pending UpdateScope = std::max(static_cast<GraphicsLayerUpdateScope>(m_pendingUpdateScop e), scope); } 191 void setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateScope scope) { m_pending UpdateScope = std::max(static_cast<GraphicsLayerUpdateScope>(m_pendingUpdateScop e), scope); }
189 void clearNeedsGraphicsLayerUpdate() { m_pendingUpdateScope = GraphicsLayerU pdateNone; } 192 void clearNeedsGraphicsLayerUpdate() { m_pendingUpdateScope = GraphicsLayerU pdateNone; }
190 193
191 GraphicsLayerUpdater::UpdateType updateTypeForChildren(GraphicsLayerUpdater: :UpdateType) const; 194 GraphicsLayerUpdater::UpdateType updateTypeForChildren(GraphicsLayerUpdater: :UpdateType) const;
192 195
193 #if ENABLE(ASSERT) 196 #if ENABLE(ASSERT)
194 void assertNeedsToUpdateGraphicsLayerBitsCleared() { ASSERT(m_pendingUpdate Scope == GraphicsLayerUpdateNone); } 197 void assertNeedsToUpdateGraphicsLayerBitsCleared() { ASSERT(m_pendingUpdate Scope == GraphicsLayerUpdateNone); }
195 #endif 198 #endif
196 199
197 String debugName(const GraphicsLayer*) override; 200 String debugName(const GraphicsLayer*) const override;
198 201
199 LayoutSize contentOffsetInCompositingLayer() const; 202 LayoutSize contentOffsetInCompositingLayer() const;
200 203
201 LayoutPoint squashingOffsetFromTransformedAncestor() 204 LayoutPoint squashingOffsetFromTransformedAncestor()
202 { 205 {
203 return m_squashingLayerOffsetFromTransformedAncestor; 206 return m_squashingLayerOffsetFromTransformedAncestor;
204 } 207 }
205 208
206 // If there is a squashed layer painting into this CLM that is an ancestor o f the given LayoutObject, return it. Otherwise return nullptr. 209 // If there is a squashed layer painting into this CLM that is an ancestor o f the given LayoutObject, return it. Otherwise return nullptr.
207 const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObject*, u nsigned maxSquashedLayerIndex); 210 const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObject*, u nsigned maxSquashedLayerIndex);
208 211
209 void updateScrollingBlockSelection(); 212 void updateScrollingBlockSelection();
210 213
211 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } 214 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); }
212 String debugName() const { return "CompositedLayerMapping for " + owningLaye r().debugName(); } 215 String debugName() const { return "CompositedLayerMapping for " + owningLaye r().debugName(); }
213 216
214 private: 217 private:
215 static IntRect computeInterestRect(const GraphicsLayer*, LayoutObject* ownin gLayoutObject); 218 static IntRect recomputeInterestRect(const GraphicsLayer*, LayoutObject* own ingLayoutObject);
216 static bool interestRectChangedEnoughToRepaint(const IntRect& previousIntere stRect, const IntRect& newInterestRect, const IntSize& layerSize); 219 static bool interestRectChangedEnoughToRepaint(const IntRect& previousIntere stRect, const IntRect& newInterestRect, const IntSize& layerSize);
217 220
218 static const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObj ect*, const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIn dex); 221 static const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObj ect*, const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIn dex);
219 222
220 // Helper methods to updateGraphicsLayerGeometry: 223 // Helper methods to updateGraphicsLayerGeometry:
221 void computeGraphicsLayerParentLocation(const PaintLayer* compositingContain er, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocat ion); 224 void computeGraphicsLayerParentLocation(const PaintLayer* compositingContain er, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocat ion);
222 void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAnc estor, const IntPoint& graphicsLayerParentLocation, const PaintLayer& referenceL ayer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offse tFromTransformedAncestor, Vector<PaintLayer*>& layersNeedingPaintInvalidation); 225 void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAnc estor, const IntPoint& graphicsLayerParentLocation, const PaintLayer& referenceL ayer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offse tFromTransformedAncestor, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
223 void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBound s, const IntRect& localCompositingBounds, const IntPoint& graphicsLayerParentLoc ation); 226 void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBound s, const IntRect& localCompositingBounds, const IntPoint& graphicsLayerParentLoc ation);
224 void updateAncestorClippingLayerGeometry(const PaintLayer* compositingContai ner, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLaye rParentLocation); 227 void updateAncestorClippingLayerGeometry(const PaintLayer* compositingContai ner, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLaye rParentLocation);
225 void updateOverflowControlsHostLayerGeometry(const PaintLayer* compositingSt ackingContext, const PaintLayer* compositingContainer); 228 void updateOverflowControlsHostLayerGeometry(const PaintLayer* compositingSt ackingContext, const PaintLayer* compositingContainer);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (inclusive) of the 312 // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (inclusive) of the
310 // clipping container for |m_owningLayer|. 313 // clipping container for |m_owningLayer|.
311 bool owningLayerClippedByLayerNotAboveCompositedAncestor(PaintLayer* scrollP arent); 314 bool owningLayerClippedByLayerNotAboveCompositedAncestor(PaintLayer* scrollP arent);
312 315
313 PaintLayer* scrollParent(); 316 PaintLayer* scrollParent();
314 317
315 // Clear the groupedMapping entry on the layer at the given index, only if t hat layer does 318 // Clear the groupedMapping entry on the layer at the given index, only if t hat layer does
316 // not appear earlier in the set of layers for this object. 319 // not appear earlier in the set of layers for this object.
317 bool invalidateLayerIfNoPrecedingEntry(size_t); 320 bool invalidateLayerIfNoPrecedingEntry(size_t);
318 321
319 void paintContentsInternal(const GraphicsLayer*, GraphicsContext&, GraphicsL ayerPaintingPhase, const IntRect& interestRect) const;
320
321 PaintLayer& m_owningLayer; 322 PaintLayer& m_owningLayer;
322 323
323 // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this: 324 // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this:
324 // 325 //
325 // + m_ancestorClippingLayer [OPTIONAL] 326 // + m_ancestorClippingLayer [OPTIONAL]
326 // + m_graphicsLayer 327 // + m_graphicsLayer
327 // + m_childTransformLayer [OPTIONAL] 328 // + m_childTransformLayer [OPTIONAL]
328 // | + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTI ONAL] 329 // | + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTI ONAL]
329 // | + m_scrollingContentsL ayer [Present iff m_scrollingLayer is present] 330 // | + m_scrollingContentsL ayer [Present iff m_scrollingLayer is present]
330 // | + m_scrollingBlockSe lectionLayer [Present iff m_scrollingLayer is present] 331 // | + m_scrollingBlockSe lectionLayer [Present iff m_scrollingLayer is present]
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 435
435 LayoutSize m_contentOffsetInCompositingLayer; 436 LayoutSize m_contentOffsetInCompositingLayer;
436 unsigned m_contentOffsetInCompositingLayerDirty : 1; 437 unsigned m_contentOffsetInCompositingLayerDirty : 1;
437 438
438 unsigned m_pendingUpdateScope : 2; 439 unsigned m_pendingUpdateScope : 2;
439 unsigned m_isMainFrameLayoutViewLayer : 1; 440 unsigned m_isMainFrameLayoutViewLayer : 1;
440 441
441 unsigned m_backgroundLayerPaintsFixedRootBackground : 1; 442 unsigned m_backgroundLayerPaintsFixedRootBackground : 1;
442 unsigned m_scrollingContentsAreEmpty : 1; 443 unsigned m_scrollingContentsAreEmpty : 1;
443 444
444 mutable IntRect m_previousPaintInterestRect;
445
446 friend class CompositedLayerMappingTest; 445 friend class CompositedLayerMappingTest;
447 }; 446 };
448 447
449 } // namespace blink 448 } // namespace blink
450 449
451 #endif // CompositedLayerMapping_h 450 #endif // CompositedLayerMapping_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698