Backed out 5 changesets (bug 1731541) for causing multiple wpt failures. CLOSED TREE
[gecko.git] / layout / generic / nsLineLayout.h
blob1c265c9e9153befcc4cfc28516be704a079a18ee
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 /* state and methods used while laying out a single line of a block frame */
9 #ifndef nsLineLayout_h___
10 #define nsLineLayout_h___
12 #include "gfxTypes.h"
13 #include "gfxTextRun.h"
14 #include "JustificationUtils.h"
15 #include "mozilla/ArenaAllocator.h"
16 #include "mozilla/WritingModes.h"
17 #include "BlockReflowState.h"
18 #include "nsLineBox.h"
20 class nsFloatManager;
21 struct nsStyleText;
23 class nsLineLayout {
24 using BlockReflowState = mozilla::BlockReflowState;
25 using ReflowInput = mozilla::ReflowInput;
26 using ReflowOutput = mozilla::ReflowOutput;
28 public:
29 /**
30 * @param aBaseLineLayout the nsLineLayout for ruby base,
31 * nullptr if no separate base nsLineLayout is needed.
33 nsLineLayout(nsPresContext* aPresContext, nsFloatManager* aFloatManager,
34 const ReflowInput& aLineContainerRI,
35 const nsLineList::iterator* aLine,
36 nsLineLayout* aBaseLineLayout);
37 ~nsLineLayout();
39 void Init(BlockReflowState* aState, nscoord aMinLineBSize,
40 int32_t aLineNumber) {
41 mBlockRS = aState;
42 mMinLineBSize = aMinLineBSize;
43 mLineNumber = aLineNumber;
46 int32_t GetLineNumber() const { return mLineNumber; }
48 void BeginLineReflow(nscoord aICoord, nscoord aBCoord, nscoord aISize,
49 nscoord aBSize, bool aImpactedByFloats,
50 bool aIsTopOfPage, mozilla::WritingMode aWritingMode,
51 const nsSize& aContainerSize);
53 void EndLineReflow();
55 /**
56 * Called when a float has been placed. This method updates the
57 * inline frame and span data to account for any change in positions
58 * due to available space for the line boxes changing.
59 * @param aX/aY/aWidth/aHeight are the new available
60 * space rectangle, relative to the containing block.
61 * @param aFloatFrame the float frame that was placed.
63 void UpdateBand(mozilla::WritingMode aWM,
64 const mozilla::LogicalRect& aNewAvailableSpace,
65 nsIFrame* aFloatFrame);
67 void BeginSpan(nsIFrame* aFrame, const ReflowInput* aSpanReflowInput,
68 nscoord aLeftEdge, nscoord aRightEdge, nscoord* aBaseline);
70 // Returns the width of the span
71 nscoord EndSpan(nsIFrame* aFrame);
73 // This method attaches the last frame reflowed in this line layout
74 // to that in the base line layout.
75 void AttachLastFrameToBaseLineLayout() {
76 AttachFrameToBaseLineLayout(LastFrame());
79 // This method attaches the root frame of this line layout to the
80 // last reflowed frame in the base line layout.
81 void AttachRootFrameToBaseLineLayout() {
82 AttachFrameToBaseLineLayout(mRootSpan->mFrame);
85 int32_t GetCurrentSpanCount() const;
87 void SplitLineTo(int32_t aNewCount);
89 bool IsZeroBSize();
91 // Reflows the frame and returns the reflow status. aPushedFrame is true
92 // if the frame is pushed to the next line because it doesn't fit.
93 void ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
94 ReflowOutput* aMetrics, bool& aPushedFrame);
96 void AddMarkerFrame(nsIFrame* aFrame, const ReflowOutput& aMetrics);
98 void RemoveMarkerFrame(nsIFrame* aFrame);
101 * Place frames in the block direction (CSS property vertical-align)
103 void VerticalAlignLine();
105 bool TrimTrailingWhiteSpace();
108 * Place frames in the inline direction (CSS property text-align).
110 void TextAlignLine(nsLineBox* aLine, bool aIsLastLine);
113 * Handle all the relative positioning in the line, compute the
114 * combined area (== overflow area) for the line, and handle view
115 * sizing/positioning and the setting of the overflow rect.
117 void RelativePositionFrames(mozilla::OverflowAreas& aOverflowAreas) {
118 RelativePositionFrames(mRootSpan, aOverflowAreas);
121 // Support methods for word-wrapping during line reflow
123 void SetJustificationInfo(const mozilla::JustificationInfo& aInfo) {
124 mJustificationInfo = aInfo;
128 * @return true if so far during reflow no non-empty content has been
129 * placed in the line (according to nsIFrame::IsEmpty())
131 bool LineIsEmpty() const { return mLineIsEmpty; }
134 * @return true if so far during reflow no non-empty leaf content
135 * (non-collapsed whitespace, replaced element, inline-block, etc) has been
136 * placed in the line
138 bool LineAtStart() const { return mLineAtStart; }
140 bool LineIsBreakable() const;
142 bool GetLineEndsInBR() const { return mLineEndsInBR; }
144 void SetLineEndsInBR(bool aOn) { mLineEndsInBR = aOn; }
146 //----------------------------------------
147 // Inform the line-layout about the presence of a floating frame
148 // XXX get rid of this: use get-frame-type?
149 bool AddFloat(nsIFrame* aFloat, nscoord aAvailableISize) {
150 // When reflowing ruby text frames, no block reflow state is
151 // provided to the line layout. However, floats should never be
152 // associated with ruby text containers, hence this method should
153 // not be called in that case.
154 MOZ_ASSERT(mBlockRS,
155 "Should not call this method if there is no block reflow state "
156 "available");
157 return mBlockRS->AddFloat(this, aFloat, aAvailableISize);
160 void SetTrimmableISize(nscoord aTrimmableISize) {
161 mTrimmableISize = aTrimmableISize;
164 //----------------------------------------
166 bool GetFirstLetterStyleOK() const { return mFirstLetterStyleOK; }
168 void SetFirstLetterStyleOK(bool aSetting) { mFirstLetterStyleOK = aSetting; }
170 bool GetInFirstLetter() const { return mInFirstLetter; }
172 void SetInFirstLetter(bool aSetting) { mInFirstLetter = aSetting; }
174 bool GetInFirstLine() const { return mInFirstLine; }
176 void SetInFirstLine(bool aSetting) { mInFirstLine = aSetting; }
178 // Calling this during block reflow ensures that the next line of inlines
179 // will be marked dirty, if there is one.
180 void SetDirtyNextLine() { mDirtyNextLine = true; }
181 bool GetDirtyNextLine() { return mDirtyNextLine; }
183 //----------------------------------------
185 nsPresContext* mPresContext;
188 * Record where an optional break could have been placed. During line reflow,
189 * frames containing optional break points (e.g., whitespace in text frames)
190 * can call SetLastOptionalBreakPosition to record where a break could
191 * have been made, but wasn't because we decided to place more content on
192 * the line. For non-text frames, offset 0 means before the frame, offset
193 * INT32_MAX means after the frame.
195 * Currently this is used to handle cases where a single word comprises
196 * multiple frames, and the first frame fits on the line but the whole word
197 * doesn't. We look back to the last optional break position and
198 * reflow the whole line again, forcing a break at that position. The last
199 * optional break position could be in a text frame or else after a frame
200 * that cannot be part of a text run, so those are the positions we record.
202 * @param aFrame the frame which contains the optional break position.
204 * @param aFits set to true if the break position is within the available
205 * width.
207 * @param aPriority the priority of the break opportunity. If we are
208 * prioritizing break opportunities, we will not set a break if we have
209 * already set a break with a higher priority. @see gfxBreakPriority.
211 * @return true if we are actually reflowing with forced break position and we
212 * should break here
214 bool NotifyOptionalBreakPosition(nsIFrame* aFrame, int32_t aOffset,
215 bool aFits, gfxBreakPriority aPriority);
217 // Tries to place a float, and records whether the float actually was placed.
218 bool TryToPlaceFloat(nsIFrame* aFloat);
220 // Records a floating frame in a nowrap context for it to be placed on the
221 // next break opportunity.
222 void RecordNoWrapFloat(nsIFrame* aFloat);
224 // Tries to place the floats from the nowrap context.
225 void FlushNoWrapFloats();
228 * Like NotifyOptionalBreakPosition, but here it's OK for mNeedBackup
229 * to be set, because the caller is merely pruning some saved break
230 * position(s) that are actually not feasible.
232 void RestoreSavedBreakPosition(nsIFrame* aFrame, int32_t aOffset,
233 gfxBreakPriority aPriority) {
234 mLastOptionalBreakFrame = aFrame;
235 mLastOptionalBreakFrameOffset = aOffset;
236 mLastOptionalBreakPriority = aPriority;
239 * Signal that no backing up will be required after all.
241 void ClearOptionalBreakPosition() {
242 mNeedBackup = false;
243 mLastOptionalBreakFrame = nullptr;
244 mLastOptionalBreakFrameOffset = -1;
245 mLastOptionalBreakPriority = gfxBreakPriority::eNoBreak;
247 // Retrieve last set optional break position. When this returns null, no
248 // optional break has been recorded (which means that the line can't break
249 // yet).
250 nsIFrame* GetLastOptionalBreakPosition(int32_t* aOffset,
251 gfxBreakPriority* aPriority) {
252 *aOffset = mLastOptionalBreakFrameOffset;
253 *aPriority = mLastOptionalBreakPriority;
254 return mLastOptionalBreakFrame;
256 // Whether any optional break position has been recorded.
257 bool HasOptionalBreakPosition() const {
258 return mLastOptionalBreakFrame != nullptr;
260 // Get the priority of the last optional break position recorded.
261 gfxBreakPriority LastOptionalBreakPriority() const {
262 return mLastOptionalBreakPriority;
266 * Check whether frames overflowed the available width and CanPlaceFrame
267 * requested backing up to a saved break position.
269 bool NeedsBackup() { return mNeedBackup; }
271 // Line layout may place too much content on a line, overflowing its available
272 // width. When that happens, if SetLastOptionalBreakPosition has been
273 // used to record an optional break that wasn't taken, we can reflow the line
274 // again and force the break to happen at that point (i.e., backtracking
275 // to the last choice point).
277 // Record that we want to break at the given content+offset (which
278 // should have been previously returned by GetLastOptionalBreakPosition
279 // from another nsLineLayout).
280 void ForceBreakAtPosition(nsIFrame* aFrame, int32_t aOffset) {
281 mForceBreakFrame = aFrame;
282 mForceBreakFrameOffset = aOffset;
284 bool HaveForcedBreakPosition() { return mForceBreakFrame != nullptr; }
285 int32_t GetForcedBreakPosition(nsIFrame* aFrame) {
286 return mForceBreakFrame == aFrame ? mForceBreakFrameOffset : -1;
290 * This can't be null. It usually returns a block frame but may return
291 * some other kind of frame when inline frames are reflowed in a non-block
292 * context (e.g. MathML or floating first-letter).
294 nsIFrame* LineContainerFrame() const { return mLineContainerRI.mFrame; }
295 const ReflowInput& LineContainerRI() const { return mLineContainerRI; }
296 const nsLineList::iterator* GetLine() const {
297 return mGotLineBox ? &mLineBox : nullptr;
299 nsLineList::iterator* GetLine() { return mGotLineBox ? &mLineBox : nullptr; }
302 * Returns the accumulated advance width of frames before the current frame
303 * on the line, plus the line container's left border+padding.
304 * This is always positive, the advance width is measured from
305 * the right edge for RTL blocks and from the left edge for LTR blocks.
306 * In other words, the current frame's distance from the line container's
307 * start content edge is:
308 * <code>GetCurrentFrameInlineDistanceFromBlock() -
309 * lineContainer->GetUsedBorderAndPadding().left</code> Note the use of
310 * <code>.left</code> for both LTR and RTL line containers.
312 nscoord GetCurrentFrameInlineDistanceFromBlock();
315 * Move the inline position where the next frame will be reflowed forward by
316 * aAmount.
318 void AdvanceICoord(nscoord aAmount) { mCurrentSpan->mICoord += aAmount; }
320 * Returns the writing mode for the root span.
322 mozilla::WritingMode GetWritingMode() { return mRootSpan->mWritingMode; }
324 * Returns the inline position where the next frame will be reflowed.
326 nscoord GetCurrentICoord() { return mCurrentSpan->mICoord; }
328 void SetSuppressLineWrap(bool aEnabled) { mSuppressLineWrap = aEnabled; }
330 protected:
331 // This state is constant for a given block frame doing line layout
333 // A non-owning pointer, which points to the object owned by
334 // nsAutoFloatManager::mNew.
335 nsFloatManager* mFloatManager;
337 const nsStyleText* mStyleText; // for the block
338 const ReflowInput& mLineContainerRI;
340 // The line layout for the base text. It is usually nullptr.
341 // It becomes not null when the current line layout is for ruby
342 // annotations. When there is nested ruby inside annotation, it
343 // forms a linked list from the inner annotation to the outermost
344 // line layout. The outermost line layout, which has this member
345 // being nullptr, is responsible for managing the life cycle of
346 // per-frame data and per-span data, and handling floats.
347 nsLineLayout* const mBaseLineLayout;
349 nsLineLayout* GetOutermostLineLayout() {
350 nsLineLayout* lineLayout = this;
351 while (lineLayout->mBaseLineLayout) {
352 lineLayout = lineLayout->mBaseLineLayout;
354 return lineLayout;
357 nsIFrame* mLastOptionalBreakFrame;
358 nsIFrame* mForceBreakFrame;
360 // XXX remove this when landing bug 154892 (splitting absolute positioned
361 // frames)
362 friend class nsInlineFrame;
364 // XXX Take care that nsRubyBaseContainer would give nullptr to this
365 // member. It should not be a problem currently, since the only
366 // code use it is handling float, which does not affect ruby.
367 // See comment in nsLineLayout::AddFloat
368 BlockReflowState* mBlockRS = nullptr; /* XXX hack! */
370 nsLineList::iterator mLineBox;
372 // Per-frame data recorded by the line-layout reflow logic. This
373 // state is the state needed to post-process the line after reflow
374 // has completed (block-direction alignment, inline-direction alignment,
375 // justification and relative positioning).
377 struct PerSpanData;
378 struct PerFrameData;
379 friend struct PerSpanData;
380 friend struct PerFrameData;
381 struct PerFrameData {
382 // link to next/prev frame in same span
383 PerFrameData* mNext;
384 PerFrameData* mPrev;
386 // Link to the frame of next ruby annotation. It is a linked list
387 // through this pointer from ruby base to all its annotations. It
388 // could be nullptr if there is no more annotation.
389 // If PFD_ISLINKEDTOBASE is set, the current PFD is one of the ruby
390 // annotations in the base's list, otherwise it is the ruby base,
391 // and its mNextAnnotation is the start of the linked list.
392 PerFrameData* mNextAnnotation;
394 // pointer to child span data if this is an inline container frame
395 PerSpanData* mSpan;
397 // The frame
398 nsIFrame* mFrame;
400 // From metrics
401 nscoord mAscent;
402 // note that mBounds is a logical rect in the *line*'s writing mode.
403 // When setting frame coordinates, we have to convert to the frame's
404 // writing mode
405 mozilla::LogicalRect mBounds;
406 mozilla::OverflowAreas mOverflowAreas;
408 // From reflow-state
409 mozilla::LogicalMargin mMargin; // in *line* writing mode
410 mozilla::LogicalMargin mBorderPadding; // in *line* writing mode
411 mozilla::LogicalMargin mOffsets; // in *frame* writing mode
413 // state for text justification
414 // Note that, although all frames would have correct inner
415 // opportunities computed after ComputeFrameJustification, start
416 // and end justifiable info are not reliable for non-text frames.
417 mozilla::JustificationInfo mJustificationInfo;
418 mozilla::JustificationAssignment mJustificationAssignment;
420 // PerFrameData flags
421 bool mIsRelativelyOrStickyPos : 1;
422 bool mIsTextFrame : 1;
423 bool mIsNonEmptyTextFrame : 1;
424 bool mIsNonWhitespaceTextFrame : 1;
425 bool mIsLetterFrame : 1;
426 bool mRecomputeOverflow : 1;
427 bool mIsMarker : 1;
428 bool mSkipWhenTrimmingWhitespace : 1;
429 bool mIsEmpty : 1;
430 bool mIsPlaceholder : 1;
431 bool mIsLinkedToBase : 1;
433 // Other state we use
434 uint8_t mBlockDirAlign;
435 mozilla::WritingMode mWritingMode;
437 PerFrameData* Last() {
438 PerFrameData* pfd = this;
439 while (pfd->mNext) {
440 pfd = pfd->mNext;
442 return pfd;
445 bool IsStartJustifiable() const {
446 return mJustificationInfo.mIsStartJustifiable;
449 bool IsEndJustifiable() const {
450 return mJustificationInfo.mIsEndJustifiable;
453 bool ParticipatesInJustification() const;
455 PerFrameData* mFrameFreeList;
457 // In nsLineLayout, a "span" is a container inline frame, and a "frame" is one
458 // of its children.
460 // nsLineLayout::BeginLineReflow() creates the initial PerSpanData which is
461 // called the "root span". nsInlineFrame::ReflowFrames() creates a new
462 // PerSpanData when it calls nsLineLayout::BeginSpan(); at this time, the
463 // nsLineLayout object's mCurrentSpan is switched to the new span. The new
464 // span records the old mCurrentSpan as its parent. After reflowing the child
465 // inline frames, nsInlineFrame::ReflowFrames() calls nsLineLayout::EndSpan(),
466 // which pops the PerSpanData and re-sets mCurrentSpan.
467 struct PerSpanData {
468 union {
469 PerSpanData* mParent;
470 PerSpanData* mNextFreeSpan;
473 // The PerFrameData of the inline frame that "owns" the span, or null if
474 // this is the root span. mFrame is initialized to the containing inline
475 // frame's PerFrameData when a new PerSpanData is pushed in
476 // nsLineLayout::BeginSpan().
477 PerFrameData* mFrame;
479 // The first PerFrameData structure in the span.
480 PerFrameData* mFirstFrame;
482 // The last PerFrameData structure in the span. PerFrameData structures are
483 // added to the span as they are reflowed. mLastFrame may also be directly
484 // manipulated if a line is split, or if frames are pushed from one line to
485 // the next.
486 PerFrameData* mLastFrame;
488 const ReflowInput* mReflowInput;
489 bool mNoWrap;
490 mozilla::WritingMode mWritingMode;
491 bool mContainsFloat;
492 bool mHasNonemptyContent;
494 nscoord mIStart;
495 nscoord mICoord;
496 nscoord mIEnd;
498 nscoord mBStartLeading, mBEndLeading;
499 nscoord mLogicalBSize;
500 nscoord mMinBCoord, mMaxBCoord;
501 nscoord* mBaseline;
503 void AppendFrame(PerFrameData* pfd) {
504 if (!mLastFrame) {
505 mFirstFrame = pfd;
506 } else {
507 mLastFrame->mNext = pfd;
508 pfd->mPrev = mLastFrame;
510 mLastFrame = pfd;
513 PerSpanData* mSpanFreeList;
514 PerSpanData* mRootSpan;
515 PerSpanData* mCurrentSpan;
517 // The container size to use when converting between logical and
518 // physical coordinates for frames in this span. For the root span
519 // this is the size of the block cached in mContainerSize; for
520 // child spans it's the size of the root span.
521 nsSize ContainerSizeForSpan(PerSpanData* aPSD) {
522 return (aPSD == mRootSpan)
523 ? mContainerSize
524 : aPSD->mFrame->mBounds.Size(mRootSpan->mWritingMode)
525 .GetPhysicalSize(mRootSpan->mWritingMode);
528 // Get the advance of any trailing hangable whitespace. If the whitespace
529 // has directionality opposite to the line, the result is negated.
530 nscoord GetHangFrom(const PerSpanData* aSpan, bool aLineIsRTL) const;
531 gfxTextRun::TrimmableWS GetTrimFrom(const PerSpanData* aSpan,
532 bool aLineIsRTL) const;
534 gfxBreakPriority mLastOptionalBreakPriority;
535 int32_t mLastOptionalBreakFrameOffset;
536 int32_t mForceBreakFrameOffset;
538 nscoord mMinLineBSize;
540 // The amount of text indent that we applied to this line, needed for
541 // max-element-size calculation.
542 nscoord mTextIndent;
544 // This state varies during the reflow of a line but is line
545 // "global" state not span "local" state.
546 int32_t mLineNumber;
547 mozilla::JustificationInfo mJustificationInfo;
549 int32_t mTotalPlacedFrames;
551 nscoord mBStartEdge;
552 nscoord mMaxStartBoxBSize;
553 nscoord mMaxEndBoxBSize;
555 nscoord mInflationMinFontSize;
557 // Final computed line-bSize value after VerticalAlignFrames for
558 // the block has been called.
559 nscoord mFinalLineBSize;
561 // Amount of trimmable whitespace inline size for the trailing text
562 // frame, if any
563 nscoord mTrimmableISize;
565 // Physical size. Use only for physical <-> logical coordinate conversion.
566 nsSize mContainerSize;
567 const nsSize& ContainerSize() const { return mContainerSize; }
569 bool mFirstLetterStyleOK : 1;
570 bool mIsTopOfPage : 1;
571 bool mImpactedByFloats : 1;
572 bool mLastFloatWasLetterFrame : 1;
573 bool mLineIsEmpty : 1;
574 bool mLineEndsInBR : 1;
575 bool mNeedBackup : 1;
576 bool mInFirstLine : 1;
577 bool mGotLineBox : 1;
578 bool mInFirstLetter : 1;
579 bool mHasMarker : 1;
580 bool mDirtyNextLine : 1;
581 bool mLineAtStart : 1;
582 bool mHasRuby : 1;
583 bool mSuppressLineWrap : 1;
585 int32_t mSpanDepth;
586 #ifdef DEBUG
587 int32_t mSpansAllocated, mSpansFreed;
588 int32_t mFramesAllocated, mFramesFreed;
589 #endif
592 * Per span and per frame data.
594 mozilla::ArenaAllocator<1024, sizeof(void*)> mArena;
597 * Allocate a PerFrameData from the mArena pool. The allocation is infallible.
599 PerFrameData* NewPerFrameData(nsIFrame* aFrame);
602 * Allocate a PerSpanData from the mArena pool. The allocation is infallible.
604 PerSpanData* NewPerSpanData();
606 PerFrameData* LastFrame() const { return mCurrentSpan->mLastFrame; }
609 * Unlink the given PerFrameData and all the siblings after it from
610 * the span. The unlinked PFDs are usually freed immediately.
611 * However, if PFD_ISLINKEDTOBASE is set, it won't be freed until
612 * the frame of its base is unlinked.
614 void UnlinkFrame(PerFrameData* pfd);
617 * Free the given PerFrameData.
619 void FreeFrame(PerFrameData* pfd);
621 void FreeSpan(PerSpanData* psd);
623 bool InBlockContext() const { return mSpanDepth == 0; }
625 void PushFrame(nsIFrame* aFrame);
627 void AllowForStartMargin(PerFrameData* pfd, ReflowInput& aReflowInput);
629 void SyncAnnotationBounds(PerFrameData* aRubyFrame);
631 bool CanPlaceFrame(PerFrameData* pfd, bool aNotSafeToBreak,
632 bool aFrameCanContinueTextRun,
633 bool aCanRollBackBeforeFrame, ReflowOutput& aMetrics,
634 nsReflowStatus& aStatus, bool* aOptionalBreakAfterFits);
636 void PlaceFrame(PerFrameData* pfd, ReflowOutput& aMetrics);
638 void AdjustLeadings(nsIFrame* spanFrame, PerSpanData* psd,
639 const nsStyleText* aStyleText, float aInflation,
640 bool* aZeroEffectiveSpanBox);
642 void VerticalAlignFrames(PerSpanData* psd);
644 void PlaceTopBottomFrames(PerSpanData* psd, nscoord aDistanceFromStart,
645 nscoord aLineBSize);
647 void ApplyRelativePositioning(PerFrameData* aPFD);
649 void RelativePositionAnnotations(PerSpanData* aRubyPSD,
650 mozilla::OverflowAreas& aOverflowAreas);
652 void RelativePositionFrames(PerSpanData* psd,
653 mozilla::OverflowAreas& aOverflowAreas);
655 bool TrimTrailingWhiteSpaceIn(PerSpanData* psd, nscoord* aDeltaISize);
657 struct JustificationComputationState;
659 static int AssignInterframeJustificationGaps(
660 PerFrameData* aFrame, JustificationComputationState& aState);
662 int32_t ComputeFrameJustification(PerSpanData* psd,
663 JustificationComputationState& aState);
665 void AdvanceAnnotationInlineBounds(PerFrameData* aPFD,
666 const nsSize& aContainerSize,
667 nscoord aDeltaICoord, nscoord aDeltaISize);
669 void ApplyLineJustificationToAnnotations(PerFrameData* aPFD,
670 nscoord aDeltaICoord,
671 nscoord aDeltaISize);
673 // Apply justification. The return value is the amount by which the width of
674 // the span corresponding to aPSD got increased due to justification.
675 nscoord ApplyFrameJustification(
676 PerSpanData* aPSD, mozilla::JustificationApplicationState& aState);
678 void ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
679 const nsSize& aContainerSize);
681 void ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
682 const nsSize& aContainerSize);
684 void ExpandInlineRubyBoxes(PerSpanData* aSpan);
686 void AttachFrameToBaseLineLayout(PerFrameData* aFrame);
688 #ifdef DEBUG
689 void DumpPerSpanData(PerSpanData* psd, int32_t aIndent);
690 #endif
693 #endif /* nsLineLayout_h___ */