| 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; | |
| 16 class LayoutObject; | 15 class LayoutObject; |
| 16 class PropertyTreeState; |
| 17 struct PrePaintTreeWalkContext; | 17 struct PrePaintTreeWalkContext; |
| 18 | 18 |
| 19 // This class walks the whole layout tree, beginning from the root FrameView, | 19 // 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 | 20 // across frame boundaries. Helper classes are called for each tree node to |
| 21 // perform actual actions. It expects to be invoked in InPrePaint phase. | 21 // perform actual actions. It expects to be invoked in InPrePaint phase. |
| 22 class PrePaintTreeWalk { | 22 class PrePaintTreeWalk { |
| 23 public: | 23 public: |
| 24 PrePaintTreeWalk(GeometryMapper& geometryMapper) | 24 PrePaintTreeWalk() {} |
| 25 : m_geometryMapper(geometryMapper) {} | |
| 26 void walk(FrameView& rootFrame); | 25 void walk(FrameView& rootFrame); |
| 27 | 26 |
| 28 private: | 27 private: |
| 29 void walk(FrameView&, const PrePaintTreeWalkContext&); | 28 void walk(FrameView&, const PrePaintTreeWalkContext&); |
| 30 void walk(const LayoutObject&, const PrePaintTreeWalkContext&); | 29 void walk(const LayoutObject&, const PrePaintTreeWalkContext&); |
| 31 | 30 |
| 32 // Invalidates paint-layer painting optimizations, such as subsequence caching | 31 // Invalidates paint-layer painting optimizations, such as subsequence caching |
| 33 // and empty paint phase optimizations if clips from the context have changed. | 32 // and empty paint phase optimizations if clips from the context have changed. |
| 34 void invalidatePaintLayerOptimizationsIfNeeded(const LayoutObject&, | 33 void invalidatePaintLayerOptimizationsIfNeeded(const LayoutObject&, |
| 35 PrePaintTreeWalkContext&); | 34 PrePaintTreeWalkContext&); |
| 36 | 35 |
| 37 // Returns in |clipRect| the clip applied to children for the given | 36 // Returns in |clipRect| the clip applied to children for the given |
| 38 // contaiing block context + effect, in the space of ancestorState adjusted | 37 // contaiing block context + effect, in the space of ancestorState adjusted |
| 39 // by ancestorPaintOffset. Sets hasClip to true if a clip was applied. | 38 // by ancestorPaintOffset. Sets hasClip to true if a clip was applied. |
| 40 void computeClipRectForContext( | 39 void computeClipRectForContext( |
| 41 const PaintPropertyTreeBuilderContext::ContainingBlockContext&, | 40 const PaintPropertyTreeBuilderContext::ContainingBlockContext&, |
| 42 const EffectPaintPropertyNode*, | 41 const EffectPaintPropertyNode*, |
| 43 const PropertyTreeState& ancestorState, | 42 const PropertyTreeState& ancestorState, |
| 44 const LayoutPoint& ancestorPaintOffset, | 43 const LayoutPoint& ancestorPaintOffset, |
| 45 bool& hasClip, | 44 bool& hasClip, |
| 46 FloatClipRect&); | 45 FloatClipRect&); |
| 47 | 46 |
| 48 // Returns true if the tree walk should stop before processing this object. | 47 // Returns true if the tree walk should stop before processing this object. |
| 49 bool shouldEndWalkBefore(const LayoutObject&, const PrePaintTreeWalkContext&); | 48 bool shouldEndWalkBefore(const LayoutObject&, const PrePaintTreeWalkContext&); |
| 50 | 49 |
| 51 PaintPropertyTreeBuilder m_propertyTreeBuilder; | 50 PaintPropertyTreeBuilder m_propertyTreeBuilder; |
| 52 PaintInvalidator m_paintInvalidator; | 51 PaintInvalidator m_paintInvalidator; |
| 53 GeometryMapper& m_geometryMapper; | |
| 54 }; | 52 }; |
| 55 | 53 |
| 56 } // namespace blink | 54 } // namespace blink |
| 57 | 55 |
| 58 #endif // PrePaintTreeWalk_h | 56 #endif // PrePaintTreeWalk_h |
| OLD | NEW |