| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PrePaintTreeWalk_h | 5 #ifndef PrePaintTreeWalk_h |
| 6 #define PrePaintTreeWalk_h | 6 #define PrePaintTreeWalk_h |
| 7 | 7 |
| 8 #include "core/paint/ClipRect.h" | 8 #include "core/paint/ClipRect.h" |
| 9 #include "core/paint/PaintInvalidator.h" | 9 #include "core/paint/PaintInvalidator.h" |
| 10 #include "core/paint/PaintPropertyTreeBuilder.h" | 10 #include "core/paint/PaintPropertyTreeBuilder.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class FrameView; | 14 class FrameView; |
| 15 class GeometryMapper; | 15 class GeometryMapper; |
| 16 class LayoutObject; | 16 class LayoutObject; |
| 17 class LayoutView; |
| 17 struct PrePaintTreeWalkContext; | 18 struct PrePaintTreeWalkContext; |
| 18 | 19 |
| 19 // This class walks the whole layout tree, beginning from the root FrameView, | 20 // This class walks the whole layout tree, beginning from the root FrameView, |
| 20 // across frame boundaries. Helper classes are called for each tree node to | 21 // across frame boundaries. Helper classes are called for each tree node to |
| 21 // perform actual actions. It expects to be invoked in InPrePaint phase. | 22 // perform actual actions. It expects to be invoked in InPrePaint phase. |
| 22 class PrePaintTreeWalk { | 23 class PrePaintTreeWalk { |
| 23 public: | 24 public: |
| 24 PrePaintTreeWalk(GeometryMapper& geometryMapper) | 25 PrePaintTreeWalk(GeometryMapper& geometryMapper) |
| 25 : m_paintInvalidator(geometryMapper), m_geometryMapper(geometryMapper) {} | 26 : m_paintInvalidator(geometryMapper), m_geometryMapper(geometryMapper) {} |
| 26 void walk(FrameView& rootFrame); | 27 void walk(FrameView& rootFrame); |
| 27 | 28 |
| 28 private: | 29 private: |
| 30 // Walk a FrameView and the entire LayoutObject tree it contains. |
| 29 void walk(FrameView&, const PrePaintTreeWalkContext&); | 31 void walk(FrameView&, const PrePaintTreeWalkContext&); |
| 30 void walk(const LayoutObject&, const PrePaintTreeWalkContext&); | 32 // Walk a LayoutView and the entire LayoutObject tree below. |
| 33 void walk(const LayoutView&, const PrePaintTreeWalkContext&); |
| 34 |
| 35 // Walk a single LayoutObject. |
| 36 void walkObject(const LayoutObject&, PrePaintTreeWalkContext&); |
| 31 | 37 |
| 32 // Invalidates paint-layer painting optimizations, such as subsequence caching | 38 // Invalidates paint-layer painting optimizations, such as subsequence caching |
| 33 // and empty paint phase optimizations if clips from the context have changed. | 39 // and empty paint phase optimizations if clips from the context have changed. |
| 34 void invalidatePaintLayerOptimizationsIfNeeded(const LayoutObject&, | 40 void invalidatePaintLayerOptimizationsIfNeeded(const LayoutObject&, |
| 35 PrePaintTreeWalkContext&); | 41 PrePaintTreeWalkContext&); |
| 36 | 42 |
| 37 // Returns the clip applied to children for the given | 43 // Returns the clip applied to children for the given |
| 38 // contaiing block context + effect, in the space of ancestorState adjusted | 44 // contaiing block context + effect, in the space of ancestorState adjusted |
| 39 // by ancestorPaintOffset. Sets hasClip to true if a clip was applied. | 45 // by ancestorPaintOffset. Sets hasClip to true if a clip was applied. |
| 40 FloatClipRect clipRectForContext( | 46 FloatClipRect clipRectForContext( |
| 41 const PaintPropertyTreeBuilderContext::ContainingBlockContext&, | 47 const PaintPropertyTreeBuilderContext::ContainingBlockContext&, |
| 42 const EffectPaintPropertyNode*, | 48 const EffectPaintPropertyNode*, |
| 43 const PropertyTreeState& ancestorState, | 49 const PropertyTreeState& ancestorState, |
| 44 const LayoutPoint& ancestorPaintOffset, | 50 const LayoutPoint& ancestorPaintOffset, |
| 45 bool& hasClip); | 51 bool& hasClip); |
| 46 | 52 |
| 47 // Returns true if the tree walk should stop before processing this object. | 53 // Returns true if the tree walk should stop before processing this object. |
| 48 bool shouldEndWalkBefore(const LayoutObject&, const PrePaintTreeWalkContext&); | 54 bool shouldEndWalkBefore(const LayoutObject&, const PrePaintTreeWalkContext&); |
| 49 | 55 |
| 50 PaintPropertyTreeBuilder m_propertyTreeBuilder; | 56 PaintPropertyTreeBuilder m_propertyTreeBuilder; |
| 51 PaintInvalidator m_paintInvalidator; | 57 PaintInvalidator m_paintInvalidator; |
| 52 GeometryMapper& m_geometryMapper; | 58 GeometryMapper& m_geometryMapper; |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 } // namespace blink | 61 } // namespace blink |
| 56 | 62 |
| 57 #endif // PrePaintTreeWalk_h | 63 #endif // PrePaintTreeWalk_h |
| OLD | NEW |