Esempio n. 1
0
        protected virtual void OnDomFocus(object sender, EventArgs ea)
        {
            DomEventArgs e = new DomEventArgs(ea);

            if (!_browserDocumentLoaded)
            {
                return;
            }

            // Only handle DomFocus that occurs on a Element.
            // This is Important or it will mess with IME keyboard focus.
            if (e == null || e.Target == null || e.Target.CastToGeckoElement() == null)
            {
                return;
            }

            var content = _browser.Document.GetElementById("main");

            if (content != null)
            {
                if ((content is GeckoHtmlElement) && (!_inFocus))
                {
                    // The following is required because we get two in focus events every time this
                    // is entered.  This is normal for Gecko.  But I don't want to be constantly
                    // refocussing.
                    _inFocus = true;
                    EnsureFocusedGeckoControlHasInputFocus();
                    if (_browser != null)
                    {
                        _browser.SetInputFocus();
                    }
                    _focusElement = (GeckoHtmlElement)content;
                    ChangeFocus();
                }
            }
        }
Esempio n. 2
0
		protected virtual void OnDomFocus(object sender, EventArgs ea)
		{
			DomEventArgs e = new DomEventArgs(ea);
			if (!_browserDocumentLoaded)
			{
				return;
			}

			// Only handle DomFocus that occurs on a Element.
			// This is Important or it will mess with IME keyboard focus.
			if (e == null || e.Target == null || e.Target.CastToGeckoElement () == null)
			{
				return;
			}

			var content = _browser.Document.GetElementById("main");
			if (content != null)
			{
				if ((content is GeckoHtmlElement) && (!_inFocus))
				{
					// The following is required because we get two in focus events every time this
					// is entered.  This is normal for Gecko.  But I don't want to be constantly
					// refocussing.
					_inFocus = true;
					EnsureFocusedGeckoControlHasInputFocus();
					if (_browser != null)
					{
						_browser.SetInputFocus();
					}
					_focusElement = (GeckoHtmlElement)content;
					ChangeFocus();
				}
			}
		}