Author: andreia Date: 2008-01-21 11:25:57 -0500 (Mon, 21 Jan 2008) New Revision: 93409
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs Log: * WebBrowserBase.cs: Check if control was loaded properly, don't bind if it wasn't. * HtmlDocument.cs: Implement CreateElement, Equals, Focus, GetElementFromPoint, equality operators, OpenNew, Write. Remove extra set_Body 2008-01-21 Andreia Gaita <[EMAIL PROTECTED]> Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-01-21 16:23:20 UTC (rev 93408) +++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-01-21 16:25:57 UTC (rev 93409) @@ -1,3 +1,12 @@ +2008-01-21 Andreia Gaita <[EMAIL PROTECTED]> + + * WebBrowserBase.cs: Check if control was loaded properly, + don't bind if it wasn't. + + * HtmlDocument.cs: Implement CreateElement, Equals, Focus, + GetElementFromPoint, equality operators, OpenNew, Write. + Remove extra set_Body + 2008-01-18 Jonathan Pobst <[EMAIL PROTECTED]> * ContainerControl.cs, Control.cs: Apply patch from James Purcell Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs 2008-01-21 16:23:20 UTC (rev 93408) +++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs 2008-01-21 16:25:57 UTC (rev 93409) @@ -25,7 +25,8 @@ #if NET_2_0 using System; -using System.Drawing; +using System.Drawing; +using System.ComponentModel; namespace System.Windows.Forms { @@ -46,23 +47,28 @@ public HtmlElement CreateElement (string elementTag) { - throw new NotImplementedException (); + Mono.WebBrowser.DOM.IElement element = webHost.Document.CreateElement (elementTag); + return new HtmlElement (element); } public void DetachEventHandler (string eventName, EventHandler eventHandler) { throw new NotImplementedException (); } + + public override bool Equals (object obj) { + return this == (HtmlDocument) obj; + } - public void ExecCommand (string command, bool showUI, Object value) { throw new NotImplementedException (); } - + + [EditorBrowsable(EditorBrowsableState.Advanced)] public void Focus () { - throw new NotImplementedException (); + webHost.FocusIn (Mono.WebBrowser.FocusOption.None); } public HtmlElement GetElementById (string id) @@ -72,7 +78,10 @@ public HtmlElement GetElementFromPoint (Point point) { - throw new NotImplementedException (); + Mono.WebBrowser.DOM.IElement elem = webHost.Document.GetElement (point.X, point.Y); + if (elem != null) + return new HtmlElement(elem); + return null; } public HtmlElementCollection GetElementsByTagName (string tagName) @@ -95,15 +104,36 @@ { throw new NotImplementedException (); } + + public static bool operator ==(HtmlDocument left, HtmlDocument right) { + if ((object)left == (object)right) { + return true; + } + + if ((object)left == null || (object)right == null) { + return false; + } + + return left.Equals (right); + } + + public static bool operator !=(HtmlDocument left, HtmlDocument right) { + return !(left == right); + } + public HtmlDocument OpenNew (bool replaceInHistory) - { - throw new NotImplementedException (); + { + Mono.WebBrowser.DOM.LoadFlags flags = Mono.WebBrowser.DOM.LoadFlags.None; + if (replaceInHistory) + flags |= Mono.WebBrowser.DOM.LoadFlags.ReplaceHistory; + webHost.Navigation.Go ("about:blank", flags); + return this; } public void Write (string text) { - throw new NotImplementedException (); + webHost.Document.Write (text); } #endregion @@ -131,10 +161,7 @@ set { throw new NotImplementedException (); } } public HtmlElement Body { - get { - return new HtmlElement (webHost.Document.Body); - } - set { throw new NotImplementedException (); } + get { return new HtmlElement (webHost.Document.Body); } } public string Cookie { Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs 2008-01-21 16:23:20 UTC (rev 93408) +++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs 2008-01-21 16:25:57 UTC (rev 93409) @@ -236,7 +236,7 @@ protected override void OnLostFocus (EventArgs e) { base.OnLostFocus (e); - WebHost.FocusOut (); +// WebHost.FocusOut (); } protected override void OnParentChanged (EventArgs e) @@ -293,7 +293,10 @@ internal WebBrowserBase () { webHost = Mono.WebBrowser.Manager.GetNewInstance (); - webHost.Load (this.Handle, this.Width, this.Height); + bool loaded = webHost.Load (this.Handle, this.Width, this.Height); + if (!loaded) + return; + state = State.Loaded; webHost.MouseClick += new EventHandler (OnWebHostMouseClick); _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches