Bumping manifests a=b2g-bump
[gecko.git] / layout / base / nsDisplayListInvalidation.h
blob5e2b12546328a145a2b4d747eb03235700310434
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"
10 #include "nsRect.h"
11 #include "nsColor.h"
12 #include "gfxRect.h"
14 class nsDisplayItem;
15 class nsDisplayListBuilder;
16 class nsDisplayBackgroundImage;
17 class nsDisplayThemedBackground;
18 class nsDisplaySVGEffects;
20 /**
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
29 public:
30 nsDisplayItemGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
31 virtual ~nsDisplayItemGeometry();
33 /**
34 * Compute the area required to be invalidated if this
35 * display item is removed.
37 const nsRect& ComputeInvalidationRegion() { return mBounds; }
39 /**
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);
52 /**
53 * Bounds of the display item
55 nsRect mBounds;
58 /**
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
66 public:
67 nsDisplayItemGenericGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
69 virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE;
71 nsRect mBorderRect;
74 class nsDisplayItemBoundsGeometry : public nsDisplayItemGeometry
76 public:
77 nsDisplayItemBoundsGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
79 bool mHasRoundedCorners;
82 class nsDisplayBorderGeometry : public nsDisplayItemGeometry
84 public:
85 nsDisplayBorderGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
87 virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE;
89 nsRect mContentRect;
92 class nsDisplayBackgroundGeometry : public nsDisplayItemGeometry
94 public:
95 nsDisplayBackgroundGeometry(nsDisplayBackgroundImage* aItem, nsDisplayListBuilder* aBuilder);
97 virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE;
99 nsRect mPositioningArea;
102 class nsDisplayThemedBackgroundGeometry : public nsDisplayItemGeometry
104 public:
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
115 public:
116 nsDisplayBoxShadowInnerGeometry(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
118 virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE;
120 nsRect mPaddingRect;
123 class nsDisplayBoxShadowOuterGeometry : public nsDisplayItemGenericGeometry
125 public:
126 nsDisplayBoxShadowOuterGeometry(nsDisplayItem* aItem,
127 nsDisplayListBuilder* aBuilder,
128 float aOpacity);
130 float mOpacity;
133 class nsDisplaySolidColorGeometry : public nsDisplayItemBoundsGeometry
135 public:
136 nsDisplaySolidColorGeometry(nsDisplayItem* aItem,
137 nsDisplayListBuilder* aBuilder,
138 nscolor aColor)
139 : nsDisplayItemBoundsGeometry(aItem, aBuilder)
140 , mColor(aColor)
143 nscolor mColor;
146 class nsDisplaySVGEffectsGeometry : public nsDisplayItemGeometry
148 public:
149 nsDisplaySVGEffectsGeometry(nsDisplaySVGEffects* aItem, nsDisplayListBuilder* aBuilder);
151 virtual void MoveBy(const nsPoint& aOffset) MOZ_OVERRIDE;
153 gfxRect mBBox;
154 gfxPoint mUserSpaceOffset;
155 nsPoint mFrameOffsetToReferenceFrame;
158 #endif /*NSDISPLAYLISTINVALIDATION_H_*/