mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1141928 part 2 - Correct the position of ruby text frames. r=roc
This commit is contained in:
parent
253be0ea22
commit
5e69de6a1f
@ -1621,6 +1621,12 @@ public:
|
||||
CHECK_WRITING_MODE(aWritingMode);
|
||||
return LogicalPoint(aWritingMode, IStart(), BStart());
|
||||
}
|
||||
void SetOrigin(WritingMode aWritingMode, const LogicalPoint& aPoint)
|
||||
{
|
||||
IStart(aWritingMode) = aPoint.I(aWritingMode);
|
||||
BStart(aWritingMode) = aPoint.B(aWritingMode);
|
||||
}
|
||||
|
||||
LogicalSize Size(WritingMode aWritingMode) const
|
||||
{
|
||||
CHECK_WRITING_MODE(aWritingMode);
|
||||
|
@ -1234,8 +1234,8 @@ nsLineLayout::GetCurrentFrameInlineDistanceFromBlock()
|
||||
* containers from their rect. It is necessary because:
|
||||
* Containers are not part of the line in their levels, which means
|
||||
* their bounds are not set properly before.
|
||||
* Ruby annotations' block-axis coordinate may have been changed when
|
||||
* reflowing their containers.
|
||||
* Ruby annotations' position may have been changed when reflowing
|
||||
* their containers.
|
||||
*/
|
||||
void
|
||||
nsLineLayout::SyncAnnotationBounds(PerFrameData* aRubyFrame)
|
||||
@ -1256,11 +1256,9 @@ nsLineLayout::SyncAnnotationBounds(PerFrameData* aRubyFrame)
|
||||
nscoord rtcWidth = rtcBounds.Width(lineWM);
|
||||
for (PerFrameData* rt = rtc->mSpan->mFirstFrame; rt; rt = rt->mNext) {
|
||||
LogicalRect rtBounds = rt->mFrame->GetLogicalRect(lineWM, rtcWidth);
|
||||
MOZ_ASSERT(rt->mBounds.IStart(lineWM) == rtBounds.IStart(lineWM) &&
|
||||
rt->mBounds.ISize(lineWM) == rtBounds.ISize(lineWM) &&
|
||||
rt->mBounds.BSize(lineWM) == rtBounds.BSize(lineWM),
|
||||
"Metrics other than bstart should not have been changed");
|
||||
rt->mBounds.BStart(lineWM) = rtBounds.BStart(lineWM);
|
||||
MOZ_ASSERT(rt->mBounds.Size(lineWM) == rtBounds.Size(lineWM),
|
||||
"Size of the annotation should not have been changed");
|
||||
rt->mBounds.SetOrigin(lineWM, rtBounds.Origin(lineWM));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,22 +149,19 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
LogicalSize size(lineWM, mISize, 0);
|
||||
if (!mFrames.IsEmpty()) {
|
||||
size.BSize(lineWM) = maxBCoord - minBCoord;
|
||||
nscoord deltaBCoord = -minBCoord;
|
||||
if (lineWM.IsVerticalRL()) {
|
||||
deltaBCoord -= size.BSize(lineWM);
|
||||
}
|
||||
|
||||
if (deltaBCoord != 0) {
|
||||
nscoord containerWidth = size.Width(lineWM);
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* child = e.get();
|
||||
LogicalPoint pos = child->GetLogicalPosition(lineWM, containerWidth);
|
||||
pos.B(lineWM) += deltaBCoord;
|
||||
// Relative positioning hasn't happened yet.
|
||||
// So MovePositionBy should not be used here.
|
||||
child->SetPosition(lineWM, pos, containerWidth);
|
||||
nsContainerFrame::PlaceFrameView(child);
|
||||
}
|
||||
nscoord containerWidth = size.Width(lineWM);
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* child = e.get();
|
||||
// We reflowed the child with container width 0, as the true width
|
||||
// was not yet known at that time.
|
||||
LogicalPoint pos = child->GetLogicalPosition(lineWM, 0);
|
||||
// Adjust block position to account for minBCoord,
|
||||
// then reposition child based on the true container width.
|
||||
pos.B(lineWM) -= minBCoord;
|
||||
// Relative positioning hasn't happened yet.
|
||||
// So MovePositionBy should not be used here.
|
||||
child->SetPosition(lineWM, pos, containerWidth);
|
||||
nsContainerFrame::PlaceFrameView(child);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user