Bug 1869043 allow a device to be specified with MediaTrackGraph::NotifyWhenDeviceStar...
[gecko.git] / layout / generic / nsLineLayout.h
blob917feb159533e67f57c9824e5cba5e4524130ac8
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,
52 // aInset is used during text-wrap:balance to reduce
53 // the effective available space on the line.
54 nscoord aInset = 0);
56 void EndLineReflow();
58 /**
59 * Called when a float has been placed. This method updates the
60 * inline frame and span data to account for any change in positions
61 * due to available space for the line boxes changing.
62 * @param aX/aY/aWidth/aHeight are the new available
63 * space rectangle, relative to the containing block.
64 * @param aFloatFrame the float frame that was placed.
66 void UpdateBand(mozilla::WritingMode aWM,
67 const mozilla::LogicalRect& aNewAvailableSpace,
68 nsIFrame* aFloatFrame);
70 void BeginSpan(nsIFrame* aFrame, const ReflowInput* aSpanReflowInput,
71 nscoord aLeftEdge, nscoord aRightEdge, nscoord* aBaseline);
73 // Returns the width of the span
74 nscoord EndSpan(nsIFrame* aFrame);
76 // This method attaches the last frame reflowed in this line layout
77 // to that in the base line layout.
78 void AttachLastFrameToBaseLineLayout() {
79 AttachFrameToBaseLineLayout(LastFrame());
82 // This method attaches the root frame of this line layout to the
83 // last reflowed frame in the base line layout.
84 void AttachRootFrameToBaseLineLayout() {
85 AttachFrameToBaseLineLayout(mRootSpan->mFrame);
88 int32_t GetCurrentSpanCount() const;
90 void SplitLineTo(int32_t aNewCount);
92 bool IsZeroBSize();
94 // Reflows the frame and returns the reflow status. aPushedFrame is true
95 // if the frame is pushed to the next line because it doesn't fit.
96 void ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
97 ReflowOutput* aMetrics, bool& aPushedFrame);
99 void AddMarkerFrame(nsIFrame* aFrame, const ReflowOutput& aMetrics);
101 void RemoveMarkerFrame(nsIFrame* aFrame);
104 * Place frames in the block direction (CSS property vertical-align)
106 void VerticalAlignLine();
108 bool TrimTrailingWhiteSpace();
111 * Place frames in the inline direction (CSS property text-align).
113 void TextAlignLine(nsLineBox* aLine, bool aIsLastLine);
116 * Handle all the relative positioning in the line, compute the
117 * combined area (== overflow area) for the line, and handle view
118 * sizing/positioning and the setting of the overflow rect.
120 void RelativePositionFrames(mozilla::OverflowAreas& aOverflowAreas) {
121 RelativePositionFrames(mRootSpan, aOverflowAreas);
124 // Support methods for word-wrapping during line reflow
126 void SetJustificationInfo(const mozilla::JustificationInfo& aInfo) {
127 mJustificationInfo = aInfo;
131 * @return true if so far during reflow no non-empty content has been
132 * placed in the line (according to nsIFrame::IsEmpty())
134 bool LineIsEmpty() const { return mLineIsEmpty; }
137 * @return true if so far during reflow no non-empty leaf content
138 * (non-collapsed whitespace, replaced element, inline-block, etc) has been
139 * placed in the line
141 bool LineAtStart() const { return mLineAtStart; }
143 bool LineIsBreakable() const;
145 bool GetLineEndsInBR() const { return mLineEndsInBR; }
147 void SetLineEndsInBR(bool aOn) { mLineEndsInBR = aOn; }
149 //----------------------------------------
150 // Inform the line-layout about the presence of a floating frame
151 // XXX get rid of this: use get-frame-type?
152 bool AddFloat(nsIFrame* aFloat, nscoord aAvailableISize) {
153 // When reflowing ruby text frames, no block reflow state is
154 // provided to the line layout. However, floats should never be
155 // associated with ruby text containers, hence this method should
156 // not be called in that case.
157 MOZ_ASSERT(mBlockRS,
158 "Should not call this method if there is no block reflow state "
159 "available");
160 return mBlockRS->AddFloat(this, aFloat, aAvailableISize);
163 void SetTrimmableISize(nscoord aTrimmableISize) {
164 mTrimmableISize = aTrimmableISize;
167 //----------------------------------------
169 bool GetFirstLetterStyleOK() const { return mFirstLetterStyleOK; }
171 void SetFirstLetterStyleOK(bool aSetting) { mFirstLetterStyleOK = aSetting; }
173 bool GetInFirstLetter() const { return mInFirstLetter; }
175 void SetInFirstLetter(bool aSetting) { mInFirstLetter = aSetting; }
177 bool GetInFirstLine() const { return mInFirstLine; }
179 void SetInFirstLine(bool aSetting) { mInFirstLine = aSetting; }
181 // Calling this during block reflow ensures that the next line of inlines
182 // will be marked dirty, if there is one.
183 void SetDirtyNextLine() { mDirtyNextLine = true; }
184 bool GetDirtyNextLine() { return mDirtyNextLine; }
186 //----------------------------------------
188 nsPresContext* mPresContext;
191 * Record where an optional break could have been placed. During line reflow,
192 * frames containing optional break points (e.g., whitespace in text frames)
193 * can call SetLastOptionalBreakPosition to record where a break could
194 * have been made, but wasn't because we decided to place more content on
195 * the line. For non-text frames, offset 0 means before the frame, offset
196 * INT32_MAX means after the frame.
198 * Currently this is used to handle cases where a single word comprises
199 * multiple frames, and the first frame fits on the line but the whole word
200 * doesn't. We look back to the last optional break position and
201 * reflow the whole line again, forcing a break at that position. The last
202 * optional break position could be in a text frame or else after a frame
203 * that cannot be part of a text run, so those are the positions we record.
205 * @param aFrame the frame which contains the optional break position.
207 * @param aFits set to true if the break position is within the available
208 * width.
210 * @param aPriority the priority of the break opportunity. If we are
211 * prioritizing break opportunities, we will not set a break if we have
212 * already set a break with a higher priority. @see gfxBreakPriority.
214 * @return true if we are actually reflowing with forced break position and we
215 * should break here
217 bool NotifyOptionalBreakPosition(nsIFrame* aFrame, int32_t aOffset,
218 bool aFits, gfxBreakPriority aPriority);
220 // Tries to place a float, and records whether the float actually was placed.
221 bool TryToPlaceFloat(nsIFrame* aFloat);
223 // Records a floating frame in a nowrap context for it to be placed on the
224 // next break opportunity.
225 void RecordNoWrapFloat(nsIFrame* aFloat);
227 // Tries to place the floats from the nowrap context.
228 void FlushNoWrapFloats();
231 * Like NotifyOptionalBreakPosition, but here it's OK for mNeedBackup
232 * to be set, because the caller is merely pruning some saved break
233 * position(s) that are actually not feasible.
235 void RestoreSavedBreakPosition(nsIFrame* aFrame, int32_t aOffset,
236 gfxBreakPriority aPriority) {
237 mLastOptionalBreakFrame = aFrame;
238 mLastOptionalBreakFrameOffset = aOffset;
239 mLastOptionalBreakPriority = aPriority;
242 * Signal that no backing up will be required after all.
244 void ClearOptionalBreakPosition() {
245 mNeedBackup = false;
246 mLastOptionalBreakFrame = nullptr;
247 mLastOptionalBreakFrameOffset = -1;
248 mLastOptionalBreakPriority = gfxBreakPriority::eNoBreak;
250 // Retrieve last set optional break position. When this returns null, no
251 // optional break has been recorded (which means that the line can't break
252 // yet).
253 nsIFrame* GetLastOptionalBreakPosition(int32_t* aOffset,
254 gfxBreakPriority* aPriority) {
255 *aOffset = mLastOptionalBreakFrameOffset;
256 *aPriority = mLastOptionalBreakPriority;
257 return mLastOptionalBreakFrame;
259 // Whether any optional break position has been recorded.
260 bool HasOptionalBreakPosition() const {
261 return mLastOptionalBreakFrame != nullptr;
263 // Get the priority of the last optional break position recorded.
264 gfxBreakPriority LastOptionalBreakPriority() const {
265 return mLastOptionalBreakPriority;
269 * Check whether frames overflowed the available width and CanPlaceFrame
270 * requested backing up to a saved break position.
272 bool NeedsBackup() { return mNeedBackup; }
274 // Line layout may place too much content on a line, overflowing its available
275 // width. When that happens, if SetLastOptionalBreakPosition has been
276 // used to record an optional break that wasn't taken, we can reflow the line
277 // again and force the break to happen at that point (i.e., backtracking
278 // to the last choice point).
280 // Record that we want to break at the given content+offset (which
281 // should have been previously returned by GetLastOptionalBreakPosition
282 // from another nsLineLayout).
283 void ForceBreakAtPosition(nsIFrame* aFrame, int32_t aOffset) {
284 mForceBreakFrame = aFrame;
285 mForceBreakFrameOffset = aOffset;
287 bool HaveForcedBreakPosition() { return mForceBreakFrame != nullptr; }
288 int32_t GetForcedBreakPosition(nsIFrame* aFrame) {
289 return mForceBreakFrame == aFrame ? mForceBreakFrameOffset : -1;
293 * This can't be null. It usually returns a block frame but may return
294 * some other kind of frame when inline frames are reflowed in a non-block
295 * context (e.g. MathML or floating first-letter).
297 nsIFrame* LineContainerFrame() const { return mLineContainerRI.mFrame; }
298 const ReflowInput& LineContainerRI() const { return mLineContainerRI; }
299 const nsLineList::iterator* GetLine() const {
300 return mGotLineBox ? &mLineBox : nullptr;
302 nsLineList::iterator* GetLine() { return mGotLineBox ? &mLineBox : nullptr; }
305 * Returns the accumulated advance width of frames before the current frame
306 * on the line, plus the line container's left border+padding.
307 * This is always positive, the advance width is measured from
308 * the right edge for RTL blocks and from the left edge for LTR blocks.
309 * In other words, the current frame's distance from the line container's
310 * start content edge is:
311 * <code>GetCurrentFrameInlineDistanceFromBlock() -
312 * lineContainer->GetUsedBorderAndPadding().left</code> Note the use of
313 * <code>.left</code> for both LTR and RTL line containers.
315 nscoord GetCurrentFrameInlineDistanceFromBlock();
318 * Move the inline position where the next frame will be reflowed forward by
319 * aAmount.
321 void AdvanceICoord(nscoord aAmount) { mCurrentSpan->mICoord += aAmount; }
323 * Returns the writing mode for the root span.
325 mozilla::WritingMode GetWritingMode() { return mRootSpan->mWritingMode; }
327 * Returns the inline position where the next frame will be reflowed.
329 nscoord GetCurrentICoord() { return mCurrentSpan->mICoord; }
331 void SetSuppressLineWrap(bool aEnabled) { mSuppressLineWrap = aEnabled; }
333 protected:
334 // This state is constant for a given block frame doing line layout
336 // A non-owning pointer, which points to the object owned by
337 // nsAutoFloatManager::mNew.
338 nsFloatManager* mFloatManager;
340 const nsStyleText* mStyleText; // for the block
341 const ReflowInput& mLineContainerRI;
343 // The line layout for the base text. It is usually nullptr.
344 // It becomes not null when the current line layout is for ruby
345 // annotations. When there is nested ruby inside annotation, it
346 // forms a linked list from the inner annotation to the outermost
347 // line layout. The outermost line layout, which has this member
348 // being nullptr, is responsible for managing the life cycle of
349 // per-frame data and per-span data, and handling floats.
350 nsLineLayout* const mBaseLineLayout;
352 nsLineLayout* GetOutermostLineLayout() {
353 nsLineLayout* lineLayout = this;
354 while (lineLayout->mBaseLineLayout) {
355 lineLayout = lineLayout->mBaseLineLayout;
357 return lineLayout;
360 nsIFrame* mLastOptionalBreakFrame;
361 nsIFrame* mForceBreakFrame;
363 // XXX remove this when landing bug 154892 (splitting absolute positioned
364 // frames)
365 friend class nsInlineFrame;
367 // XXX Take care that nsRubyBaseContainer would give nullptr to this
368 // member. It should not be a problem currently, since the only
369 // code use it is handling float, which does not affect ruby.
370 // See comment in nsLineLayout::AddFloat
371 BlockReflowState* mBlockRS = nullptr; /* XXX hack! */
373 nsLineList::iterator mLineBox;
375 // Per-frame data recorded by the line-layout reflow logic. This
376 // state is the state needed to post-process the line after reflow
377 // has completed (block-direction alignment, inline-direction alignment,
378 // justification and relative positioning).
380 struct PerSpanData;
381 struct PerFrameData;
382 friend struct PerSpanData;
383 friend struct PerFrameData;
384 struct PerFrameData {
385 // link to next/prev frame in same span
386 PerFrameData* mNext;
387 PerFrameData* mPrev;
389 // Link to the frame of next ruby annotation. It is a linked list
390 // through this pointer from ruby base to all its annotations. It
391 // could be nullptr if there is no more annotation.
392 // If PFD_ISLINKEDTOBASE is set, the current PFD is one of the ruby
393 // annotations in the base's list, otherwise it is the ruby base,
394 // and its mNextAnnotation is the start of the linked list.
395 PerFrameData* mNextAnnotation;
397 // pointer to child span data if this is an inline container frame
398 PerSpanData* mSpan;
400 // The frame
401 nsIFrame* mFrame;
403 // From metrics
404 nscoord mAscent;
405 // note that mBounds is a logical rect in the *line*'s writing mode.
406 // When setting frame coordinates, we have to convert to the frame's
407 // writing mode
408 mozilla::LogicalRect mBounds;
409 mozilla::OverflowAreas mOverflowAreas;
411 // From reflow-state
412 mozilla::LogicalMargin mMargin; // in *line* writing mode
413 mozilla::LogicalMargin mBorderPadding; // in *line* writing mode
414 mozilla::LogicalMargin mOffsets; // in *frame* writing mode
416 // state for text justification
417 // Note that, although all frames would have correct inner
418 // opportunities computed after ComputeFrameJustification, start
419 // and end justifiable info are not reliable for non-text frames.
420 mozilla::JustificationInfo mJustificationInfo;
421 mozilla::JustificationAssignment mJustificationAssignment;
423 // PerFrameData flags
424 bool mIsRelativelyOrStickyPos : 1;
425 bool mIsTextFrame : 1;
426 bool mIsNonEmptyTextFrame : 1;
427 bool mIsNonWhitespaceTextFrame : 1;
428 bool mIsLetterFrame : 1;
429 bool mRecomputeOverflow : 1;
430 bool mIsMarker : 1;
431 bool mSkipWhenTrimmingWhitespace : 1;
432 bool mIsEmpty : 1;
433 bool mIsPlaceholder : 1;
434 bool mIsLinkedToBase : 1;
436 // Other state we use
437 uint8_t mBlockDirAlign;
438 mozilla::WritingMode mWritingMode;
440 PerFrameData* Last() {
441 PerFrameData* pfd = this;
442 while (pfd->mNext) {
443 pfd = pfd->mNext;
445 return pfd;
448 bool IsStartJustifiable() const {
449 return mJustificationInfo.mIsStartJustifiable;
452 bool IsEndJustifiable() const {
453 return mJustificationInfo.mIsEndJustifiable;
456 bool ParticipatesInJustification() const;
458 PerFrameData* mFrameFreeList;
460 // In nsLineLayout, a "span" is a container inline frame, and a "frame" is one
461 // of its children.
463 // nsLineLayout::BeginLineReflow() creates the initial PerSpanData which is
464 // called the "root span". nsInlineFrame::ReflowFrames() creates a new
465 // PerSpanData when it calls nsLineLayout::BeginSpan(); at this time, the
466 // nsLineLayout object's mCurrentSpan is switched to the new span. The new
467 // span records the old mCurrentSpan as its parent. After reflowing the child
468 // inline frames, nsInlineFrame::ReflowFrames() calls nsLineLayout::EndSpan(),
469 // which pops the PerSpanData and re-sets mCurrentSpan.
470 struct PerSpanData {
471 union {
472 PerSpanData* mParent;
473 PerSpanData* mNextFreeSpan;
476 // The PerFrameData of the inline frame that "owns" the span, or null if
477 // this is the root span. mFrame is initialized to the containing inline
478 // frame's PerFrameData when a new PerSpanData is pushed in
479 // nsLineLayout::BeginSpan().
480 PerFrameData* mFrame;
482 // The first PerFrameData structure in the span.
483 PerFrameData* mFirstFrame;
485 // The last PerFrameData structure in the span. PerFrameData structures are
486 // added to the span as they are reflowed. mLastFrame may also be directly
487 // manipulated if a line is split, or if frames are pushed from one line to
488 // the next.
489 PerFrameData* mLastFrame;
491 const ReflowInput* mReflowInput;
492 bool mNoWrap;
493 mozilla::WritingMode mWritingMode;
494 bool mContainsFloat;
495 bool mHasNonemptyContent;
497 nscoord mIStart;
498 nscoord mICoord;
499 nscoord mIEnd;
500 nscoord mInset;
502 nscoord mBStartLeading, mBEndLeading;
503 nscoord mLogicalBSize;
504 nscoord mMinBCoord, mMaxBCoord;
505 nscoord* mBaseline;
507 void AppendFrame(PerFrameData* pfd) {
508 if (!mLastFrame) {
509 mFirstFrame = pfd;
510 } else {
511 mLastFrame->mNext = pfd;
512 pfd->mPrev = mLastFrame;
514 mLastFrame = pfd;
517 PerSpanData* mSpanFreeList;
518 PerSpanData* mRootSpan;
519 PerSpanData* mCurrentSpan;
521 // The container size to use when converting between logical and
522 // physical coordinates for frames in this span. For the root span
523 // this is the size of the block cached in mContainerSize; for
524 // child spans it's the size of the root span.
525 nsSize ContainerSizeForSpan(PerSpanData* aPSD) {
526 return (aPSD == mRootSpan)
527 ? mContainerSize
528 : aPSD->mFrame->mBounds.Size(mRootSpan->mWritingMode)
529 .GetPhysicalSize(mRootSpan->mWritingMode);
532 // Get the advance of any trailing hangable whitespace. If the whitespace
533 // has directionality opposite to the line, the result is negated.
534 nscoord GetHangFrom(const PerSpanData* aSpan, bool aLineIsRTL) const;
535 gfxTextRun::TrimmableWS GetTrimFrom(const PerSpanData* aSpan,
536 bool aLineIsRTL) const;
538 gfxBreakPriority mLastOptionalBreakPriority;
539 int32_t mLastOptionalBreakFrameOffset;
540 int32_t mForceBreakFrameOffset;
542 nscoord mMinLineBSize;
544 // The amount of text indent that we applied to this line, needed for
545 // max-element-size calculation.
546 nscoord mTextIndent;
548 // This state varies during the reflow of a line but is line
549 // "global" state not span "local" state.
550 int32_t mLineNumber;
551 mozilla::JustificationInfo mJustificationInfo;
553 int32_t mTotalPlacedFrames;
555 nscoord mBStartEdge;
556 nscoord mMaxStartBoxBSize;
557 nscoord mMaxEndBoxBSize;
559 nscoord mInflationMinFontSize;
561 // Final computed line-bSize value after VerticalAlignFrames for
562 // the block has been called.
563 nscoord mFinalLineBSize;
565 // Amount of trimmable whitespace inline size for the trailing text
566 // frame, if any
567 nscoord mTrimmableISize;
569 // Physical size. Use only for physical <-> logical coordinate conversion.
570 nsSize mContainerSize;
571 const nsSize& ContainerSize() const { return mContainerSize; }
573 bool mFirstLetterStyleOK : 1;
574 bool mIsTopOfPage : 1;
575 bool mImpactedByFloats : 1;
576 bool mLastFloatWasLetterFrame : 1;
577 bool mLineIsEmpty : 1;
578 bool mLineEndsInBR : 1;
579 bool mNeedBackup : 1;
580 bool mInFirstLine : 1;
581 bool mGotLineBox : 1;
582 bool mInFirstLetter : 1;
583 bool mHasMarker : 1;
584 bool mDirtyNextLine : 1;
585 bool mLineAtStart : 1;
586 bool mHasRuby : 1;
587 bool mSuppressLineWrap : 1;
589 int32_t mSpanDepth;
590 #ifdef DEBUG
591 int32_t mSpansAllocated, mSpansFreed;
592 int32_t mFramesAllocated, mFramesFreed;
593 #endif
596 * Per span and per frame data.
598 mozilla::ArenaAllocator<1024, sizeof(void*)> mArena;
601 * Allocate a PerFrameData from the mArena pool. The allocation is infallible.
603 PerFrameData* NewPerFrameData(nsIFrame* aFrame);
606 * Allocate a PerSpanData from the mArena pool. The allocation is infallible.
608 PerSpanData* NewPerSpanData();
610 PerFrameData* LastFrame() const { return mCurrentSpan->mLastFrame; }
613 * Unlink the given PerFrameData and all the siblings after it from
614 * the span. The unlinked PFDs are usually freed immediately.
615 * However, if PFD_ISLINKEDTOBASE is set, it won't be freed until
616 * the frame of its base is unlinked.
618 void UnlinkFrame(PerFrameData* pfd);
621 * Free the given PerFrameData.
623 void FreeFrame(PerFrameData* pfd);
625 void FreeSpan(PerSpanData* psd);
627 bool InBlockContext() const { return mSpanDepth == 0; }
629 void PushFrame(nsIFrame* aFrame);
631 void AllowForStartMargin(PerFrameData* pfd, ReflowInput& aReflowInput);
633 void SyncAnnotationBounds(PerFrameData* aRubyFrame);
635 bool CanPlaceFrame(PerFrameData* pfd, bool aNotSafeToBreak,
636 bool aFrameCanContinueTextRun,
637 bool aCanRollBackBeforeFrame, ReflowOutput& aMetrics,
638 nsReflowStatus& aStatus, bool* aOptionalBreakAfterFits);
640 void PlaceFrame(PerFrameData* pfd, ReflowOutput& aMetrics);
642 void AdjustLeadings(nsIFrame* spanFrame, PerSpanData* psd,
643 const nsStyleText* aStyleText, float aInflation,
644 bool* aZeroEffectiveSpanBox);
646 void VerticalAlignFrames(PerSpanData* psd);
648 void PlaceTopBottomFrames(PerSpanData* psd, nscoord aDistanceFromStart,
649 nscoord aLineBSize);
651 void ApplyRelativePositioning(PerFrameData* aPFD);
653 void RelativePositionAnnotations(PerSpanData* aRubyPSD,
654 mozilla::OverflowAreas& aOverflowAreas);
656 void RelativePositionFrames(PerSpanData* psd,
657 mozilla::OverflowAreas& aOverflowAreas);
659 bool TrimTrailingWhiteSpaceIn(PerSpanData* psd, nscoord* aDeltaISize);
661 struct JustificationComputationState;
663 static int AssignInterframeJustificationGaps(
664 PerFrameData* aFrame, JustificationComputationState& aState);
666 int32_t ComputeFrameJustification(PerSpanData* psd,
667 JustificationComputationState& aState);
669 void AdvanceAnnotationInlineBounds(PerFrameData* aPFD,
670 const nsSize& aContainerSize,
671 nscoord aDeltaICoord, nscoord aDeltaISize);
673 void ApplyLineJustificationToAnnotations(PerFrameData* aPFD,
674 nscoord aDeltaICoord,
675 nscoord aDeltaISize);
677 // Apply justification. The return value is the amount by which the width of
678 // the span corresponding to aPSD got increased due to justification.
679 nscoord ApplyFrameJustification(
680 PerSpanData* aPSD, mozilla::JustificationApplicationState& aState);
682 void ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
683 const nsSize& aContainerSize);
685 void ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
686 const nsSize& aContainerSize);
688 void ExpandInlineRubyBoxes(PerSpanData* aSpan);
690 void AttachFrameToBaseLineLayout(PerFrameData* aFrame);
692 #ifdef DEBUG
693 void DumpPerSpanData(PerSpanData* psd, int32_t aIndent);
694 #endif
696 private:
697 static bool ShouldApplyLineHeightInPreserveWhiteSpace(const PerSpanData* psd);
700 #endif /* nsLineLayout_h___ */