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

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 RenderLayer* ancestorCompositedScrollingLayer;
491 RenderLayer* scrollParent;
492
493 bool ancestorCompositedScrollingLayerDirty;
494 bool scrollParentDirty;
495 };
496
497 void ensureAncestorDependentPropertyCache() const;
498
483 bool hasOverflowControls() const; 499 bool hasOverflowControls() const;
484 500
485 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; } 501 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; }
486 502
487 void setAncestorChainHasSelfPaintingLayerDescendant(); 503 void setAncestorChainHasSelfPaintingLayerDescendant();
488 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 504 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
489 505
490 void setAncestorChainHasOutOfFlowPositionedDescendant(); 506 void setAncestorChainHasOutOfFlowPositionedDescendant();
491 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 507 void dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
492 508
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 587
572 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect & layerBounds, const HitTestLocation&, HitTestFilter) const; 588 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; 589 bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest &, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
574 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend erLayer* containerLayer, const HitTestRequest&, HitTestResult&, 590 RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, Rend erLayer* containerLayer, const HitTestRequest&, HitTestResult&,
575 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0); 591 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0);
576 592
577 bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const; 593 bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
578 594
579 bool shouldBeSelfPaintingLayer() const; 595 bool shouldBeSelfPaintingLayer() const;
580 596
581 private:
582 // FIXME: We should only create the stacking node if needed. 597 // FIXME: We should only create the stacking node if needed.
583 bool requiresStackingNode() const { return true; } 598 bool requiresStackingNode() const { return true; }
584 void updateStackingNode(); 599 void updateStackingNode();
585 600
586 void updateReflectionInfo(const RenderStyle*); 601 void updateReflectionInfo(const RenderStyle*);
587 602
588 // FIXME: We could lazily allocate our ScrollableArea based on style propert ies ('overflow', ...) 603 // 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. 604 // but for now, we are always allocating it for RenderBox as it's safer.
590 bool requiresScrollableArea() const { return renderBox(); } 605 bool requiresScrollableArea() const { return renderBox(); }
591 void updateScrollableArea(); 606 void updateScrollableArea();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 bool lostGroupedMapping() const { return m_compositingProperties.lostGrouped Mapping; } 638 bool lostGroupedMapping() const { return m_compositingProperties.lostGrouped Mapping; }
624 void setLostGroupedMapping(bool b) { m_compositingProperties.lostGroupedMapp ing = b; } 639 void setLostGroupedMapping(bool b) { m_compositingProperties.lostGroupedMapp ing = b; }
625 640
626 void setCompositingReasons(CompositingReasons); 641 void setCompositingReasons(CompositingReasons);
627 CompositingReasons compositingReasons() const { return m_compositingProperti es.compositingReasons; } 642 CompositingReasons compositingReasons() const { return m_compositingProperti es.compositingReasons; }
628 643
629 friend class CompositedLayerMapping; 644 friend class CompositedLayerMapping;
630 friend class RenderLayerCompositor; 645 friend class RenderLayerCompositor;
631 friend class RenderLayerModelObject; 646 friend class RenderLayerModelObject;
632 647
633 private:
634 LayerType m_layerType; 648 LayerType m_layerType;
635 649
636 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting 650 // 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. 651 // 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. 652 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept.
639 unsigned m_isSelfPaintingLayer : 1; 653 unsigned m_isSelfPaintingLayer : 1;
640 654
641 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 655 // 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). 656 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
643 unsigned m_hasSelfPaintingLayerDescendant : 1; 657 unsigned m_hasSelfPaintingLayerDescendant : 1;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 IntSize offsetFromSquashingLayerOrigin; 763 IntSize offsetFromSquashingLayerOrigin;
750 }; 764 };
751 765
752 CompositingProperties m_compositingProperties; 766 CompositingProperties m_compositingProperties;
753 767
754 IntRect m_blockSelectionGapsBounds; 768 IntRect m_blockSelectionGapsBounds;
755 769
756 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; 770 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping;
757 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; 771 OwnPtr<RenderLayerScrollableArea> m_scrollableArea;
758 772
773 mutable OwnPtr<AncestorDependentPropertyCache> m_ancestorDependentPropertyCa che;
774
759 CompositedLayerMapping* m_groupedMapping; 775 CompositedLayerMapping* m_groupedMapping;
760 776
761 RenderLayerRepainter m_repainter; 777 RenderLayerRepainter m_repainter;
762 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? 778 RenderLayerClipper m_clipper; // FIXME: Lazily allocate?
763 OwnPtr<RenderLayerStackingNode> m_stackingNode; 779 OwnPtr<RenderLayerStackingNode> m_stackingNode;
764 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; 780 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo;
765 RenderLayerBlendInfo m_blendInfo; 781 RenderLayerBlendInfo m_blendInfo;
766 }; 782 };
767 783
768 } // namespace WebCore 784 } // namespace WebCore
769 785
770 #ifndef NDEBUG 786 #ifndef NDEBUG
771 // Outside the WebCore namespace for ease of invocation from gdb. 787 // Outside the WebCore namespace for ease of invocation from gdb.
772 void showLayerTree(const WebCore::RenderLayer*); 788 void showLayerTree(const WebCore::RenderLayer*);
773 void showLayerTree(const WebCore::RenderObject*); 789 void showLayerTree(const WebCore::RenderObject*);
774 #endif 790 #endif
775 791
776 #endif // RenderLayer_h 792 #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