Bug 1174504 - Logical-coordinate versions of nsIFrame::SetSize should maintain the frame's logical position. r=smontagu

This commit is contained in:
Jonathan Kew 2015-06-23 06:06:16 -07:00
Родитель 138e30b4a8
Коммит a043edf3b3
1 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -734,21 +734,39 @@ public:
}
/**
* Set this frame's size from a logical size in its own writing direction
* Set this frame's size from a logical size in its own writing direction.
* This leaves the frame's logical position unchanged, which means its
* physical position may change (for right-to-left modes).
*/
void SetSize(const mozilla::LogicalSize& aSize) {
SetSize(GetWritingMode(), aSize);
}
/*
* Set this frame's size from a logical size in a different writing direction
* Set this frame's size from a logical size in a different writing direction.
* This leaves the frame's logical position in the given mode unchanged,
* which means its physical position may change (for right-to-left modes).
*/
void SetSize(mozilla::WritingMode aWritingMode,
const mozilla::LogicalSize& aSize) {
SetSize(aSize.GetPhysicalSize(aWritingMode));
const mozilla::LogicalSize& aSize)
{
if ((!aWritingMode.IsVertical() && !aWritingMode.IsBidiLTR()) ||
aWritingMode.IsVerticalRL()) {
nscoord oldWidth = mRect.width;
SetSize(aSize.GetPhysicalSize(aWritingMode));
mRect.x -= mRect.width - oldWidth;
} else {
SetSize(aSize.GetPhysicalSize(aWritingMode));
}
}
/**
* Set this frame's physical size. This leaves the frame's physical position
* (topLeft) unchanged.
*/
void SetSize(const nsSize& aSize) {
SetRect(nsRect(mRect.TopLeft(), aSize));
}
void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); }
void SetPosition(mozilla::WritingMode aWritingMode,
const mozilla::LogicalPoint& aPt,