Bug 1131451 part 2 - Respect the container height when converting vertical-RTL inline-direction coordinates. r=dholbert

* * *
Bug 1131451 part 2a - Remove hack for rtl-in-vertical-mode from ReflowAbsoluteFrame. r=dholbert
* * *
Bug 1131451 part 2b - Mark relative-overconstrained tests that now pass in vertical mode with rtl. r=dholbert
* * *
Bug 1131451 part 2c - Mark vertical border-collapse bevel tests that now pass. r=dholbert
* * *
Bug 1131451 part 2d - Remove partial rtl-in-vertical support from nsBidiPresUtils now that logical-coordinate classes handle it better. r=dholbert
* * *
Bug 1131451 part 2e - Remove hack for float positioning in vertical mode with dir=rtl. r=dholbert
* * *
Bug 1131451 part 2f - Mark vertical-mode float-in-rtl reftests that are now passing. r=dholbert
* * *
Bug 1131451 part 2g - Compute both dimensions of containerSize in nsFlexContainerFrame::DoLayout. r=dholbert
* * *
Bug 1131451 part 2h - Mark flexbox writing-mode tests that are now passing. r=dholbert
This commit is contained in:
Jonathan Kew 2015-07-16 10:08:05 +01:00
parent e96446a347
commit 2cb68dfcab
10 changed files with 64 additions and 74 deletions

View File

@ -1620,28 +1620,23 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
frameWM.IsOrthogonalTo(aContainerWM) ? aFrame->BSize() : frameISize;
}
// LogicalRect doesn't correctly calculate the vertical position
// in vertical writing modes with right-to-left direction (Bug 1131451).
// This does the correct calculation ad hoc pending the fix for that.
nsRect rect = aFrame->GetRect();
LogicalMargin margin = frameMargin.ConvertTo(aContainerWM, frameWM);
// In the following variables, if aContainerReverseDir is true, i.e.
// the container is positioning its children in reverse of its logical
// direction, the "StartOrEnd" refers to the distance from the frame
// to the inline end edge of the container, elsewise, it refers to the
// distance to the inline start edge.
nscoord marginStartOrEnd = aContainerReverseDir ?
margin.IEnd(aContainerWM) : margin.IStart(aContainerWM);
const LogicalMargin margin = frameMargin.ConvertTo(aContainerWM, frameWM);
nscoord marginStartOrEnd =
aContainerReverseDir ? margin.IEnd(aContainerWM)
: margin.IStart(aContainerWM);
nscoord frameStartOrEnd = aStartOrEnd + marginStartOrEnd;
// Whether we are placing frames from right to left.
// e.g. If the frames are placed reversely in LTR mode, they are
// actually placed from right to left.
bool orderingRTL = aContainerReverseDir == aContainerWM.IsBidiLTR();
(aContainerWM.IsVertical() ? rect.y : rect.x) = orderingRTL ?
lineSize - (frameStartOrEnd + icoord) : frameStartOrEnd;
(aContainerWM.IsVertical() ? rect.height : rect.width) = icoord;
aFrame->SetRect(rect);
LogicalRect rect = aFrame->GetLogicalRect(aContainerWM, aContainerSize);
rect.ISize(aContainerWM) = icoord;
rect.IStart(aContainerWM) =
aContainerReverseDir ? lineSize - frameStartOrEnd - icoord
: frameStartOrEnd;
aFrame->SetRect(aContainerWM, rect, aContainerSize);
return icoord + margin.IStartEnd(aContainerWM);
}

View File

@ -642,7 +642,7 @@ public:
// Construct from a writing mode and a physical point, within a given
// containing rectangle's size (defining the conversion between LTR
// and RTL coordinates).
// and RTL coordinates, and between TTB and BTT coordinates).
LogicalPoint(WritingMode aWritingMode,
const nsPoint& aPoint,
const nsSize& aContainerSize)
@ -651,7 +651,8 @@ public:
#endif
{
if (aWritingMode.IsVertical()) {
I() = aPoint.y;
I() = aWritingMode.IsBidiLTR() ? aPoint.y
: aContainerSize.height - aPoint.y;
B() = aWritingMode.IsVerticalLR() ? aPoint.x
: aContainerSize.width - aPoint.x;
} else {
@ -701,7 +702,8 @@ public:
if (aWritingMode.IsVertical()) {
return nsPoint(aWritingMode.IsVerticalLR()
? B() : aContainerSize.width - B(),
I());
aWritingMode.IsBidiLTR()
? I() : aContainerSize.height - I());
} else {
return nsPoint(aWritingMode.IsBidiLTR()
? I() : aContainerSize.width - I(),
@ -1379,7 +1381,8 @@ public:
if (aWritingMode.IsVertical()) {
mRect.y = aWritingMode.IsVerticalLR()
? aRect.x : aContainerSize.width - aRect.XMost();
mRect.x = aRect.y;
mRect.x = aWritingMode.IsBidiLTR()
? aRect.y : aContainerSize.height - aRect.YMost();
mRect.height = aRect.width;
mRect.width = aRect.height;
} else {
@ -1458,23 +1461,23 @@ public:
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
if (aWritingMode.IsBidiLTR()) {
return IStart();
} else {
return aWritingMode.IsBidiLTR() ? IStart()
: aContainerSize.width - IEnd();
}
nscoord containerISize =
aWritingMode.IsVertical() ? aContainerSize.height : aContainerSize.width;
return containerISize - IEnd();
}
nscoord LineRight(WritingMode aWritingMode,
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
if (aWritingMode.IsBidiLTR()) {
return IEnd();
} else {
return aWritingMode.IsBidiLTR() ? IEnd()
: aContainerSize.width - IStart();
}
nscoord containerISize =
aWritingMode.IsVertical() ? aContainerSize.height : aContainerSize.width;
return containerISize - IStart();
}
/**
@ -1496,7 +1499,8 @@ public:
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return mRect.X();
return aWritingMode.IsBidiLTR() ? mRect.X()
: aContainerHeight - mRect.XMost();
} else {
return mRect.Y();
}
@ -1530,7 +1534,8 @@ public:
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return mRect.XMost();
return aWritingMode.IsBidiLTR() ? mRect.XMost()
: aContainerHeight - mRect.x;
} else {
return mRect.YMost();
}
@ -1644,7 +1649,8 @@ public:
if (aWritingMode.IsVertical()) {
return nsRect(aWritingMode.IsVerticalLR()
? BStart() : aContainerSize.width - BEnd(),
IStart(),
aWritingMode.IsBidiLTR()
? IStart() : aContainerSize.height - IEnd(),
BSize(), ISize());
} else {
return nsRect(aWritingMode.IsBidiLTR()

View File

@ -470,10 +470,6 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsRect r =
rect.GetPhysicalRect(outerWM, logicalCBSize.GetPhysicalSize(wm) +
border.Size(outerWM).GetPhysicalSize(outerWM));
// XXX hack to correct for lack of bidi support in vertical mode
if (outerWM.IsVertical() && !outerWM.IsBidiLTR()) {
r.y = logicalCBSize.Height(wm) + border.TopBottom(outerWM) - r.YMost();
}
// Offset the frame rect by the given origin of the absolute containing block.
// If the frame is auto-positioned on both sides of an axis, it will be

View File

@ -852,16 +852,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
LogicalPoint floatPos(wm);
bool leftFloat = NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats;
if (wm.IsVertical()) {
// IStart and IEnd should use the ContainerHeight in vertical modes
// with rtl direction. Since they don't yet (bug 1131451), we'll
// just put left floats at the top of the line and right floats at
// bottom.
floatPos.I(wm) =
leftFloat ? floatAvailableSpace.mRect.Y(wm, ContainerSize().height)
: floatAvailableSpace.mRect.YMost(wm, ContainerSize().height) -
floatMarginISize;
} else if (leftFloat == wm.IsBidiLTR()) {
if (leftFloat == wm.IsBidiLTR()) {
floatPos.I(wm) = floatAvailableSpace.mRect.IStart(wm);
}
else {

View File

@ -3824,11 +3824,12 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
containerBP.IStart(flexWM),
containerBP.BStart(flexWM));
nsSize containerSize;
containerSize.width = aAxisTracker.IsMainAxisHorizontal() ?
aContentBoxMainSize : contentBoxCrossSize;
containerSize.width +=
aReflowState.ComputedPhysicalBorderPadding().LeftRight();
// Determine flex container's border-box size (used in positioning children):
LogicalSize logSize =
aAxisTracker.LogicalSizeFromFlexRelativeSizes(aContentBoxMainSize,
contentBoxCrossSize);
logSize += aReflowState.ComputedLogicalBorderPadding().Size(flexWM);
nsSize containerSize = logSize.GetPhysicalSize(flexWM);
// FINAL REFLOW: Give each child frame another chance to reflow, now that
// we know its final size and position.

View File

@ -242,9 +242,10 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
nscoord blockSize = (blockEnd == nscoord_MAX) ?
nscoord_MAX : (blockEnd - blockStart);
// convert back from LineLeft/Right to IStart
nscoord inlineStart = aWM.IsVertical() || aWM.IsBidiLTR()
nscoord inlineStart = aWM.IsBidiLTR()
? lineLeft - mLineLeft
: mLineLeft - lineRight + aContainerSize.width;
: mLineLeft - lineRight +
LogicalSize(aWM, aContainerSize).ISize(aWM);
return nsFlowAreaRect(aWM, inlineStart, blockStart - mBlockStart,
lineRight - lineLeft, blockSize, haveFloats);

View File

@ -51,14 +51,14 @@ default-preferences pref(layout.css.vertical-text.enabled,true)
== float-in-rtl-vlr-2b.html float-in-rtl-vlr-2-ref.html
== float-in-rtl-vlr-2c.html float-in-rtl-vlr-2-ref.html
== float-in-rtl-vlr-2d.html float-in-rtl-vlr-2-ref.html
fails == float-in-rtl-vlr-3a.html float-in-rtl-vlr-3-ref.html # bug 1131451
fails == float-in-rtl-vlr-3b.html float-in-rtl-vlr-3-ref.html # bug 1131451
fails == float-in-rtl-vlr-3c.html float-in-rtl-vlr-3-ref.html # bug 1131451
fails == float-in-rtl-vlr-3d.html float-in-rtl-vlr-3-ref.html # bug 1131451
fails == float-in-rtl-vlr-4a.html float-in-rtl-vlr-4-ref.html # bug 1131451
fails == float-in-rtl-vlr-4b.html float-in-rtl-vlr-4-ref.html # bug 1131451
fails == float-in-rtl-vlr-4c.html float-in-rtl-vlr-4-ref.html # bug 1131451
fails == float-in-rtl-vlr-4d.html float-in-rtl-vlr-4-ref.html # bug 1131451
== float-in-rtl-vlr-3a.html float-in-rtl-vlr-3-ref.html
== float-in-rtl-vlr-3b.html float-in-rtl-vlr-3-ref.html
== float-in-rtl-vlr-3c.html float-in-rtl-vlr-3-ref.html
== float-in-rtl-vlr-3d.html float-in-rtl-vlr-3-ref.html
== float-in-rtl-vlr-4a.html float-in-rtl-vlr-4-ref.html
== float-in-rtl-vlr-4b.html float-in-rtl-vlr-4-ref.html
== float-in-rtl-vlr-4c.html float-in-rtl-vlr-4-ref.html
== float-in-rtl-vlr-4d.html float-in-rtl-vlr-4-ref.html
== float-in-rtl-vrl-1a.html float-in-rtl-vrl-1-ref.html
== float-in-rtl-vrl-1b.html float-in-rtl-vrl-1-ref.html
== float-in-rtl-vrl-1c.html float-in-rtl-vrl-1-ref.html
@ -67,14 +67,14 @@ fails == float-in-rtl-vlr-4d.html float-in-rtl-vlr-4-ref.html # bug 1131451
== float-in-rtl-vrl-2b.html float-in-rtl-vrl-2-ref.html
== float-in-rtl-vrl-2c.html float-in-rtl-vrl-2-ref.html
== float-in-rtl-vrl-2d.html float-in-rtl-vrl-2-ref.html
fails == float-in-rtl-vrl-3a.html float-in-rtl-vrl-3-ref.html # bug 1131451
fails == float-in-rtl-vrl-3b.html float-in-rtl-vrl-3-ref.html # bug 1131451
fails == float-in-rtl-vrl-3c.html float-in-rtl-vrl-3-ref.html # bug 1131451
fails == float-in-rtl-vrl-3d.html float-in-rtl-vrl-3-ref.html # bug 1131451
fails == float-in-rtl-vrl-4a.html float-in-rtl-vrl-4-ref.html # bug 1131451
fails == float-in-rtl-vrl-4b.html float-in-rtl-vrl-4-ref.html # bug 1131451
fails == float-in-rtl-vrl-4c.html float-in-rtl-vrl-4-ref.html # bug 1131451
fails == float-in-rtl-vrl-4d.html float-in-rtl-vrl-4-ref.html # bug 1131451
== float-in-rtl-vrl-3a.html float-in-rtl-vrl-3-ref.html
== float-in-rtl-vrl-3b.html float-in-rtl-vrl-3-ref.html
== float-in-rtl-vrl-3c.html float-in-rtl-vrl-3-ref.html
== float-in-rtl-vrl-3d.html float-in-rtl-vrl-3-ref.html
== float-in-rtl-vrl-4a.html float-in-rtl-vrl-4-ref.html
== float-in-rtl-vrl-4b.html float-in-rtl-vrl-4-ref.html
== float-in-rtl-vrl-4c.html float-in-rtl-vrl-4-ref.html
== float-in-rtl-vrl-4d.html float-in-rtl-vrl-4-ref.html
fuzzy-if(OSX==1010,26,7) fuzzy-if(Android,16,2) == orthogonal-floats-1a.html orthogonal-floats-1-ref.html
fuzzy-if(OSX==1010,26,7) == orthogonal-floats-1b.html orthogonal-floats-1-ref.html
fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,116,700) HTTP(..) == orthogonal-floats-1c.html orthogonal-floats-1-ref.html

View File

@ -188,8 +188,8 @@ test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-001.htm
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-002.html flexbox-writing-mode-002-ref.html
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-003.html flexbox-writing-mode-003-ref.html
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-004.html flexbox-writing-mode-004-ref.html
test-pref(layout.css.vertical-text.enabled,true) fails == flexbox-writing-mode-005.html flexbox-writing-mode-005-ref.html # bug 1131451
test-pref(layout.css.vertical-text.enabled,true) fails == flexbox-writing-mode-006.html flexbox-writing-mode-006-ref.html # bug 1131451
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-005.html flexbox-writing-mode-005-ref.html
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-006.html flexbox-writing-mode-006-ref.html
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-007.html flexbox-writing-mode-007-ref.html
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-008.html flexbox-writing-mode-008-ref.html
test-pref(layout.css.vertical-text.enabled,true) == flexbox-writing-mode-009.html flexbox-writing-mode-009-ref.html

View File

@ -130,9 +130,9 @@ test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLin
== 1147834-relative-overconstrained-horizontal-tb-ltr.html 1147834-bottom-right-ref.html
== 1147834-relative-overconstrained-horizontal-tb-rtl.html 1147834-bottom-left-ref.html
== 1147834-relative-overconstrained-vertical-lr-ltr.html 1147834-bottom-right-ref.html
fails == 1147834-relative-overconstrained-vertical-lr-rtl.html 1147834-top-right-ref.html # bug 1131451
== 1147834-relative-overconstrained-vertical-lr-rtl.html 1147834-top-right-ref.html
== 1147834-relative-overconstrained-vertical-rl-ltr.html 1147834-bottom-left-ref.html
fails == 1147834-relative-overconstrained-vertical-rl-rtl.html 1147834-top-left-ref.html # bug 1131451
== 1147834-relative-overconstrained-vertical-rl-rtl.html 1147834-top-left-ref.html
== 1151993-1-orthogonal-block-size.html 1151993-1-orthogonal-block-size-ref.html
== 1152941-1-orthogonal-blocksize-overflow.html 1152941-1-orthogonal-blocksize-overflow-ref.html
== 1156021-text-indent-percent.html 1156021-text-indent-percent-ref.html

View File

@ -86,5 +86,5 @@ fuzzy-if(Android,255,38) == table-caption-bottom-1.html table-caption-bottom-1-r
== border-collapse-bevels-1a.html border-collapse-bevels-1-ref.html
fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1b.html border-collapse-bevels-1-ref.html
fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1c.html border-collapse-bevels-1-ref.html
fails == border-collapse-bevels-1d.html border-collapse-bevels-1-ref.html # bug 1177690, bug 1180528
fails == border-collapse-bevels-1e.html border-collapse-bevels-1-ref.html # bug 1177690, bug 1180528
fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1d.html border-collapse-bevels-1-ref.html
fuzzy-if(cocoaWidget,23,162) == border-collapse-bevels-1e.html border-collapse-bevels-1-ref.html