Bug 1468402 - Part 3: Add test for subgrids in the grid list. r=pbro
[gecko.git] / layout / base / PresShellForwards.h
blob089d8f710252109b4bd47909f7cb0e24665fe9d1
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;
14 namespace mozilla {
16 class PresShell;
18 // Flags to pass to PresShell::SetCapturingContent().
19 enum class CaptureFlags {
20 None = 0,
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
28 // element.
29 PointerLock = 1 << 3,
32 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CaptureFlags)
34 enum class RectVisibility {
35 Visible,
36 AboveViewport,
37 BelowViewport,
38 LeftOfViewport,
39 RightOfViewport,
42 enum class ResizeReflowOptions : uint32_t {
43 NoOption = 0,
44 // the resulting BSize can be less than the given one, producing
45 // shrink-to-fit sizing in the block dimension
46 BSizeLimit = 1 << 0,
47 // suppress resize events even if the content size is changed due to the
48 // reflow. This flag is used for mobile since on mobile we need to do an
49 // additional reflow to zoom the content by the initial-scale or auto scaling
50 // and we don't want any resize events during the initial paint.
51 SuppressResizeEvent = 1 << 1,
54 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ResizeReflowOptions)
56 // This is actually pref-controlled, but we use this value if we fail to get
57 // the pref for any reason.
58 #define PAINTLOCK_EVENT_DELAY 5
60 enum class IntrinsicDirty {
61 // XXXldb eResize should be renamed
62 Resize, // don't mark any intrinsic widths dirty
63 TreeChange, // mark intrinsic widths dirty on aFrame and its ancestors
64 StyleChange, // Do eTreeChange, plus all of aFrame's descendants
67 enum class ReflowRootHandling {
68 PositionOrSizeChange, // aFrame is changing position or size
69 NoPositionOrSizeChange, // ... NOT changing ...
70 InferFromBitToAdd, // is changing iff (aBitToAdd == NS_FRAME_IS_DIRTY)
72 // Note: With eStyleChange, these can also apply to out-of-flows
73 // in addition to aFrame.
76 // WhereToScroll should be 0 ~ 100 or -1. When it's in 0 ~ 100, it means
77 // percentage of scrollTop/scrollLeft in scrollHeight/scrollWidth.
78 // See the comment for constructor of ScrollAxis for the detail.
79 typedef int16_t WhereToScroll;
80 static const WhereToScroll kScrollToTop = 0;
81 static const WhereToScroll kScrollToLeft = 0;
82 static const WhereToScroll kScrollToCenter = 50;
83 static const WhereToScroll kScrollToBottom = 100;
84 static const WhereToScroll kScrollToRight = 100;
85 static const WhereToScroll kScrollMinimum = -1;
87 // See the comment for constructor of ScrollAxis for the detail.
88 enum class WhenToScroll : uint8_t {
89 Always,
90 IfNotVisible,
91 IfNotFullyVisible,
94 struct ScrollAxis final {
95 /**
96 * aWhere:
97 * Either a percentage or a special value. PresShell defines:
98 * * (Default) kScrollMinimum = -1: The visible area is scrolled the
99 * minimum amount to show as much as possible of the frame. This won't
100 * hide any initially visible part of the frame.
101 * * kScrollToTop = 0: The frame's upper edge is aligned with the top edge
102 * of the visible area.
103 * * kScrollToBottom = 100: The frame's bottom edge is aligned with the
104 * bottom edge of the visible area.
105 * * kScrollToLeft = 0: The frame's left edge is aligned with the left edge
106 * of the visible area.
107 * * kScrollToRight = 100: The frame's right edge is aligned* with the right
108 * edge of the visible area.
109 * * kScrollToCenter = 50: The frame is centered along the axis the
110 * ScrollAxis is used for.
112 * Other values are treated as a percentage, and the point*"percent"
113 * down the frame is placed at the point "percent" down the visible area.
115 * aWhen:
116 * * (Default) WhenToScroll::IfNotFullyVisible: Move the frame only if it is
117 * not fully visible (including if it's not visible at all). Note that
118 * in this case if the frame is too large to fit in view, it will only
119 * be scrolled if more of it can fit than is already in view.
120 * * WhenToScroll::IfNotVisible: Move the frame only if none of it is
121 * visible.
122 * * WhenToScroll::Always: Move the frame regardless of its current
123 * visibility.
125 * aOnlyIfPerceivedScrollableDirection:
126 * If the direction is not a perceived scrollable direction (i.e. no
127 * scrollbar showing and less than one device pixel of scrollable
128 * distance), don't scroll. Defaults to false.
130 explicit ScrollAxis(WhereToScroll aWhere = kScrollMinimum,
131 WhenToScroll aWhen = WhenToScroll::IfNotFullyVisible,
132 bool aOnlyIfPerceivedScrollableDirection = false)
133 : mWhereToScroll(aWhere),
134 mWhenToScroll(aWhen),
135 mOnlyIfPerceivedScrollableDirection(
136 aOnlyIfPerceivedScrollableDirection) {}
138 WhereToScroll mWhereToScroll;
139 WhenToScroll mWhenToScroll;
140 bool mOnlyIfPerceivedScrollableDirection : 1;
143 enum class ScrollFlags {
144 None = 0,
145 ScrollFirstAncestorOnly = 1 << 0,
146 ScrollOverflowHidden = 1 << 1,
147 ScrollNoParentFrames = 1 << 2,
148 ScrollSmooth = 1 << 3,
149 ScrollSmoothAuto = 1 << 4,
150 ScrollSnap = 1 << 5,
151 IgnoreMarginAndPadding = 1 << 6,
152 // ScrollOverflowHidden | ScrollNoParentFrames
153 AnchorScrollFlags = (1 << 1) | (1 << 2),
156 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollFlags)
158 enum class ScrollableDirection { Horizontal, Vertical, Either };
160 // See comment at declaration of RenderDocument() for the detail.
161 enum class RenderDocumentFlags {
162 None = 0,
163 IsUntrusted = 1 << 0,
164 IgnoreViewportScrolling = 1 << 1,
165 DrawCaret = 1 << 2,
166 UseWidgetLayers = 1 << 3,
167 AsyncDecodeImages = 1 << 4,
168 DocumentRelative = 1 << 5,
169 DrawWindowNotFlushing = 1 << 6,
172 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderDocumentFlags)
174 // See comment at declaration of RenderSelection() for the detail.
175 enum class RenderImageFlags {
176 None = 0,
177 IsImage = 1 << 0,
178 AutoScale = 1 << 1,
181 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderImageFlags)
183 enum class ResolutionChangeOrigin : uint8_t {
184 Apz,
185 MainThread,
188 // See comment at declaration of AddCanvasBackgroundColorItem() for the detail.
189 enum class AddCanvasBackgroundColorFlags {
190 None = 0,
191 ForceDraw = 1 << 0,
192 AddForSubDocument = 1 << 1,
193 AppendUnscrolledOnly = 1 << 2,
196 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AddCanvasBackgroundColorFlags)
198 enum class PaintFlags {
199 None = 0,
200 /* Update the layer tree and paint PaintedLayers. If this is not specified,
201 * we may still have to do it if the layer tree lost PaintedLayer contents
202 * we need for compositing. */
203 PaintLayers = 1 << 0,
204 /* Composite layers to the window. */
205 PaintComposite = 1 << 1,
206 /* Sync-decode images. */
207 PaintSyncDecodeImages = 1 << 2,
210 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(PaintFlags)
212 // See comment at declaration of ScheduleViewManagerFlush() for the detail.
213 enum class PaintType { Default, DelayedCompress };
215 // This is a private enum class of PresShell, but currently,
216 // MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS isn't available in class definition.
217 // Therefore, we need to put this here.
218 enum class RenderingStateFlags : uint8_t {
219 None = 0,
220 IgnoringViewportScrolling = 1 << 0,
221 DrawWindowNotFlushing = 1 << 1,
224 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RenderingStateFlags)
226 #ifdef DEBUG
228 enum class VerifyReflowFlags {
229 None = 0,
230 On = 1 << 0,
231 Noisy = 1 << 1,
232 All = 1 << 2,
233 DumpCommands = 1 << 3,
234 NoisyCommands = 1 << 4,
235 ReallyNoisyCommands = 1 << 5,
236 DuringResizeReflow = 1 << 6,
239 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(VerifyReflowFlags)
241 #endif // #ifdef DEBUG
243 } // namespace mozilla
245 #endif // #ifndef mozilla_PresShellForwards_h