michael@0: /*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_LAYER_TREE_INVALIDATION_H michael@0: #define GFX_LAYER_TREE_INVALIDATION_H michael@0: michael@0: #include "nsRegion.h" // for nsIntRegion michael@0: michael@0: class nsPresContext; michael@0: struct nsIntPoint; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class Layer; michael@0: class ContainerLayer; michael@0: michael@0: /** michael@0: * Callback for ContainerLayer invalidations. michael@0: * michael@0: * @param aContainer ContainerLayer being invalidated. michael@0: * @param aRegion Invalidated region in the ContainerLayer's coordinate michael@0: * space. michael@0: */ michael@0: typedef void (*NotifySubDocInvalidationFunc)(ContainerLayer* aLayer, michael@0: const nsIntRegion& aRegion); michael@0: michael@0: /** michael@0: * A set of cached layer properties (including those of child layers), michael@0: * used for comparing differences in layer trees. michael@0: */ michael@0: struct LayerProperties michael@0: { michael@0: virtual ~LayerProperties() {} michael@0: michael@0: /** michael@0: * Copies the current layer tree properties into michael@0: * a new LayerProperties object. michael@0: * michael@0: * @param Layer tree to copy, or nullptr if we have no michael@0: * initial layer tree. michael@0: */ michael@0: static LayerProperties* CloneFrom(Layer* aRoot); michael@0: michael@0: /** michael@0: * Clear all invalidation status from this layer tree. michael@0: */ michael@0: static void ClearInvalidations(Layer* aRoot); michael@0: michael@0: /** michael@0: * Compares a set of existing layer tree properties to the current layer michael@0: * tree and generates the changed rectangle. michael@0: * michael@0: * @param aRoot Root layer of the layer tree to compare against. michael@0: * @param aCallback If specified, callback to call when ContainerLayers michael@0: * are invalidated. michael@0: * @return Painted area changed by the layer tree changes. michael@0: */ michael@0: virtual nsIntRegion ComputeDifferences(Layer* aRoot, michael@0: NotifySubDocInvalidationFunc aCallback, michael@0: bool* aGeometryChanged = nullptr) = 0; michael@0: michael@0: michael@0: virtual void MoveBy(const nsIntPoint& aOffset) = 0; michael@0: }; michael@0: michael@0: } // namespace layers michael@0: } // namespace mozilla michael@0: michael@0: #endif /* GFX_LAYER_TREE_INVALIDATON_H */