mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Use logical text layout API in nsLineLayout. Bug 789096, r=jfkthame
This commit is contained in:
parent
2498a9e3b8
commit
677c6954d4
@ -1229,7 +1229,9 @@ nsBidiPresUtils::ResolveParagraphWithinBlock(nsBlockFrame* aBlockFrame,
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
|
nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
|
||||||
int32_t aNumFramesOnLine)
|
int32_t aNumFramesOnLine,
|
||||||
|
WritingMode aLineWM,
|
||||||
|
nscoord& aLineWidth)
|
||||||
{
|
{
|
||||||
// If this line consists of a line frame, reorder the line frame's children.
|
// If this line consists of a line frame, reorder the line frame's children.
|
||||||
if (aFirstFrameOnLine->GetType() == nsGkAtoms::lineFrame) {
|
if (aFirstFrameOnLine->GetType() == nsGkAtoms::lineFrame) {
|
||||||
@ -1242,7 +1244,7 @@ nsBidiPresUtils::ReorderFrames(nsIFrame* aFirstFrameOnLine,
|
|||||||
}
|
}
|
||||||
|
|
||||||
BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine);
|
BidiLineData bld(aFirstFrameOnLine, aNumFramesOnLine);
|
||||||
RepositionInlineFrames(&bld, aFirstFrameOnLine);
|
RepositionInlineFrames(&bld, aFirstFrameOnLine, aLineWM, aLineWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
@ -1282,22 +1284,20 @@ nsBidiPresUtils::GetFrameBaseLevel(nsIFrame* aFrame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsBidiPresUtils::IsLeftOrRightMost(nsIFrame* aFrame,
|
nsBidiPresUtils::IsFirstOrLast(nsIFrame* aFrame,
|
||||||
nsContinuationStates* aContinuationStates,
|
nsContinuationStates* aContinuationStates,
|
||||||
bool& aIsLeftMost /* out */,
|
bool& aIsFirst /* out */,
|
||||||
bool& aIsRightMost /* out */)
|
bool& aIsLast /* out */)
|
||||||
{
|
{
|
||||||
const nsStyleVisibility* vis = aFrame->StyleVisibility();
|
|
||||||
bool isLTR = (NS_STYLE_DIRECTION_LTR == vis->mDirection);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since we lay out frames from left to right (in both LTR and RTL), visiting a
|
* Since we lay out frames in the line's direction, visiting a frame with
|
||||||
* frame with 'mFirstVisualFrame == nullptr', means it's the first appearance of
|
* 'mFirstVisualFrame == nullptr', means it's the first appearance of one
|
||||||
* one of its continuation chain frames on the line.
|
* of its continuation chain frames on the line.
|
||||||
* To determine if it's the last visual frame of its continuation chain on the line
|
* To determine if it's the last visual frame of its continuation chain on
|
||||||
* or not, we count the number of frames of the chain on the line, and then reduce
|
* the line or not, we count the number of frames of the chain on the line,
|
||||||
* it when we lay out a frame of the chain. If this value becomes 1 it means
|
* and then reduce it when we lay out a frame of the chain. If this value
|
||||||
* that it's the last visual frame of its continuation chain on this line.
|
* becomes 1 it means that it's the last visual frame of its continuation
|
||||||
|
* chain on this line.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsFrameContinuationState* frameState = aContinuationStates->GetEntry(aFrame);
|
nsFrameContinuationState* frameState = aContinuationStates->GetEntry(aFrame);
|
||||||
@ -1334,20 +1334,18 @@ nsBidiPresUtils::IsLeftOrRightMost(nsIFrame* aFrame,
|
|||||||
}
|
}
|
||||||
frameState->mHasContOnNextLines = (frame != nullptr);
|
frameState->mHasContOnNextLines = (frame != nullptr);
|
||||||
|
|
||||||
aIsLeftMost = isLTR ? !frameState->mHasContOnPrevLines
|
aIsFirst = !frameState->mHasContOnPrevLines;
|
||||||
: !frameState->mHasContOnNextLines;
|
|
||||||
firstFrameState = frameState;
|
firstFrameState = frameState;
|
||||||
} else {
|
} else {
|
||||||
// aFrame is not the first visual frame of its continuation chain
|
// aFrame is not the first visual frame of its continuation chain
|
||||||
aIsLeftMost = false;
|
aIsFirst = false;
|
||||||
firstFrameState = aContinuationStates->GetEntry(frameState->mFirstVisualFrame);
|
firstFrameState = aContinuationStates->GetEntry(frameState->mFirstVisualFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
aIsRightMost = (firstFrameState->mFrameCount == 1) &&
|
aIsLast = (firstFrameState->mFrameCount == 1 &&
|
||||||
(isLTR ? !firstFrameState->mHasContOnNextLines
|
!firstFrameState->mHasContOnNextLines);
|
||||||
: !firstFrameState->mHasContOnPrevLines);
|
|
||||||
|
|
||||||
if ((aIsLeftMost || aIsRightMost) &&
|
if ((aIsFirst || aIsLast) &&
|
||||||
(aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT)) {
|
(aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT)) {
|
||||||
// For ib splits, don't treat anything except the last part as
|
// For ib splits, don't treat anything except the last part as
|
||||||
// endmost or anything except the first part as startmost.
|
// endmost or anything except the first part as startmost.
|
||||||
@ -1355,19 +1353,11 @@ nsBidiPresUtils::IsLeftOrRightMost(nsIFrame* aFrame,
|
|||||||
nsIFrame* firstContinuation = aFrame->FirstContinuation();
|
nsIFrame* firstContinuation = aFrame->FirstContinuation();
|
||||||
if (firstContinuation->FrameIsNonLastInIBSplit()) {
|
if (firstContinuation->FrameIsNonLastInIBSplit()) {
|
||||||
// We are not endmost
|
// We are not endmost
|
||||||
if (isLTR) {
|
aIsLast = false;
|
||||||
aIsRightMost = false;
|
|
||||||
} else {
|
|
||||||
aIsLeftMost = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (firstContinuation->FrameIsNonFirstInIBSplit()) {
|
if (firstContinuation->FrameIsNonFirstInIBSplit()) {
|
||||||
// We are not startmost
|
// We are not startmost
|
||||||
if (isLTR) {
|
aIsFirst = false;
|
||||||
aIsLeftMost = false;
|
|
||||||
} else {
|
|
||||||
aIsRightMost = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1377,28 +1367,38 @@ nsBidiPresUtils::IsLeftOrRightMost(nsIFrame* aFrame,
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
||||||
bool aIsOddLevel,
|
bool aIsEvenLevel,
|
||||||
nscoord& aLeft,
|
nscoord& aStart,
|
||||||
nsContinuationStates* aContinuationStates)
|
nsContinuationStates* aContinuationStates,
|
||||||
|
WritingMode aLineWM,
|
||||||
|
nscoord& aLineWidth)
|
||||||
{
|
{
|
||||||
if (!aFrame)
|
if (!aFrame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isLeftMost, isRightMost;
|
bool isFirst, isLast;
|
||||||
IsLeftOrRightMost(aFrame,
|
IsFirstOrLast(aFrame,
|
||||||
aContinuationStates,
|
aContinuationStates,
|
||||||
isLeftMost /* out */,
|
isFirst /* out */,
|
||||||
isRightMost /* out */);
|
isLast /* out */);
|
||||||
|
|
||||||
|
WritingMode frameWM = aFrame->GetWritingMode();
|
||||||
nsInlineFrame* testFrame = do_QueryFrame(aFrame);
|
nsInlineFrame* testFrame = do_QueryFrame(aFrame);
|
||||||
|
|
||||||
|
//XXX temporary until GetSkipSides is logicalized
|
||||||
|
bool isLeftMost = false, isRightMost = false;
|
||||||
if (testFrame) {
|
if (testFrame) {
|
||||||
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET);
|
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET);
|
||||||
|
|
||||||
|
isLeftMost = ((isFirst && frameWM.IsBidiLTR()) ||
|
||||||
|
(isLast && !frameWM.IsBidiLTR()));
|
||||||
if (isLeftMost)
|
if (isLeftMost)
|
||||||
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_LEFT_MOST);
|
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_LEFT_MOST);
|
||||||
else
|
else
|
||||||
aFrame->RemoveStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_LEFT_MOST);
|
aFrame->RemoveStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_LEFT_MOST);
|
||||||
|
|
||||||
|
isRightMost = ((isLast && frameWM.IsBidiLTR()) ||
|
||||||
|
(isFirst && !frameWM.IsBidiLTR()));
|
||||||
if (isRightMost)
|
if (isRightMost)
|
||||||
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_RIGHT_MOST);
|
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_IS_RIGHT_MOST);
|
||||||
else
|
else
|
||||||
@ -1407,26 +1407,30 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
|||||||
// This method is called from nsBlockFrame::PlaceLine via the call to
|
// This method is called from nsBlockFrame::PlaceLine via the call to
|
||||||
// bidiUtils->ReorderFrames, so this is guaranteed to be after the inlines
|
// bidiUtils->ReorderFrames, so this is guaranteed to be after the inlines
|
||||||
// have been reflowed, which is required for GetUsedMargin/Border/Padding
|
// have been reflowed, which is required for GetUsedMargin/Border/Padding
|
||||||
nsMargin margin = aFrame->GetUsedMargin();
|
LogicalMargin margin(frameWM, aFrame->GetUsedMargin());
|
||||||
if (isLeftMost)
|
if (isFirst) {
|
||||||
aLeft += margin.left;
|
aStart += margin.IStart(frameWM);
|
||||||
|
}
|
||||||
|
|
||||||
nscoord start = aLeft;
|
nscoord start = aStart;
|
||||||
|
nscoord frameWidth = aFrame->GetSize().width;
|
||||||
|
|
||||||
if (!IsBidiLeaf(aFrame))
|
if (!IsBidiLeaf(aFrame))
|
||||||
{
|
{
|
||||||
nscoord x = 0;
|
nscoord iCoord = 0;
|
||||||
nsMargin borderPadding = aFrame->GetUsedBorderAndPadding();
|
LogicalMargin borderPadding(frameWM, aFrame->GetUsedBorderAndPadding());
|
||||||
if (isLeftMost) {
|
if (isFirst) {
|
||||||
x += borderPadding.left;
|
iCoord += borderPadding.IStart(frameWM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If aIsOddLevel is true, so we need to traverse the child list
|
// If the resolved direction of the container is different from the
|
||||||
// in reverse order, to make it O(n) we store the list locally and
|
// direction of the frame, we need to traverse the child list in reverse
|
||||||
// iterate the list reversely
|
// order, to make it O(n) we store the list locally and iterate the list
|
||||||
|
// in reverse
|
||||||
|
bool reverseOrder = aIsEvenLevel != frameWM.IsBidiLTR();
|
||||||
nsTArray<nsIFrame*> childList;
|
nsTArray<nsIFrame*> childList;
|
||||||
nsIFrame *frame = aFrame->GetFirstPrincipalChild();
|
nsIFrame *frame = aFrame->GetFirstPrincipalChild();
|
||||||
if (frame && aIsOddLevel) {
|
if (frame && reverseOrder) {
|
||||||
childList.AppendElement((nsIFrame*)nullptr);
|
childList.AppendElement((nsIFrame*)nullptr);
|
||||||
while (frame) {
|
while (frame) {
|
||||||
childList.AppendElement(frame);
|
childList.AppendElement(frame);
|
||||||
@ -1439,27 +1443,33 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
|||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
while (frame) {
|
while (frame) {
|
||||||
RepositionFrame(frame,
|
RepositionFrame(frame,
|
||||||
aIsOddLevel,
|
aIsEvenLevel,
|
||||||
x,
|
iCoord,
|
||||||
aContinuationStates);
|
aContinuationStates,
|
||||||
|
frameWM,
|
||||||
|
frameWidth);
|
||||||
index++;
|
index++;
|
||||||
frame = aIsOddLevel ?
|
frame = reverseOrder ?
|
||||||
childList[childList.Length() - index - 1] :
|
childList[childList.Length() - index - 1] :
|
||||||
frame->GetNextSibling();
|
frame->GetNextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRightMost) {
|
if (isLast) {
|
||||||
x += borderPadding.right;
|
iCoord += borderPadding.IEnd(frameWM);
|
||||||
}
|
}
|
||||||
aLeft += x;
|
aStart += iCoord;
|
||||||
} else {
|
} else {
|
||||||
aLeft += aFrame->GetSize().width;
|
aStart += frameWidth;
|
||||||
}
|
}
|
||||||
nsRect rect = aFrame->GetRect();
|
|
||||||
aFrame->SetRect(nsRect(start, rect.y, aLeft - start, rect.height));
|
|
||||||
|
|
||||||
if (isRightMost)
|
LogicalRect logicalRect(aLineWM, aFrame->GetRect(), aLineWidth);
|
||||||
aLeft += margin.right;
|
logicalRect.IStart(aLineWM) = start;
|
||||||
|
logicalRect.ISize(aLineWM) = aStart - start;
|
||||||
|
aFrame->SetRect(aLineWM, logicalRect, aLineWidth);
|
||||||
|
|
||||||
|
if (isLast) {
|
||||||
|
aStart += margin.IEnd(frameWM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1484,21 +1494,23 @@ nsBidiPresUtils::InitContinuationStates(nsIFrame* aFrame,
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
|
nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
|
||||||
nsIFrame* aFirstChild)
|
nsIFrame* aFirstChild,
|
||||||
|
WritingMode aLineWM,
|
||||||
|
nscoord& aLineWidth)
|
||||||
{
|
{
|
||||||
const nsStyleVisibility* vis = aFirstChild->StyleVisibility();
|
nscoord startSpace = 0;
|
||||||
bool isLTR = (NS_STYLE_DIRECTION_LTR == vis->mDirection);
|
|
||||||
nscoord leftSpace = 0;
|
|
||||||
|
|
||||||
// This method is called from nsBlockFrame::PlaceLine via the call to
|
// This method is called from nsBlockFrame::PlaceLine via the call to
|
||||||
// bidiUtils->ReorderFrames, so this is guaranteed to be after the inlines
|
// bidiUtils->ReorderFrames, so this is guaranteed to be after the inlines
|
||||||
// have been reflowed, which is required for GetUsedMargin/Border/Padding
|
// have been reflowed, which is required for GetUsedMargin/Border/Padding
|
||||||
nsMargin margin = aFirstChild->GetUsedMargin();
|
WritingMode frameWM = aFirstChild->GetWritingMode();
|
||||||
|
LogicalMargin margin(frameWM, aFirstChild->GetUsedMargin());
|
||||||
if (!aFirstChild->GetPrevContinuation() &&
|
if (!aFirstChild->GetPrevContinuation() &&
|
||||||
!aFirstChild->FrameIsNonFirstInIBSplit())
|
!aFirstChild->FrameIsNonFirstInIBSplit())
|
||||||
leftSpace = isLTR ? margin.left : margin.right;
|
startSpace = margin.IStart(frameWM);
|
||||||
|
|
||||||
nscoord left = aFirstChild->GetPosition().x - leftSpace;
|
nscoord start = LogicalRect(aLineWM, aFirstChild->GetRect(),
|
||||||
|
aLineWidth).IStart(aLineWM) - startSpace;
|
||||||
nsIFrame* frame;
|
nsIFrame* frame;
|
||||||
int32_t count = aBld->mVisualFrames.Length();
|
int32_t count = aBld->mVisualFrames.Length();
|
||||||
int32_t index;
|
int32_t index;
|
||||||
@ -1511,13 +1523,25 @@ nsBidiPresUtils::RepositionInlineFrames(BidiLineData *aBld,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reposition frames in visual order
|
// Reposition frames in visual order
|
||||||
for (index = 0; index < count; index++) {
|
int32_t step, limit;
|
||||||
|
if (aLineWM.IsBidiLTR()) {
|
||||||
|
index = 0;
|
||||||
|
step = 1;
|
||||||
|
limit = count;
|
||||||
|
} else {
|
||||||
|
index = count - 1;
|
||||||
|
step = -1;
|
||||||
|
limit = -1;
|
||||||
|
}
|
||||||
|
for (; index != limit; index += step) {
|
||||||
frame = aBld->VisualFrameAt(index);
|
frame = aBld->VisualFrameAt(index);
|
||||||
RepositionFrame(frame,
|
RepositionFrame(frame,
|
||||||
(aBld->mLevels[aBld->mIndexMap[index]] & 1),
|
!(aBld->mLevels[aBld->mIndexMap[index]] & 1),
|
||||||
left,
|
start,
|
||||||
&continuationStates);
|
&continuationStates,
|
||||||
} // for
|
aLineWM,
|
||||||
|
aLineWidth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -27,6 +27,7 @@ class nsRenderingContext;
|
|||||||
class nsBlockInFlowLineIterator;
|
class nsBlockInFlowLineIterator;
|
||||||
class nsStyleContext;
|
class nsStyleContext;
|
||||||
template<class T> class nsTHashtable;
|
template<class T> class nsTHashtable;
|
||||||
|
namespace mozilla { class WritingMode; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A structure representing some continuation state for each frame on the line,
|
* A structure representing some continuation state for each frame on the line,
|
||||||
@ -159,7 +160,9 @@ public:
|
|||||||
* @lina 05/02/2000
|
* @lina 05/02/2000
|
||||||
*/
|
*/
|
||||||
static void ReorderFrames(nsIFrame* aFirstFrameOnLine,
|
static void ReorderFrames(nsIFrame* aFirstFrameOnLine,
|
||||||
int32_t aNumFramesOnLine);
|
int32_t aNumFramesOnLine,
|
||||||
|
mozilla::WritingMode aLineWM,
|
||||||
|
nscoord& aLineWidth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format Unicode text, taking into account bidi capabilities
|
* Format Unicode text, taking into account bidi capabilities
|
||||||
@ -379,22 +382,25 @@ private:
|
|||||||
BidiParagraphData* aBpd);
|
BidiParagraphData* aBpd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Position aFrame and it's descendants to their visual places. Also if aFrame
|
* Position aFrame and its descendants to their visual places. Also if aFrame
|
||||||
* is not leaf, resize it to embrace it's children.
|
* is not leaf, resize it to embrace its children.
|
||||||
*
|
*
|
||||||
* @param aFrame The frame which itself and its children are going
|
* @param aFrame The frame which itself and its children are
|
||||||
* to be repositioned
|
* going to be repositioned
|
||||||
* @param aIsOddLevel TRUE means the embedding level of this frame is odd
|
* @param aIsEvenLevel TRUE means the embedding level of this frame
|
||||||
* @param[in,out] aLeft IN value is the starting position of aFrame(without
|
* is even (LTR)
|
||||||
* considering its left margin)
|
* @param[in,out] aStart IN value is the starting position of aFrame
|
||||||
* OUT value will be the ending position of aFrame(after
|
* (without considering its inline-start margin)
|
||||||
* adding its right margin)
|
* OUT value will be the ending position of aFrame
|
||||||
|
* (after adding its inline-end margin)
|
||||||
* @param aContinuationStates A map from nsIFrame* to nsFrameContinuationState
|
* @param aContinuationStates A map from nsIFrame* to nsFrameContinuationState
|
||||||
*/
|
*/
|
||||||
static void RepositionFrame(nsIFrame* aFrame,
|
static void RepositionFrame(nsIFrame* aFrame,
|
||||||
bool aIsOddLevel,
|
bool aIsEvenLevel,
|
||||||
nscoord& aLeft,
|
nscoord& aStart,
|
||||||
nsContinuationStates* aContinuationStates);
|
nsContinuationStates* aContinuationStates,
|
||||||
|
mozilla::WritingMode aLineWM,
|
||||||
|
nscoord& aLineWidth);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the continuation state(nsFrameContinuationState) to
|
* Initialize the continuation state(nsFrameContinuationState) to
|
||||||
@ -422,10 +428,10 @@ private:
|
|||||||
* @param[out] aIsLeftMost TRUE means aFrame is leftmost frame or continuation
|
* @param[out] aIsLeftMost TRUE means aFrame is leftmost frame or continuation
|
||||||
* @param[out] aIsRightMost TRUE means aFrame is rightmost frame or continuation
|
* @param[out] aIsRightMost TRUE means aFrame is rightmost frame or continuation
|
||||||
*/
|
*/
|
||||||
static void IsLeftOrRightMost(nsIFrame* aFrame,
|
static void IsFirstOrLast(nsIFrame* aFrame,
|
||||||
nsContinuationStates* aContinuationStates,
|
nsContinuationStates* aContinuationStates,
|
||||||
bool& aIsLeftMost /* out */,
|
bool& aIsFirst /* out */,
|
||||||
bool& aIsRightMost /* out */);
|
bool& aIsLast /* out */);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust frame positions following their visual order
|
* Adjust frame positions following their visual order
|
||||||
@ -435,7 +441,9 @@ private:
|
|||||||
* @lina 04/11/2000
|
* @lina 04/11/2000
|
||||||
*/
|
*/
|
||||||
static void RepositionInlineFrames(BidiLineData* aBld,
|
static void RepositionInlineFrames(BidiLineData* aBld,
|
||||||
nsIFrame* aFirstChild);
|
nsIFrame* aFirstChild,
|
||||||
|
mozilla::WritingMode aLineWM,
|
||||||
|
nscoord& aLineWidth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for Resolve()
|
* Helper method for Resolve()
|
||||||
|
@ -833,6 +833,12 @@ public:
|
|||||||
*this : LogicalMargin(aToMode, GetPhysicalMargin(aFromMode));
|
*this : LogicalMargin(aToMode, GetPhysicalMargin(aFromMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsEmpty() const
|
||||||
|
{
|
||||||
|
return (mMargin.left == 0 && mMargin.top == 0 &&
|
||||||
|
mMargin.right == 0 && mMargin.bottom == 0);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class LogicalRect;
|
friend class LogicalRect;
|
||||||
|
|
||||||
@ -1123,6 +1129,17 @@ public:
|
|||||||
return aWritingMode.IsVertical() ? mRect.XMost() : mRect.YMost();
|
return aWritingMode.IsVertical() ? mRect.XMost() : mRect.YMost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsEmpty() const
|
||||||
|
{
|
||||||
|
return (mRect.x == 0 && mRect.y == 0 &&
|
||||||
|
mRect.width == 0 && mRect.height == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsZeroSize() const
|
||||||
|
{
|
||||||
|
return (mRect.width == 0 && mRect.height == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX are these correct?
|
/* XXX are these correct?
|
||||||
nscoord ILeft(WritingMode aWritingMode) const
|
nscoord ILeft(WritingMode aWritingMode) const
|
||||||
{
|
{
|
||||||
|
@ -1450,7 +1450,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||||||
*aBottomEdgeOfChildren = bottomEdgeOfChildren;
|
*aBottomEdgeOfChildren = bottomEdgeOfChildren;
|
||||||
|
|
||||||
#ifdef DEBUG_blocks
|
#ifdef DEBUG_blocks
|
||||||
if (CRAZY_WIDTH(aMetrics.Width()) || CRAZY_HEIGHT(aMetrics.Height())) {
|
if (CRAZY_SIZE(aMetrics.Width()) || CRAZY_SIZE(aMetrics.Height())) {
|
||||||
ListTag(stdout);
|
ListTag(stdout);
|
||||||
printf(": WARNING: desired:%d,%d\n", aMetrics.Width(), aMetrics.Height());
|
printf(": WARNING: desired:%d,%d\n", aMetrics.Width(), aMetrics.Height());
|
||||||
}
|
}
|
||||||
@ -3448,35 +3448,32 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
|
|||||||
this, aFloatAvailableSpace.mHasFloats);
|
this, aFloatAvailableSpace.mHasFloats);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nscoord x = aFloatAvailableSpace.mRect.x;
|
WritingMode wm = GetWritingMode(aLine->mFirstChild);
|
||||||
nscoord availWidth = aFloatAvailableSpace.mRect.width;
|
nscoord lineWidth = aFloatAvailableSpace.mRect.width +
|
||||||
nscoord availHeight;
|
aState.BorderPadding().LeftRight();
|
||||||
|
LogicalRect lineRect(wm, aFloatAvailableSpace.mRect, lineWidth);
|
||||||
|
|
||||||
|
nscoord iStart = lineRect.IStart(wm);
|
||||||
|
|
||||||
|
nscoord availISize = lineRect.ISize(wm);
|
||||||
|
nscoord availBSize;
|
||||||
if (aState.GetFlag(BRS_UNCONSTRAINEDHEIGHT)) {
|
if (aState.GetFlag(BRS_UNCONSTRAINEDHEIGHT)) {
|
||||||
availHeight = NS_UNCONSTRAINEDSIZE;
|
availBSize = NS_UNCONSTRAINEDSIZE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* XXX get the height right! */
|
/* XXX get the height right! */
|
||||||
availHeight = aFloatAvailableSpace.mRect.height;
|
availBSize = lineRect.BSize(wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure to enable resize optimization before we call BeginLineReflow
|
// Make sure to enable resize optimization before we call BeginLineReflow
|
||||||
// because it might get disabled there
|
// because it might get disabled there
|
||||||
aLine->EnableResizeReflowOptimization();
|
aLine->EnableResizeReflowOptimization();
|
||||||
|
|
||||||
// For unicode-bidi: plaintext, we need to get the direction of the line from
|
aLineLayout.BeginLineReflow(iStart, aState.mY,
|
||||||
// the resolved paragraph level of the first frame on the line, not the block
|
availISize, availBSize,
|
||||||
// frame, because the block frame could be split by hard line breaks into
|
|
||||||
// multiple paragraphs with different base direction
|
|
||||||
uint8_t direction =
|
|
||||||
(StyleTextReset()->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_PLAINTEXT) ?
|
|
||||||
nsBidiPresUtils::GetFrameBaseLevel(aLine->mFirstChild) & 1 :
|
|
||||||
StyleVisibility()->mDirection;
|
|
||||||
|
|
||||||
aLineLayout.BeginLineReflow(x, aState.mY,
|
|
||||||
availWidth, availHeight,
|
|
||||||
aFloatAvailableSpace.mHasFloats,
|
aFloatAvailableSpace.mHasFloats,
|
||||||
false, /*XXX isTopOfPage*/
|
false, /*XXX isTopOfPage*/
|
||||||
direction);
|
wm, lineWidth);
|
||||||
|
|
||||||
aState.SetFlag(BRS_LINE_LAYOUT_EMPTY, false);
|
aState.SetFlag(BRS_LINE_LAYOUT_EMPTY, false);
|
||||||
|
|
||||||
@ -4052,7 +4049,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||||||
bool addedBullet = false;
|
bool addedBullet = false;
|
||||||
if (HasOutsideBullet() &&
|
if (HasOutsideBullet() &&
|
||||||
((aLine == mLines.front() &&
|
((aLine == mLines.front() &&
|
||||||
(!aLineLayout.IsZeroHeight() || (aLine == mLines.back()))) ||
|
(!aLineLayout.IsZeroBSize() || (aLine == mLines.back()))) ||
|
||||||
(mLines.front() != mLines.back() &&
|
(mLines.front() != mLines.back() &&
|
||||||
0 == mLines.front()->mBounds.height &&
|
0 == mLines.front()->mBounds.height &&
|
||||||
aLine == mLines.begin().next()))) {
|
aLine == mLines.begin().next()))) {
|
||||||
@ -4064,7 +4061,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||||||
aLineLayout.AddBulletFrame(bullet, metrics);
|
aLineLayout.AddBulletFrame(bullet, metrics);
|
||||||
addedBullet = true;
|
addedBullet = true;
|
||||||
}
|
}
|
||||||
aLineLayout.VerticalAlignLine();
|
aLineLayout.BlockDirAlignLine();
|
||||||
|
|
||||||
// We want to compare to the available space that we would have had in
|
// We want to compare to the available space that we would have had in
|
||||||
// the line's height *before* we placed any floats in the line itself.
|
// the line's height *before* we placed any floats in the line itself.
|
||||||
@ -4092,9 +4089,9 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
static nscoord lastHeight = 0;
|
static nscoord lastHeight = 0;
|
||||||
if (CRAZY_HEIGHT(aLine->mBounds.y)) {
|
if (CRAZY_SIZE(aLine->mBounds.y)) {
|
||||||
lastHeight = aLine->mBounds.y;
|
lastHeight = aLine->mBounds.y;
|
||||||
if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) {
|
if (abs(aLine->mBounds.y - lastHeight) > CRAZY_COORD/10) {
|
||||||
nsFrame::ListTag(stdout);
|
nsFrame::ListTag(stdout);
|
||||||
printf(": line=%p y=%d line.bounds.height=%d\n",
|
printf(": line=%p y=%d line.bounds.height=%d\n",
|
||||||
static_cast<void*>(aLine.get()),
|
static_cast<void*>(aLine.get()),
|
||||||
@ -4125,20 +4122,9 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||||||
NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign) &&
|
NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign) &&
|
||||||
(aLineLayout.GetLineEndsInBR() ||
|
(aLineLayout.GetLineEndsInBR() ||
|
||||||
IsLastLine(aState, aLine)));
|
IsLastLine(aState, aLine)));
|
||||||
aLineLayout.HorizontalAlignFrames(aLine->mBounds, isLastLine);
|
|
||||||
// XXX: not only bidi: right alignment can be broken after
|
aLineLayout.InlineDirAlignFrames(aLine->mBounds, isLastLine,
|
||||||
// RelativePositionFrames!!!
|
aLine->GetChildCount());
|
||||||
// XXXldb Is something here considering relatively positioned frames at
|
|
||||||
// other than their original positions?
|
|
||||||
#ifdef IBMBIDI
|
|
||||||
// XXXldb Why don't we do this earlier?
|
|
||||||
if (aState.mPresContext->BidiEnabled()) {
|
|
||||||
if (!aState.mPresContext->IsVisualMode() ||
|
|
||||||
StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
|
||||||
nsBidiPresUtils::ReorderFrames(aLine->mFirstChild, aLine->GetChildCount());
|
|
||||||
} // not visual mode
|
|
||||||
} // bidi enabled
|
|
||||||
#endif // IBMBIDI
|
|
||||||
|
|
||||||
// From here on, pfd->mBounds rectangles are incorrect because bidi
|
// From here on, pfd->mBounds rectangles are incorrect because bidi
|
||||||
// might have moved frames around!
|
// might have moved frames around!
|
||||||
|
@ -262,7 +262,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) {
|
if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) {
|
||||||
if (CRAZY_WIDTH(mMetrics.Width()) || CRAZY_HEIGHT(mMetrics.Height())) {
|
if (CRAZY_SIZE(mMetrics.Width()) || CRAZY_SIZE(mMetrics.Height())) {
|
||||||
printf("nsBlockReflowContext: ");
|
printf("nsBlockReflowContext: ");
|
||||||
nsFrame::ListTag(stdout, mFrame);
|
nsFrame::ListTag(stdout, mFrame);
|
||||||
printf(" metrics=%d,%d!\n", mMetrics.Width(), mMetrics.Height());
|
printf(" metrics=%d,%d!\n", mMetrics.Width(), mMetrics.Height());
|
||||||
|
@ -34,11 +34,8 @@ class FramePropertyTable;
|
|||||||
// dependency on nsDeviceContext.h. It doesn't matter if it's a
|
// dependency on nsDeviceContext.h. It doesn't matter if it's a
|
||||||
// little off.
|
// little off.
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define CRAZY_W (1000000*60)
|
#define CRAZY_COORD (1000000*60)
|
||||||
#define CRAZY_H CRAZY_W
|
#define CRAZY_SIZE(_x) (((_x) < -CRAZY_COORD) || ((_x) > CRAZY_COORD))
|
||||||
|
|
||||||
#define CRAZY_WIDTH(_x) (((_x) < -CRAZY_W) || ((_x) > CRAZY_W))
|
|
||||||
#define CRAZY_HEIGHT(_y) (((_y) < -CRAZY_H) || ((_y) > CRAZY_H))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -188,21 +188,10 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
nsHTMLReflowState rs(aPresContext, aReflowState, kid, availSize);
|
nsHTMLReflowState rs(aPresContext, aReflowState, kid, availSize);
|
||||||
nsLineLayout ll(aPresContext, nullptr, &aReflowState, nullptr);
|
nsLineLayout ll(aPresContext, nullptr, &aReflowState, nullptr);
|
||||||
|
|
||||||
// For unicode-bidi: plaintext, we need to get the direction of the line
|
|
||||||
// from the resolved paragraph level of the child, not the block frame,
|
|
||||||
// because the block frame could be split by hard line breaks into
|
|
||||||
// multiple paragraphs with different base direction
|
|
||||||
uint8_t direction;
|
|
||||||
nsIFrame* containerFrame = ll.LineContainerFrame();
|
|
||||||
if (containerFrame->StyleTextReset()->mUnicodeBidi &
|
|
||||||
NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
|
||||||
FramePropertyTable *propTable = aPresContext->PropertyTable();
|
|
||||||
direction = NS_PTR_TO_INT32(propTable->Get(kid, BaseLevelProperty())) & 1;
|
|
||||||
} else {
|
|
||||||
direction = containerFrame->StyleVisibility()->mDirection;
|
|
||||||
}
|
|
||||||
ll.BeginLineReflow(bp.left, bp.top, availSize.width, NS_UNCONSTRAINEDSIZE,
|
ll.BeginLineReflow(bp.left, bp.top, availSize.width, NS_UNCONSTRAINEDSIZE,
|
||||||
false, true, direction);
|
false, true,
|
||||||
|
ll.LineContainerFrame()->GetWritingMode(kid),
|
||||||
|
aReflowState.AvailableWidth());
|
||||||
rs.mLineLayout = ≪
|
rs.mLineLayout = ≪
|
||||||
ll.SetInFirstLetter(true);
|
ll.SetInFirstLetter(true);
|
||||||
ll.SetFirstLetterStyleOK(true);
|
ll.SetFirstLetterStyleOK(true);
|
||||||
|
@ -975,6 +975,20 @@ nsIFrame::GetPaddingRect() const
|
|||||||
return GetPaddingRectRelativeToSelf() + GetPosition();
|
return GetPaddingRectRelativeToSelf() + GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WritingMode
|
||||||
|
nsIFrame::GetWritingMode(nsIFrame* aSubFrame) const
|
||||||
|
{
|
||||||
|
WritingMode writingMode = GetWritingMode();
|
||||||
|
|
||||||
|
if (!writingMode.IsVertical() &&
|
||||||
|
(StyleTextReset()->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_PLAINTEXT)) {
|
||||||
|
nsBidiLevel frameLevel = nsBidiPresUtils::GetFrameBaseLevel(aSubFrame);
|
||||||
|
writingMode.SetDirectionFromBidiLevel(frameLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return writingMode;
|
||||||
|
}
|
||||||
|
|
||||||
nsRect
|
nsRect
|
||||||
nsIFrame::GetMarginRectRelativeToSelf() const
|
nsIFrame::GetMarginRectRelativeToSelf() const
|
||||||
{
|
{
|
||||||
|
@ -672,6 +672,15 @@ public:
|
|||||||
return mozilla::WritingMode(StyleVisibility());
|
return mozilla::WritingMode(StyleVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the writing mode of this frame, but if it is styled with
|
||||||
|
* unicode-bidi: plaintext, reset the direction to the resolved paragraph
|
||||||
|
* level of the given subframe (typically the first frame on the line),
|
||||||
|
* not this frame's writing mode, because the container frame could be split
|
||||||
|
* by hard line breaks into multiple paragraphs with different base direction.
|
||||||
|
*/
|
||||||
|
mozilla::WritingMode GetWritingMode(nsIFrame* aSubFrame) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bounding rect of the frame. The values are in app units, and the origin is
|
* Bounding rect of the frame. The values are in app units, and the origin is
|
||||||
* relative to the upper-left of the geometric parent. The size includes the
|
* relative to the upper-left of the geometric parent. The size includes the
|
||||||
|
@ -487,23 +487,21 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||||||
nsLineLayout* lineLayout = aReflowState.mLineLayout;
|
nsLineLayout* lineLayout = aReflowState.mLineLayout;
|
||||||
bool inFirstLine = aReflowState.mLineLayout->GetInFirstLine();
|
bool inFirstLine = aReflowState.mLineLayout->GetInFirstLine();
|
||||||
RestyleManager* restyleManager = aPresContext->RestyleManager();
|
RestyleManager* restyleManager = aPresContext->RestyleManager();
|
||||||
bool ltr = (NS_STYLE_DIRECTION_LTR == aReflowState.mStyleVisibility->mDirection);
|
WritingMode wm = aReflowState.GetWritingMode();
|
||||||
nscoord leftEdge = 0;
|
nscoord startEdge = 0;
|
||||||
// Don't offset by our start borderpadding if we have a prev continuation or
|
// Don't offset by our start borderpadding if we have a prev continuation or
|
||||||
// if we're in a part of an {ib} split other than the first one.
|
// if we're in a part of an {ib} split other than the first one.
|
||||||
if (!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) {
|
if (!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) {
|
||||||
leftEdge = ltr ? aReflowState.ComputedPhysicalBorderPadding().left
|
startEdge = aReflowState.ComputedLogicalBorderPadding().IStart(wm);
|
||||||
: aReflowState.ComputedPhysicalBorderPadding().right;
|
|
||||||
}
|
}
|
||||||
nscoord availableWidth = aReflowState.AvailableWidth();
|
nscoord availableISize = aReflowState.AvailableISize();
|
||||||
NS_ASSERTION(availableWidth != NS_UNCONSTRAINEDSIZE,
|
NS_ASSERTION(availableISize != NS_UNCONSTRAINEDSIZE,
|
||||||
"should no longer use available widths");
|
"should no longer use available widths");
|
||||||
// Subtract off left and right border+padding from availableWidth
|
// Subtract off inline axis border+padding from availableISize
|
||||||
availableWidth -= leftEdge;
|
availableISize -= startEdge;
|
||||||
availableWidth -= ltr ? aReflowState.ComputedPhysicalBorderPadding().right
|
availableISize -= aReflowState.ComputedLogicalBorderPadding().IEnd(wm);
|
||||||
: aReflowState.ComputedPhysicalBorderPadding().left;
|
lineLayout->BeginSpan(this, &aReflowState, startEdge,
|
||||||
lineLayout->BeginSpan(this, &aReflowState, leftEdge,
|
startEdge + availableISize, &mBaseline);
|
||||||
leftEdge + availableWidth, &mBaseline);
|
|
||||||
|
|
||||||
// First reflow our principal children.
|
// First reflow our principal children.
|
||||||
nsIFrame* frame = mFrames.FirstChild();
|
nsIFrame* frame = mFrames.FirstChild();
|
||||||
@ -646,7 +644,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||||||
// line-height calculations. However, continuations of an inline
|
// line-height calculations. However, continuations of an inline
|
||||||
// that are empty we force to empty so that things like collapsed
|
// that are empty we force to empty so that things like collapsed
|
||||||
// whitespace in an inline element don't affect the line-height.
|
// whitespace in an inline element don't affect the line-height.
|
||||||
aMetrics.Width() = lineLayout->EndSpan(this);
|
aMetrics.ISize() = lineLayout->EndSpan(this);
|
||||||
|
|
||||||
// Compute final width.
|
// Compute final width.
|
||||||
|
|
||||||
@ -654,8 +652,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||||||
// continuation or if we're in a part of an {ib} split other than the first
|
// continuation or if we're in a part of an {ib} split other than the first
|
||||||
// one.
|
// one.
|
||||||
if (!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) {
|
if (!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) {
|
||||||
aMetrics.Width() += ltr ? aReflowState.ComputedPhysicalBorderPadding().left
|
aMetrics.ISize() += aReflowState.ComputedLogicalBorderPadding().IStart(wm);
|
||||||
: aReflowState.ComputedPhysicalBorderPadding().right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -668,8 +665,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||||||
if (NS_FRAME_IS_COMPLETE(aStatus) &&
|
if (NS_FRAME_IS_COMPLETE(aStatus) &&
|
||||||
!LastInFlow()->GetNextContinuation() &&
|
!LastInFlow()->GetNextContinuation() &&
|
||||||
!FrameIsNonLastInIBSplit()) {
|
!FrameIsNonLastInIBSplit()) {
|
||||||
aMetrics.Width() += ltr ? aReflowState.ComputedPhysicalBorderPadding().right
|
aMetrics.Width() += aReflowState.ComputedLogicalBorderPadding().IEnd(wm);
|
||||||
: aReflowState.ComputedPhysicalBorderPadding().left;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsFontMetrics> fm;
|
nsRefPtr<nsFontMetrics> fm;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,7 @@
|
|||||||
#include "nsBlockReflowState.h"
|
#include "nsBlockReflowState.h"
|
||||||
#include "plarena.h"
|
#include "plarena.h"
|
||||||
#include "gfxTypes.h"
|
#include "gfxTypes.h"
|
||||||
|
#include "WritingModes.h"
|
||||||
|
|
||||||
class nsFloatManager;
|
class nsFloatManager;
|
||||||
struct nsStyleText;
|
struct nsStyleText;
|
||||||
@ -33,10 +34,10 @@ public:
|
|||||||
const nsLineList::iterator* aLine);
|
const nsLineList::iterator* aLine);
|
||||||
~nsLineLayout();
|
~nsLineLayout();
|
||||||
|
|
||||||
void Init(nsBlockReflowState* aState, nscoord aMinLineHeight,
|
void Init(nsBlockReflowState* aState, nscoord aMinLineBSize,
|
||||||
int32_t aLineNumber) {
|
int32_t aLineNumber) {
|
||||||
mBlockRS = aState;
|
mBlockRS = aState;
|
||||||
mMinLineHeight = aMinLineHeight;
|
mMinLineBSize = aMinLineBSize;
|
||||||
mLineNumber = aLineNumber;
|
mLineNumber = aLineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,11 +45,12 @@ public:
|
|||||||
return mLineNumber;
|
return mLineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeginLineReflow(nscoord aX, nscoord aY,
|
void BeginLineReflow(nscoord aICoord, nscoord aBCoord,
|
||||||
nscoord aWidth, nscoord aHeight,
|
nscoord aISize, nscoord aBSize,
|
||||||
bool aImpactedByFloats,
|
bool aImpactedByFloats,
|
||||||
bool aIsTopOfPage,
|
bool aIsTopOfPage,
|
||||||
uint8_t aDirection);
|
mozilla::WritingMode aWritingMode,
|
||||||
|
nscoord aContainerWidth);
|
||||||
|
|
||||||
void EndLineReflow();
|
void EndLineReflow();
|
||||||
|
|
||||||
@ -73,7 +75,7 @@ public:
|
|||||||
|
|
||||||
void SplitLineTo(int32_t aNewCount);
|
void SplitLineTo(int32_t aNewCount);
|
||||||
|
|
||||||
bool IsZeroHeight();
|
bool IsZeroBSize();
|
||||||
|
|
||||||
// Reflows the frame and returns the reflow status. aPushedFrame is true
|
// Reflows the frame and returns the reflow status. aPushedFrame is true
|
||||||
// if the frame is pushed to the next line because it doesn't fit
|
// if the frame is pushed to the next line because it doesn't fit
|
||||||
@ -88,11 +90,12 @@ public:
|
|||||||
PushFrame(aFrame);
|
PushFrame(aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalAlignLine();
|
void BlockDirAlignLine();
|
||||||
|
|
||||||
bool TrimTrailingWhiteSpace();
|
bool TrimTrailingWhiteSpace();
|
||||||
|
|
||||||
void HorizontalAlignFrames(nsRect& aLineBounds, bool aIsLastLine);
|
void InlineDirAlignFrames(nsRect& aLineBounds, bool aIsLastLine,
|
||||||
|
int32_t aFrameCount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle all the relative positioning in the line, compute the
|
* Handle all the relative positioning in the line, compute the
|
||||||
@ -303,10 +306,10 @@ public:
|
|||||||
* the right edge for RTL blocks and from the left edge for LTR blocks.
|
* the right edge for RTL blocks and from the left edge for LTR blocks.
|
||||||
* In other words, the current frame's distance from the line container's
|
* In other words, the current frame's distance from the line container's
|
||||||
* start content edge is:
|
* start content edge is:
|
||||||
* <code>GetCurrentFrameXDistanceFromBlock() - lineContainer->GetUsedBorderAndPadding().left</code>
|
* <code>GetCurrentFrameInlineDistanceFromBlock() - lineContainer->GetUsedBorderAndPadding().left</code>
|
||||||
* Note the use of <code>.left</code> for both LTR and RTL line containers.
|
* Note the use of <code>.left</code> for both LTR and RTL line containers.
|
||||||
*/
|
*/
|
||||||
nscoord GetCurrentFrameXDistanceFromBlock();
|
nscoord GetCurrentFrameInlineDistanceFromBlock();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This state is constant for a given block frame doing line layout
|
// This state is constant for a given block frame doing line layout
|
||||||
@ -326,14 +329,22 @@ protected:
|
|||||||
|
|
||||||
// Per-frame data recorded by the line-layout reflow logic. This
|
// Per-frame data recorded by the line-layout reflow logic. This
|
||||||
// state is the state needed to post-process the line after reflow
|
// state is the state needed to post-process the line after reflow
|
||||||
// has completed (vertical alignment, horizontal alignment,
|
// has completed (block-direction alignment, inline-direction alignment,
|
||||||
// justification and relative positioning).
|
// justification and relative positioning).
|
||||||
|
|
||||||
struct PerSpanData;
|
struct PerSpanData;
|
||||||
struct PerFrameData;
|
struct PerFrameData;
|
||||||
friend struct PerSpanData;
|
friend struct PerSpanData;
|
||||||
friend struct PerFrameData;
|
friend struct PerFrameData;
|
||||||
struct PerFrameData {
|
struct PerFrameData
|
||||||
|
{
|
||||||
|
PerFrameData(mozilla::WritingMode aWritingMode)
|
||||||
|
: mBounds(aWritingMode)
|
||||||
|
, mMargin(aWritingMode)
|
||||||
|
, mBorderPadding(aWritingMode)
|
||||||
|
, mOffsets(aWritingMode)
|
||||||
|
{}
|
||||||
|
|
||||||
// link to next/prev frame in same span
|
// link to next/prev frame in same span
|
||||||
PerFrameData* mNext;
|
PerFrameData* mNext;
|
||||||
PerFrameData* mPrev;
|
PerFrameData* mPrev;
|
||||||
@ -346,20 +357,23 @@ protected:
|
|||||||
|
|
||||||
// From metrics
|
// From metrics
|
||||||
nscoord mAscent;
|
nscoord mAscent;
|
||||||
nsRect mBounds;
|
// note that mBounds is a logical rect in the *line*'s writing mode.
|
||||||
|
// When setting frame coordinates, we have to convert to the frame's
|
||||||
|
// writing mode
|
||||||
|
mozilla::LogicalRect mBounds;
|
||||||
nsOverflowAreas mOverflowAreas;
|
nsOverflowAreas mOverflowAreas;
|
||||||
|
|
||||||
// From reflow-state
|
// From reflow-state
|
||||||
nsMargin mMargin;
|
mozilla::LogicalMargin mMargin;
|
||||||
nsMargin mBorderPadding;
|
mozilla::LogicalMargin mBorderPadding;
|
||||||
nsMargin mOffsets;
|
mozilla::LogicalMargin mOffsets;
|
||||||
|
|
||||||
// state for text justification
|
// state for text justification
|
||||||
int32_t mJustificationNumSpaces;
|
int32_t mJustificationNumSpaces;
|
||||||
int32_t mJustificationNumLetters;
|
int32_t mJustificationNumLetters;
|
||||||
|
|
||||||
// Other state we use
|
// Other state we use
|
||||||
uint8_t mVerticalAlign;
|
uint8_t mBlockDirAlign;
|
||||||
|
|
||||||
// PerFrameData flags
|
// PerFrameData flags
|
||||||
#define PFD_RELATIVEPOS 0x00000001
|
#define PFD_RELATIVEPOS 0x00000001
|
||||||
@ -414,19 +428,18 @@ protected:
|
|||||||
|
|
||||||
const nsHTMLReflowState* mReflowState;
|
const nsHTMLReflowState* mReflowState;
|
||||||
bool mNoWrap;
|
bool mNoWrap;
|
||||||
uint8_t mDirection;
|
mozilla::WritingMode mWritingMode;
|
||||||
bool mChangedFrameDirection;
|
|
||||||
bool mZeroEffectiveSpanBox;
|
bool mZeroEffectiveSpanBox;
|
||||||
bool mContainsFloat;
|
bool mContainsFloat;
|
||||||
bool mHasNonemptyContent;
|
bool mHasNonemptyContent;
|
||||||
|
|
||||||
nscoord mLeftEdge;
|
nscoord mIStart;
|
||||||
nscoord mX;
|
nscoord mICoord;
|
||||||
nscoord mRightEdge;
|
nscoord mIEnd;
|
||||||
|
|
||||||
nscoord mTopLeading, mBottomLeading;
|
nscoord mBStartLeading, mBEndLeading;
|
||||||
nscoord mLogicalHeight;
|
nscoord mLogicalBSize;
|
||||||
nscoord mMinY, mMaxY;
|
nscoord mMinBCoord, mMaxBCoord;
|
||||||
nscoord* mBaseline;
|
nscoord* mBaseline;
|
||||||
|
|
||||||
void AppendFrame(PerFrameData* pfd) {
|
void AppendFrame(PerFrameData* pfd) {
|
||||||
@ -448,7 +461,7 @@ protected:
|
|||||||
int32_t mLastOptionalBreakContentOffset;
|
int32_t mLastOptionalBreakContentOffset;
|
||||||
int32_t mForceBreakContentOffset;
|
int32_t mForceBreakContentOffset;
|
||||||
|
|
||||||
nscoord mMinLineHeight;
|
nscoord mMinLineBSize;
|
||||||
|
|
||||||
// The amount of text indent that we applied to this line, needed for
|
// The amount of text indent that we applied to this line, needed for
|
||||||
// max-element-size calculation.
|
// max-element-size calculation.
|
||||||
@ -462,19 +475,21 @@ protected:
|
|||||||
|
|
||||||
int32_t mTotalPlacedFrames;
|
int32_t mTotalPlacedFrames;
|
||||||
|
|
||||||
nscoord mTopEdge;
|
nscoord mBStartEdge;
|
||||||
nscoord mMaxTopBoxHeight;
|
nscoord mMaxStartBoxBSize;
|
||||||
nscoord mMaxBottomBoxHeight;
|
nscoord mMaxEndBoxBSize;
|
||||||
|
|
||||||
nscoord mInflationMinFontSize;
|
nscoord mInflationMinFontSize;
|
||||||
|
|
||||||
// Final computed line-height value after VerticalAlignFrames for
|
// Final computed line-bSize value after BlockDirAlignFrames for
|
||||||
// the block has been called.
|
// the block has been called.
|
||||||
nscoord mFinalLineHeight;
|
nscoord mFinalLineBSize;
|
||||||
|
|
||||||
// Amount of trimmable whitespace width for the trailing text frame, if any
|
// Amount of trimmable whitespace width for the trailing text frame, if any
|
||||||
nscoord mTrimmableWidth;
|
nscoord mTrimmableWidth;
|
||||||
|
|
||||||
|
nscoord mContainerWidth;
|
||||||
|
|
||||||
bool mFirstLetterStyleOK : 1;
|
bool mFirstLetterStyleOK : 1;
|
||||||
bool mIsTopOfPage : 1;
|
bool mIsTopOfPage : 1;
|
||||||
bool mImpactedByFloats : 1;
|
bool mImpactedByFloats : 1;
|
||||||
@ -499,7 +514,7 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Allocate a PerFrameData from the mArena pool. The allocation is infallible.
|
* Allocate a PerFrameData from the mArena pool. The allocation is infallible.
|
||||||
*/
|
*/
|
||||||
PerFrameData* NewPerFrameData();
|
PerFrameData* NewPerFrameData(nsIFrame* aFrame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a PerSpanData from the mArena pool. The allocation is infallible.
|
* Allocate a PerSpanData from the mArena pool. The allocation is infallible.
|
||||||
@ -518,7 +533,6 @@ protected:
|
|||||||
nsHTMLReflowState& aReflowState);
|
nsHTMLReflowState& aReflowState);
|
||||||
|
|
||||||
bool CanPlaceFrame(PerFrameData* pfd,
|
bool CanPlaceFrame(PerFrameData* pfd,
|
||||||
uint8_t aFrameDirection,
|
|
||||||
bool aNotSafeToBreak,
|
bool aNotSafeToBreak,
|
||||||
bool aFrameCanContinueTextRun,
|
bool aFrameCanContinueTextRun,
|
||||||
bool aCanRollBackBeforeFrame,
|
bool aCanRollBackBeforeFrame,
|
||||||
@ -529,15 +543,15 @@ protected:
|
|||||||
void PlaceFrame(PerFrameData* pfd,
|
void PlaceFrame(PerFrameData* pfd,
|
||||||
nsHTMLReflowMetrics& aMetrics);
|
nsHTMLReflowMetrics& aMetrics);
|
||||||
|
|
||||||
void VerticalAlignFrames(PerSpanData* psd);
|
void BlockDirAlignFrames(PerSpanData* psd);
|
||||||
|
|
||||||
void PlaceTopBottomFrames(PerSpanData* psd,
|
void PlaceStartEndFrames(PerSpanData* psd,
|
||||||
nscoord aDistanceFromTop,
|
nscoord aDistanceFromStart,
|
||||||
nscoord aLineHeight);
|
nscoord aLineBSize);
|
||||||
|
|
||||||
void RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflowAreas);
|
void RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflowAreas);
|
||||||
|
|
||||||
bool TrimTrailingWhiteSpaceIn(PerSpanData* psd, nscoord* aDeltaWidth);
|
bool TrimTrailingWhiteSpaceIn(PerSpanData* psd, nscoord* aDeltaISize);
|
||||||
|
|
||||||
void ComputeJustificationWeights(PerSpanData* psd, int32_t* numSpaces, int32_t* numLetters);
|
void ComputeJustificationWeights(PerSpanData* psd, int32_t* numSpaces, int32_t* numLetters);
|
||||||
|
|
||||||
|
@ -7841,7 +7841,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||||||
|
|
||||||
iter.SetOriginalOffset(offset);
|
iter.SetOriginalOffset(offset);
|
||||||
nscoord xOffsetForTabs = (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) ?
|
nscoord xOffsetForTabs = (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TAB) ?
|
||||||
(aLineLayout.GetCurrentFrameXDistanceFromBlock() -
|
(aLineLayout.GetCurrentFrameInlineDistanceFromBlock() -
|
||||||
lineContainer->GetUsedBorderAndPadding().left)
|
lineContainer->GetUsedBorderAndPadding().left)
|
||||||
: -1;
|
: -1;
|
||||||
PropertyProvider provider(mTextRun, textStyle, frag, this, iter, length,
|
PropertyProvider provider(mTextRun, textStyle, frag, this, iter, length,
|
||||||
|
Loading…
Reference in New Issue
Block a user