public string toDataURLAs(string mimeType, string encoderOptions) { var retval = new nsAString(); DOMHTMLElement.ToDataURLAs(new nsAString(mimeType), new nsAString(encoderOptions), retval); return(retval.ToString()); }
public string toDataURLAs(string mimeType, string encoderOptions) { nsAString result = new nsAString(); DOMHTMLElement.toDataURLAs(new nsAString(mimeType), new nsAString(encoderOptions), result); return(result.ToString()); }
public string toDataURL() { var retval = new nsAString(); DOMHTMLElement.ToDataURL(null, null, retval); return(retval.ToString()); }
public void SetData_ToEmptyString_ToStringReturnsEmptyString() { var objectUnderTest = new nsAString(); objectUnderTest.SetData(String.Empty); Assert.AreEqual(String.Empty, objectUnderTest.ToString()); }
public void SetData_ToTestValue_ToStringReturnsTestValue() { var objectUnderTest = new nsAString(); objectUnderTest.SetData("hello world"); Assert.AreEqual("hello world", objectUnderTest.ToString()); }
public string GetStringValue() { using (var str = new nsAString()) { xpathResult.GetStringValueAttribute(str); return(str.ToString()); } }
public void SetData_ToNull_ToStringReturnsNull() { var objectUnderTest = new nsAString(); objectUnderTest.SetData(null); Assert.AreEqual(null, objectUnderTest.ToString()); }
public string toDataURL(string type) { using (nsAString retval = new nsAString(), param = new nsAString(type)) { DOMHTMLElement.ToDataURL(param, null, 2, retval); return retval.ToString(); } }
/// <summary> /// Function to get metadata associated with the window's current document /// @param aName the name of the metadata. This should be all lowercase. /// @return the value of the metadata, or the empty string if it's not set /// /// Will throw a DOM security error if called without UniversalXPConnect /// privileges. /// </summary> public string GetDocumentMetadata(string name) { using (nsAString tempName = new nsAString(name), ret = new nsAString()) { _windowUtils.GetDocumentMetadata(tempName, ret); return(ret.ToString()); } }
public void OutputToString_OutputEditableBody_BodyAndContentWrittenToString() { using (nsAString formatType = new nsAString("text/html"), retval = new nsAString()) { _editor.OutputToString(formatType, 8, retval); Assert.AreEqual("<body contenteditable=\"true\"><div>hello world</div></body>", retval.ToString()); } }
public string toDataURL(string type) { using (nsAString retval = new nsAString(), param = new nsAString(type)) { DOMHTMLElement.ToDataURL(param, null, 2, retval); return(retval.ToString()); } }
public string ToDataURL(string type) { using (var context = new AutoJSContext(GlobalJSContextHolder.BackstageJSContext)) using (nsAString retval = new nsAString(), param = new nsAString(type)) { JsVal js = default(JsVal); DOMHTMLElement.ToDataURL(param, ref js, context.ContextPointer, retval); return retval.ToString(); } }
public string toDataURL(string type) { using (nsAString retval = new nsAString(), param = new nsAString(type)) { var instance = Xpcom.CreateInstance<nsIVariant>(Contracts.Variant); DOMHTMLElement.ToDataURL(param, instance, 2, retval); Marshal.ReleaseComObject(instance); return retval.ToString(); } }
public string toDataURL(string type) { using (nsAString retval = new nsAString(), param = new nsAString(type)) { var instance = Xpcom.CreateInstance <nsIVariant>(Contracts.Variant); DOMHTMLElement.ToDataURL(param, instance, 2, retval); Marshal.ReleaseComObject(instance); return(retval.ToString()); } }
public string ToDataURL(string type) { using (var context = new AutoJSContext(GlobalJSContextHolder.BackstageJSContext)) using (nsAString retval = new nsAString(), param = new nsAString(type)) { JsVal js = default(JsVal); DOMHTMLElement.ToDataURL(param, ref js, context.ContextPointer, retval); return(retval.ToString()); } }
public string GetUsagesString(bool localOnly, ref uint verified) { string ret = null; using (nsAString str = new nsAString()) { _cert.Instance.GetUsagesString(localOnly, ref verified, str); ret = str.ToString(); } return(ret); }
public string toDataURLAs(string mimeType, string encoderOptions) { var retval = new nsAString(); DOMHTMLElement.ToDataURLAs(new nsAString(mimeType), new nsAString(encoderOptions), retval); return retval.ToString(); }
public override string ToString() { using (nsAString retval = new nsAString()) { DomRange.ToString(retval); return retval.ToString(); } }
public void ConstructorWithString_ToTestValue_ToStringReturnsTestValue() { var objectUnderTest = new nsAString("Hello world"); Assert.AreEqual("Hello world", objectUnderTest.ToString()); }
/// <summary> /// Function to get metadata associated with the window's current document /// @param aName the name of the metadata. This should be all lowercase. /// @return the value of the metadata, or the empty string if it's not set /// /// Will throw a DOM security error if called without UniversalXPConnect /// privileges. /// </summary> public string GetDocumentMetadata(string name) { using (nsAString tempName = new nsAString(name), ret = new nsAString()) { _windowUtils.GetDocumentMetadata(tempName, ret); return ret.ToString(); } }
void nsIContextMenuListener2.OnShowContextMenu(uint aContextFlags, nsIContextMenuInfo info) { // if we don't have a target node, we can't do anything by default. this happens in XUL forms (i.e. about:config) if (info.GetTargetNodeAttribute() == null) return; ContextMenu menu = new ContextMenu(); // no default items are added when the context menu is disabled if (!this.NoDefaultContextMenu) { List<MenuItem> optionals = new List<MenuItem>(); if (this.CanUndo || this.CanRedo) { optionals.Add(new MenuItem("Undo", delegate { Undo(); })); optionals.Add(new MenuItem("Redo", delegate { Redo(); })); optionals[0].Enabled = this.CanUndo; optionals[1].Enabled = this.CanRedo; } else { optionals.Add(new MenuItem("Back", delegate { GoBack(); })); optionals.Add(new MenuItem("Forward", delegate { GoForward(); })); optionals[0].Enabled = this.CanGoBack; optionals[1].Enabled = this.CanGoForward; } optionals.Add(new MenuItem("-")); if (this.CanCopyImageContents) optionals.Add(new MenuItem("Copy Image Contents", delegate { CopyImageContents(); })); if (this.CanCopyImageLocation) optionals.Add(new MenuItem("Copy Image Location", delegate { CopyImageLocation(); })); if (this.CanCopyLinkLocation) optionals.Add(new MenuItem("Copy Link Location", delegate { CopyLinkLocation(); })); if (this.CanCopySelection) optionals.Add(new MenuItem("Copy Selection", delegate { CopySelection(); })); MenuItem mnuSelectAll = new MenuItem("Select All"); mnuSelectAll.Click += delegate { SelectAll(); }; GeckoDomDocument doc = GeckoDomDocument.CreateDomDocumentWraper(info.GetTargetNodeAttribute().GetOwnerDocumentAttribute()); string viewSourceUrl = (doc == null) ? null : Convert.ToString(doc.Uri); MenuItem mnuViewSource = new MenuItem("View Source"); mnuViewSource.Enabled = !string.IsNullOrEmpty(viewSourceUrl); mnuViewSource.Click += delegate { ViewSource(viewSourceUrl); }; MenuItem mnuOpenInSystemBrowser = new MenuItem("View In System Browser");//nice for debugging with firefox/firebug mnuOpenInSystemBrowser.Enabled = !string.IsNullOrEmpty(viewSourceUrl); mnuOpenInSystemBrowser.Click += delegate { ViewInSystemBrowser(viewSourceUrl); }; string properties = (doc != null && doc.Uri == Document.Uri) ? "Page Properties" : "IFRAME Properties"; MenuItem mnuProperties = new MenuItem(properties); mnuProperties.Enabled = doc != null; mnuProperties.Click += delegate { ShowPageProperties(doc); }; menu.MenuItems.AddRange(optionals.ToArray()); menu.MenuItems.Add(mnuSelectAll); menu.MenuItems.Add("-"); menu.MenuItems.Add(mnuViewSource); menu.MenuItems.Add(mnuOpenInSystemBrowser); menu.MenuItems.Add(mnuProperties); } // get image urls Uri backgroundImageSrc = null, imageSrc = null; nsIURI src; try { src = info.GetBackgroundImageSrcAttribute(); backgroundImageSrc = new Uri(new nsURI(src).Spec); } catch (COMException comException) { if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005) throw comException; } try { src = info.GetImageSrcAttribute(); if (src != null) imageSrc = new Uri(new nsURI(src).Spec); } catch (COMException comException) { if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005) throw comException; } // get associated link. note that this needs to be done manually because GetAssociatedLink returns a non-zero // result when no associated link is available, so an exception would be thrown by nsString.Get() string associatedLink = null; try { using (nsAString str = new nsAString()) { info.GetAssociatedLinkAttribute(str); associatedLink = str.ToString(); } } catch (COMException comException) { } //GeckoContextMenuEventArgs e = new GeckoContextMenuEventArgs( // PointToClient(MousePosition), menu, associatedLink, backgroundImageSrc, imageSrc, // GeckoNode.Create(Xpcom.QueryInterface<nsIDOMNode>(info.GetTargetNodeAttribute())) // ); //OnShowContextMenu(e); //if (e.ContextMenu != null && e.ContextMenu.MenuItems.Count > 0) //{ // e.ContextMenu.Show(this, e.Location); //} }
public string toDataURL() { var retval = new nsAString(); DOMHTMLElement.ToDataURL(null, null, retval); return retval.ToString(); }
/// <summary> /// Gets the value of an attribute on this element with the specified name and namespace. /// </summary> /// <param name="attributeName"></param> /// <returns></returns> public string GetAttributeNS(string namespaceUri, string attributeName) { if (string.IsNullOrEmpty(namespaceUri)) return GetAttribute(attributeName); if (string.IsNullOrEmpty(attributeName)) throw new ArgumentException("attributeName"); nsAString retval = new nsAString(); _domElement.GetAttributeNS(new nsAString(namespaceUri), new nsAString(attributeName), retval); return retval.ToString(); }
void nsIContextMenuListener2.OnShowContextMenu(uint aContextFlags, nsIContextMenuInfo info) { // if we don't have a target node, we can't do anything by default. this happens in XUL forms (i.e. about:config) if (info.GetTargetNodeAttribute() == null) return; ContextMenu menu = new ContextMenu(); // no default items are added when the context menu is disabled if (!this.NoDefaultContextMenu) { List<MenuItem> optionals = new List<MenuItem>(); if (this.CanUndo || this.CanRedo) { optionals.Add(new MenuItem("Undo", delegate { Undo(); })); optionals.Add(new MenuItem("Redo", delegate { Redo(); })); optionals[0].Enabled = this.CanUndo; optionals[1].Enabled = this.CanRedo; } else { optionals.Add(new MenuItem("Back", delegate { GoBack(); })); optionals.Add(new MenuItem("Forward", delegate { GoForward(); })); optionals[0].Enabled = this.CanGoBack; optionals[1].Enabled = this.CanGoForward; } optionals.Add(new MenuItem("-")); if (this.CanCopyImageContents) optionals.Add(new MenuItem("Copy Image Contents", delegate { CopyImageContents(); })); if (this.CanCopyImageLocation) optionals.Add(new MenuItem("Copy Image Location", delegate { CopyImageLocation(); })); if (this.CanCopyLinkLocation) optionals.Add(new MenuItem("Copy Link Location", delegate { CopyLinkLocation(); })); if (this.CanCopySelection) optionals.Add(new MenuItem("Copy Selection", delegate { CopySelection(); })); MenuItem mnuSelectAll = new MenuItem("Select All"); mnuSelectAll.Click += delegate { SelectAll(); }; GeckoDomDocument doc = GeckoDomDocument.CreateDomDocumentWraper(info.GetTargetNodeAttribute().GetOwnerDocumentAttribute()); string viewSourceUrl = (doc == null) ? null : Convert.ToString(doc.Uri); MenuItem mnuViewSource = new MenuItem("View Source"); mnuViewSource.Enabled = !string.IsNullOrEmpty(viewSourceUrl); mnuViewSource.Click += delegate { ViewSource(viewSourceUrl); }; MenuItem mnuOpenInSystemBrowser = new MenuItem("View In System Browser");//nice for debugging with firefox/firebug mnuOpenInSystemBrowser.Enabled = !string.IsNullOrEmpty(viewSourceUrl); mnuOpenInSystemBrowser.Click += delegate { ViewInSystemBrowser(viewSourceUrl); }; string properties = (doc != null && doc.Uri == Document.Uri) ? "Page Properties" : "IFRAME Properties"; MenuItem mnuProperties = new MenuItem(properties); mnuProperties.Enabled = doc != null; mnuProperties.Click += delegate { ShowPageProperties(doc); }; menu.MenuItems.AddRange(optionals.ToArray()); menu.MenuItems.Add(mnuSelectAll); menu.MenuItems.Add("-"); menu.MenuItems.Add(mnuViewSource); menu.MenuItems.Add(mnuOpenInSystemBrowser); menu.MenuItems.Add(mnuProperties); } // get image urls Uri backgroundImageSrc = null, imageSrc = null; nsIURI src; try { src = info.GetBackgroundImageSrcAttribute(); backgroundImageSrc = src.ToUri(); Marshal.ReleaseComObject( src ); } catch (COMException comException) { if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005) throw comException; } try { src = info.GetImageSrcAttribute(); if ( src != null ) { imageSrc = src.ToUri(); Marshal.ReleaseComObject( src ); } } catch (COMException comException) { if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005) throw comException; } // get associated link. note that this needs to be done manually because GetAssociatedLink returns a non-zero // result when no associated link is available, so an exception would be thrown by nsString.Get() string associatedLink = null; try { using (nsAString str = new nsAString()) { info.GetAssociatedLinkAttribute(str); associatedLink = str.ToString(); } } catch (COMException comException) { } GeckoContextMenuEventArgs e = new GeckoContextMenuEventArgs( PointToClient(MousePosition), menu, associatedLink, backgroundImageSrc, imageSrc, GeckoNode.Create(Xpcom.QueryInterface<nsIDOMNode>(info.GetTargetNodeAttribute())) ); OnShowContextMenu(e); if (e.ContextMenu != null && e.ContextMenu.MenuItems.Count > 0) { #if GTK // When using GTK we can't use SWF to display the context menu: SWF displays // the context menu and then tries to track the mouse so that it knows when to // close the context menu. However, GTK intercepts the mouse click before SWF gets // it, so the menu never closes. Instead we display a GTK menu and translate // the SWF menu items into Gtk.MenuItems. // TODO: currently this code only handles text menu items. Would be nice to also // translate images etc. var popupMenu = new Gtk.Menu(); foreach (MenuItem swfMenuItem in e.ContextMenu.MenuItems) { var gtkMenuItem = new Gtk.MenuItem(swfMenuItem.Text); gtkMenuItem.Sensitive = swfMenuItem.Enabled; MenuItem origMenuItem = swfMenuItem; gtkMenuItem.Activated += (sender, ev) => origMenuItem.PerformClick(); popupMenu.Append(gtkMenuItem); } popupMenu.ShowAll(); popupMenu.Popup(); #else e.ContextMenu.Show(this, e.Location); #endif } }