示例#1
0
 internal Document(IBrowsingContext context, TextSource source)
     : base(null, "#document", NodeType.Document)
 {
     _async             = true;
     _designMode        = false;
     _firedUnload       = false;
     _salvageable       = true;
     _shown             = false;
     _context           = context;
     _source            = source;
     Referrer           = String.Empty;
     ContentType        = MimeTypeNames.ApplicationXml;
     _ready             = DocumentReadyState.Loading;
     _sandbox           = Sandboxes.None;
     _quirksMode        = QuirksMode.Off;
     _loadingScripts    = new Queue <HtmlScriptElement>();
     _location          = new Location("about:blank");
     _ranges            = new List <WeakReference <Range> >();
     _location.Changed += LocationChanged;
     _view              = new Window(this);
     _loader            = context.CreateService <IResourceLoader>();
     _loop              = context.CreateService <IEventLoop>();
     _mutations         = new MutationHost(_loop);
     _subtasks          = new List <Task>();
     _statusCode        = HttpStatusCode.OK;
 }
示例#2
0
 /// <summary>
 /// Creates a new document node.
 /// </summary>
 /// <param name="context">The context of the document.</param>
 /// <param name="source">The underlying source.</param>
 internal Document(IBrowsingContext context, TextSource source)
     : base(null, "#document", NodeType.Document)
 {
     _async = true;
     _designMode = false;
     _firedUnload = false;
     _salvageable = true;
     _shown = false;
     _preferredStyleSheetSet = String.Empty;
     _context = context ?? BrowsingContext.New();
     _source = source;
     _referrer = String.Empty;
     _contentType = MimeTypes.ApplicationXml;
     _ready = DocumentReadyState.Loading;
     _sandbox = Sandboxes.None;
     _quirksMode = QuirksMode.Off;
     _tasks = new CancellableTasks();
     _mutations = new MutationHost(Options);
     _loadingScripts = new Queue<HtmlScriptElement>();
     _location = new Location(AboutBlank);
     _ranges = new List<WeakReference<Range>>();
     _location.Changed += LocationChanged;
     _styleSheets = this.CreateStyleSheets();
     _view = this.CreateWindow();
     _loader = this.CreateLoader();
 }