HtmlObjectElement
sealed class HtmlObjectElement : HtmlFormControlElement, IHtmlObjectElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IGlobalEventHandlers, IValidation, ILoadableElement
Represents the HTML object element.
using AngleSharp.Dom;
using AngleSharp.Dom.Events;
using AngleSharp.Io;
using AngleSharp.Io.Processors;
using AngleSharp.Text;
using System.Runtime.CompilerServices;
namespace AngleSharp.Html.Dom
{
[System.Runtime.CompilerServices.NullableContext(2)]
[System.Runtime.CompilerServices.Nullable(0)]
internal sealed class HtmlObjectElement : HtmlFormControlElement, IHtmlObjectElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IGlobalEventHandlers, IValidation, ILoadableElement
{
[System.Runtime.CompilerServices.Nullable(1)]
private readonly ObjectRequestProcessor _request;
public IDownload CurrentDownload => _request?.Download;
public string Source {
get {
return this.GetUrlAttribute(AttributeNames.Data);
}
set {
this.SetOwnAttribute(AttributeNames.Data, value, false);
}
}
public string Type {
get {
return this.GetOwnAttribute(AttributeNames.Type);
}
set {
this.SetOwnAttribute(AttributeNames.Type, value, false);
}
}
public bool TypeMustMatch {
get {
return this.GetBoolAttribute(AttributeNames.TypeMustMatch);
}
set {
this.SetBoolAttribute(AttributeNames.TypeMustMatch, value);
}
}
public string UseMap {
get {
return this.GetOwnAttribute(AttributeNames.UseMap);
}
set {
this.SetOwnAttribute(AttributeNames.UseMap, value, false);
}
}
public int DisplayWidth {
get {
return this.GetOwnAttribute(AttributeNames.Width).ToInteger(OriginalWidth);
}
set {
this.SetOwnAttribute(AttributeNames.Width, value.ToString(), false);
}
}
public int DisplayHeight {
get {
return this.GetOwnAttribute(AttributeNames.Height).ToInteger(OriginalHeight);
}
set {
this.SetOwnAttribute(AttributeNames.Height, value.ToString(), false);
}
}
public int OriginalWidth => _request?.Width ?? 0;
public int OriginalHeight => _request?.Height ?? 0;
public IDocument ContentDocument => null;
public IWindow ContentWindow => null;
[System.Runtime.CompilerServices.NullableContext(1)]
public HtmlObjectElement(Document owner, [System.Runtime.CompilerServices.Nullable(2)] string prefix = null)
: base(owner, TagNames.Object, prefix, NodeFlags.Scoped)
{
_request = new ObjectRequestProcessor(owner.Context);
}
protected override bool CanBeValidated()
{
return false;
}
internal override void SetupElement()
{
base.SetupElement();
UpdateSource(this.GetOwnAttribute(AttributeNames.Data));
}
internal void UpdateSource(string value)
{
if (value != null) {
Url url = new Url(Source);
this.Process(_request, url);
}
}
}
}