Bug 1062963 patch 1: Logical coordinates in nsLineLayout:ReflowFrame and CanPlaceFrame. r=jfkthame

This commit is contained in:
Simon Montagu 2014-10-21 15:16:11 -07:00
parent 61d98d3191
commit 1c299d429d
3 changed files with 15 additions and 14 deletions

View File

@ -93,7 +93,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mLineNumber = 0;
mTotalPlacedFrames = 0;
mBStartEdge = 0;
mTrimmableWidth = 0;
mTrimmableISize = 0;
mInflationMinFontSize =
nsLayoutUtils::InflationMinFontSizeFor(aOuterReflowState->frame);
@ -878,10 +878,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
pfd->SetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE, true);
nsIFrame* outOfFlowFrame = nsLayoutUtils::GetFloatFromPlaceholder(aFrame);
if (outOfFlowFrame) {
// Add mTrimmableWidth to the available width since if the line ends
// Add mTrimmableISize to the available width since if the line ends
// here, the width of the inline content will be reduced by
// mTrimmableWidth.
nscoord availableWidth = psd->mIEnd - (psd->mICoord - mTrimmableWidth);
// mTrimmableISize.
nscoord availableISize = psd->mIEnd - (psd->mICoord - mTrimmableISize);
if (psd->mNoWrap) {
// If we place floats after inline content where there's
// no break opportunity, we don't know how much additional
@ -892,9 +892,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// but hopefully rare. Fixing it will require significant
// restructuring of line layout.
// We might as well allow zero-width floats to be placed, though.
availableWidth = 0;
availableISize = 0;
}
placedFloat = AddFloat(outOfFlowFrame, availableWidth);
placedFloat = AddFloat(outOfFlowFrame, availableISize);
NS_ASSERTION(!(outOfFlowFrame->GetType() == nsGkAtoms::letterFrame &&
GetFirstLetterStyleOK()),
"FirstLetterStyle set on line with floating first letter");
@ -1003,9 +1003,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// runs (hence return false here) except for text frames and inline containers.
bool continuingTextRun = aFrame->CanContinueTextRun();
// Clear any residual mTrimmableWidth if this isn't a text frame
// Clear any residual mTrimmableISize if this isn't a text frame
if (!continuingTextRun && !pfd->GetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE)) {
mTrimmableWidth = 0;
mTrimmableISize = 0;
}
// See if we can place the frame. If we can't fit it, then we
@ -1204,7 +1204,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
// Set outside to true if the result of the reflow leads to the
// frame sticking outside of our available area.
bool outside = pfd->mBounds.IEnd(lineWM) - mTrimmableWidth + endMargin >
bool outside = pfd->mBounds.IEnd(lineWM) - mTrimmableISize + endMargin >
psd->mIEnd;
if (!outside) {
// If it fits, it fits

View File

@ -155,8 +155,8 @@ public:
return mBlockRS->AddFloat(this, aFloat, aAvailableWidth);
}
void SetTrimmableWidth(nscoord aTrimmableWidth) {
mTrimmableWidth = aTrimmableWidth;
void SetTrimmableISize(nscoord aTrimmableISize) {
mTrimmableISize = aTrimmableISize;
}
//----------------------------------------
@ -504,8 +504,9 @@ protected:
// the block has been called.
nscoord mFinalLineBSize;
// Amount of trimmable whitespace width for the trailing text frame, if any
nscoord mTrimmableWidth;
// Amount of trimmable whitespace inline size for the trailing text
// frame, if any
nscoord mTrimmableISize;
nscoord mContainerWidth;

View File

@ -8313,7 +8313,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
// at most one space so there's no way for trimmable width from a previous
// frame to accumulate with trimmable width from this frame.)
if (transformedCharsFit > 0) {
aLineLayout.SetTrimmableWidth(NSToCoordFloor(trimmableWidth));
aLineLayout.SetTrimmableISize(NSToCoordFloor(trimmableWidth));
AddStateBits(TEXT_HAS_NONCOLLAPSED_CHARACTERS);
}
if (charsFit > 0 && charsFit == length &&