@@ -25,22 +25,43 @@ class ContainerLayer : public Layer {
2525
2626 const std::vector<std::shared_ptr<Layer>>& layers () const { return layers_; }
2727
28+ // Called when the layer, which must be a child of this container,
29+ // changes its tree_reads_surface() result from false to true.
30+ void NotifyChildReadback (const Layer* layer);
31+
2832 protected:
2933 void PrerollChildren (PrerollContext* context,
3034 const SkMatrix& child_matrix,
3135 SkRect* child_paint_bounds);
3236 void PaintChildren (PaintContext& context) const ;
3337
38+ virtual bool ComputeTreeReadsSurface () const override ;
39+
3440#if defined(OS_FUCHSIA)
3541 void UpdateSceneChildren (SceneUpdateContext& context);
3642#endif // defined(OS_FUCHSIA)
3743
44+ // Specify whether or not the container has its children render
45+ // to a SaveLayer which will prevent many rendering anomalies
46+ // from propagating to the parent - such as if the children
47+ // read back from the surface on which they render, or if the
48+ // children perform non-associative rendering. Those children
49+ // will now be performing those operations on the SaveLayer
50+ // rather than the layer that this container renders onto.
51+ void set_renders_to_save_layer (bool value);
52+
3853 // For OpacityLayer to restructure to have a single child.
39- void ClearChildren () { layers_. clear (); }
54+ void ClearChildren ();
4055
4156 private:
4257 std::vector<std::shared_ptr<Layer>> layers_;
4358
59+ // child_needs_screen_readback_ is maintained even if the
60+ // renders_to_save_layer_ property is set in case both
61+ // parameters are dynamically and independently determined.
62+ bool child_needs_screen_readback_;
63+ bool renders_to_save_layer_;
64+
4465 FML_DISALLOW_COPY_AND_ASSIGN (ContainerLayer);
4566};
4667
0 commit comments