mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 911786 - Part 2: Reapply relative positioning when moving frames without reflowing them. r=dholbert
This commit is contained in:
parent
23d185d13b
commit
c885568e56
@ -2582,9 +2582,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState,
|
||||
|
||||
if (aLine->IsBlock()) {
|
||||
if (aDY) {
|
||||
nsPoint p = kid->GetPosition();
|
||||
p.y += aDY;
|
||||
kid->SetPosition(p);
|
||||
kid->MovePositionBy(nsPoint(0, aDY));
|
||||
}
|
||||
|
||||
// Make sure the frame's view and any child views are updated
|
||||
@ -2598,9 +2596,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState,
|
||||
int32_t n = aLine->GetChildCount();
|
||||
while (--n >= 0) {
|
||||
if (aDY) {
|
||||
nsPoint p = kid->GetPosition();
|
||||
p.y += aDY;
|
||||
kid->SetPosition(p);
|
||||
kid->MovePositionBy(nsPoint(0, aDY));
|
||||
}
|
||||
// Make sure the frame's view and any child views are updated
|
||||
::PlaceFrameView(kid);
|
||||
|
@ -386,8 +386,7 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
|
||||
while (fc) {
|
||||
nsIFrame* floatFrame = fc->mFloat;
|
||||
if (aDeltaY != 0) {
|
||||
nsPoint p = floatFrame->GetPosition();
|
||||
floatFrame->SetPosition(nsPoint(p.x, p.y + aDeltaY));
|
||||
floatFrame->MovePositionBy(nsPoint(0, aDeltaY));
|
||||
nsContainerFrame::PositionFrameView(floatFrame);
|
||||
nsContainerFrame::PositionChildViews(floatFrame);
|
||||
}
|
||||
|
@ -5070,6 +5070,22 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame,
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
nsIFrame::MovePositionBy(const nsPoint& aTranslation)
|
||||
{
|
||||
nsPoint position = GetNormalPosition() + aTranslation;
|
||||
|
||||
const nsMargin* computedOffsets = nullptr;
|
||||
if (IsRelativelyPositioned()) {
|
||||
computedOffsets = static_cast<nsMargin*>
|
||||
(Properties().Get(nsIFrame::ComputedOffsetProperty()));
|
||||
}
|
||||
nsHTMLReflowState::ApplyRelativePositioning(this, computedOffsets ?
|
||||
*computedOffsets : nsMargin(),
|
||||
&position);
|
||||
SetPosition(position);
|
||||
}
|
||||
|
||||
nsPoint
|
||||
nsIFrame::GetNormalPosition() const
|
||||
{
|
||||
|
@ -866,6 +866,13 @@ public:
|
||||
}
|
||||
void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); }
|
||||
|
||||
/**
|
||||
* Move the frame, accounting for relative positioning. Use this when
|
||||
* adjusting the frame's position by a known amount, to properly update its
|
||||
* saved normal position (see GetNormalPosition below).
|
||||
*/
|
||||
void MovePositionBy(const nsPoint& aTranslation);
|
||||
|
||||
/**
|
||||
* Return frame's position without relative positioning
|
||||
*/
|
||||
|
@ -2196,9 +2196,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
||||
|
||||
static void SlideSpanFrameRect(nsIFrame* aFrame, nscoord aDeltaWidth)
|
||||
{
|
||||
nsRect r = aFrame->GetRect();
|
||||
r.x -= aDeltaWidth;
|
||||
aFrame->SetRect(r);
|
||||
aFrame->MovePositionBy(nsPoint(-aDeltaWidth, 0));
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user