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 #ifndef mozilla_PresShellForwards_h
8 #define mozilla_PresShellForwards_h
10 #include "mozilla/TypedEnumBits.h"
12 struct CapturingContentInfo
;
18 // Flags to pass to PresShell::SetCapturingContent().
19 enum class CaptureFlags
{
21 // When assigning capture, ignore whether capture is allowed or not.
22 IgnoreAllowedState
= 1 << 0,
23 // Set if events should be targeted at the capturing content or its children.
24 RetargetToElement
= 1 << 1,
25 // Set if the current capture wants drags to be prevented.
26 PreventDragStart
= 1 << 2,
27 // Set when the mouse is pointer locked, and events are sent to locked
32 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CaptureFlags
)
34 enum class ResizeReflowOptions
: uint32_t {
36 // the resulting BSize can be less than the given one, producing
37 // shrink-to-fit sizing in the block dimension
39 // Invalidate layout, but don't reflow.
41 // TODO(emilio): Ideally this should just become the default, or we should
42 // unconditionally not reflow and rely on the caller to do so, having a
43 // separate API for shrink-to-fit.
44 SuppressReflow
= 1 << 1,
47 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ResizeReflowOptions
)
49 enum class IntrinsicDirty
{
50 // XXXldb eResize should be renamed
51 Resize
, // don't mark any intrinsic widths dirty
52 TreeChange
, // mark intrinsic widths dirty on aFrame and its ancestors
53 StyleChange
, // Do eTreeChange, plus all of aFrame's descendants
56 enum class ReflowRootHandling
{
57 PositionOrSizeChange
, // aFrame is changing position or size
58 NoPositionOrSizeChange
, // ... NOT changing ...
59 InferFromBitToAdd
, // is changing iff (aBitToAdd == NS_FRAME_IS_DIRTY)
61 // Note: With eStyleChange, these can also apply to out-of-flows
62 // in addition to aFrame.
65 // WhereToScroll should be 0 ~ 100 or -1. When it's in 0 ~ 100, it means
66 // percentage of scrollTop/scrollLeft in scrollHeight/scrollWidth.
67 // See the comment for constructor of ScrollAxis for the detail.
68 typedef int16_t WhereToScroll
;
69 static const WhereToScroll kScrollToTop
= 0;
70 static const WhereToScroll kScrollToLeft
= 0;
71 static const WhereToScroll kScrollToCenter
= 50;
72 static const WhereToScroll kScrollToBottom
= 100;
73 static const WhereToScroll kScrollToRight
= 100;
74 static const WhereToScroll kScrollMinimum
= -1;
76 // See the comment for constructor of ScrollAxis for the detail.
77 enum class WhenToScroll
: uint8_t {
83 struct ScrollAxis final
{
86 * Either a percentage or a special value. PresShell defines:
87 * * (Default) kScrollMinimum = -1: The visible area is scrolled the
88 * minimum amount to show as much as possible of the frame. This won't
89 * hide any initially visible part of the frame.
90 * * kScrollToTop = 0: The frame's upper edge is aligned with the top edge
91 * of the visible area.
92 * * kScrollToBottom = 100: The frame's bottom edge is aligned with the
93 * bottom edge of the visible area.
94 * * kScrollToLeft = 0: The frame's left edge is aligned with the left edge
95 * of the visible area.
96 * * kScrollToRight = 100: The frame's right edge is aligned* with the right
97 * edge of the visible area.
98 * * kScrollToCenter = 50: The frame is centered along the axis the
99 * ScrollAxis is used for.
101 * Other values are treated as a percentage, and the point*"percent"
102 * down the frame is placed at the point "percent" down the visible area.
105 * * (Default) WhenToScroll::IfNotFullyVisible: Move the frame only if it is
106 * not fully visible (including if it's not visible at all). Note that
107 * in this case if the frame is too large to fit in view, it will only
108 * be scrolled if more of it can fit than is already in view.
109 * * WhenToScroll::IfNotVisible: Move the frame only if none of it is
111 * * WhenToScroll::Always: Move the frame regardless of its current
114 * aOnlyIfPerceivedScrollableDirection:
115 * If the direction is not a perceived scrollable direction (i.e. no
116 * scrollbar showing and less than one device pixel of scrollable
117 * distance), don't scroll. Defaults to false.
119 explicit ScrollAxis(WhereToScroll aWhere
= kScrollMinimum
,
120 WhenToScroll aWhen
= WhenToScroll::IfNotFullyVisible
,
121 bool aOnlyIfPerceivedScrollableDirection
= false)
122 : mWhereToScroll(aWhere
),
123 mWhenToScroll(aWhen
),
124 mOnlyIfPerceivedScrollableDirection(
125 aOnlyIfPerceivedScrollableDirection
) {}
127 WhereToScroll mWhereToScroll
;
128 WhenToScroll mWhenToScroll
;
129 bool mOnlyIfPerceivedScrollableDirection
: 1;
132 enum class ScrollFlags
{
134 ScrollFirstAncestorOnly
= 1 << 0,
135 ScrollOverflowHidden
= 1 << 1,
136 ScrollNoParentFrames
= 1 << 2,
137 ScrollSmooth
= 1 << 3,
138 ScrollSmoothAuto
= 1 << 4,
140 // ScrollOverflowHidden | ScrollNoParentFrames
141 AnchorScrollFlags
= (1 << 1) | (1 << 2),
142 ALL_BITS
= (1 << 7) - 1,
145 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollFlags
)
147 // See comment at declaration of RenderDocument() for the detail.
148 enum class RenderDocumentFlags
{
150 IsUntrusted
= 1 << 0,
151 IgnoreViewportScrolling
= 1 << 1,
153 UseWidgetLayers
= 1 << 3,
154 AsyncDecodeImages
= 1 << 4,
155 DocumentRelative
= 1 << 5,
156 DrawWindowNotFlushing
= 1 << 6,
157 UseHighQualityScaling
= 1 << 7,
158 ResetViewportScrolling
= 1 << 8,
161 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderDocumentFlags
)
163 // See comment at declaration of RenderSelection() for the detail.
164 enum class RenderImageFlags
{
170 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderImageFlags
)
172 enum class ResolutionChangeOrigin
: uint8_t {
176 MainThreadAdjustment
,
179 // See comment at declaration of AddCanvasBackgroundColorItem() for the detail.
180 enum class AddCanvasBackgroundColorFlags
{
183 AddForSubDocument
= 1 << 1,
184 AppendUnscrolledOnly
= 1 << 2,
187 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AddCanvasBackgroundColorFlags
)
189 enum class PaintFlags
{
191 /* Composite layers to the window. */
192 PaintComposite
= 1 << 1,
193 /* Sync-decode images. */
194 PaintSyncDecodeImages
= 1 << 2,
197 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(PaintFlags
)
199 // See comment at declaration of ScheduleViewManagerFlush() for the detail.
200 enum class PaintType
{ Default
, DelayedCompress
};
202 // This is a private enum class of PresShell, but currently,
203 // MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS isn't available in class definition.
204 // Therefore, we need to put this here.
205 enum class RenderingStateFlags
: uint8_t {
207 IgnoringViewportScrolling
= 1 << 0,
208 DrawWindowNotFlushing
= 1 << 1,
211 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderingStateFlags
)
213 // The state of the dynamic toolbar on Mobile.
214 enum class DynamicToolbarState
{
215 None
, // No dynamic toolbar, i.e. the toolbar is static or there is
216 // no available toolbar.
217 Expanded
, // The dynamic toolbar is expanded to the maximum height.
218 InTransition
, // The dynamic toolbar is being shown/hidden.
219 Collapsed
, // The dynamic toolbar is collapsed to zero height.
224 enum class VerifyReflowFlags
{
229 DumpCommands
= 1 << 3,
230 NoisyCommands
= 1 << 4,
231 ReallyNoisyCommands
= 1 << 5,
232 DuringResizeReflow
= 1 << 6,
235 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(VerifyReflowFlags
)
237 #endif // #ifdef DEBUG
239 } // namespace mozilla
241 #endif // #ifndef mozilla_PresShellForwards_h