// Author:
// Dick Porter <dick@ximian.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.ComponentModel;
using System.Globalization;
using System.Security.Permissions;
+using System.Web.Util;
namespace System.Web.UI.HtmlControls
{
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
-#if NET_2_0
[ControlBuilder (typeof (HtmlEmptyTagControlBuilder))]
-#else
- [ControlBuilder (typeof (HtmlControlBuilder))]
-#endif
public class HtmlImage : HtmlControl
{
public HtmlImage () : base ("img")
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[WebSysDescription("")]
[WebCategory("Layout")]
- public string Align
- {
+ public string Align {
get {
string align = Attributes["align"];
[WebSysDescription("")]
[WebCategory("Appearance")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-#if NET_2_0
[Localizable (true)]
-#endif
- public string Alt
- {
+ public string Alt {
get {
string alt = Attributes["alt"];
[WebSysDescription("")]
[WebCategory("Appearance")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public int Border
- {
+ public int Border {
get {
string border = Attributes["border"];
if (border == null) {
return (-1);
} else {
- return (Int32.Parse (border, CultureInfo.InvariantCulture));
+ return (Int32.Parse (border, Helpers.InvariantCulture));
}
}
set {
[WebSysDescription("")]
[WebCategory("Layout")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public int Height
- {
+ public int Height {
get {
string height = Attributes["height"];
if (height == null) {
return (-1);
} else {
- return (Int32.Parse (height, CultureInfo.InvariantCulture));
+ return (Int32.Parse (height, Helpers.InvariantCulture));
}
}
set {
[WebSysDescription("")]
[WebCategory("Behavior")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-#if NET_2_0
[UrlProperty]
-#endif
- public string Src
- {
+ public string Src {
get {
string src = Attributes["src"];
[WebSysDescription("")]
[WebCategory("Layout")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public int Width
- {
+ public int Width {
get {
string width = Attributes["width"];
return (-1);
}
else {
- return (Int32.Parse (width, CultureInfo.InvariantCulture));
+ return (Int32.Parse (width, Helpers.InvariantCulture));
}
}
set {
protected override void RenderAttributes (HtmlTextWriter w)
{
PreProcessRelativeReference (w, "src");
+
+ /* MS does not seem to render the src attribute if it
+ * is empty. Firefox, at least, will fetch the current
+ * page as the src="" if other img attributes exist.
+ */
+ string src = Attributes["src"];
+ if (src == null || src.Length == 0)
+ Attributes.Remove ("src");
+
base.RenderAttributes (w);
/* MS closes the HTML element at the end of
}
}
}
-
-