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

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

Issue 206283003: Avoid tree walks when computing RenderLayer::scrollParent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 void* operator new(size_t); 351 void* operator new(size_t);
352 // Only safe to call from RenderLayerModelObject::destroyLayer() 352 // Only safe to call from RenderLayerModelObject::destroyLayer()
353 void operator delete(void*); 353 void operator delete(void*);
354 354
355 CompositingState compositingState() const; 355 CompositingState compositingState() const;
356 356
357 // This returns true if our document is in a phase of its lifestyle during w hich 357 // This returns true if our document is in a phase of its lifestyle during w hich
358 // compositing state may legally be read. 358 // compositing state may legally be read.
359 bool isAllowedToQueryCompositingState() const; 359 bool isAllowedToQueryCompositingState() const;
360 360
361 // This returns true if our current phase is the compositing update.
362 bool isInCompositingUpdate() const;
363
361 CompositedLayerMappingPtr compositedLayerMapping() const; 364 CompositedLayerMappingPtr compositedLayerMapping() const;
362 CompositedLayerMappingPtr ensureCompositedLayerMapping(); 365 CompositedLayerMappingPtr ensureCompositedLayerMapping();
363 366
364 // NOTE: If you are using hasCompositedLayerMapping to determine the state o f compositing for this layer, 367 // NOTE: If you are using hasCompositedLayerMapping to determine the state o f compositing for this layer,
365 // (and not just to do bookkeeping related to the mapping like, say, allocat ing or deallocating a mapping), 368 // (and not just to do bookkeeping related to the mapping like, say, allocat ing or deallocating a mapping),
366 // then you may have incorrect logic. Use compositingState() instead. 369 // then you may have incorrect logic. Use compositingState() instead.
367 bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get (); } 370 bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get (); }
368 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); 371 void clearCompositedLayerMapping(bool layerBeingDestroyed = false);
369 372
370 CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; } 373 CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 475
473 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; } 476 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; }
474 477
475 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper ties.offsetFromSquashingLayerOrigin = offset; } 478 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper ties.offsetFromSquashingLayerOrigin = offset; }
476 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert ies.offsetFromSquashingLayerOrigin; } 479 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert ies.offsetFromSquashingLayerOrigin; }
477 480
478 bool scrollsOverflow() const; 481 bool scrollsOverflow() const;
479 482
480 bool hasDirectReasonsForCompositing() const { return compositingReasons() & CompositingReasonComboAllDirectReasons; } 483 bool hasDirectReasonsForCompositing() const { return compositingReasons() & CompositingReasonComboAllDirectReasons; }
481 484
485 void clearAncestorDependentPropertyCache();
486
482 private: 487 private:
488 struct AncestorDependentPropertyCache {
489 AncestorDependentPropertyCache();
490 RenderObject* containingBlock;
491 RenderLayer* ancestorCompositedScrollingLayer;
492 RenderLayer* scrollParent;
493 };
494
495 void ensureAncestorDependentPropertyCache() const;
496
483 bool hasOverflowControls() const; 497 bool hasOverflowControls() const;
484 498
485 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; } 499 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; }
486 500
487 void setAncestorChainHasSelfPaintingLayerDescendant(); 501 void setAncestorChainHasSelfPaintingLayerDescendant();
488 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 502 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
489 503
490 void setAncestorChainHasOutOfFlowPositionedDescendant(); 504 void setAncestorChainHasOutOfFlowPositionedDescendant();
491 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 505 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
492 506
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 585
572 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect & layerBounds, const HitTestLocation&, HitTestFilter) const; 586 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect & layerBounds, const HitTestLocation&, HitTestFilter) const;
573 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest &, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const; 587 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest &, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
574 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend erLayer* containerLayer, const HitTestRequest&, HitTestResult&, 588 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend erLayer* containerLayer, const HitTestRequest&, HitTestResult&,
575 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0); 589 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0);
576 590
577 bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const; 591 bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
578 592
579 bool shouldBeSelfPaintingLayer() const; 593 bool shouldBeSelfPaintingLayer() const;
580 594
581 private:
582 // FIXME: We should only create the stacking node if needed. 595 // FIXME: We should only create the stacking node if needed.
583 bool requiresStackingNode() const { return true; } 596 bool requiresStackingNode() const { return true; }
584 void updateStackingNode(); 597 void updateStackingNode();
585 598
586 void updateReflectionInfo(const RenderStyle*); 599 void updateReflectionInfo(const RenderStyle*);
587 600
588 // FIXME: We could lazily allocate our ScrollableArea based on style propert ies ('overflow', ...) 601 // FIXME: We could lazily allocate our ScrollableArea based on style propert ies ('overflow', ...)
589 // but for now, we are always allocating it for RenderBox as it's safer. 602 // but for now, we are always allocating it for RenderBox as it's safer.
590 bool requiresScrollableArea() const { return renderBox(); } 603 bool requiresScrollableArea() const { return renderBox(); }
591 void updateScrollableArea(); 604 void updateScrollableArea();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 bool lostGroupedMapping() const { return m_compositingProperties.lostGrouped Mapping; } 636 bool lostGroupedMapping() const { return m_compositingProperties.lostGrouped Mapping; }
624 void setLostGroupedMapping(bool b) { m_compositingProperties.lostGroupedMapp ing = b; } 637 void setLostGroupedMapping(bool b) { m_compositingProperties.lostGroupedMapp ing = b; }
625 638
626 void setCompositingReasons(CompositingReasons); 639 void setCompositingReasons(CompositingReasons);
627 CompositingReasons compositingReasons() const { return m_compositingProperti es.compositingReasons; } 640 CompositingReasons compositingReasons() const { return m_compositingProperti es.compositingReasons; }
628 641
629 friend class CompositedLayerMapping; 642 friend class CompositedLayerMapping;
630 friend class RenderLayerCompositor; 643 friend class RenderLayerCompositor;
631 friend class RenderLayerModelObject; 644 friend class RenderLayerModelObject;
632 645
633 private:
634 LayerType m_layerType; 646 LayerType m_layerType;
635 647
636 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting 648 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting
637 // machinery for a RenderLayer allocated only to handle the overflow clip ca se. 649 // machinery for a RenderLayer allocated only to handle the overflow clip ca se.
638 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept. 650 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept.
639 unsigned m_isSelfPaintingLayer : 1; 651 unsigned m_isSelfPaintingLayer : 1;
640 652
641 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 653 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
642 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells). 654 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
643 unsigned m_hasSelfPaintingLayerDescendant : 1; 655 unsigned m_hasSelfPaintingLayerDescendant : 1;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 IntSize offsetFromSquashingLayerOrigin; 761 IntSize offsetFromSquashingLayerOrigin;
750 }; 762 };
751 763
752 CompositingProperties m_compositingProperties; 764 CompositingProperties m_compositingProperties;
753 765
754 IntRect m_blockSelectionGapsBounds; 766 IntRect m_blockSelectionGapsBounds;
755 767
756 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; 768 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping;
757 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; 769 OwnPtr<RenderLayerScrollableArea> m_scrollableArea;
758 770
771 mutable OwnPtr<AncestorDependentPropertyCache> m_ancestorDependentPropertyCa che;
772
759 CompositedLayerMapping* m_groupedMapping; 773 CompositedLayerMapping* m_groupedMapping;
760 774
761 RenderLayerRepainter m_repainter; 775 RenderLayerRepainter m_repainter;
762 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? 776 RenderLayerClipper m_clipper; // FIXME: Lazily allocate?
763 OwnPtr<RenderLayerStackingNode> m_stackingNode; 777 OwnPtr<RenderLayerStackingNode> m_stackingNode;
764 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; 778 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo;
765 RenderLayerBlendInfo m_blendInfo; 779 RenderLayerBlendInfo m_blendInfo;
766 }; 780 };
767 781
768 } // namespace WebCore 782 } // namespace WebCore
769 783
770 #ifndef NDEBUG 784 #ifndef NDEBUG
771 // Outside the WebCore namespace for ease of invocation from gdb. 785 // Outside the WebCore namespace for ease of invocation from gdb.
772 void showLayerTree(const WebCore::RenderLayer*); 786 void showLayerTree(const WebCore::RenderLayer*);
773 void showLayerTree(const WebCore::RenderObject*); 787 void showLayerTree(const WebCore::RenderObject*);
774 #endif 788 #endif
775 789
776 #endif // RenderLayer_h 790 #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