internal void UpdateBottomlessPara(
            IntPtr pfspara,                     // IN:  pointer to the para data
            ContainerParaClient paraClient,     // IN:
            int iArea,                          // IN:  column-span area index
            IntPtr pfsgeom,                     // IN:  pointer to geometry
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  current direction
            int urTrack,                        // IN:  u of bootomless rectangle to fill
            int durTrack,                       // IN:  du of bootomless rectangle to fill
            int vrTrack,                        // IN:  v of bootomless rectangle to fill
            MarginCollapsingState mcs,          // IN:  input margin collapsing state
            PTS.FSKCLEAR fskclearIn,            // IN:  clear property that must be satisfied
            int fInterruptable,                 // IN:  formatting can be interrupted
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting the paragraph
            out int dvrUsed,                    // OUT: vertical space used by the para
            out PTS.FSBBOX fsbbox,              // OUT: para BBox
            out IntPtr pmcsclientOut,           // OUT: margin collapsing state at the bottom
            out PTS.FSKCLEAR fskclearOut,       // OUT: ClearIn for the next paragraph
            out int dvrTopSpace,                // OUT: top space due to collapsed margin
            out int fPageBecomesUninterruptable)// OUT: interruption is prohibited from now on
        {
            uint fswdirSubtrack = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty)));

            Debug.Assert(iArea == 0);

            // Top margin collapsing.
            int marginTop;
            MarginCollapsingState mcsContainer;

            MbpInfo mbp = MbpInfo.FromElement(Element);
            MarginCollapsingState.CollapseTopMargin(PtsContext, mbp, mcs, out mcsContainer, out marginTop);
            if (PTS.ToBoolean(fSuppressTopSpace))
            {
                marginTop = 0;
            }

            // Set clear property
            Invariant.Assert(Element is Block || Element is ListItem);
            fskclearIn = PTS.WrapDirectionToFskclear((WrapDirection)Element.GetValue(Block.ClearFloatersProperty));

            if(fswdirSubtrack != fswdir)
            {
                PTS.FSRECT fsrcToFillSubtrack = new PTS.FSRECT(urTrack, 0, durTrack, 0);
                PTS.FSRECT pageRect = StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformRectangle(fswdir, ref pageRect, ref fsrcToFillSubtrack, fswdirSubtrack, out fsrcToFillSubtrack));

                urTrack = fsrcToFillSubtrack.u;
                durTrack = fsrcToFillSubtrack.du;
                mbp.MirrorMargin();
            }

            // Take into accound MBPs and modify subtrack metrics,
            // and make sure that subtrack is at least 1 unit wide (cannot measure at width <= 0)
            int urSubtrack, durSubtrack, vrSubtrack;
            int dvrSubTrackTopSpace = 0;
            urSubtrack  = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
            durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
            vrSubtrack  = vrTrack + (marginTop + mbp.BPTop);

            // Format subtrack
            try
            {
                PTS.Validate(PTS.FsUpdateBottomlessSubtrack(PtsContext.Context, pfspara, this.Handle, iArea,
                    pfsgeom, fSuppressTopSpace, fswdirSubtrack, urSubtrack, durSubtrack, vrSubtrack, 
                    (mcsContainer != null) ? mcsContainer.Handle : IntPtr.Zero, fskclearIn, fInterruptable, 
                    out fsfmtrbl, out dvrUsed, out fsbbox, out pmcsclientOut, 
                    out fskclearOut, out dvrSubTrackTopSpace, out fPageBecomesUninterruptable), PtsContext);
            }
            finally
            {
                // Destroy top margin collapsing state (not needed anymore).
                if (mcsContainer != null)
                {
                    mcsContainer.Dispose();
                    mcsContainer = null;
                }
            }

            if (fsfmtrbl != PTS.FSFMTRBL.fmtrblCollision)
            {
                // Bottom margin collapsing:
                // (1) retrieve mcs from the subtrack
                // (2) do margin collapsing; create a new margin collapsing state
                if (pmcsclientOut != IntPtr.Zero)
                {
                    mcsContainer = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                    PTS.ValidateHandle(mcsContainer);
                    pmcsclientOut = IntPtr.Zero;
                }
                int marginBottom;
                MarginCollapsingState mcsNew;
                MarginCollapsingState.CollapseBottomMargin(PtsContext, mbp, mcsContainer, out mcsNew, out marginBottom);
                pmcsclientOut = (mcsNew != null) ? mcsNew.Handle : IntPtr.Zero;

                // Since MCS returned by PTS is never passed back, destroy MCS provided by PTS.
                // If necessary, new MCS is created and passed back to PTS.
                if (mcsContainer != null)
                {
                    mcsContainer.Dispose();
                    mcsContainer = null;
                }

                // Take into accound MBPs and modify subtrack metrics
                dvrTopSpace = (mbp.BPTop != 0) ? marginTop : dvrSubTrackTopSpace;
                dvrUsed += (vrSubtrack - vrTrack) + marginBottom + mbp.BPBottom;
            }
            else
            {
                Debug.Assert(pmcsclientOut == IntPtr.Zero);
                pfspara = IntPtr.Zero;
                dvrTopSpace = 0;
            }

            // Adjust fsbbox to account for margins
            fsbbox.fsrc.u -= mbp.MBPLeft;
            fsbbox.fsrc.du += mbp.MBPLeft + mbp.MBPRight;
            if(fswdirSubtrack != fswdir)
            {
                PTS.FSRECT pageRect = StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformBbox(fswdirSubtrack, ref pageRect, ref fsbbox, fswdir, out fsbbox));
            }

            // Update information about first/last chunk. In bottomless scenario
            // paragraph is not broken, so there is only one chunk.
            paraClient.SetChunkInfo(true, true);
        }
Exemple #2
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="paraClient">Object representing a paragraph.</param>
        internal ContainerParagraphResult(ContainerParaClient paraClient)
            : base(paraClient)
        {
        }
        internal void FormatParaFinite(
            ContainerParaClient paraClient,     // IN:
            IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
            int fBRFromPreviousPage,            // IN:  break record was created on previous page
            int iArea,                          // IN:  column-span area index
            IntPtr footnoteRejector,            // IN:
            IntPtr geometry,                    // IN:  pointer to geometry
            int fEmptyOk,                       // IN:  is it OK not to add anything?
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  current direction
            ref PTS.FSRECT fsrcToFill,          // IN:  rectangle to fill
            MarginCollapsingState mcs,          // IN:  input margin collapsing state
            PTS.FSKCLEAR fskclearIn,            // IN:  clear property that must be satisfied
            PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
                                                // IN: suppress breaks at track start?
            out PTS.FSFMTR fsfmtr,              // OUT: result of formatting the paragraph
            out IntPtr pfspara,                 // OUT: pointer to the para data
            out IntPtr pbrkrecOut,              // OUT: pointer to the para break record
            out int dvrUsed,                    // OUT: vertical space used by the para
            out PTS.FSBBOX fsbbox,              // OUT: para BBox
            out IntPtr pmcsclientOut,           // OUT: margin collapsing state at the bottom
            out PTS.FSKCLEAR fskclearOut,       // OUT: ClearIn for the next paragraph
            out int dvrTopSpace)                // OUT: top space due to collapsed margin
        {
            uint fswdirSubtrack = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty)));

            Debug.Assert(iArea == 0);
            // Currently it is possible to get MCS and BR in following situation:
            // At the end of the page there is a paragraph with delayed figure, so the figure
            // gets delayed to the next page. But part of the next paragraph fits in the page,
            // so it gets broken. PTS creates BR with delayed figure and broken para.
            // PTS will format the next page starting from delayed figure, which can produce MCS.
            // So when the next paragraph is continued from BR, it has MCS.
            // This problem is currently investigated by PTS team: PTSLS bug 915.
            // For now, MCS gets ignored here.
            //ErrorHandler.Assert(pbrkrecIn == IntPtr.Zero || mcs == null, ErrorHandler.BrokenParaHasMcs);
            if (mcs != null && pbrkrecIn != IntPtr.Zero)
            {
                mcs = null;
            }

            int marginTop = 0;
            int marginBottom = 0;
            MarginCollapsingState mcsContainer = null;

            // Set clear property
            Invariant.Assert(Element is Block || Element is ListItem);
            fskclearIn = PTS.WrapDirectionToFskclear((WrapDirection)Element.GetValue(Block.ClearFloatersProperty));


            // Take into accound MBPs and modify subtrack metrics,
            // and make sure that subtrack is at least 1 unit wide (cannot measure at width <= 0)
            PTS.FSRECT fsrcToFillSubtrack = fsrcToFill;
            MbpInfo mbp = MbpInfo.FromElement(Element);

            if(fswdirSubtrack != fswdir)
            {
                PTS.FSRECT pageRect = StructuralCache.CurrentFormatContext.PageRect;

                PTS.Validate(PTS.FsTransformRectangle(fswdir, ref pageRect, ref fsrcToFillSubtrack, fswdirSubtrack, out fsrcToFillSubtrack));
                PTS.Validate(PTS.FsTransformRectangle(fswdir, ref pageRect, ref fsrcToFill, fswdirSubtrack, out fsrcToFill));
                mbp.MirrorMargin();
            }

            fsrcToFillSubtrack.u  += mbp.MBPLeft;
            fsrcToFillSubtrack.du -= mbp.MBPLeft + mbp.MBPRight;
            fsrcToFillSubtrack.u  = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
            fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0);

            if (pbrkrecIn == IntPtr.Zero)
            {
                // Top margin collapsing. If suppresing top space, top margin is always 0.
                MarginCollapsingState.CollapseTopMargin(PtsContext, mbp, mcs, out mcsContainer, out marginTop);
                if (PTS.ToBoolean(fSuppressTopSpace))
                {
                    marginTop = 0;
                }

                fsrcToFillSubtrack.v  += marginTop + mbp.BPTop;
                fsrcToFillSubtrack.dv -= marginTop + mbp.BPTop;
                fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
                fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0);
            }

            // Format subtrack
            int dvrSubTrackTopSpace = 0;
            try
            {
                PTS.Validate(PTS.FsFormatSubtrackFinite(PtsContext.Context, pbrkrecIn, fBRFromPreviousPage, this.Handle, iArea, 
                    footnoteRejector, geometry, fEmptyOk, fSuppressTopSpace, fswdirSubtrack, ref fsrcToFillSubtrack, 
                    (mcsContainer != null) ? mcsContainer.Handle : IntPtr.Zero, fskclearIn, 
                    fsksuppresshardbreakbeforefirstparaIn, 
                    out fsfmtr, out pfspara, out pbrkrecOut, out dvrUsed, out fsbbox, out pmcsclientOut, out fskclearOut, 
                    out dvrSubTrackTopSpace), PtsContext);
            }
            finally
            {
                // Destroy top margin collapsing state (not needed anymore).
                if (mcsContainer != null)
                {
                    mcsContainer.Dispose();
                    mcsContainer = null;
                }
                // 
                if (dvrSubTrackTopSpace > PTS.dvBottomUndefined / 2)
                {
                    dvrSubTrackTopSpace = 0;
                }
            }

            // Take into accound MBPs and modify subtrack metrics
            dvrTopSpace = (mbp.BPTop != 0) ? marginTop : dvrSubTrackTopSpace;
            dvrUsed += (fsrcToFillSubtrack.v - fsrcToFill.v);

            // Initialize subtrack metrics
            if (fsfmtr.kstop >= PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)   // No progress or collision
            {
                dvrUsed = 0;
            }

            // Since MCS returned by PTS is never passed back, destroy MCS provided by PTS.
            // If necessary, new MCS is created and passed back to PTS.
            if (pmcsclientOut != IntPtr.Zero)
            {
                mcsContainer = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                PTS.ValidateHandle(mcsContainer);
                pmcsclientOut = IntPtr.Zero;
            }

            if (fsfmtr.kstop == PTS.FSFMTRKSTOP.fmtrGoalReached)
            {
                // Bottom margin collapsing:
                // (a) retrieve mcs from the subtrack
                // (b) do margin collapsing; create a new margin collapsing state
                // There is no bottom margin collapsing if paragraph will be continued (output break record is not null).
                MarginCollapsingState mcsNew = null;
                MarginCollapsingState.CollapseBottomMargin(PtsContext, mbp, mcsContainer, out mcsNew, out marginBottom);
                pmcsclientOut = (mcsNew != null) ? mcsNew.Handle : IntPtr.Zero;

                // If we exceed fill rectangle after adding bottom border and padding, clip them
                dvrUsed += marginBottom + mbp.BPBottom;
                dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
            }

            // Since MCS returned by PTS is never passed back, destroy MCS provided by PTS.
            // If necessary, new MCS is created and passed back to PTS.
            if (mcsContainer != null)
            {
                mcsContainer.Dispose();
                mcsContainer = null;
            }

            // Adjust fsbbox to account for margins
            fsbbox.fsrc.u -= mbp.MBPLeft;
            fsbbox.fsrc.du += mbp.MBPLeft + mbp.MBPRight;

            if(fswdirSubtrack != fswdir)
            {
                PTS.FSRECT pageRect = StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformBbox(fswdirSubtrack, ref pageRect, ref fsbbox, fswdir, out fsbbox));
            }

            // Update information about first/last chunk
            paraClient.SetChunkInfo(pbrkrecIn == IntPtr.Zero, pbrkrecOut == IntPtr.Zero);
        }
        //-------------------------------------------------------------------
        // CreateParaclient
        //-------------------------------------------------------------------
        internal override void CreateParaclient(
            out IntPtr paraClientHandle)        // OUT: opaque to PTS paragraph client
        {
#pragma warning disable 6518
            // Disable PRESharp warning 6518. ContainerParaClient is an UnmamangedHandle, that adds itself
            // to HandleMapper that holds a reference to it. PTS manages lifetime of this object, and 
            // calls DestroyParaclient to get rid of it. DestroyParaclient will call Dispose() on the object
            // and remove it from HandleMapper.
            ContainerParaClient paraClient =  new ContainerParaClient(this);
            paraClientHandle = paraClient.Handle;
#pragma warning restore 6518
        }
        internal void UpdateBottomlessPara(IntPtr pfspara, ContainerParaClient paraClient, int iArea, IntPtr pfsgeom, int fSuppressTopSpace, uint fswdir, int urTrack, int durTrack, int vrTrack, MarginCollapsingState mcs, PTS.FSKCLEAR fskclearIn, int fInterruptable, out PTS.FSFMTRBL fsfmtrbl, out int dvrUsed, out PTS.FSBBOX fsbbox, out IntPtr pmcsclientOut, out PTS.FSKCLEAR fskclearOut, out int dvrTopSpace, out int fPageBecomesUninterruptable)
        {
            uint    num     = PTS.FlowDirectionToFswdir((FlowDirection)base.Element.GetValue(FrameworkElement.FlowDirectionProperty));
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip);
            MarginCollapsingState marginCollapsingState;
            int num2;

            MarginCollapsingState.CollapseTopMargin(base.PtsContext, mbpInfo, mcs, out marginCollapsingState, out num2);
            if (PTS.ToBoolean(fSuppressTopSpace))
            {
                num2 = 0;
            }
            Invariant.Assert(base.Element is Block || base.Element is ListItem);
            fskclearIn = PTS.WrapDirectionToFskclear((WrapDirection)base.Element.GetValue(Block.ClearFloatersProperty));
            if (num != fswdir)
            {
                PTS.FSRECT fsrect   = new PTS.FSRECT(urTrack, 0, durTrack, 0);
                PTS.FSRECT pageRect = base.StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformRectangle(fswdir, ref pageRect, ref fsrect, num, out fsrect));
                urTrack  = fsrect.u;
                durTrack = fsrect.du;
                mbpInfo.MirrorMargin();
            }
            int num3 = 0;
            int ur   = Math.Max(Math.Min(urTrack + mbpInfo.MBPLeft, urTrack + durTrack - 1), urTrack);
            int dur  = Math.Max(durTrack - (mbpInfo.MBPLeft + mbpInfo.MBPRight), 0);
            int num4 = vrTrack + (num2 + mbpInfo.BPTop);

            try
            {
                PTS.Validate(PTS.FsUpdateBottomlessSubtrack(base.PtsContext.Context, pfspara, base.Handle, iArea, pfsgeom, fSuppressTopSpace, num, ur, dur, num4, (marginCollapsingState != null) ? marginCollapsingState.Handle : IntPtr.Zero, fskclearIn, fInterruptable, out fsfmtrbl, out dvrUsed, out fsbbox, out pmcsclientOut, out fskclearOut, out num3, out fPageBecomesUninterruptable), base.PtsContext);
            }
            finally
            {
                if (marginCollapsingState != null)
                {
                    marginCollapsingState.Dispose();
                    marginCollapsingState = null;
                }
            }
            if (fsfmtrbl != PTS.FSFMTRBL.fmtrblCollision)
            {
                if (pmcsclientOut != IntPtr.Zero)
                {
                    marginCollapsingState = (base.PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState);
                    PTS.ValidateHandle(marginCollapsingState);
                    pmcsclientOut = IntPtr.Zero;
                }
                MarginCollapsingState marginCollapsingState2;
                int num5;
                MarginCollapsingState.CollapseBottomMargin(base.PtsContext, mbpInfo, marginCollapsingState, out marginCollapsingState2, out num5);
                pmcsclientOut = ((marginCollapsingState2 != null) ? marginCollapsingState2.Handle : IntPtr.Zero);
                if (marginCollapsingState != null)
                {
                    marginCollapsingState.Dispose();
                    marginCollapsingState = null;
                }
                dvrTopSpace = ((mbpInfo.BPTop != 0) ? num2 : num3);
                dvrUsed    += num4 - vrTrack + num5 + mbpInfo.BPBottom;
            }
            else
            {
                pfspara     = IntPtr.Zero;
                dvrTopSpace = 0;
            }
            fsbbox.fsrc.u  = fsbbox.fsrc.u - mbpInfo.MBPLeft;
            fsbbox.fsrc.du = fsbbox.fsrc.du + (mbpInfo.MBPLeft + mbpInfo.MBPRight);
            if (num != fswdir)
            {
                PTS.FSRECT pageRect2 = base.StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformBbox(num, ref pageRect2, ref fsbbox, fswdir, out fsbbox));
            }
            paraClient.SetChunkInfo(true, true);
        }
        internal void FormatParaFinite(ContainerParaClient paraClient, IntPtr pbrkrecIn, int fBRFromPreviousPage, int iArea, IntPtr footnoteRejector, IntPtr geometry, int fEmptyOk, int fSuppressTopSpace, uint fswdir, ref PTS.FSRECT fsrcToFill, MarginCollapsingState mcs, PTS.FSKCLEAR fskclearIn, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out IntPtr pfspara, out IntPtr pbrkrecOut, out int dvrUsed, out PTS.FSBBOX fsbbox, out IntPtr pmcsclientOut, out PTS.FSKCLEAR fskclearOut, out int dvrTopSpace)
        {
            uint num = PTS.FlowDirectionToFswdir((FlowDirection)base.Element.GetValue(FrameworkElement.FlowDirectionProperty));

            if (mcs != null && pbrkrecIn != IntPtr.Zero)
            {
                mcs = null;
            }
            int num2 = 0;
            int num3 = 0;
            MarginCollapsingState marginCollapsingState = null;

            Invariant.Assert(base.Element is Block || base.Element is ListItem);
            fskclearIn = PTS.WrapDirectionToFskclear((WrapDirection)base.Element.GetValue(Block.ClearFloatersProperty));
            PTS.FSRECT fsrect  = fsrcToFill;
            MbpInfo    mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (num != fswdir)
            {
                PTS.FSRECT pageRect = base.StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformRectangle(fswdir, ref pageRect, ref fsrect, num, out fsrect));
                PTS.Validate(PTS.FsTransformRectangle(fswdir, ref pageRect, ref fsrcToFill, num, out fsrcToFill));
                mbpInfo.MirrorMargin();
            }
            fsrect.u  += mbpInfo.MBPLeft;
            fsrect.du -= mbpInfo.MBPLeft + mbpInfo.MBPRight;
            fsrect.u   = Math.Max(Math.Min(fsrect.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
            fsrect.du  = Math.Max(fsrect.du, 0);
            if (pbrkrecIn == IntPtr.Zero)
            {
                MarginCollapsingState.CollapseTopMargin(base.PtsContext, mbpInfo, mcs, out marginCollapsingState, out num2);
                if (PTS.ToBoolean(fSuppressTopSpace))
                {
                    num2 = 0;
                }
                fsrect.v  += num2 + mbpInfo.BPTop;
                fsrect.dv -= num2 + mbpInfo.BPTop;
                fsrect.v   = Math.Max(Math.Min(fsrect.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
                fsrect.dv  = Math.Max(fsrect.dv, 0);
            }
            int num4 = 0;

            try
            {
                PTS.Validate(PTS.FsFormatSubtrackFinite(base.PtsContext.Context, pbrkrecIn, fBRFromPreviousPage, base.Handle, iArea, footnoteRejector, geometry, fEmptyOk, fSuppressTopSpace, num, ref fsrect, (marginCollapsingState != null) ? marginCollapsingState.Handle : IntPtr.Zero, fskclearIn, fsksuppresshardbreakbeforefirstparaIn, out fsfmtr, out pfspara, out pbrkrecOut, out dvrUsed, out fsbbox, out pmcsclientOut, out fskclearOut, out num4), base.PtsContext);
            }
            finally
            {
                if (marginCollapsingState != null)
                {
                    marginCollapsingState.Dispose();
                    marginCollapsingState = null;
                }
                if (num4 > 1073741823)
                {
                    num4 = 0;
                }
            }
            dvrTopSpace = ((mbpInfo.BPTop != 0) ? num2 : num4);
            dvrUsed    += fsrect.v - fsrcToFill.v;
            if (fsfmtr.kstop >= PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)
            {
                dvrUsed = 0;
            }
            if (pmcsclientOut != IntPtr.Zero)
            {
                marginCollapsingState = (base.PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState);
                PTS.ValidateHandle(marginCollapsingState);
                pmcsclientOut = IntPtr.Zero;
            }
            if (fsfmtr.kstop == PTS.FSFMTRKSTOP.fmtrGoalReached)
            {
                MarginCollapsingState marginCollapsingState2 = null;
                MarginCollapsingState.CollapseBottomMargin(base.PtsContext, mbpInfo, marginCollapsingState, out marginCollapsingState2, out num3);
                pmcsclientOut = ((marginCollapsingState2 != null) ? marginCollapsingState2.Handle : IntPtr.Zero);
                dvrUsed      += num3 + mbpInfo.BPBottom;
                dvrUsed       = Math.Min(fsrcToFill.dv, dvrUsed);
            }
            if (marginCollapsingState != null)
            {
                marginCollapsingState.Dispose();
                marginCollapsingState = null;
            }
            fsbbox.fsrc.u  = fsbbox.fsrc.u - mbpInfo.MBPLeft;
            fsbbox.fsrc.du = fsbbox.fsrc.du + (mbpInfo.MBPLeft + mbpInfo.MBPRight);
            if (num != fswdir)
            {
                PTS.FSRECT pageRect2 = base.StructuralCache.CurrentFormatContext.PageRect;
                PTS.Validate(PTS.FsTransformBbox(num, ref pageRect2, ref fsbbox, fswdir, out fsbbox));
            }
            paraClient.SetChunkInfo(pbrkrecIn == IntPtr.Zero, pbrkrecOut == IntPtr.Zero);
        }
        // Token: 0x0600679C RID: 26524 RVA: 0x001CFE58 File Offset: 0x001CE058
        internal override void CreateParaclient(out IntPtr paraClientHandle)
        {
            ContainerParaClient containerParaClient = new ContainerParaClient(this);

            paraClientHandle = containerParaClient.Handle;
        }