Line data Source code
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
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : /* struct containing the input to nsIFrame::Reflow */
7 :
8 : #ifndef mozilla_ReflowInput_h
9 : #define mozilla_ReflowInput_h
10 :
11 : #include "nsMargin.h"
12 : #include "nsStyleCoord.h"
13 : #include "nsIFrame.h"
14 : #include "mozilla/Assertions.h"
15 : #include <algorithm>
16 :
17 : class gfxContext;
18 : class nsFloatManager;
19 : struct nsHypotheticalPosition;
20 : class nsIPercentBSizeObserver;
21 : class nsLineLayout;
22 : class nsPlaceholderFrame;
23 : class nsPresContext;
24 :
25 : /**
26 : * @return aValue clamped to [aMinValue, aMaxValue].
27 : *
28 : * @note This function needs to handle aMinValue > aMaxValue. In that case,
29 : * aMinValue is returned.
30 : * @see http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
31 : * @see http://www.w3.org/TR/CSS21/visudet.html#min-max-heights
32 : */
33 : template <class NumericType>
34 : NumericType
35 224 : NS_CSS_MINMAX(NumericType aValue, NumericType aMinValue, NumericType aMaxValue)
36 : {
37 224 : NumericType result = aValue;
38 224 : if (aMaxValue < result)
39 0 : result = aMaxValue;
40 224 : if (aMinValue > result)
41 0 : result = aMinValue;
42 224 : return result;
43 : }
44 :
45 : /**
46 : * CSS Frame type. Included as part of the reflow state.
47 : */
48 : typedef uint32_t nsCSSFrameType;
49 :
50 : #define NS_CSS_FRAME_TYPE_UNKNOWN 0
51 : #define NS_CSS_FRAME_TYPE_INLINE 1
52 : #define NS_CSS_FRAME_TYPE_BLOCK 2 /* block-level in normal flow */
53 : #define NS_CSS_FRAME_TYPE_FLOATING 3
54 : #define NS_CSS_FRAME_TYPE_ABSOLUTE 4
55 : #define NS_CSS_FRAME_TYPE_INTERNAL_TABLE 5 /* row group frame, row frame, cell frame, ... */
56 :
57 : /**
58 : * Bit-flag that indicates whether the element is replaced. Applies to inline,
59 : * block-level, floating, and absolutely positioned elements
60 : */
61 : #define NS_CSS_FRAME_TYPE_REPLACED 0x08000
62 :
63 : /**
64 : * Bit-flag that indicates that the element is replaced and contains a block
65 : * (eg some form controls). Applies to inline, block-level, floating, and
66 : * absolutely positioned elements. Mutually exclusive with
67 : * NS_CSS_FRAME_TYPE_REPLACED.
68 : */
69 : #define NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK 0x10000
70 :
71 : /**
72 : * Helper macros for telling whether items are replaced
73 : */
74 : #define NS_FRAME_IS_REPLACED_NOBLOCK(_ft) \
75 : (NS_CSS_FRAME_TYPE_REPLACED == ((_ft) & NS_CSS_FRAME_TYPE_REPLACED))
76 :
77 : #define NS_FRAME_IS_REPLACED(_ft) \
78 : (NS_FRAME_IS_REPLACED_NOBLOCK(_ft) || \
79 : NS_FRAME_IS_REPLACED_CONTAINS_BLOCK(_ft))
80 :
81 : #define NS_FRAME_REPLACED(_ft) \
82 : (NS_CSS_FRAME_TYPE_REPLACED | (_ft))
83 :
84 : #define NS_FRAME_IS_REPLACED_CONTAINS_BLOCK(_ft) \
85 : (NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK == \
86 : ((_ft) & NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK))
87 :
88 : #define NS_FRAME_REPLACED_CONTAINS_BLOCK(_ft) \
89 : (NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK | (_ft))
90 :
91 : /**
92 : * A macro to extract the type. Masks off the 'replaced' bit-flag
93 : */
94 : #define NS_FRAME_GET_TYPE(_ft) \
95 : ((_ft) & ~(NS_CSS_FRAME_TYPE_REPLACED | \
96 : NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK))
97 :
98 : namespace mozilla {
99 :
100 : // A base class of ReflowInput that computes only the padding,
101 : // border, and margin, since those values are needed more often.
102 23 : struct SizeComputationInput {
103 : public:
104 : typedef mozilla::WritingMode WritingMode;
105 : typedef mozilla::LogicalMargin LogicalMargin;
106 :
107 : // The frame being reflowed.
108 : nsIFrame* mFrame;
109 :
110 : // Rendering context to use for measurement.
111 : gfxContext* mRenderingContext;
112 :
113 0 : const nsMargin& ComputedPhysicalMargin() const { return mComputedMargin; }
114 461 : const nsMargin& ComputedPhysicalBorderPadding() const { return mComputedBorderPadding; }
115 533 : const nsMargin& ComputedPhysicalPadding() const { return mComputedPadding; }
116 :
117 : // We may need to eliminate the (few) users of these writable-reference accessors
118 : // as part of migrating to logical coordinates.
119 1759 : nsMargin& ComputedPhysicalMargin() { return mComputedMargin; }
120 1797 : nsMargin& ComputedPhysicalBorderPadding() { return mComputedBorderPadding; }
121 2212 : nsMargin& ComputedPhysicalPadding() { return mComputedPadding; }
122 :
123 1053 : const LogicalMargin ComputedLogicalMargin() const
124 1053 : { return LogicalMargin(mWritingMode, mComputedMargin); }
125 3147 : const LogicalMargin ComputedLogicalBorderPadding() const
126 3147 : { return LogicalMargin(mWritingMode, mComputedBorderPadding); }
127 1144 : const LogicalMargin ComputedLogicalPadding() const
128 1144 : { return LogicalMargin(mWritingMode, mComputedPadding); }
129 :
130 77 : void SetComputedLogicalMargin(mozilla::WritingMode aWM,
131 : const LogicalMargin& aMargin)
132 77 : { mComputedMargin = aMargin.GetPhysicalMargin(aWM); }
133 77 : void SetComputedLogicalMargin(const LogicalMargin& aMargin)
134 77 : { SetComputedLogicalMargin(mWritingMode, aMargin); }
135 :
136 0 : void SetComputedLogicalBorderPadding(mozilla::WritingMode aWM,
137 : const LogicalMargin& aMargin)
138 0 : { mComputedBorderPadding = aMargin.GetPhysicalMargin(aWM); }
139 0 : void SetComputedLogicalBorderPadding(const LogicalMargin& aMargin)
140 0 : { SetComputedLogicalBorderPadding(mWritingMode, aMargin); }
141 :
142 0 : void SetComputedLogicalPadding(mozilla::WritingMode aWM,
143 : const LogicalMargin& aMargin)
144 0 : { mComputedPadding = aMargin.GetPhysicalMargin(aWM); }
145 : void SetComputedLogicalPadding(const LogicalMargin& aMargin)
146 : { SetComputedLogicalPadding(mWritingMode, aMargin); }
147 :
148 7412 : WritingMode GetWritingMode() const { return mWritingMode; }
149 :
150 : protected:
151 : // cached copy of the frame's writing-mode, for logical coordinates
152 : WritingMode mWritingMode;
153 :
154 : // These are PHYSICAL coordinates (for now).
155 : // Will probably become logical in due course.
156 :
157 : // Computed margin values
158 : nsMargin mComputedMargin;
159 :
160 : // Cached copy of the border + padding values
161 : nsMargin mComputedBorderPadding;
162 :
163 : // Computed padding values
164 : nsMargin mComputedPadding;
165 :
166 : public:
167 : // Callers using this constructor must call InitOffsets on their own.
168 723 : SizeComputationInput(nsIFrame *aFrame, gfxContext *aRenderingContext)
169 723 : : mFrame(aFrame)
170 : , mRenderingContext(aRenderingContext)
171 723 : , mWritingMode(aFrame->GetWritingMode())
172 : {
173 723 : }
174 :
175 : SizeComputationInput(nsIFrame *aFrame, gfxContext *aRenderingContext,
176 : mozilla::WritingMode aContainingBlockWritingMode,
177 : nscoord aContainingBlockISize);
178 :
179 : struct ReflowInputFlags {
180 200 : ReflowInputFlags() { memset(this, 0, sizeof(*this)); }
181 : bool mSpecialBSizeReflow : 1; // used by tables to communicate special reflow (in process) to handle
182 : // percent bsize frames inside cells which may not have computed bsizes
183 : bool mNextInFlowUntouched : 1; // nothing in the frame's next-in-flow (or its descendants)
184 : // is changing
185 : bool mIsTopOfPage : 1; // Is the current context at the top of a
186 : // page? When true, we force something
187 : // that's too tall for a page/column to
188 : // fit anyway to avoid infinite loops.
189 : bool mAssumingHScrollbar : 1; // parent frame is an nsIScrollableFrame and it
190 : // is assuming a horizontal scrollbar
191 : bool mAssumingVScrollbar : 1; // parent frame is an nsIScrollableFrame and it
192 : // is assuming a vertical scrollbar
193 :
194 : bool mIsIResize : 1; // Is frame (a) not dirty and (b) a
195 : // different inline-size than before?
196 :
197 : bool mIsBResize : 1; // Is frame (a) not dirty and (b) a
198 : // different block-size than before or
199 : // (potentially) in a context where
200 : // percent block-sizes have a different
201 : // basis?
202 : bool mTableIsSplittable : 1; // tables are splittable, this should happen only inside a page
203 : // and never insider a column frame
204 : bool mHeightDependsOnAncestorCell : 1; // Does frame height depend on
205 : // an ancestor table-cell?
206 : bool mIsColumnBalancing : 1; // nsColumnSetFrame is balancing columns
207 : bool mIsFlexContainerMeasuringHeight : 1; // nsFlexContainerFrame is
208 : // reflowing this child to
209 : // measure its intrinsic height.
210 : bool mDummyParentReflowInput : 1; // a "fake" reflow state made
211 : // in order to be the parent
212 : // of a real one
213 : bool mMustReflowPlaceholders : 1; // Should this frame reflow its place-
214 : // holder children? If the available
215 : // height of this frame didn't change,
216 : // but its in a paginated environment
217 : // (e.g. columns), it should always
218 : // reflow its placeholder children.
219 : bool mShrinkWrap : 1; // stores the COMPUTE_SIZE_SHRINK_WRAP ctor flag
220 : bool mUseAutoBSize : 1; // stores the COMPUTE_SIZE_USE_AUTO_BSIZE ctor flag
221 : bool mStaticPosIsCBOrigin : 1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
222 : bool mIClampMarginBoxMinSize : 1; // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag
223 : bool mBClampMarginBoxMinSize : 1; // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag
224 : bool mApplyAutoMinSize : 1; // the I_APPLY_AUTO_MIN_SIZE ctor flag
225 :
226 : // If set, the following two flags indicate that:
227 : // (1) this frame is absolutely-positioned (or fixed-positioned).
228 : // (2) this frame's static position depends on the CSS Box Alignment.
229 : // (3) we do need to compute the static position, because the frame's
230 : // {Inline and/or Block} offsets actually depend on it.
231 : // When these bits are set, the offset values (IStart/IEnd, BStart/BEnd)
232 : // represent the "start" edge of the frame's CSS Box Alignment container
233 : // area, in that axis -- and these offsets need to be further-resolved
234 : // (with CSS Box Alignment) after we know the OOF frame's size.
235 : // NOTE: The "I" and "B" (for "Inline" and "Block") refer the axes of the
236 : // *containing block's writing-mode*, NOT mFrame's own writing-mode. This
237 : // is purely for convenience, since that's the writing-mode we're dealing
238 : // with when we set & react to these bits.
239 : bool mIOffsetsNeedCSSAlign : 1;
240 : bool mBOffsetsNeedCSSAlign : 1;
241 : };
242 :
243 : #ifdef DEBUG
244 : // Reflow trace methods. Defined in nsFrame.cpp so they have access
245 : // to the display-reflow infrastructure.
246 : static void* DisplayInitOffsetsEnter(
247 : nsIFrame* aFrame,
248 : SizeComputationInput* aState,
249 : const mozilla::LogicalSize& aPercentBasis,
250 : WritingMode aCBWritingMode,
251 : const nsMargin* aBorder,
252 : const nsMargin* aPadding);
253 : static void DisplayInitOffsetsExit(nsIFrame* aFrame,
254 : SizeComputationInput* aState,
255 : void* aValue);
256 : #endif
257 :
258 : private:
259 : /**
260 : * Computes margin values from the specified margin style information, and
261 : * fills in the mComputedMargin member.
262 : *
263 : * @param aWM Writing mode of the containing block
264 : * @param aPercentBasis
265 : * Logical size in the writing mode of the containing block to use
266 : * for resolving percentage margin values in the inline and block
267 : * axes.
268 : * The inline size is usually the containing block inline-size
269 : * (width if writing mode is horizontal, and height if vertical).
270 : * The block size is usually the containing block inline-size, per
271 : * CSS21 sec 8.3 (read in conjunction with CSS Writing Modes sec
272 : * 7.2), but may be the containing block block-size, e.g. in CSS3
273 : * Flexbox and Grid.
274 : * @return true if the margin is dependent on the containing block size.
275 : */
276 : bool ComputeMargin(mozilla::WritingMode aWM,
277 : const mozilla::LogicalSize& aPercentBasis);
278 :
279 : /**
280 : * Computes padding values from the specified padding style information, and
281 : * fills in the mComputedPadding member.
282 : *
283 : * @param aWM Writing mode of the containing block
284 : * @param aPercentBasis
285 : * Logical size in the writing mode of the containing block to use
286 : * for resolving percentage padding values in the inline and block
287 : * axes.
288 : * The inline size is usually the containing block inline-size
289 : * (width if writing mode is horizontal, and height if vertical).
290 : * The block size is usually the containing block inline-size, per
291 : * CSS21 sec 8.3 (read in conjunction with CSS Writing Modes sec
292 : * 7.2), but may be the containing block block-size, e.g. in CSS3
293 : * Flexbox and Grid.
294 : * @return true if the padding is dependent on the containing block size.
295 : */
296 : bool ComputePadding(mozilla::WritingMode aWM,
297 : const mozilla::LogicalSize& aPercentBasis,
298 : mozilla::LayoutFrameType aFrameType);
299 :
300 : protected:
301 : void InitOffsets(mozilla::WritingMode aWM,
302 : const mozilla::LogicalSize& aPercentBasis,
303 : mozilla::LayoutFrameType aFrameType,
304 : ReflowInputFlags aFlags,
305 : const nsMargin* aBorder = nullptr,
306 : const nsMargin* aPadding = nullptr,
307 : const nsStyleDisplay* aDisplay = nullptr);
308 :
309 : /*
310 : * Convert nsStyleCoord to nscoord when percentages depend on the
311 : * inline size of the containing block, and enumerated values are for
312 : * inline size, min-inline-size, or max-inline-size. Does not handle
313 : * auto inline sizes.
314 : */
315 : inline nscoord ComputeISizeValue(nscoord aContainingBlockISize,
316 : nscoord aContentEdgeToBoxSizing,
317 : nscoord aBoxSizingToMarginEdge,
318 : const nsStyleCoord& aCoord) const;
319 : // same as previous, but using mComputedBorderPadding, mComputedPadding,
320 : // and mComputedMargin
321 : nscoord ComputeISizeValue(nscoord aContainingBlockISize,
322 : mozilla::StyleBoxSizing aBoxSizing,
323 : const nsStyleCoord& aCoord) const;
324 :
325 : nscoord ComputeBSizeValue(nscoord aContainingBlockBSize,
326 : mozilla::StyleBoxSizing aBoxSizing,
327 : const nsStyleCoord& aCoord) const;
328 : };
329 :
330 : /**
331 : * State passed to a frame during reflow or intrinsic size calculation.
332 : *
333 : * XXX Refactor so only a base class (nsSizingState?) is used for intrinsic
334 : * size calculation.
335 : *
336 : * @see nsIFrame#Reflow()
337 : */
338 23 : struct ReflowInput : public SizeComputationInput {
339 : // the reflow states are linked together. this is the pointer to the
340 : // parent's reflow state
341 : const ReflowInput* mParentReflowInput;
342 :
343 : // A non-owning pointer to the float manager associated with this area,
344 : // which points to the object owned by nsAutoFloatManager::mNew.
345 : nsFloatManager* mFloatManager;
346 :
347 : // LineLayout object (only for inline reflow; set to nullptr otherwise)
348 : nsLineLayout* mLineLayout;
349 :
350 : // The appropriate reflow state for the containing block (for
351 : // percentage widths, etc.) of this reflow state's frame.
352 : MOZ_INIT_OUTSIDE_CTOR
353 : const ReflowInput *mCBReflowInput;
354 :
355 : // The type of frame, from css's perspective. This value is
356 : // initialized by the Init method below.
357 : MOZ_INIT_OUTSIDE_CTOR
358 : nsCSSFrameType mFrameType;
359 :
360 : // The amount the in-flow position of the block is moving vertically relative
361 : // to its previous in-flow position (i.e. the amount the line containing the
362 : // block is moving).
363 : // This should be zero for anything which is not a block outside, and it
364 : // should be zero for anything which has a non-block parent.
365 : // The intended use of this value is to allow the accurate determination
366 : // of the potential impact of a float
367 : // This takes on an arbitrary value the first time a block is reflowed
368 : nscoord mBlockDelta;
369 :
370 : // If an ReflowInput finds itself initialized with an unconstrained
371 : // inline-size, it will look up its parentReflowInput chain for a state
372 : // with an orthogonal writing mode and a non-NS_UNCONSTRAINEDSIZE value for
373 : // orthogonal limit; when it finds such a reflow-state, it will use its
374 : // orthogonal-limit value to constrain inline-size.
375 : // This is initialized to NS_UNCONSTRAINEDSIZE (so it will be ignored),
376 : // but reset to a suitable value for the reflow root by nsPresShell.
377 : nscoord mOrthogonalLimit;
378 :
379 : // Accessors for the private fields below. Forcing all callers to use these
380 : // will allow us to introduce logical-coordinate versions and gradually
381 : // change clients from physical to logical as needed; and potentially switch
382 : // the internal fields from physical to logical coordinates in due course,
383 : // while maintaining compatibility with not-yet-updated code.
384 4 : nscoord AvailableWidth() const { return mAvailableWidth; }
385 4 : nscoord AvailableHeight() const { return mAvailableHeight; }
386 716 : nscoord ComputedWidth() const { return mComputedWidth; }
387 728 : nscoord ComputedHeight() const { return mComputedHeight; }
388 139 : nscoord ComputedMinWidth() const { return mComputedMinWidth; }
389 185 : nscoord ComputedMaxWidth() const { return mComputedMaxWidth; }
390 270 : nscoord ComputedMinHeight() const { return mComputedMinHeight; }
391 187 : nscoord ComputedMaxHeight() const { return mComputedMaxHeight; }
392 :
393 0 : nscoord& AvailableWidth() { return mAvailableWidth; }
394 0 : nscoord& AvailableHeight() { return mAvailableHeight; }
395 351 : nscoord& ComputedWidth() { return mComputedWidth; }
396 839 : nscoord& ComputedHeight() { return mComputedHeight; }
397 255 : nscoord& ComputedMinWidth() { return mComputedMinWidth; }
398 255 : nscoord& ComputedMaxWidth() { return mComputedMaxWidth; }
399 255 : nscoord& ComputedMinHeight() { return mComputedMinHeight; }
400 255 : nscoord& ComputedMaxHeight() { return mComputedMaxHeight; }
401 :
402 : // ISize and BSize are logical-coordinate dimensions:
403 : // ISize is the size in the writing mode's inline direction (which equates to
404 : // width in horizontal writing modes, height in vertical ones), and BSize is
405 : // the size in the block-progression direction.
406 499 : nscoord AvailableISize() const
407 499 : { return mWritingMode.IsVertical() ? mAvailableHeight : mAvailableWidth; }
408 2652 : nscoord AvailableBSize() const
409 2652 : { return mWritingMode.IsVertical() ? mAvailableWidth : mAvailableHeight; }
410 1217 : nscoord ComputedISize() const
411 1217 : { return mWritingMode.IsVertical() ? mComputedHeight : mComputedWidth; }
412 1707 : nscoord ComputedBSize() const
413 1707 : { return mWritingMode.IsVertical() ? mComputedWidth : mComputedHeight; }
414 0 : nscoord ComputedMinISize() const
415 0 : { return mWritingMode.IsVertical() ? mComputedMinHeight : mComputedMinWidth; }
416 0 : nscoord ComputedMaxISize() const
417 0 : { return mWritingMode.IsVertical() ? mComputedMaxHeight : mComputedMaxWidth; }
418 363 : nscoord ComputedMinBSize() const
419 363 : { return mWritingMode.IsVertical() ? mComputedMinWidth : mComputedMinHeight; }
420 291 : nscoord ComputedMaxBSize() const
421 291 : { return mWritingMode.IsVertical() ? mComputedMaxWidth : mComputedMaxHeight; }
422 :
423 2021 : nscoord& AvailableISize()
424 2021 : { return mWritingMode.IsVertical() ? mAvailableHeight : mAvailableWidth; }
425 1111 : nscoord& AvailableBSize()
426 1111 : { return mWritingMode.IsVertical() ? mAvailableWidth : mAvailableHeight; }
427 2603 : nscoord& ComputedISize()
428 2603 : { return mWritingMode.IsVertical() ? mComputedHeight : mComputedWidth; }
429 2540 : nscoord& ComputedBSize()
430 2540 : { return mWritingMode.IsVertical() ? mComputedWidth : mComputedHeight; }
431 794 : nscoord& ComputedMinISize()
432 794 : { return mWritingMode.IsVertical() ? mComputedMinHeight : mComputedMinWidth; }
433 794 : nscoord& ComputedMaxISize()
434 794 : { return mWritingMode.IsVertical() ? mComputedMaxHeight : mComputedMaxWidth; }
435 921 : nscoord& ComputedMinBSize()
436 921 : { return mWritingMode.IsVertical() ? mComputedMinWidth : mComputedMinHeight; }
437 921 : nscoord& ComputedMaxBSize()
438 921 : { return mWritingMode.IsVertical() ? mComputedMaxWidth : mComputedMaxHeight; }
439 :
440 367 : mozilla::LogicalSize AvailableSize() const {
441 734 : return mozilla::LogicalSize(mWritingMode,
442 734 : AvailableISize(), AvailableBSize());
443 : }
444 604 : mozilla::LogicalSize ComputedSize() const {
445 1208 : return mozilla::LogicalSize(mWritingMode,
446 1208 : ComputedISize(), ComputedBSize());
447 : }
448 0 : mozilla::LogicalSize ComputedMinSize() const {
449 0 : return mozilla::LogicalSize(mWritingMode,
450 0 : ComputedMinISize(), ComputedMinBSize());
451 : }
452 0 : mozilla::LogicalSize ComputedMaxSize() const {
453 0 : return mozilla::LogicalSize(mWritingMode,
454 0 : ComputedMaxISize(), ComputedMaxBSize());
455 : }
456 :
457 367 : mozilla::LogicalSize AvailableSize(mozilla::WritingMode aWM) const
458 367 : { return AvailableSize().ConvertTo(aWM, mWritingMode); }
459 284 : mozilla::LogicalSize ComputedSize(mozilla::WritingMode aWM) const
460 284 : { return ComputedSize().ConvertTo(aWM, mWritingMode); }
461 0 : mozilla::LogicalSize ComputedMinSize(mozilla::WritingMode aWM) const
462 0 : { return ComputedMinSize().ConvertTo(aWM, mWritingMode); }
463 0 : mozilla::LogicalSize ComputedMaxSize(mozilla::WritingMode aWM) const
464 0 : { return ComputedMaxSize().ConvertTo(aWM, mWritingMode); }
465 :
466 36 : mozilla::LogicalSize ComputedSizeWithPadding() const {
467 36 : mozilla::WritingMode wm = GetWritingMode();
468 108 : return mozilla::LogicalSize(wm,
469 36 : ComputedISize() +
470 72 : ComputedLogicalPadding().IStartEnd(wm),
471 36 : ComputedBSize() +
472 108 : ComputedLogicalPadding().BStartEnd(wm));
473 : }
474 :
475 36 : mozilla::LogicalSize ComputedSizeWithPadding(mozilla::WritingMode aWM) const {
476 36 : return ComputedSizeWithPadding().ConvertTo(aWM, GetWritingMode());
477 : }
478 :
479 4 : mozilla::LogicalSize ComputedSizeWithBorderPadding() const {
480 4 : mozilla::WritingMode wm = GetWritingMode();
481 12 : return mozilla::LogicalSize(wm,
482 4 : ComputedISize() +
483 8 : ComputedLogicalBorderPadding().IStartEnd(wm),
484 4 : ComputedBSize() +
485 12 : ComputedLogicalBorderPadding().BStartEnd(wm));
486 : }
487 :
488 : mozilla::LogicalSize
489 0 : ComputedSizeWithBorderPadding(mozilla::WritingMode aWM) const {
490 0 : return ComputedSizeWithBorderPadding().ConvertTo(aWM, GetWritingMode());
491 : }
492 :
493 : mozilla::LogicalSize
494 0 : ComputedSizeWithMarginBorderPadding() const {
495 0 : mozilla::WritingMode wm = GetWritingMode();
496 0 : return mozilla::LogicalSize(wm,
497 0 : ComputedISize() +
498 0 : ComputedLogicalMargin().IStartEnd(wm) +
499 0 : ComputedLogicalBorderPadding().IStartEnd(wm),
500 0 : ComputedBSize() +
501 0 : ComputedLogicalMargin().BStartEnd(wm) +
502 0 : ComputedLogicalBorderPadding().BStartEnd(wm));
503 : }
504 :
505 : mozilla::LogicalSize
506 0 : ComputedSizeWithMarginBorderPadding(mozilla::WritingMode aWM) const {
507 0 : return ComputedSizeWithMarginBorderPadding().ConvertTo(aWM,
508 0 : GetWritingMode());
509 : }
510 :
511 : nsSize
512 45 : ComputedPhysicalSize() const {
513 45 : return nsSize(ComputedWidth(), ComputedHeight());
514 : }
515 :
516 : // XXX this will need to change when we make mComputedOffsets logical;
517 : // we won't be able to return a reference for the physical offsets
518 : const nsMargin& ComputedPhysicalOffsets() const { return mComputedOffsets; }
519 652 : nsMargin& ComputedPhysicalOffsets() { return mComputedOffsets; }
520 :
521 286 : const LogicalMargin ComputedLogicalOffsets() const
522 286 : { return LogicalMargin(mWritingMode, mComputedOffsets); }
523 :
524 154 : void SetComputedLogicalOffsets(const LogicalMargin& aOffsets)
525 154 : { mComputedOffsets = aOffsets.GetPhysicalMargin(mWritingMode); }
526 :
527 : // Return the state's computed size including border-padding, with
528 : // unconstrained dimensions replaced by zero.
529 77 : nsSize ComputedSizeAsContainerIfConstrained() const {
530 77 : const nscoord wd = ComputedWidth();
531 77 : const nscoord ht = ComputedHeight();
532 308 : return nsSize(wd == NS_UNCONSTRAINEDSIZE
533 77 : ? 0 : wd + ComputedPhysicalBorderPadding().LeftRight(),
534 : ht == NS_UNCONSTRAINEDSIZE
535 231 : ? 0 : ht + ComputedPhysicalBorderPadding().TopBottom());
536 : }
537 :
538 : private:
539 : // the available width in which to reflow the frame. The space
540 : // represents the amount of room for the frame's margin, border,
541 : // padding, and content area. The frame size you choose should fit
542 : // within the available width.
543 : nscoord mAvailableWidth;
544 :
545 : // A value of NS_UNCONSTRAINEDSIZE for the available height means
546 : // you can choose whatever size you want. In galley mode the
547 : // available height is always NS_UNCONSTRAINEDSIZE, and only page
548 : // mode or multi-column layout involves a constrained height. The
549 : // element's the top border and padding, and content, must fit. If the
550 : // element is complete after reflow then its bottom border, padding
551 : // and margin (and similar for its complete ancestors) will need to
552 : // fit in this height.
553 : nscoord mAvailableHeight;
554 :
555 : // The computed width specifies the frame's content area width, and it does
556 : // not apply to inline non-replaced elements
557 : //
558 : // For replaced inline frames, a value of NS_INTRINSICSIZE means you should
559 : // use your intrinsic width as the computed width
560 : //
561 : // For block-level frames, the computed width is based on the width of the
562 : // containing block, the margin/border/padding areas, and the min/max width.
563 : MOZ_INIT_OUTSIDE_CTOR
564 : nscoord mComputedWidth;
565 :
566 : // The computed height specifies the frame's content height, and it does
567 : // not apply to inline non-replaced elements
568 : //
569 : // For replaced inline frames, a value of NS_INTRINSICSIZE means you should
570 : // use your intrinsic height as the computed height
571 : //
572 : // For non-replaced block-level frames in the flow and floated, a value of
573 : // NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
574 : // flow child frames. The height must be within the limit of the min/max
575 : // height if there is such a limit
576 : //
577 : // For replaced block-level frames, a value of NS_INTRINSICSIZE
578 : // means you use your intrinsic height as the computed height
579 : MOZ_INIT_OUTSIDE_CTOR
580 : nscoord mComputedHeight;
581 :
582 : // Computed values for 'left/top/right/bottom' offsets. Only applies to
583 : // 'positioned' elements. These are PHYSICAL coordinates (for now).
584 : nsMargin mComputedOffsets;
585 :
586 : // Computed values for 'min-width/max-width' and 'min-height/max-height'
587 : // XXXldb The width ones here should go; they should be needed only
588 : // internally.
589 : MOZ_INIT_OUTSIDE_CTOR
590 : nscoord mComputedMinWidth, mComputedMaxWidth;
591 : MOZ_INIT_OUTSIDE_CTOR
592 : nscoord mComputedMinHeight, mComputedMaxHeight;
593 :
594 : public:
595 : // Our saved containing block dimensions.
596 : MOZ_INIT_OUTSIDE_CTOR
597 : LogicalSize mContainingBlockSize;
598 :
599 : // Cached pointers to the various style structs used during intialization
600 : MOZ_INIT_OUTSIDE_CTOR
601 : const nsStyleDisplay* mStyleDisplay;
602 : MOZ_INIT_OUTSIDE_CTOR
603 : const nsStyleVisibility* mStyleVisibility;
604 : MOZ_INIT_OUTSIDE_CTOR
605 : const nsStylePosition* mStylePosition;
606 : MOZ_INIT_OUTSIDE_CTOR
607 : const nsStyleBorder* mStyleBorder;
608 : MOZ_INIT_OUTSIDE_CTOR
609 : const nsStyleMargin* mStyleMargin;
610 : MOZ_INIT_OUTSIDE_CTOR
611 : const nsStylePadding* mStylePadding;
612 : MOZ_INIT_OUTSIDE_CTOR
613 : const nsStyleText* mStyleText;
614 :
615 : bool IsFloating() const;
616 :
617 : mozilla::StyleDisplay GetDisplay() const;
618 :
619 : // a frame (e.g. nsTableCellFrame) which may need to generate a special
620 : // reflow for percent bsize calculations
621 : nsIPercentBSizeObserver* mPercentBSizeObserver;
622 :
623 : // CSS margin collapsing sometimes requires us to reflow
624 : // optimistically assuming that margins collapse to see if clearance
625 : // is required. When we discover that clearance is required, we
626 : // store the frame in which clearance was discovered to the location
627 : // requested here.
628 : nsIFrame** mDiscoveredClearance;
629 :
630 : ReflowInputFlags mFlags;
631 :
632 : // This value keeps track of how deeply nested a given reflow state
633 : // is from the top of the frame tree.
634 : int16_t mReflowDepth;
635 :
636 : // Logical and physical accessors for the resize flags. All users should go
637 : // via these accessors, so that in due course we can change the storage from
638 : // physical to logical.
639 0 : bool IsHResize() const {
640 0 : return mWritingMode.IsVertical() ? mFlags.mIsBResize : mFlags.mIsIResize;
641 : }
642 0 : bool IsVResize() const {
643 0 : return mWritingMode.IsVertical() ? mFlags.mIsIResize : mFlags.mIsBResize;
644 : }
645 605 : bool IsIResize() const {
646 605 : return mFlags.mIsIResize;
647 : }
648 1791 : bool IsBResize() const {
649 1791 : return mFlags.mIsBResize;
650 : }
651 721 : bool IsBResizeForWM(mozilla::WritingMode aWM) const {
652 721 : return aWM.IsOrthogonalTo(mWritingMode) ? mFlags.mIsIResize
653 721 : : mFlags.mIsBResize;
654 : }
655 31 : void SetHResize(bool aValue) {
656 31 : if (mWritingMode.IsVertical()) {
657 0 : mFlags.mIsBResize = aValue;
658 : } else {
659 31 : mFlags.mIsIResize = aValue;
660 : }
661 31 : }
662 65 : void SetVResize(bool aValue) {
663 65 : if (mWritingMode.IsVertical()) {
664 0 : mFlags.mIsIResize = aValue;
665 : } else {
666 65 : mFlags.mIsBResize = aValue;
667 : }
668 65 : }
669 2018 : void SetIResize(bool aValue) {
670 2018 : mFlags.mIsIResize = aValue;
671 2018 : }
672 2667 : void SetBResize(bool aValue) {
673 2667 : mFlags.mIsBResize = aValue;
674 2667 : }
675 :
676 : // Note: The copy constructor is written by the compiler automatically. You
677 : // can use that and then override specific values if you want, or you can
678 : // call Init as desired...
679 :
680 : /**
681 : * Initialize a ROOT reflow state.
682 : *
683 : * @param aPresContext Must be equal to aFrame->PresContext().
684 : * @param aFrame The frame for whose reflow state is being constructed.
685 : * @param aRenderingContext The rendering context to be used for measurements.
686 : * @param aAvailableSpace See comments for availableHeight and availableWidth
687 : * members.
688 : * @param aFlags A set of flags used for additional boolean parameters (see
689 : * below).
690 : */
691 : ReflowInput(nsPresContext* aPresContext,
692 : nsIFrame* aFrame,
693 : gfxContext* aRenderingContext,
694 : const mozilla::LogicalSize& aAvailableSpace,
695 : uint32_t aFlags = 0);
696 :
697 : /**
698 : * Initialize a reflow state for a child frame's reflow. Some parts of the
699 : * state are copied from the parent's reflow state. The remainder is computed.
700 : *
701 : * @param aPresContext Must be equal to aFrame->PresContext().
702 : * @param aParentReflowInput A reference to an ReflowInput object that
703 : * is to be the parent of this object.
704 : * @param aFrame The frame for whose reflow state is being constructed.
705 : * @param aAvailableSpace See comments for availableHeight and availableWidth
706 : * members.
707 : * @param aContainingBlockSize An optional size, in app units, specifying
708 : * the containing block size to use instead of the default which is
709 : * to use the aAvailableSpace.
710 : * @param aFlags A set of flags used for additional boolean parameters (see
711 : * below).
712 : */
713 : ReflowInput(nsPresContext* aPresContext,
714 : const ReflowInput& aParentReflowInput,
715 : nsIFrame* aFrame,
716 : const mozilla::LogicalSize& aAvailableSpace,
717 : const mozilla::LogicalSize* aContainingBlockSize = nullptr,
718 : uint32_t aFlags = 0);
719 :
720 : // Values for |aFlags| passed to constructor
721 : enum {
722 : // Indicates that the parent of this reflow state is "fake" (see
723 : // mDummyParentReflowInput in mFlags).
724 : DUMMY_PARENT_REFLOW_STATE = (1<<0),
725 :
726 : // Indicates that the calling function will initialize the reflow state, and
727 : // that the constructor should not call Init().
728 : CALLER_WILL_INIT = (1<<1),
729 :
730 : // The caller wants shrink-wrap behavior (i.e. ComputeSizeFlags::eShrinkWrap
731 : // will be passed to ComputeSize()).
732 : COMPUTE_SIZE_SHRINK_WRAP = (1<<2),
733 :
734 : // The caller wants 'auto' bsize behavior (ComputeSizeFlags::eUseAutoBSize
735 : // will be be passed to ComputeSize()).
736 : COMPUTE_SIZE_USE_AUTO_BSIZE = (1<<3),
737 :
738 : // The caller wants the abs.pos. static-position resolved at the origin of
739 : // the containing block, i.e. at LogicalPoint(0, 0). (Note that this
740 : // doesn't necessarily mean that (0, 0) is the *correct* static position
741 : // for the frame in question.)
742 : STATIC_POS_IS_CB_ORIGIN = (1<<4),
743 :
744 : // Pass ComputeSizeFlags::eIClampMarginBoxMinSize to ComputeSize().
745 : I_CLAMP_MARGIN_BOX_MIN_SIZE = (1<<5),
746 :
747 : // Pass ComputeSizeFlags::eBClampMarginBoxMinSize to ComputeSize().
748 : B_CLAMP_MARGIN_BOX_MIN_SIZE = (1<<6),
749 :
750 : // Pass ComputeSizeFlags::eIApplyAutoMinSize to ComputeSize().
751 : I_APPLY_AUTO_MIN_SIZE = (1<<7),
752 : };
753 :
754 : // This method initializes various data members. It is automatically
755 : // called by the various constructors
756 : void Init(nsPresContext* aPresContext,
757 : const mozilla::LogicalSize* aContainingBlockSize = nullptr,
758 : const nsMargin* aBorder = nullptr,
759 : const nsMargin* aPadding = nullptr);
760 :
761 : /**
762 : * Find the content isize of our containing block for the given writing mode,
763 : * which need not be the same as the reflow state's mode.
764 : */
765 : nscoord GetContainingBlockContentISize(mozilla::WritingMode aWritingMode) const;
766 :
767 : /**
768 : * Calculate the used line-height property. The return value will be >= 0.
769 : */
770 : nscoord CalcLineHeight() const;
771 :
772 : /**
773 : * Same as CalcLineHeight() above, but doesn't need a reflow state.
774 : *
775 : * @param aBlockBSize The computed block size of the content rect of the block
776 : * that the line should fill.
777 : * Only used with line-height:-moz-block-height.
778 : * NS_AUTOHEIGHT results in a normal line-height for
779 : * line-height:-moz-block-height.
780 : * @param aFontSizeInflation The result of the appropriate
781 : * nsLayoutUtils::FontSizeInflationFor call,
782 : * or 1.0 if during intrinsic size
783 : * calculation.
784 : */
785 : static nscoord CalcLineHeight(nsIContent* aContent,
786 : nsStyleContext* aStyleContext,
787 : nscoord aBlockBSize,
788 : float aFontSizeInflation);
789 :
790 :
791 : mozilla::LogicalSize ComputeContainingBlockRectangle(
792 : nsPresContext* aPresContext,
793 : const ReflowInput* aContainingBlockRI) const;
794 :
795 : /**
796 : * Apply the mComputed(Min/Max)Width constraints to the content
797 : * size computed so far.
798 : */
799 127 : nscoord ApplyMinMaxWidth(nscoord aWidth) const {
800 127 : if (NS_UNCONSTRAINEDSIZE != ComputedMaxWidth()) {
801 46 : aWidth = std::min(aWidth, ComputedMaxWidth());
802 : }
803 127 : return std::max(aWidth, ComputedMinWidth());
804 : }
805 :
806 : /**
807 : * Apply the mComputed(Min/Max)ISize constraints to the content
808 : * size computed so far.
809 : */
810 0 : nscoord ApplyMinMaxISize(nscoord aISize) const {
811 0 : if (NS_UNCONSTRAINEDSIZE != ComputedMaxISize()) {
812 0 : aISize = std::min(aISize, ComputedMaxISize());
813 : }
814 0 : return std::max(aISize, ComputedMinISize());
815 : }
816 :
817 : /**
818 : * Apply the mComputed(Min/Max)Height constraints to the content
819 : * size computed so far.
820 : *
821 : * @param aHeight The height that we've computed an to which we want to apply
822 : * min/max constraints.
823 : * @param aConsumed The amount of the computed height that was consumed by
824 : * our prev-in-flows.
825 : */
826 129 : nscoord ApplyMinMaxHeight(nscoord aHeight, nscoord aConsumed = 0) const {
827 129 : aHeight += aConsumed;
828 :
829 129 : if (NS_UNCONSTRAINEDSIZE != ComputedMaxHeight()) {
830 46 : aHeight = std::min(aHeight, ComputedMaxHeight());
831 : }
832 :
833 129 : if (NS_UNCONSTRAINEDSIZE != ComputedMinHeight()) {
834 129 : aHeight = std::max(aHeight, ComputedMinHeight());
835 : }
836 :
837 129 : return aHeight - aConsumed;
838 : }
839 :
840 : /**
841 : * Apply the mComputed(Min/Max)BSize constraints to the content
842 : * size computed so far.
843 : *
844 : * @param aBSize The block-size that we've computed an to which we want to apply
845 : * min/max constraints.
846 : * @param aConsumed The amount of the computed block-size that was consumed by
847 : * our prev-in-flows.
848 : */
849 118 : nscoord ApplyMinMaxBSize(nscoord aBSize, nscoord aConsumed = 0) const {
850 118 : aBSize += aConsumed;
851 :
852 118 : if (NS_UNCONSTRAINEDSIZE != ComputedMaxBSize()) {
853 46 : aBSize = std::min(aBSize, ComputedMaxBSize());
854 : }
855 :
856 118 : if (NS_UNCONSTRAINEDSIZE != ComputedMinBSize()) {
857 118 : aBSize = std::max(aBSize, ComputedMinBSize());
858 : }
859 :
860 118 : return aBSize - aConsumed;
861 : }
862 :
863 214 : bool ShouldReflowAllKids() const {
864 : // Note that we could make a stronger optimization for IsBResize if
865 : // we use it in a ShouldReflowChild test that replaces the current
866 : // checks of NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN, if it
867 : // were tested there along with NS_FRAME_CONTAINS_RELATIVE_BSIZE.
868 : // This would need to be combined with a slight change in which
869 : // frames NS_FRAME_CONTAINS_RELATIVE_BSIZE is marked on.
870 354 : return (mFrame->GetStateBits() & NS_FRAME_IS_DIRTY) ||
871 428 : IsIResize() ||
872 82 : (IsBResize() &&
873 216 : (mFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE));
874 : }
875 :
876 : // This method doesn't apply min/max computed widths to the value passed in.
877 : void SetComputedWidth(nscoord aComputedWidth);
878 :
879 : // This method doesn't apply min/max computed heights to the value passed in.
880 : void SetComputedHeight(nscoord aComputedHeight);
881 :
882 0 : void SetComputedISize(nscoord aComputedISize) {
883 0 : if (mWritingMode.IsVertical()) {
884 0 : SetComputedHeight(aComputedISize);
885 : } else {
886 0 : SetComputedWidth(aComputedISize);
887 : }
888 0 : }
889 :
890 289 : void SetComputedBSize(nscoord aComputedBSize) {
891 289 : if (mWritingMode.IsVertical()) {
892 0 : SetComputedWidth(aComputedBSize);
893 : } else {
894 289 : SetComputedHeight(aComputedBSize);
895 : }
896 289 : }
897 :
898 0 : void SetComputedBSizeWithoutResettingResizeFlags(nscoord aComputedBSize) {
899 : // Viewport frames reset the computed block size on a copy of their reflow
900 : // state when reflowing fixed-pos kids. In that case we actually don't
901 : // want to mess with the resize flags, because comparing the frame's rect
902 : // to the munged computed isize is pointless.
903 0 : ComputedBSize() = aComputedBSize;
904 0 : }
905 :
906 : void SetTruncated(const ReflowOutput& aMetrics, nsReflowStatus* aStatus) const;
907 :
908 95 : bool WillReflowAgainForClearance() const {
909 95 : return mDiscoveredClearance && *mDiscoveredClearance;
910 : }
911 :
912 : // Compute the offsets for a relative position element
913 : static void ComputeRelativeOffsets(mozilla::WritingMode aWM,
914 : nsIFrame* aFrame,
915 : const mozilla::LogicalSize& aCBSize,
916 : nsMargin& aComputedOffsets);
917 :
918 : // If a relatively positioned element, adjust the position appropriately.
919 : static void ApplyRelativePositioning(nsIFrame* aFrame,
920 : const nsMargin& aComputedOffsets,
921 : nsPoint* aPosition);
922 :
923 : void ApplyRelativePositioning(nsPoint* aPosition) const {
924 : ApplyRelativePositioning(mFrame, ComputedPhysicalOffsets(), aPosition);
925 : }
926 :
927 : static void
928 55 : ApplyRelativePositioning(nsIFrame* aFrame,
929 : mozilla::WritingMode aWritingMode,
930 : const mozilla::LogicalMargin& aComputedOffsets,
931 : mozilla::LogicalPoint* aPosition,
932 : const nsSize& aContainerSize) {
933 : // Subtract the size of the frame from the container size that we
934 : // use for converting between the logical and physical origins of
935 : // the frame. This accounts for the fact that logical origins in RTL
936 : // coordinate systems are at the top right of the frame instead of
937 : // the top left.
938 55 : nsSize frameSize = aFrame->GetSize();
939 : nsPoint pos = aPosition->GetPhysicalPoint(aWritingMode,
940 55 : aContainerSize - frameSize);
941 : ApplyRelativePositioning(aFrame,
942 110 : aComputedOffsets.GetPhysicalMargin(aWritingMode),
943 55 : &pos);
944 55 : *aPosition = mozilla::LogicalPoint(aWritingMode, pos,
945 110 : aContainerSize - frameSize);
946 55 : }
947 :
948 55 : void ApplyRelativePositioning(mozilla::LogicalPoint* aPosition,
949 : const nsSize& aContainerSize) const {
950 55 : ApplyRelativePositioning(mFrame, mWritingMode,
951 110 : ComputedLogicalOffsets(), aPosition,
952 55 : aContainerSize);
953 55 : }
954 :
955 : #ifdef DEBUG
956 : // Reflow trace methods. Defined in nsFrame.cpp so they have access
957 : // to the display-reflow infrastructure.
958 : static void* DisplayInitConstraintsEnter(nsIFrame* aFrame,
959 : ReflowInput* aState,
960 : nscoord aCBISize,
961 : nscoord aCBBSize,
962 : const nsMargin* aBorder,
963 : const nsMargin* aPadding);
964 : static void DisplayInitConstraintsExit(nsIFrame* aFrame,
965 : ReflowInput* aState,
966 : void* aValue);
967 : static void* DisplayInitFrameTypeEnter(nsIFrame* aFrame,
968 : ReflowInput* aState);
969 : static void DisplayInitFrameTypeExit(nsIFrame* aFrame,
970 : ReflowInput* aState,
971 : void* aValue);
972 : #endif
973 :
974 : protected:
975 : void InitFrameType(LayoutFrameType aFrameType);
976 : void InitCBReflowInput();
977 : void InitResizeFlags(nsPresContext* aPresContext,
978 : mozilla::LayoutFrameType aFrameType);
979 :
980 : void InitConstraints(nsPresContext* aPresContext,
981 : const mozilla::LogicalSize& aContainingBlockSize,
982 : const nsMargin* aBorder,
983 : const nsMargin* aPadding,
984 : mozilla::LayoutFrameType aFrameType);
985 :
986 : // Returns the nearest containing block or block frame (whether or not
987 : // it is a containing block) for the specified frame. Also returns
988 : // the inline-start edge and logical size of the containing block's
989 : // content area.
990 : // These are returned in the coordinate space of the containing block.
991 : nsIFrame* GetHypotheticalBoxContainer(nsIFrame* aFrame,
992 : nscoord& aCBIStartEdge,
993 : mozilla::LogicalSize& aCBSize) const;
994 :
995 : // Calculate a "hypothetical box" position where the placeholder frame
996 : // (for a position:fixed/absolute element) would have been placed if it were
997 : // positioned statically. The hypothetical box position will have a writing
998 : // mode with the same block direction as the absolute containing block
999 : // (cbrs->frame), though it may differ in inline direction.
1000 : void CalculateHypotheticalPosition(nsPresContext* aPresContext,
1001 : nsPlaceholderFrame* aPlaceholderFrame,
1002 : const ReflowInput* cbrs,
1003 : nsHypotheticalPosition& aHypotheticalPos,
1004 : mozilla::LayoutFrameType aFrameType) const;
1005 :
1006 : void InitAbsoluteConstraints(nsPresContext* aPresContext,
1007 : const ReflowInput* cbrs,
1008 : const mozilla::LogicalSize& aContainingBlockSize,
1009 : mozilla::LayoutFrameType aFrameType);
1010 :
1011 : // Calculates the computed values for the 'min-Width', 'max-Width',
1012 : // 'min-Height', and 'max-Height' properties, and stores them in the assorted
1013 : // data members
1014 : void ComputeMinMaxValues(const mozilla::LogicalSize& aContainingBlockSize);
1015 :
1016 : // aInsideBoxSizing returns the part of the padding, border, and margin
1017 : // in the aAxis dimension that goes inside the edge given by box-sizing;
1018 : // aOutsideBoxSizing returns the rest.
1019 : void CalculateBorderPaddingMargin(mozilla::LogicalAxis aAxis,
1020 : nscoord aContainingBlockSize,
1021 : nscoord* aInsideBoxSizing,
1022 : nscoord* aOutsideBoxSizing) const;
1023 :
1024 : void CalculateBlockSideMargins(LayoutFrameType aFrameType);
1025 : };
1026 :
1027 : } // namespace mozilla
1028 :
1029 : #endif // mozilla_ReflowInput_h
|