1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsDisplayListInvalidation.h"
8 #include "nsDisplayList.h"
10 #include "nsTableFrame.h"
12 nsDisplayItemGeometry::nsDisplayItemGeometry(nsDisplayItem
* aItem
,
13 nsDisplayListBuilder
* aBuilder
) {
14 MOZ_COUNT_CTOR(nsDisplayItemGeometry
);
16 mBounds
= aItem
->GetBounds(aBuilder
, &snap
);
19 nsDisplayItemGeometry::~nsDisplayItemGeometry() {
20 MOZ_COUNT_DTOR(nsDisplayItemGeometry
);
23 nsDisplayItemGenericGeometry::nsDisplayItemGenericGeometry(
24 nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
)
25 : nsDisplayItemGeometry(aItem
, aBuilder
),
26 mBorderRect(aItem
->GetBorderRect()) {}
28 bool ShouldSyncDecodeImages(nsDisplayListBuilder
* aBuilder
) {
29 return aBuilder
->ShouldSyncDecodeImages();
32 void nsDisplayItemGenericGeometry::MoveBy(const nsPoint
& aOffset
) {
33 nsDisplayItemGeometry::MoveBy(aOffset
);
34 mBorderRect
.MoveBy(aOffset
);
37 nsDisplayItemBoundsGeometry::nsDisplayItemBoundsGeometry(
38 nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
)
39 : nsDisplayItemGeometry(aItem
, aBuilder
) {
41 mHasRoundedCorners
= aItem
->Frame()->GetBorderRadii(radii
);
44 nsDisplayBorderGeometry::nsDisplayBorderGeometry(nsDisplayItem
* aItem
,
45 nsDisplayListBuilder
* aBuilder
)
46 : nsDisplayItemGeometry(aItem
, aBuilder
),
47 nsImageGeometryMixin(aItem
, aBuilder
) {}
49 nsDisplayBackgroundGeometry::nsDisplayBackgroundGeometry(
50 nsDisplayBackgroundImage
* aItem
, nsDisplayListBuilder
* aBuilder
)
51 : nsDisplayItemGeometry(aItem
, aBuilder
),
52 nsImageGeometryMixin(aItem
, aBuilder
),
53 mPositioningArea(aItem
->GetPositioningArea()),
54 mDestRect(aItem
->GetDestRect()) {}
56 void nsDisplayBackgroundGeometry::MoveBy(const nsPoint
& aOffset
) {
57 nsDisplayItemGeometry::MoveBy(aOffset
);
58 mPositioningArea
.MoveBy(aOffset
);
59 mDestRect
.MoveBy(aOffset
);
62 nsDisplayThemedBackgroundGeometry::nsDisplayThemedBackgroundGeometry(
63 nsDisplayThemedBackground
* aItem
, nsDisplayListBuilder
* aBuilder
)
64 : nsDisplayItemGeometry(aItem
, aBuilder
),
65 mPositioningArea(aItem
->GetPositioningArea()),
66 mWindowIsActive(aItem
->IsWindowActive()) {}
68 void nsDisplayThemedBackgroundGeometry::MoveBy(const nsPoint
& aOffset
) {
69 nsDisplayItemGeometry::MoveBy(aOffset
);
70 mPositioningArea
.MoveBy(aOffset
);
73 nsDisplayBoxShadowInnerGeometry::nsDisplayBoxShadowInnerGeometry(
74 nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
)
75 : nsDisplayItemGeometry(aItem
, aBuilder
),
76 mPaddingRect(aItem
->GetPaddingRect()) {}
78 void nsDisplayBoxShadowInnerGeometry::MoveBy(const nsPoint
& aOffset
) {
79 nsDisplayItemGeometry::MoveBy(aOffset
);
80 mPaddingRect
.MoveBy(aOffset
);
83 nsDisplayBoxShadowOuterGeometry::nsDisplayBoxShadowOuterGeometry(
84 nsDisplayItem
* aItem
, nsDisplayListBuilder
* aBuilder
, float aOpacity
)
85 : nsDisplayItemGenericGeometry(aItem
, aBuilder
), mOpacity(aOpacity
) {}
87 void nsDisplaySolidColorRegionGeometry::MoveBy(const nsPoint
& aOffset
) {
88 nsDisplayItemGeometry::MoveBy(aOffset
);
89 mRegion
.MoveBy(aOffset
);
92 nsDisplaySVGEffectGeometry::nsDisplaySVGEffectGeometry(
93 nsDisplayEffectsBase
* aItem
, nsDisplayListBuilder
* aBuilder
)
94 : nsDisplayItemGeometry(aItem
, aBuilder
),
95 mBBox(aItem
->BBoxInUserSpace()),
96 mUserSpaceOffset(aItem
->UserSpaceOffset()),
97 mFrameOffsetToReferenceFrame(aItem
->ToReferenceFrame()),
98 mOpacity(aItem
->Frame()->StyleEffects()->mOpacity
),
99 mHandleOpacity(aItem
->ShouldHandleOpacity()) {}
101 void nsDisplaySVGEffectGeometry::MoveBy(const nsPoint
& aOffset
) {
102 mBounds
.MoveBy(aOffset
);
103 mFrameOffsetToReferenceFrame
+= aOffset
;
106 nsDisplayMasksAndClipPathsGeometry::nsDisplayMasksAndClipPathsGeometry(
107 nsDisplayMasksAndClipPaths
* aItem
, nsDisplayListBuilder
* aBuilder
)
108 : nsDisplaySVGEffectGeometry(aItem
, aBuilder
),
109 nsImageGeometryMixin(aItem
, aBuilder
),
110 mDestRects(aItem
->GetDestRects().Clone()) {}
112 nsDisplayFiltersGeometry::nsDisplayFiltersGeometry(
113 nsDisplayFilters
* aItem
, nsDisplayListBuilder
* aBuilder
)
114 : nsDisplaySVGEffectGeometry(aItem
, aBuilder
),
115 nsImageGeometryMixin(aItem
, aBuilder
) {}
117 nsDisplayTableItemGeometry::nsDisplayTableItemGeometry(
118 nsDisplayTableItem
* aItem
, nsDisplayListBuilder
* aBuilder
,
119 const nsPoint
& aFrameOffsetToViewport
)
120 : nsDisplayItemGenericGeometry(aItem
, aBuilder
),
121 nsImageGeometryMixin(aItem
, aBuilder
),
122 mFrameOffsetToViewport(aFrameOffsetToViewport
) {}