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

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

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) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 DontConstrainForMask = 1 << 4, 292 DontConstrainForMask = 1 << 4,
293 IncludeCompositedDescendants = 1 << 5, 293 IncludeCompositedDescendants = 1 << 5,
294 UseFragmentBoxes = 1 << 6, 294 UseFragmentBoxes = 1 << 6,
295 PretendLayerHasOwnBacking = 1 << 7, 295 PretendLayerHasOwnBacking = 1 << 7,
296 DefaultCalculateLayerBoundsFlags = IncludeSelfTransform | UseLocalClipR ectIfPossible | IncludeLayerFilterOutsets | UseFragmentBoxes 296 DefaultCalculateLayerBoundsFlags = IncludeSelfTransform | UseLocalClipR ectIfPossible | IncludeLayerFilterOutsets | UseFragmentBoxes
297 }; 297 };
298 typedef unsigned CalculateLayerBoundsFlags; 298 typedef unsigned CalculateLayerBoundsFlags;
299 299
300 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know n. 300 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know n.
301 LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFla gs = 0, const LayoutPoint* offsetFromRoot = 0) const; 301 LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFla gs = 0, const LayoutPoint* offsetFromRoot = 0) const;
302 // Bounding box in the coordinates of this layer.
303 LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const;
304 // Pixel snapped bounding box relative to the root.
305 IntRect absoluteBoundingBox() const;
306 302
307 // Bounds used for layer overlap testing in RenderLayerCompositor. 303 // Bounds used for layer overlap testing in RenderLayerCompositor.
308 LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? c alculateLayerBounds(this) : localBoundingBox(); } 304 LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? c alculateLayerBounds(this) : localBoundingBox(); }
309 305
310 // If true, this layer's children are included in its bounds for overlap tes ting. 306 // If true, this layer's children are included in its bounds for overlap tes ting.
311 // We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around. 307 // We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around.
312 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer() ->style()->filter().hasFilterThatMovesPixels(); } 308 bool overlapBoundsIncludeChildren() const { return hasFilter() && renderer() ->style()->filter().hasFilterThatMovesPixels(); }
313 309
314 // Can pass offsetFromRoot if known. 310 // Can pass offsetFromRoot if known.
315 LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const Layo utPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBo undsFlags) const; 311 LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const Layo utPoint* offsetFromRoot = 0, CalculateLayerBoundsFlags = DefaultCalculateLayerBo undsFlags) const;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 468
473 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; } 469 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; }
474 470
475 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper ties.offsetFromSquashingLayerOrigin = offset; } 471 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper ties.offsetFromSquashingLayerOrigin = offset; }
476 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert ies.offsetFromSquashingLayerOrigin; } 472 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert ies.offsetFromSquashingLayerOrigin; }
477 473
478 bool scrollsOverflow() const; 474 bool scrollsOverflow() const;
479 475
480 bool hasDirectReasonsForCompositing() const { return compositingReasons() & CompositingReasonComboAllDirectReasons; } 476 bool hasDirectReasonsForCompositing() const { return compositingReasons() & CompositingReasonComboAllDirectReasons; }
481 477
478 const IntRect& cachedAbsoluteBoundingBox() { ASSERT(!m_needsToRecomputeBound s); return m_cachedAbsoluteBoundingBox; }
479 void setAbsoluteBoundingBoxForOverlap(const IntRect&);
480 void clearNeedsToRecomputeBounds();
481 bool needsToRecomputeBounds() { return m_needsToRecomputeBounds; }
482
482 private: 483 private:
484 // Bounding box in the coordinates of this layer.
485 LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const;
486
483 bool hasOverflowControls() const; 487 bool hasOverflowControls() const;
484 488
485 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; } 489 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; }
486 490
487 void setAncestorChainHasSelfPaintingLayerDescendant(); 491 void setAncestorChainHasSelfPaintingLayerDescendant();
488 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 492 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
489 493
490 void setAncestorChainHasOutOfFlowPositionedDescendant(); 494 void setAncestorChainHasOutOfFlowPositionedDescendant();
491 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 495 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
492 496
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 unsigned m_has3DTransformedDescendant : 1; 679 unsigned m_has3DTransformedDescendant : 1;
676 680
677 unsigned m_containsDirtyOverlayScrollbars : 1; 681 unsigned m_containsDirtyOverlayScrollbars : 1;
678 682
679 // This is an optimization added for <table>. 683 // This is an optimization added for <table>.
680 // Currently cells do not need to update their repaint rectangles when scrol ling. This also 684 // Currently cells do not need to update their repaint rectangles when scrol ling. This also
681 // saves a lot of time when scrolling on a table. 685 // saves a lot of time when scrolling on a table.
682 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; 686 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1;
683 687
684 unsigned m_hasFilterInfo : 1; 688 unsigned m_hasFilterInfo : 1;
689 unsigned m_needsToRecomputeBounds : 1;
685 690
686 RenderLayerModelObject* m_renderer; 691 RenderLayerModelObject* m_renderer;
687 692
688 RenderLayer* m_parent; 693 RenderLayer* m_parent;
689 RenderLayer* m_previous; 694 RenderLayer* m_previous;
690 RenderLayer* m_next; 695 RenderLayer* m_next;
691 RenderLayer* m_first; 696 RenderLayer* m_first;
692 RenderLayer* m_last; 697 RenderLayer* m_last;
693 698
694 // Our current relative position offset. 699 // Our current relative position offset.
695 LayoutSize m_offsetForInFlowPosition; 700 LayoutSize m_offsetForInFlowPosition;
696 701
697 // Our (x,y) coordinates are in our parent layer's coordinate space. 702 // Our (x,y) coordinates are in our parent layer's coordinate space.
698 LayoutPoint m_topLeft; 703 LayoutPoint m_topLeft;
699 704
700 // The layer's width/height 705 // The layer's width/height
701 IntSize m_layerSize; 706 IntSize m_layerSize;
702 707
703 // Cached normal flow values for absolute positioned elements with static le ft/top values. 708 // Cached normal flow values for absolute positioned elements with static le ft/top values.
704 LayoutUnit m_staticInlinePosition; 709 LayoutUnit m_staticInlinePosition;
705 LayoutUnit m_staticBlockPosition; 710 LayoutUnit m_staticBlockPosition;
706 711
712 IntRect m_cachedAbsoluteBoundingBox;
esprehn 2014/03/21 23:28:01 m_absoluteBoundingBox ? cached seems like a detail
ojan 2014/03/22 00:25:43 I guess. I wanted to distinguish from boundingBox.
713
707 OwnPtr<TransformationMatrix> m_transform; 714 OwnPtr<TransformationMatrix> m_transform;
708 715
709 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i s 0 if we are not paginated. 716 // Pointer to the enclosing RenderLayer that caused us to be paginated. It i s 0 if we are not paginated.
710 RenderLayer* m_enclosingPaginationLayer; 717 RenderLayer* m_enclosingPaginationLayer;
711 718
712 // Pointer to the enclosing RenderLayer that establishes the 3d rendering co ntext in which this layer participates. 719 // Pointer to the enclosing RenderLayer that establishes the 3d rendering co ntext in which this layer participates.
713 // If it 0, it does not participate in a 3d rendering context. 720 // If it 0, it does not participate in a 3d rendering context.
714 RenderLayer* m_3dRenderingContextRoot; 721 RenderLayer* m_3dRenderingContextRoot;
715 722
716 // Properties that are computed while updating compositing layers. These val ues may be dirty/invalid if 723 // Properties that are computed while updating compositing layers. These val ues may be dirty/invalid if
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 774
768 } // namespace WebCore 775 } // namespace WebCore
769 776
770 #ifndef NDEBUG 777 #ifndef NDEBUG
771 // Outside the WebCore namespace for ease of invocation from gdb. 778 // Outside the WebCore namespace for ease of invocation from gdb.
772 void showLayerTree(const WebCore::RenderLayer*); 779 void showLayerTree(const WebCore::RenderLayer*);
773 void showLayerTree(const WebCore::RenderObject*); 780 void showLayerTree(const WebCore::RenderObject*);
774 #endif 781 #endif
775 782
776 #endif // RenderLayer_h 783 #endif // RenderLayer_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderLayer.cpp » ('j') | Source/core/rendering/RenderLayer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698