# HG changeset patch # User Jonathan Kew # Date 1436453973 -3600 # Thu Jul 09 15:59:33 2015 +0100 # Node ID ba207ca59c6a1dce4b509666864489aeef2af35b # Parent fcb26110a3a155c52a7c2731c88031d0ecd45c53 Bug 1131451 part 2d - Remove partial rtl-in-vertical support from nsBidiPresUtils now that logical-coordinate classes handle it better. diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -1585,40 +1585,35 @@ nsBidiPresUtils::RepositionFrame(nsIFram } else if (RubyUtils::IsRubyBox(aFrame->GetType())) { icoord += RepositionRubyFrame(aFrame, aContinuationStates, aContainerWM, borderPadding); } else { icoord += 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. + 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); - return icoord + margin.IStartEnd(aContainerWM); + 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 + + frameMargin.ConvertTo(aContainerWM, frameWM).IStartEnd(aContainerWM); } void nsBidiPresUtils::InitContinuationStates(nsIFrame* aFrame, nsContinuationStates* aContinuationStates) { nsFrameContinuationState* state = aContinuationStates->PutEntry(aFrame); state->mFirstVisualFrame = nullptr;