Exemple #1
0
        // Token: 0x06006FB2 RID: 28594 RVA: 0x00201C3C File Offset: 0x001FFE3C
        internal override bool Validate(ITextPointer position)
        {
            FlowDocumentView flowDocumentView = this._owner as FlowDocumentView;
            bool             result;

            if (flowDocumentView == null || flowDocumentView.Document == null)
            {
                result = base.Validate(position);
            }
            else
            {
                if (this.Validate())
                {
                    BackgroundFormatInfo  backgroundFormatInfo = flowDocumentView.Document.StructuralCache.BackgroundFormatInfo;
                    FlowDocumentFormatter bottomlessFormatter  = flowDocumentView.Document.BottomlessFormatter;
                    int num = -1;
                    while (this.IsValid && !this.Contains(position))
                    {
                        backgroundFormatInfo.BackgroundFormat(bottomlessFormatter, true);
                        this._owner.UpdateLayout();
                        if (backgroundFormatInfo.CPInterrupted <= num)
                        {
                            break;
                        }
                        num = backgroundFormatInfo.CPInterrupted;
                    }
                }
                result = (this.IsValid && this.Contains(position));
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// <see cref="ITextView.Validate(ITextPointer)"/>
        /// </summary>
        internal override bool Validate(ITextPointer position)
        {
            FlowDocumentView owner = _owner as FlowDocumentView;
            bool             isValid;

            if (owner == null || owner.Document == null)
            {
                isValid = base.Validate(position);
            }
            else
            {
                if (Validate())
                {
                    BackgroundFormatInfo  backgroundFormatInfo = owner.Document.StructuralCache.BackgroundFormatInfo;
                    FlowDocumentFormatter formatter            = owner.Document.BottomlessFormatter;

                    int lastCPInterrupted = -1;

                    while (this.IsValid && !Contains(position))
                    {
                        backgroundFormatInfo.BackgroundFormat(formatter, true /* ignoreThrottle */);
                        _owner.UpdateLayout(); // May invalidate the view.

                        // Break if background layout is not progressing.
                        // There are some edge cases where Validate() == true, but background
                        // layout will not progress (such as collapsed text in a tree view).
                        if (backgroundFormatInfo.CPInterrupted <= lastCPInterrupted)
                        {
                            // CPInterrupted is reset to -1 when background layout finishes, so
                            // check explicitly below to see if the position is valid or not.
                            break;
                        }
                        lastCPInterrupted = backgroundFormatInfo.CPInterrupted;
                    }
                }

                isValid = this.IsValid && Contains(position);
            }

            return(isValid);
        }