{\r
internal class Document : Node, IDocument\r
{\r
- internal nsIDOMHTMLDocument document;\r
+ internal nsIDOMDocument document;\r
\r
public Document (WebBrowser control, nsIDOMHTMLDocument document)\r
: base (control, document)\r
this.document = document;\r
}\r
\r
+ public Document (WebBrowser control, nsIDOMDocument document)\r
+ : base (control, document)\r
+ {\r
+ if (control.platform != control.enginePlatform)\r
+ this.document = nsDOMDocument.GetProxy (control, document);\r
+ else\r
+ this.document = document;\r
+ }\r
+ \r
#region IDisposable Members\r
protected override void Dispose (bool disposing)\r
{\r
}\r
#endregion\r
\r
- #region IDocument Members\r
+ #region IDocument Properties\r
\r
public IElement Active {
get {
}
public string ActiveLinkColor {
- get {
+ get {\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).getALink(storage);
return Base.StringGet (storage);
}
- set {
+ set {\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).setALink(storage);
}
}
public IElementCollection Anchors {\r
- get {
+ get {\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return null;
nsIDOMHTMLCollection ret;\r
- this.document.getAnchors (out ret);
+ ((nsIDOMHTMLDocument)document).getAnchors (out ret);
return new HTMLElementCollection(control, (nsIDOMNodeList)ret);\r
}\r
public IElementCollection Applets {\r
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return null;
nsIDOMHTMLCollection ret;\r
- this.document.getApplets (out ret);
+ ((nsIDOMHTMLDocument)document).getApplets (out ret);
return new HTMLElementCollection(control, (nsIDOMNodeList)ret);\r
}\r
public string Background {
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).getBackground(storage);
return Base.StringGet (storage);
}
- set {
+ set {\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).setBackground(storage);
}
}
public string BackColor {
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).getBgColor(storage);
return Base.StringGet (storage);
}
set {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).setBgColor(storage);
}
}
public IElement Body {\r
get {\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return null;\r
+
if (!resources.Contains ("Body")) {\r
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);\r
+ ((nsIDOMHTMLDocument)document).getBody (out element);\r
nsIDOMHTMLBodyElement b = element as nsIDOMHTMLBodyElement;\r
resources.Add ("Body", new HTMLElement (control, b));\r
}\r
public string Cookie {\r
get {\r
- this.document.getCookie (storage);
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
+ ((nsIDOMHTMLDocument)document).getCookie (storage);
return Base.StringGet (storage);\r
}\r
set {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);\r
- this.document.setCookie (storage);\r
+ ((nsIDOMHTMLDocument)document).setCookie (storage);\r
}\r
}\r
public string Domain {\r
get {\r
- this.document.getDomain (storage);
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
+ ((nsIDOMHTMLDocument)document).getDomain (storage);
return Base.StringGet (storage);\r
}\r
}\r
return resources["DocumentElement"] as IElement;\r
}\r
}\r
+ \r
+ public IDocumentType DocType {\r
+ get {\r
+ nsIDOMDocumentType doctype;\r
+ this.document.getDoctype (out doctype);\r
+ return new DocumentType (this.control, doctype);\r
+ }\r
+ }\r
+ \r
public string ForeColor {
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).getText(storage);
return Base.StringGet (storage);
}
set {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).setText(storage);
}
}
public IElementCollection Forms {\r
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return null;
nsIDOMHTMLCollection ret;\r
- this.document.getForms (out ret);
+ ((nsIDOMHTMLDocument)document).getForms (out ret);
return new HTMLElementCollection(control, (nsIDOMNodeList)ret);\r
}\r
public IElementCollection Images {\r
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return null;
nsIDOMHTMLCollection ret;\r
- this.document.getImages (out ret);
+ ((nsIDOMHTMLDocument)document).getImages (out ret);
return new HTMLElementCollection(control, (nsIDOMNodeList)ret);\r
}\r
+ }\r
+ \r
+ public IDOMImplementation Implementation {\r
+ get {\r
+ nsIDOMDOMImplementation implementation;\r
+ document.getImplementation (out implementation);\r
+ return new DOMImplementation (this.control, implementation);\r
+ }\r
}
public string LinkColor {
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).getLink(storage);
return Base.StringGet (storage);
}
set {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).setLink(storage);
}
}
public IElementCollection Links {\r
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return null;
nsIDOMHTMLCollection ret;\r
- this.document.getLinks (out ret);
+ ((nsIDOMHTMLDocument)document).getLinks (out ret);
return new HTMLElementCollection(control, (nsIDOMNodeList)ret);\r
}\r
- }
-\r
+ }\r
+
+ public IStylesheetList Stylesheets\r
+ {\r
+ get {\r
+ nsIDOMStyleSheetList styleList;\r
+ nsIDOMDocumentStyle docStyle = ((nsIDOMDocumentStyle)this.document);\r
+ docStyle.getStyleSheets (out styleList);\r
+ return new StylesheetList (this.control, styleList);\r
+ }\r
+ }\r
+ \r
public string Title {\r
get {\r
- this.document.getTitle (storage);\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
+ ((nsIDOMHTMLDocument)document).getTitle (storage);\r
return Base.StringGet (storage);\r
}\r
set {\r
Base.StringSet (storage, value);\r
- this.document.setTitle (storage);\r
+ ((nsIDOMHTMLDocument)document).setTitle (storage);\r
}\r
}\r
\r
public string Url {\r
get {\r
- this.document.getURL (storage);\r
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
+ ((nsIDOMHTMLDocument)document).getURL (storage);\r
return Base.StringGet (storage);\r
}\r
}\r
public string VisitedLinkColor {
get {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return String.Empty;\r
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).getVLink(storage);
return Base.StringGet (storage);
}
set {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;
Base.StringSet (storage, value);
nsIDOMHTMLElement element;\r
- this.document.getBody (out element);
+ ((nsIDOMHTMLDocument)document).getBody (out element);
((nsIDOMHTMLBodyElement)element).setVLink(storage);
}
}\r
}\r
}
-
+ #endregion
+\r
+ #region Public IDocument Methods
public IElement CreateElement (string tagName)
{
nsIDOMElement nsElement;
Base.StringSet (storage, tagName);
- this.document.createElement (storage, out nsElement);
- return new HTMLElement (control, (nsIDOMHTMLElement)nsElement);
+ this.document.createElement (storage, out nsElement);\r
+ if (document is nsIDOMHTMLDocument)\r
+ return new HTMLElement (control, (nsIDOMHTMLElement)nsElement);\r
+ return new Element (control, nsElement);
}
\r
public IElement GetElementById (string id)\r
}
public void Write (string text) {
+ if (!(document is nsIDOMHTMLDocument))\r
+ return;\r
Base.StringSet (storage, text);
- this.document.write (storage);
+ ((nsIDOMHTMLDocument)document).write (storage);
}\r
\r
public string InvokeScript (string script)\r