From 23d185d13b3d6f3e299ab6a0df25313841d40d00 Mon Sep 17 00:00:00 2001 From: Corey Ford Date: Tue, 10 Sep 2013 11:33:59 -0700 Subject: [PATCH] Bug 911786 - Part 1: Store computed relative position offsets. r=dholbert --- layout/generic/StickyScrollContainer.cpp | 6 +++--- layout/generic/nsHTMLReflowState.cpp | 11 +++++++++++ layout/generic/nsIFrame.h | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/layout/generic/StickyScrollContainer.cpp b/layout/generic/StickyScrollContainer.cpp index a57eb75c7966..16fe0edd095e 100644 --- a/layout/generic/StickyScrollContainer.cpp +++ b/layout/generic/StickyScrollContainer.cpp @@ -116,11 +116,11 @@ StickyScrollContainer::ComputeStickyOffsets(nsIFrame* aFrame) // Store the offset FrameProperties props = aFrame->Properties(); nsMargin* offsets = static_cast - (props.Get(nsIFrame::ComputedStickyOffsetProperty())); + (props.Get(nsIFrame::ComputedOffsetProperty())); if (offsets) { *offsets = computedOffsets; } else { - props.Set(nsIFrame::ComputedStickyOffsetProperty(), + props.Set(nsIFrame::ComputedOffsetProperty(), new nsMargin(computedOffsets)); } } @@ -133,7 +133,7 @@ StickyScrollContainer::ComputeStickyLimits(nsIFrame* aFrame, nsRect* aStick, aContain->SetRect(nscoord_MIN/2, nscoord_MIN/2, nscoord_MAX, nscoord_MAX); const nsMargin* computedOffsets = static_cast( - aFrame->Properties().Get(nsIFrame::ComputedStickyOffsetProperty())); + aFrame->Properties().Get(nsIFrame::ComputedOffsetProperty())); if (!computedOffsets) { // We haven't reflowed the scroll frame yet, so offsets haven't been // computed. Bail. diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index c6ddde4c6fce..93d2040bfecf 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -831,6 +831,17 @@ nsHTMLReflowState::ComputeRelativeOffsets(uint8_t aCBDirection, // Computed value for 'bottom' is minus the value of 'top' aComputedOffsets.bottom = -aComputedOffsets.top; } + + // Store the offset + FrameProperties props = aFrame->Properties(); + nsMargin* offsets = static_cast + (props.Get(nsIFrame::ComputedOffsetProperty())); + if (offsets) { + *offsets = aComputedOffsets; + } else { + props.Set(nsIFrame::ComputedOffsetProperty(), + new nsMargin(aComputedOffsets)); + } } /* static */ void diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 3c332082a933..880557441aba 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -927,7 +927,7 @@ public: NS_DECLARE_FRAME_PROPERTY(IBSplitSpecialPrevSibling, nullptr) NS_DECLARE_FRAME_PROPERTY(NormalPositionProperty, DestroyPoint) - NS_DECLARE_FRAME_PROPERTY(ComputedStickyOffsetProperty, DestroyMargin) + NS_DECLARE_FRAME_PROPERTY(ComputedOffsetProperty, DestroyMargin) NS_DECLARE_FRAME_PROPERTY(OutlineInnerRectProperty, DestroyRect) NS_DECLARE_FRAME_PROPERTY(PreEffectsBBoxProperty, DestroyRect)