| 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/PaintInvalidator.h" | 9 #include "core/paint/PaintInvalidator.h" |
| 9 #include "core/paint/PaintPropertyTreeBuilder.h" | 10 #include "core/paint/PaintPropertyTreeBuilder.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class FrameView; | 14 class FrameView; |
| 14 class GeometryMapper; | 15 class GeometryMapper; |
| 15 class LayoutObject; | 16 class LayoutObject; |
| 16 struct PrePaintTreeWalkContext; | 17 struct PrePaintTreeWalkContext; |
| 17 | 18 |
| 18 // 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, |
| 19 // 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 |
| 20 // perform actual actions. It expects to be invoked in InPrePaint phase. | 21 // perform actual actions. It expects to be invoked in InPrePaint phase. |
| 21 class PrePaintTreeWalk { | 22 class PrePaintTreeWalk { |
| 22 public: | 23 public: |
| 23 PrePaintTreeWalk(GeometryMapper& geometryMapper) | 24 PrePaintTreeWalk(GeometryMapper& geometryMapper) |
| 24 : m_paintInvalidator(geometryMapper) {} | 25 : m_paintInvalidator(geometryMapper), m_geometryMapper(geometryMapper) {} |
| 25 void walk(FrameView& rootFrame); | 26 void walk(FrameView& rootFrame); |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 void walk(FrameView&, const PrePaintTreeWalkContext&); | 29 void walk(FrameView&, const PrePaintTreeWalkContext&); |
| 29 void walk(const LayoutObject&, const PrePaintTreeWalkContext&); | 30 void walk(const LayoutObject&, const PrePaintTreeWalkContext&); |
| 30 | 31 |
| 32 // Invalidates paint-layer painting optimizations, such as |
| 33 // subsequence caching and empty paint phase optimizations, |
| 34 // if clips from the context have changed. |
| 35 void invalidatePaintLayerOptimizationsIfNeeded( |
| 36 const LayoutObject&, |
| 37 const PaintLayer& ancestorTransformedOrRootPaintLayer, |
| 38 PaintPropertyTreeBuilderContext&); |
| 39 |
| 40 // Returns the clip applied to children for the given |
| 41 // contaiing block context + effect, in the space of ancestorState adjusted |
| 42 // by ancestorPaintOffset. Sets hasClip to true if a clip was applied. |
| 43 ClipRect clipRectForContext( |
| 44 const PaintPropertyTreeBuilderContext::ContainingBlockContext&, |
| 45 const EffectPaintPropertyNode*, |
| 46 const PropertyTreeState& ancestorState, |
| 47 const LayoutPoint& ancestorPaintOffset, |
| 48 bool& hasClip); |
| 49 |
| 31 PaintPropertyTreeBuilder m_propertyTreeBuilder; | 50 PaintPropertyTreeBuilder m_propertyTreeBuilder; |
| 32 PaintInvalidator m_paintInvalidator; | 51 PaintInvalidator m_paintInvalidator; |
| 52 GeometryMapper& m_geometryMapper; |
| 33 }; | 53 }; |
| 34 | 54 |
| 35 } // namespace blink | 55 } // namespace blink |
| 36 | 56 |
| 37 #endif // PrePaintTreeWalk_h | 57 #endif // PrePaintTreeWalk_h |
| OLD | NEW |