1 /*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef NSDISPLAYLISTINVALIDATION_H_
7 #define NSDISPLAYLISTINVALIDATION_H_
9 #include "mozilla/Attributes.h"
15 class nsDisplayListBuilder
;
16 class nsDisplayBackgroundImage
;
17 class nsDisplayThemedBackground
;
18 class nsDisplaySVGEffects
;
21 * This stores the geometry of an nsDisplayItem, and the area
22 * that will be affected when painting the item.
24 * It is used to retain information about display items so they
25 * can be compared against new display items in the next paint.
27 class nsDisplayItemGeometry
30 nsDisplayItemGeometry(nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
);
31 virtual ~nsDisplayItemGeometry();
34 * Compute the area required to be invalidated if this
35 * display item is removed.
37 const nsRect
& ComputeInvalidationRegion() { return mBounds
; }
40 * Shifts all retained areas of the nsDisplayItemGeometry by the given offset.
42 * This is used to compensate for scrolling, since the destination buffer
43 * can scroll without requiring a full repaint.
45 * @param aOffset Offset to shift by.
47 virtual void MoveBy(const nsPoint
& aOffset
)
49 mBounds
.MoveBy(aOffset
);
53 * Bounds of the display item
59 * A default geometry implementation, used by nsDisplayItem. Retains
60 * and compares the bounds, and border rect.
62 * This should be sufficient for the majority of display items.
64 class nsDisplayItemGenericGeometry
: public nsDisplayItemGeometry
67 nsDisplayItemGenericGeometry(nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
);
69 virtual void MoveBy(const nsPoint
& aOffset
) MOZ_OVERRIDE
;
74 class nsDisplayItemBoundsGeometry
: public nsDisplayItemGeometry
77 nsDisplayItemBoundsGeometry(nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
);
79 bool mHasRoundedCorners
;
82 class nsDisplayBorderGeometry
: public nsDisplayItemGeometry
85 nsDisplayBorderGeometry(nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
);
87 virtual void MoveBy(const nsPoint
& aOffset
) MOZ_OVERRIDE
;
92 class nsDisplayBackgroundGeometry
: public nsDisplayItemGeometry
95 nsDisplayBackgroundGeometry(nsDisplayBackgroundImage
* aItem
, nsDisplayListBuilder
* aBuilder
);
97 virtual void MoveBy(const nsPoint
& aOffset
) MOZ_OVERRIDE
;
99 nsRect mPositioningArea
;
102 class nsDisplayThemedBackgroundGeometry
: public nsDisplayItemGeometry
105 nsDisplayThemedBackgroundGeometry(nsDisplayThemedBackground
* aItem
, nsDisplayListBuilder
* aBuilder
);
107 virtual void MoveBy(const nsPoint
& aOffset
) MOZ_OVERRIDE
;
109 nsRect mPositioningArea
;
110 bool mWindowIsActive
;
113 class nsDisplayBoxShadowInnerGeometry
: public nsDisplayItemGeometry
116 nsDisplayBoxShadowInnerGeometry(nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
);
118 virtual void MoveBy(const nsPoint
& aOffset
) MOZ_OVERRIDE
;
123 class nsDisplayBoxShadowOuterGeometry
: public nsDisplayItemGenericGeometry
126 nsDisplayBoxShadowOuterGeometry(nsDisplayItem
* aItem
,
127 nsDisplayListBuilder
* aBuilder
,
133 class nsDisplaySolidColorGeometry
: public nsDisplayItemBoundsGeometry
136 nsDisplaySolidColorGeometry(nsDisplayItem
* aItem
,
137 nsDisplayListBuilder
* aBuilder
,
139 : nsDisplayItemBoundsGeometry(aItem
, aBuilder
)
146 class nsDisplaySVGEffectsGeometry
: public nsDisplayItemGeometry
149 nsDisplaySVGEffectsGeometry(nsDisplaySVGEffects
* aItem
, nsDisplayListBuilder
* aBuilder
);
151 virtual void MoveBy(const nsPoint
& aOffset
) MOZ_OVERRIDE
;
154 gfxPoint mUserSpaceOffset
;
155 nsPoint mFrameOffsetToReferenceFrame
;
158 #endif /*NSDISPLAYLISTINVALIDATION_H_*/