Below you'll find a list of the most prominant features implemented.
For the most part, this page has been written in succession with posted builds. From the top down you will find older features followed by more recent ones, until you reach
the bottom where it lists the latests features of the currently available build. Keep in mind that this page does not address every single feature available in MozNET, it's here, more or less, to let you get an idea of what all it can do.
Support for running arbitrary javascript and
returning values to your code without the use of any
navigation hacks.
This also allows you to run javascript directly from your applications' address bar without invoking an actual navigation on the web browser
object! Take the following js snippet for example..
javascript:document.getElementById('movie_player').pauseVideo();
Navigate most GeckoFX or WebKit.NET based web browsers to any youtube.com page and start playing a video.
Next, paste that snippet in your address bar and click your 'Go' button. What happened? Absolutely nothing, the video kept on playing.
Doing the same thing with a MozNET based web browser will actually pause the video - and this is only scratching the surface of what's possible
with the scripting system. You can play with this feature until your hearts' content with the example project
that is available.
- Proper downloads using the XulRunner provided dialogs. (default)
- Download to a predefined folder, skipping the save dialog.
- Open downloaded files with the default handler application.
- Implement your own download manager using notifications and information provided by MozNET.
- Easily implement your own print preview window with MozNET's ability to clone a page without reloading it.
- MozNET supports printing via user interacted dialog or silently.
- Printing with MozNET requires no modifications to any XulRunner files.
- Page setup is also available and fully functional.
Use the intrinsic XulRunner provided Find dialog..
..or even roll your own
Enhanced 'Find' feature implementation with ability to highlight all matches and iterate through them one at a time.
(Javascript is not used to do this)
Highlight search results from Google, Yahoo, Bing and Ask based on the query string.
(Javascript is not used to do this)
- Set per-site style sheets of your own creation.
- Supports most site-specific style sheets provided by
UserStyles.org.
- Supports simple message logging.
- Supports complex message logging.
- Monitor messages sent to the console.
- Access to the excluded sites list.
- Support for querying the login manager for saved logins.
- Add, remove and modify logins.
- Built in 'Secure Login' feature - similar to the 'Secure Login' FireFox addon.

Refer to the example project to see how it's put together.
Fly your own dialog when requesting to save a user login.
..or even build your own Info Bar style prompt that runs async.
- Supports changing, resetting or even removing the master password.
- Full support for flying your own dialogs to change, set or clear the master password - with optional
pass/fail messages.
- Supports using the native XulRunner dialogs for master passwords.
- Add custom items to the MozNET context menu.
- Set a desired index for your custom added items.
This allows you to easily extend the default context menu so you don't have to re-invent the wheel just to add a few new spokes.
Save images from the context menu without the need to re-download them.
Save entire web pages - and (optionally) supporting objects such as scripts and images are saved to a subdirectory
with the same name used to save the document.
- Open implementation so you can use the feature in any part of your application.
- Does not require a browser window to use.
- Easily extendable via user added dictionaries. - Spell check in your native language.
- Fixed the 'Add Word To Dictionary' feature and added the 'Ignore Word' feature.
- Text elements are rechecked after any spell check fixes are made so that corrected words are
no longer marked as incorrect.
- Dictionary switching has also been added to the context menu.
- Spell Check can be enabled or disabled to prevent its use from the context menu.

Suggestions for misspelled words are automatically added to the MozNET context menu. The spell check
feature works automatically for html <textarea/> and <input type='text' /> elements.
Support for the HTML 5 specification <video>, <audio> and <source> elements.
Neatly wrapped up and made accessible via the DOM access classes.
Also supported is XulRunner's WiFi monitoring.
This is exposed similar to the DOM access classes.
You can use this feature to monitor WiFi hot spots directly from your application.
MozNET will also retrieve the favicon for a website and notify you when it has it. The event args for the notification
will return the favicon to you as a System.Drawing.Image so that you may convert it to whatever format you want it in.
This is a non-blocking operation so your application won't hang out waiting for the image to be returned. For WPF fans,
such as myself, there is also a FavIcon property that you can bind to. The value of this property is internally set by
the same event that would otherwise notify you that an icon is available but, you don't even have to subscribe to it -
just bind your desired control to the FavIcon property and you're work is done. If you have a peek at the
code snippets page you'll find a
WPF converter that you can use in your binding.
Ability to get the computed CSS property value for a given elements' styling.
Wrapped nsIDOMText into MozDomTextNode so you will now have access to text nodes in html documents.
Wrapped nsIDOMDocumentRange into MozDomDocumentRange and nsIDOMDocumentFragment into MozDomDomFragment so you'll be able to easily nest elements.
Added 'NodeType' property member to MozDomNode so you can check whether or not a cast may fail before attempting to change the node's type. Eg. casting
from MozDomNode to MozDomElement will fail if the NodeType value of MozDomNode is TEXT_NODE.
MozImageElement now contains the property ManagedImage, which returns a System.Drawing.Image object.
This property has both a getter and a setter so you can easily change the image displayed by swapping it with a local (or remote) one.
Also implemented in MozNET is mouse gestures.
Give your application the ability to navigate by mouse!
Easily add the DOM Inspector addon as part of your application.
Printing and Print Settings are now exposed via MozWindowPrint and MozPrintSettings classes.
Easily create your own print preview dialog as well as modify header/footer text and margins of printed documents.

(Notice the custom left/center/right headers and top margin, this was done with the new MozPrintSettings class
which gives you fine grained control over most print settings. The print preview dialog in the example application supports 99.9% of XulRunner's printing capabilities,
including full support for the Page Setup dialog. -- Note that the dialog shown above is a custom dialog, created in the example application.)
With the new MozPrintSettings class you can print and print preview in both 'Landscape' and 'Portrait' layout orientations.
Print pages directly to PDF format.

Full support for the Adobe Acrobat Reader plugin.
Popup blocking has been enhanced with the ability to handle notifications with your own dialogs.
A new property has been added to GlobalSettings that allows you to prevent MozNET from attempting to
download favicons. This lets you use your own logic for finding and downloading them while MozNET does less internal processing.
Media sites such as You Tube no longer continue to play media after disposing of the
MozWebView instance that the page is loaded in.
Patched a ton of memory leaks caused by undisposed of ns*String instances.
Fully opened access to unmanaged interfaces.
This allows you to fine tune the way MozNET behaves to better suite your application needs.
All methods, in MozNET.XPCom, that are needed to interact with XulRunner via the unmanaged interfaces have been opened up for external access.
You can even write your own javascript based XPCom components, register them with XulRunner, and access them from your own code.
Note that you'll need the sdk for the version of XulRunner that MozNET is targeting. In addition to the sdk you'll also need a few other
Mozilla build tools - I've provided a link to them in the tutorial. I've also written a web based interface that automates the tools
and creates the XPCOM component from your IDL file allowing you to download the resulting archive. This tool is offered to paid users only but,
the tutorial does walk you through the steps to accomplish the same thing using the command line.
Fixed handling of 'mailto:' links. They now open the default mail client and properly populate the correct fields.
Added methods to wrap the following data types in order to pass to javascript safely:
- nsISupportsCString
- nsISupportsString
- nsISupportsPRBool
- nsISupportsPRUint8
- nsISupportsPRUint16
- nsISupportsPRUint32
- nsISupportsPRUint64
- nsISupportsPRTime
- nsISupportsChar
- nsISupportsPRInt16
- nsISupportsPRInt32
- nsISupportsPRInt64
- nsISupportsFloat
- nsISupportsDouble
- nsISupportsVoid
- nsISupportsInterfacePointer
Enhanced features added to
MozWindow in the form of a new class member -
WindowUtils.
WindowUtils is a wrapper for
nsIDOMWindowUtils and is
encapsulated in a new class,
MozWindowUtils.
The features include:
Redraw,
SendMouseEvent,
SendMouseScrollEvent,
SendKeyEvent,
SendSimpleGestureEvent,
Focus (MozDomElement),
GarbageCollect,
ElementFromPoint,
GetScrollXY,
ScreenPixelsPerCSSPixel
..and more.
Added an overloaded Initialize method to Xpcom which allows you to set your developer key and profile directory in a single call.
Also, Xpcom no longer requires a specified profile directory. If you pass null to the Initialize method a default directory
('~/Users/[username]/appdata/localapplicationdata/MozNET/defaultprofile') will be created and used to store the profile.
I've wrapped most interfaces used to query the 'Places' database so they can be used similar to the DOM access classes.
At the moment the implementation is still pretty bare but, it does provide a starting point and I'll continue to develop
this area of the control as I work my way around. Note: XulRunner is unreliable when it comes to the 'Places' database.
Added a new class, MozObserverNotifier, which can be used to register an observer (listener) for certain
XulRunner posted notifications or you can even register your own notifications and use it as a sort of free event system.
This class can also be used to send out notifications so that your own listeners can be notified of whatever string data
you want to send. To use this feature your application must implement both nsIWeakReference and nsISupportsWeakReference.
The two interface implementations are pretty simple though, just a single method in each one and I'll even post the code you
should put in them (on the code snips page) when I make the next release.
You'll also need to implement nsIObserver in the class that you want to use for listening to notifications but,
that's fairly simple too.
MozObserverNotifier could probably be used for passing data to custom XPCom components but, I haven't tested it in this scenario.
Se7enSoft.MozNET.GlobalSettings.LoginManager.ValidLoginFound now returns an instance of
Se7enSoft.MozNET.GlobalSettings.SecureLoginFormFoundEventArgs which provides you with a reference to both the
web browser object that contains the login form as well as the login form, itself - wrapped up in a MozFormElement
object. This is intended for use with the 'Secure Login' feature implemented by MozNET. The example application contains a
working implementation of this.
Added overloaded methods (LoadHTML) to MozWebView that allows you to load arbitrary HTML directly into the control via
string or stream; without the use of temp files or any other cheap tricks.
Added the ability to easily set, change or remove http and ftp proxy server settings to the Se7enSoft.MozNET.GlobalSettings class.
Fixed context menu features: 'Save Target As..' and 'Save Image As..'.
Added media player controls to the context menu when the target item is a HTML 5 video or audio element.
Added ability to block downloads on a global level.
Added the ability to display toast notifications using the alert system like the download manager sends when a file completes. You can even register an observer to listen for whether
the message text was clicked or not and when the notification closes.
Updated handling of 'mailto' links. MozNET now uses the nsIExternalProtocolHandlerService interface to service requests of this type. Additional protocols can be added to the list of
protocols to be handled by a default, external, application, in 'all.js'. You can also override the system's default handler by specifiying what application to use when servicing a specific protocol. This is
done via 'all.js' (or about:config) as well. The same procedure can be used to handle 'callto' links that open with Skype.
Added 'Send Link' feature to the MozNET context menu to allow you to send hyper-links via email. This will open the default mail client just as if a 'mailto' link were clicked.
Added 'Send Image' feature to the MozNET context menu. This works the same as the 'Send Link' feature.
Added two new instance member properties to Se7enSoft.MozNET.MozDomElement, IsImageLink and ImageLinkHREF. The first returns whether
or not a given element (internally cast as MozImageElement) is parented by an instance of MozAnchorElement. The second returns the HREF value for
a given MozDomElement. It is meant for use with IsImageLink to get the HREF value of the parent link and returns null if the element is not an image link. I created them for internal use but, decided
to open them up for your own use.
MozDomNode now implements IDisposable to aid in cleanup of unmanaged resources.
Added ability to play html5 video's in fullscreen mode. This is only available from the context menu.
Added ability to save html5 video and audio sources from the context menu.
Added the ability to download files using the XulRunner download manager. Just pass the new DownloadFile method the location of the local file to save to and the full path to the remote
file you want to download - the rest is taken care of for you. This new method is a MozWebView instance member.
Added a new instance member property, ParentAnchor, to MozDomElement. This property returns the first found MozAnchorElement when traversing up the element chain
beginning with the specified element; if the specified element is an instance of MozAnchorElement the specified element will be returned. This is useful for determining if a given element is wrapped in a link.
Consider this a generic, modified, version of IsImageLink because it will work with any MozDomElement but, returns the MozAnchorElement found (if any) instead of a bool value.
Added a new MozAnchorElement2 class wrapping nsIDOMNSHTMLAnchorElement2 and extending MozAnchorElement to provide
a few more get/set properties that you can access.
Added several more DOM access classes wrapping the following XulRunner interfaces:
nsIDOMNSHTMLAreaElement2, nsIDOMNSHTMLButtonElement,
nsIDOMNSHTMLFrameElement, nsIDOMNSHTMLHRElement, nsIDOMNSHTMLImageElement, nsIDOMNSHTMLInputElement,
nsIDOMNSHTMLOptionCollection, nsIDOMNSHTMLOptionElement, nsIDOMNSHTMLScriptElement and nsIDOMNSHTMLSelectElement.
Added overloaded 'Create' methods to the most commonly used MozDomElement types. This makes it as easy as:
MozAnchorElement anchor = MozAnchorElement.Create(browser.document);.
Added a new class, IncrementalDownloader, which is able to silently download files, in the background and by specified chunk size and timed interval. The
downloader has two events which are pretty self-explanatory: DownloadStarted and DownloadStopped. The class also implements several
read-only properties to give you a little more information about the download.. TotalSize, CurrentSize and FinalURI. Of the three,
the one that may need explaining is FinalURI. This property contains the final uri of the file being downloaded after any redirects are done to get there. This class is
not dependent on any other controls, etc. and can even be used without creating a MozWebView instance. The IncrementalDownloader will
automatically resume downloads where left off from a previous session the next time it is called to download said file.
A new property, DownloadMode, has been added to Se7enSoft.MozNET.GlobalSettings. This property defines the way downloading works. The value
is one of 3 members of the new DownloadModes enum. You can specify one of the following modes: Default, Custom or Disabled. To
go along with this change is the ability to use your own downloader when specifiying Custom as the DownloadMode.
To go with the new ability to use your own downloader I've enabled the (very) basic downloader in the example project and hooked into the toast alert system used by XulRunner to display a
notification when a download finishes. In addition, I've modified the alert system to take a System.Drawing.Image object as a parameter so it will show the image as the popup's icon.
Implemented the ability to load content from a stream into a MozWebView object via nsIWebBrowserStream. This allows you to load content that can't
be loaded by conventional URL's, etc.
Added support for five button mice with a new property: GlobalSettings.SupportFiveButtonMouse. This property can both enable and disable support for five button mice. At the moment,
the X buttons are hard coded to navigate Back and Forward but, by the time the next release rolls around this will probably be developer configurable.
Added the ability to programatically click any MozDomElement via a new method in MozWebView - ClickElement(MozDomElement).
Added ScrollToElement(MozDomElement) and GetElementLocation(MozDomElement) methods to the MozWindowclass. ScrollToElement does exactly that while
GetElementLocation returns a System.Drawing.Point value with the offset position of the element relative to the document.
Fixed MozWebDocument.GetElementByXPath method. It was returning null instead of valid values due to a casting bug.
Fixed MozButtonElement and MozButtonElement2 Create methods. They now return valid instances instead of always null.
Fixed a bug preventing the ability to copy text selections using the context menu.
XPCom no longer requires initialization. You can now set the new MozWebView.DeveloperKey property with your key and away you go. To sweeten it up even more, the new MozNET AIO build (soon to come)
will be even easier to use. Just drop it on a form, set the DeveloperKey property and press 'F5' - you don't even have to supply the XulRunner runtime.
Added support for calling your application's methods from javascript. You can now call out of javascript, similar to:
"var result = window.external.callMethod(self,'method_name_here', '_param1','_param2');
alert(result);",
and be able to return both strings and objects back to the calling javascript from your
own code.
The feature is governed by IsScriptableObject, this is a bool property. Because there is no way to assign an object other than the MozWebView instance to be the target.
Instead, IsScriptableObject is used to either allow or disallow the control being scripted by the 'window.external' access methods.
Each MozWebView instance can govern whether or not it is permitted to be scripted but, they can all also be globally governed by a property in
MozNET.GlobalSettings - GlobalBrowser_IsScriptableObjectEnabled.
Added overloaded MozWindow.InvokeScript method which invokes a defined 'window.external' handler. The overloaded method takes 3 parameters. The first is the name of the extension method that window.external will call, the second
is the name of your method you want to pass to your handler, and the third is an array of strings that will be passed to your handler. This overload returns any results from the script invocation back to the caller, as a string.
Added another overloaded MozWindow.InvokeScript method, mimicing the IE web browser method. This overload expects the name of the javascript function to be called along with a string array of parameters to pass to it.
Added a new method to the Xpcom class, DestroyInstance<TInterfaceType>, which finalizes and releases reference to an unmanaged XulRunner inteface.
This method is meant to work as an opposite of CreateInstance<TInterfaceType>.
Added a new method to the Xpcom class, Shutdown, which calls DestroyInstance<TInterfaceType> on internally used interfaces.
Your application should call this method when exiting so that unmanaged resources, used internally by MozNET, are released.
Fully managed access to the nsIFaviconService and its methods via the new FaviconService class.
Take note that nsIFaviconService is NOT a magical interface that will automatically get the favicon for any given page.
It is a storage mechanism that you can use to store and retrieve favicons. This will all be done behind the scenes in MozNET but, should you want
to use the class for yourself it's best to know what it is now instead of having false expectations.>
Due to some well hidden bugs this feature has been disabled for now.
Much improved favicon handling. MozNET now utilizes the nsIFaviconService via the FaviconService class, for icon caching.
This dramatically reduces the time it takes to fetch a favicon on consecutive loads. By default, favicons are expired after 24 hours and will be refetched from the server the
next time the page is loaded.
See comment above.
The MozNET trial will not expire after 14 days. Instead it will revert to a reduced functionality mode but, continue to work.
Disabled Features:
- Spell Checking
- Custom *Find* Implementations
- Login Manager and Secure Login Feature
- Script Injection and 2-Way Script Communication
- All Media Related Events
- Built-in Mouse Gesture Support
- Built-in 5 Button Mouse Support
- Several Context Menu Related Features
- DOMContentLoaded and DOMContentFrameLoaded Events
- File Downloads
- Custom component registration
MozNET will NOT notifiy you when your trial period expires. Instead it will quietly slip into Limited Service Mode, employing the reduced functionality set above.
This mode is to allow you to
continue using the control in your own, personal, projects or while you continue development before purchasing the control. The Xpcom class contains a static property -
IsLimitedServiceMode - that you can query if you need to know what mode the control is in.
Fixed a bug that prevents proper rendering of some web pages.
Added a new property to the MozWebView class, IsLoadingDocument. This property will return true if the browser component is currently loading a page and
false otherwise. To supplement this property comes a new event - DocumentLoadingStateChanged. This event will notify you of changes to the new IsLoadingDocument
property. You can think of the combination of the two as a live version of DocumentCompleted as the event will fire the property notification repeatedly as it changes state during load.
Also, the event is fired from within an inline timer. This makes it async but, without the overhead of threading work. (Ya, I cheaped out there. If you don't like it change it ;) )
You can read the descriptions for
both the property and the event in the documentation (whenever I get around to updating it) or in the intellisense popup within VS for more information.
Added support for embedded icons to the favicon retrieval feature. This allows you to get the favicon if its embedded as a base64 string within the webpage.
Added the event PageZoomLevelChanged to notify your code that the user has changed the zoom level. Also, added a new get/set property for easier zoom level access - PageSize.
This property is of type double and exposes the value of PageZoom in an easier to digest form. Easily set the zoom level using a percentage!
Deprecated property, PageZoom, has been removed from the MozWebView class. The alternative is to use the property of the same name located in the MozWindow class.
Fixed MozHTTPChannel.GetRequestHeader, MozHTTPChannel.SetRequestHeader and MozHTTPChannel.GetResponseHeader methods. This allows you to modify headers on
requests and responses.
Implemented the ability to create and register your own, managed code, XPCom components with MozNET. This gives your application code the ability to be called upon from Javascript without using MozNET as a passthrough.
Component item templates, in both C# and VB, are available to help you with this feature.
No longer are you confined to the default JS communication methods employed by MozNET.
By implementing a simple interface you can create custom components that do whatever you need them to do - including returning any results back to the calling script.
This is MozNETs' version of Pandora's box. Read the walk-through here.
Want to slim down your applications' footprint? MozNET can now run without the need of a profile directory by setting the new XPCom.UseProfileDirectory property to false. Note, that this is
not available in the AIO build as it requires a profile directory in the current release.
Newly added events include:
- DOMDblClick
- DOMFocus
- DOMBlur
- DOMDragStart
- DOMDragEnter
- DOMDragOver
- DOMDragDrop
- DOMDragExit
- DOMDragEnd
- DOMOverflowed
- DOMUnderflowed
- DOMCopyOperationCompleted
- DOMCutOperationCompleted
- DOMPasteOperationCompleted
- DOMKeyPress
- DOMLoad
- DOMUnload
- DOMSelect
- DOMChange
- DOMScroll
- DOMTitleChanged
- DOMActivate
- DOMCharacterDataModified
- DOMSubTreeModified
- DOMNodeInserted
- DOMNodeRemoved
- DOMInputChanged
- DOMAttrModified
Did you count all those? Me neither but, I can tell you there's over 25 of them! This should give your application a bit more information in respect to
what the Hell is going on in those pages it's showin' to your users. Need to know when some chunk of page changes? Got you covered! Just check out the new
DOMSubTreeModified event - its target is the changed element. Need finer grained information than that?
Switch over to DOMNodeInserted, DOMNodeRemoved, DOMAttrModified and
DOMCharacterDataModified - you're still covered.
Ever tried stopping an event? You know, like trying to prevent someone from clicking a link by setting e.Handled = true in the DOMClick event handler.
Are you sitting there, cursing me and the library while saying "Hell yeah, I tried to prevent it and nothing happened!"? Well, your wait is over - it's fixed! You can now set e.Handled = true
and it will stop in its tracks.
Need to paste something into a text field but, you're unable to access 'Paste' in the context menu? I had that problem too.. so, I fixed that also.
Added Create methods for most MozDomElement-derived DOM object classes where
they were missing.
I've moved the SetStyleSheet and RemoveStyleSheet static methods from GlobalSettings and
made them into member properties of the MozWebDocument class.
Many service classes have been moved out of the Se7enSoft.MozNet.dll assembly and into the Se7enSoft.MZXPCom.dll
assembly.
The ability to print directly from the MozWindow class has been implemented in the form of a new method, Print(bool withdialog = true).
The MozDownloader class has been moved to Se7enSoft.MZXPCom.dll so that it can be accessed without ever creating
a MozWebView object.
Fixed close to 80 minor issues, in several interface definitions, located in Se7enSoft.MZXPCom.dll.
MozNET has a much improved load time for both the control and pages it renders. Using an instance of the
Stopwatch class, the
example project will start and completely load the homepage in 1.87 seconds on my system (3.4ghz dual core) and with my connection (20mbit) - outside of the VS IDE.
Fixed the issue causing a NullReferenceException to be thrown, at design time and by the Visual Studio designer, when removing the component from
a Form or WindowsFormsHost (WPF).
The issue causing Visual Basic.NET projects [targeting .NET frameworks 3.5 and 4.0] not to compile without using the work-around, has been resolved.
Added a new CreateElement method to MozWebDocument. The method is similar in nature to the XPCom.CreateInstance type of methods in that it accepts a MozDomElement-derived type
and returns an instance of that type if possible.
The method works as such:
PROTOTYPE: public T CreateElement<T>();
MozAnchorElement anchor = Browser.Document.CreateElement<MozAnchorElement>();
if(anchor != null)
{
anchor.Href ="http://somesite.com/";
anchor.TextContent ="Click Me, I'm A Link!";
Browser.Document.Body.AppendChild(anchor);
}
Added another new, overloaded, CreateElement method to MozWebDocument. The method is similar to the one outlined above but, it accepts a single parameter of type
MozDomElement and returns it, converted to the type specified if possible.
The method works as such:
PROTOTYPE: public T CreateElement<T>(MozDomElement elm);
MozAnchorElement anchor = Browser.Document.CreateElement<MozAnchorElement>();>
if(anchor != null)
{
anchor.Id = "__myMozLink";
anchor.Href ="http://somesite.com/";
anchor.TextContent ="Click Me, I'm A Link!";
if(Browser.Document.Body.AppendChild(anchor) is MozAnchorElement)
{
MozDomElement m_elem = Browser.Document.GetElementById(anchor.Id);
if(m_elem != null)
{
MozAnchorElement m_link = Browser.Document.CreateElement<MozAnchorElement>(m_elem);
if(m_link != null)
{
m_link.SetAttribute("onclick", "alert('This is a test!');");
Browser.ClickElement(m_link);
}
}
}
}
A new property, ParentWindow, has been added to the MozWebDocument class so that you can get the window instance which
contains said document. This gives you the ability to go from a MozDomElement instance to the host window element as easy as:
MozWindow window = [MozDomElement_Instance].OwnerDocument.ParentWindow;
A note about the code above.. If the element, MozDomElement_Instance in this case, is contained within the contents of an iframe then the MozWindow
instance returned is the window containing the MozWebDocument that is loaded into the iframe, via its Src property. This is not the toplevel
MozWindow that you would get if you query MozWebView.Window but, rather a child window instead. You can treat this window just like
the toplevel MozWindow which contains the toplevel document being viewed.
The Se7enSoft.MozNet.Dom namespace has been eliminated. All DOM elements are now available under the generic Se7enSoft.MozNet namespace.
Added a new method to MozWindow, GetElementById, which accepts two parameters; the ID of the element to find and, optionally, the MozWindow
to start the search in. The method will recursively search the specified window and any child windows contained within it (iframes/frames) until it finds the first instance of
an element with the specified ID attribute. Any child windows contained within the specified window will also be recursively searched. If the MozWindow parameter
is ommitted, the search will begin in the window the method is called on. By specifying the window to start in you can direct your search at specific frames if you
know about them beforehand.
MozDomElement element =
MozWebView_Instance.Window.GetElementById("_myElementId" [optional:, MozWebView_Instance.Window]);
Added yet another overloaded GetElementById method to MozWindow. It works almost identical to the method described above but, with a slight
twist. It allows you to specify the MozDomElement-subtype to look for and return. The method prototype is as follows:
MozAnchorElement anchor =
MozWebView_Instance.Window.GetElementById<MozAnchorElement>("_myElementId" [optional:, MozWebView_Instance.Window]);
Added a new method to MozWebView, OwnsWindow, which takes a single parameter of type MozWindow. It will return
whether or not (true or false) the specified window is a child of an element (think frames) in the particular MozWebView instance.
Added two new methods to MozDomElement that you can use to get/set specific CSS properties on any MozDomElement based class.
GetCSSProperty and SetCSSProperty, respectively. Both the get and set method requires the first parameter to
be a member of the supported enum below but, the set method also takes a single parameter of type string, containing
the value to set on the property and the get method returns a string representation of the property value being queried for.
The available properties are as follows:
public enum CSSProperties
{
Azimuth, Background, BackgroundAttachment, BackgroundColor, BackgroundImage, BackgroundPosition,
BackgroundRepeat, Border, BorderCollapse, BorderColor, BorderSpacing, BorderStyle, BorderTop,
BorderRight, BorderBottom, BorderLeft, BorderTopColor, BorderRightColor, BorderBottomColor,BorderLeftColor,
BorderTopStyle, BorderRightStyle, BorderBottomStyle, BorderLeftStyle, BorderTopWidth, BorderRightWidth,
BorderBottomWidth, BorderLeftWidth, BorderWidth, Bottom, CaptionSide, Clear, Clip, Color, Content,
CounterIncrement, CounterReset, Cue, CueAfter, CueBefore, Cursor, Direction, Display, Elevation,
EmptyCells, CssFloat, Font, FontFamily, FontSize, FontSizeAdjust, FontStretch, FontStyle, FontVariant,
FontWeight, Height, Left, LetterSpacing, LineHeight, ListStyle, ListStyleImage, ListStylePosition,
ListStyleType, Margin, MarginTop, MarginRight, MarginBottom, MarginLeft, MarkerOffset, Marks,
MaxHeight, MaxWidth, MinHeight, MinWidth, Orphans, Outline, OutlineColor, OutlineStyle, OutlineWidth,
Overflow, Padding, PaddingTop, PaddingRight, PaddingBottom, PaddingLeft, Page, PageBreakAfter,
PageBreakBefore, PageBreakInside, Pause, PauseAfter, PauseBefore, Pitch, PitchRange, Position,
Quotes, Richness, Right, Size, Speak, SpeakHeader, SpeakNumeral, SpeakPunctuation, SpeechRate, Stress,
TableLayout, TextAlign, TextDecoration, TextIndent, TextShadow, TextTransform, Top, UnicodeBidi,
VerticalAlign, Visibility, VoiceFamily, Volume, WhiteSpace, Widows, Width, WordSpacing, ZIndex
}
Have you developed a managed code XPCom component that doesn't need to be used from anywhere but Javascript? I've implemented a new method that will allow you
to blind load components from a directory you specify, although they still need to be registered with XPCom in the usual manner. This gives you the freedom to
use your component without needing to reference it in your project. This method is called internally so, all you need to do is specify a directory to load from
in the XPCom.Initialize() overloaded method. If you need to load a component on demand [remember, they cannot be unloaded], you can call the
XPCom.DemandComponentLoad(string cmpPath) method, passing the absolute file path in the cmpPath parameter and the component will be
registered and ready to use from Javascript.
Beginning with the re-release of the R14 build, developers are now responsible for creating prompt dialogs for their applications. I don't feel that MozNET should be responsible for them as 99.999% of the time they
will not fit in with the host application and the developers will certainly want to override them anyway. A few password related dialogs still remain in the library but, will be removed in a future build. All dialogs for
alerts, prompts/inputs, etc. must now be provided by the host application.
SSL. What can I say about it? Hmmm.... Oh yeah, you know those sites that use certificates that aren't already installed on your system so XulRunner won't let you
access the web site securely or at all? You know the kind, Se7en-Soft.com is one of them! Anyway, you can accept them now. Yup, it's fixed. No more bs 'This site has an invalid
certificate - screw you, Jack!' messages. If you want to accept that certificate and enter the site it's your damn right to do so! So, go ahead and access those sites -
don't let XulRunner stop you! Need to fly a custom acceptance dialog? You can do that too!
You can read a bit more on the forum in this post.
Beginning with R15, MozNET will become more localizable-friendly! The moznet.jar (in the supplemental files archive) will contain a localizable properties file (MozLocale.properties) that you'll
be able to translate to your language of choice. At the moment, this file holds all of the strings used by the context menu. MozNET now uses the new MozStringBundleService to read values from property files making it easier to localize without breaking anything. MozNET no longer depends
on any strings to remain in English but, if the localization file is AWOL for any reason it will fall back to English so that no strings are missing.
Strings that were previously hard coded (eg. dialog buttons, etc) are
now pulled up utilizing the MozStringBundleService and therefore can be localized to your language as well. So, pretty much, if you want to translate every string (in the *.properties files) that you
find in the XulRunner jar files, you can. It should no longer effect MozNET in any way. Not only can you translate existing strings but, you can also create your own jar files, containing your own strings for use in other parts
of your application UI; making it easy for others to localize your application as well. The MozStringBundleService is fully accessible and useable by your code. There are no rules saying that it can only
serve strings from known jar files as the class contains a method that allows you to pass the chrome:// url of your properties sheet to create a string bundle which you can then easily query for your UI strings. To demonstrate it I've
modified the example application to use a custom jar file with its own properties sheet holding the strings used in the main menu.
The R16 release brings even more compatibility to the current SSL handling in MozNET. Now, you'll be able to open those 'other' sites that haven't been working for you - if you've come across them, you know what I mean; if you haven't then
you'll never notice this fix.
R16 brings a new class, MozSanitizer, that gives you access to such things as clearing global browser history, cache (sic), cookies, sessions, etc. right from one place. This class is a replication of the 'sanitizer.js' file that
is part of Firefox.
All media events have been removed from the MozWebView class and placed into the new MozMediaEventListener class. An instance of this class is available in the MozWebView as MediaEventListener.
AuthPrompt dialog methods (the ones that ask for a username/password pair) have been fixed. They'll now properly return the values back to MozNET (as long as you implement the return properly ;-}).
The member method, GetPageDescriptor (in MozWebView), has been changed to a property with the name of PageDescriptor.
MozCreateWindowEventHandler.WebBrowser has been renamed MozCreateWindowEventHandler.WebView.
Added the ability to modify the CSS applied to text highlighted by the custom 'Find' feature. Easily change the CSS in 'all.js' or by modifying the 'moznet.find_hilite.find*' and 'moznet.find_hilite.search_results*' user preferences.
Need to know when the value of a certain preference is changed? Well, now you can be notified automatically. Just hookup to the new MozPrefChanged event in MozUserPreferences and specify the preferences you want to monitor for changes.
In your event handler you'll receive an instance of MozPrefBranch (rooted at the registered branch) and both the name of the preference who's value has changed as well as the new value and its value type, specified as a member of the new enum MozPreferenceTypes.
Added new events for touch enabled devices including, MozSwipeGesture, MozMagnifyGestureStart, MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart, MozRotateGestureUpdate,
MozRotateGesture, MozTapGesture, MozPressTapGesture - the one caveat is that I can't directly test and debug (although, I don't believe they should need debugging) these events, as my Wacom Pen & Touch tablet doesn't appear to emit the proper
notifications. Your mileage may vary.
Implemented the MozMousePixelScroll event (within MozWebView) so you can have notifications of minute scrolling within the control.
Implemented support for PageShow and PageHide events along with proper notification values.
Script injection has been enhanced!
I've simplified script injection down to the point where a chimp can use it. No more messy callbacks, your results are returned via a simple method call!
Using the new enhancements is a breeze. There is now an encapsulation class, MozJScript, that insulates you from the messy details. The MozScriptManager class includes both an instance method as well
as a static method for creating a MozJScript instance. Putting it all together is dead easy, the following code snippet will show you how.
//Instance Creation
string _scriptContentsA = @"var x = GetAnswerToEverything(" + 10.ToString() +@"," + 32.ToString() + @");";
_scriptContentsA += @"MozNetEventRunner.raiseEvent('TheAnswerToEverythingScript', '{""Answer"":' + x + '}');";
MozJScript jScriptA = CurrentBrowser.Window.ScriptRunner.CreateJScript("TheAnswerToEverythingScript", _scriptContentsA);
//Static Creation
string _scriptContentsB = @"var x = GetAnswerToEverything(" + 89.ToString() + @"," + 94.ToString() + @");";
_scriptContentsB += @"__doMozJSPostback('TheAnswerToEverythingScript', '{""Answer"":' + x + '}');";
MozJScript jScriptB = MozScriptManager.CreateJScript("TheAnswerToEverythingScript", _scriptContentsB, CurrentBrowser.Document, false, true);
MessageBox.Show("A: " + jScriptA.Execute() + "\r\nB: " + jScriptB.Execute());
Note that the above code was taken from my current example project build and that I am using the RunJSEventTest() method, which already provides code to inject the 'TheAnswerToEverythingScript' Javascript block
that is used in the above code.
The new creation method prototypes are as follows: (Note, these methods are located in the MozScriptManager class.)
//Instance Member
/// <summary>
/// Creates and returns a <see cref="MozJScript"/> object.
/// </summary>
/// <param name="ScriptID">The ID used for the injected script block.</param>
/// <param name="ScriptContents">The script code.</param>
/// <param name="WrapTryCatch">Whether or not to wrap the script code in a try/catch block. This is good for debugging, no so much for distributed applications ;-}</param>
/// <returns></returns>
public MozJScript CreateJScript(string ScriptID, string ScriptContents, bool WrapTryCatch = false, bool RemoveAferExecution = false);
//Static Member
/// <summary>
/// Creates and returns a <see cref="MozJScript"/> object.
/// </summary>
/// <param name="ScriptID">The ID used for the injected script block.</param>
/// <param name="ScriptContents">The script code.</param>
/// <param name="TargetDoc">The document that the script will be executed in.</param>
/// <param name="WrapTryCatch">Whether or not to wrap the script code in a try/catch block. This is good for debugging, no so much for distributed applications ;-}</param>
/// <returns></returns>
public static MozJScript CreateJScript(string ScriptID, string ScriptContents, MozWebDocument TargetDoc, bool WrapTryCatch = false, bool RemoveAferExecution = false);
There is also an updated, static, InvokeScript method which allows you to specify which document to run the script in as well as providing any return value, as a string.
string _blockScript = "function AScriptToRun(_var){ return _var; }";
CurrentBrowser.Window.InsertScriptBlock(_blockScript, "_testBlockScript");
string a_result = __doMozJSPostback("AScriptToRun", new string[] { "This is the result." }, CurrentBrowser.Document);
MessageBox.Show(a_result);
It's also possible to execute an arbitrary inline script targeting any MozWebDocument while also being able to return a string value.
MessageBox.Show(MozJScript.Execute("function inline_script(){ return 'arbitrary value';} " +
"__doMozJSPostback('__inline_script', inline_script());", "__inline_script", CurrentBrowser.Document));
Did you happen to read through my Javascript XPCom component tutorial? You know, the one where I showed you how to create a component that can take a full page screen shot of the MozNET component. Ya, that one. Well...
You no longer need it. At least not that specific component. Yup. It's built right in now. MozWebView now contains a DrawToBitmap method, that takes a full page screen shot and returns it as a System.Drawing.Image instance.
I've even overloaded the method so it can return a thumbnail at your specified size. This is all done in code now, too. No XPCom component is needed to take screen shots!
First up to bat is the ability to pass Objects from your injected scripts back to the C#/VB.NET caller - inline. Objects are passed around as an nsIVariant instances but, they can be converted to an easier to use managed class,
MozVariant, which makes it easier to handle. When you begin using this feature (beginning with the R19 release) it would be a good idea to learn how to use the raw XulRunner interfaces provided by MozNET, specifically nsIVariant. In most cases, using the interfaces
is MUCH faster than thier wrapped counter parts. You did know that MozNET publicly exposes 99.998% of the interfaces it wraps, right? I suggest you read up on the nsIVariant interface because if you want to use
this newest scripting feature, you'll need to know how to get your values from the return. If your script returns a single object you will get an array with a single nsISupports instance, back. If your script returns an array of objects you will
get an array of nsIVariant instances back. You'll have to do the conversion from nsIVariant to your desired (and supported) object type, as required by your needs. If you want to return a single string back
it needs to be wrapped in an array and cast to a string as in the example below.
Very Basic Example: (preliminary code, subject to changes and/or revisions)
string script = "var obj1 = document.createElement('a'); obj1.setAttribute('href','http://se7en-soft.com/'); obj1.innerHTML = 'Take Me To Se7en Soft Software';";
script += " var obj2 = document.createElement('a'); obj2.setAttribute('href','http://google.com'); obj2.innerHTML = 'I seek the Oracle.';" +
"__doMozJSPostback(new Array(obj1, obj2, 'My Super-Duper Javascript Test String Value!', 42));";
//Note the '__doMozJSPostback' method. This is an intrinsic Javascript method which is required to return objects from injected scripts.
//At the time of this writing, the intrinsic __doMozJSPostback method will only work with inline script injection as shown in this example.
//To use this feature you must also register the new 'MozXPT.xpt' file with your XulRunner runtime.
//This new xpt file will replace the current 'MozNet.xpt' that is required to use the 'window.external' feature.
object[] obj = (object[])MozScriptManager.CreateJScript("MyScript", script, CurrentBrowser.Document).Execute2();
if (obj != null && obj.Length == 4)
{
CurrentBrowser.Document.Body.AppendChild(CurrentBrowser.Document.CreateElement("br"));
MozVariant variant = new MozVariant(obj[0]);
MozAnchorElement m_anchor = MozDomElement.Create(variant).AsAnchorElement();
if (m_anchor != null)
CurrentBrowser.Document.Body.AppendChild(m_anchor);
CurrentBrowser.Document.Body.AppendChild(CurrentBrowser.Document.CreateElement("br"));
variant = new MozVariant(obj[1]);
m_anchor = MozDomElement.Create(variant).AsAnchorElement();
if (m_anchor != null)
CurrentBrowser.Document.Body.AppendChild(m_anchor);
string test_value = (new MozVariant(obj[2])).AsString;
int number = (new MozVariant(obj[3])).AsInt32;
MessageBox.Show(test_value + "\r\nThe answer to everything is " + number.ToString());
}
I'm working to extend this new scripting enhancement to allow for returning a value back to the calling javascript, inline with the incoming value, via an optional callback parameter passed to the MozJScript.Execute2() method.
This is more or less intended for the 'seasoned' users but, not so difficult to use that you'll be wandering in the dark for days, in MozJScript-woods. I'm still ironing out the details but, I do have a working implementation.
Below is a quick example, almost identical to the example above, of the current method of returning objects to the calling Javascript..
string script = "var obj1 = document.createElement('a'); obj1.setAttribute('href','http://se7en-soft.com/'); obj1.innerHTML = 'Take Me To Se7en Soft Software';";
script += " var obj2 = document.createElement('a'); obj2.setAttribute('href','http://google.com'); obj2.innerHTML = 'I seek the Oracle.';" +
"var obj3 = __doMozJSPostback(new Array(obj, obj2, 'This is my cool javascript string!', GetAnswerToEverything(10, 32))); document.body.appendChild(obj3);";
//Note the '__doMozJSPostback' method. This is an intrinsic Javascript method which is required to return objects from injected scripts.
//Also note that my current testing of this code is being done in the MozNET example project, in the 'RunJSEventTest' method to be specific.
//This is why the script is able to use the predefined 'GetAnswerToEverything' function that is injected from the 'RunJSEventTest' method.
//At the time of this writing, the intrinsic __doMozJSPostback method will only work with inline script injection as shown in this example.
//To use this feature you must also register the new 'MozXPT.xpt' file with your XulRunner runtime.
//This new xpt file will replace the current 'MozNet.xpt' that is required to use the 'window.external' feature.
MozJScript jscript = MozScriptManager.CreateJScript("MyScript", script, CurrentBrowser.Document);
object[] obj = (object[])jscript.Execute2(//using an inline, lamda, handler here
(a, b) => {
//if you need access to the data that is being returned by the outer script (the MozJSCript you called Execute2() on) you can get it from b.Data
MozInputElement ipt = MozInputElement.Create(CurrentBrowser.Document);
ipt.Type = "button";
ipt.Value = "Poke Me!";
ipt.SetAttribute("onclick", "alert('I was created using managed code!');");
b.Result = ipt.DomObject; //must return the native element - not the wrapper object
}
);
if (obj != null && obj.Length == 4)
{
CurrentBrowser.Document.Body.AppendChild(CurrentBrowser.Document.CreateElement("br"));
MozVariant variant = new MozVariant(obj[0]);
MozAnchorElement m_anchor = MozDomElement.Create(variant).AsAnchorElement();
if (m_anchor != null)
CurrentBrowser.Document.Body.AppendChild(m_anchor);
CurrentBrowser.Document.Body.AppendChild(CurrentBrowser.Document.CreateElement("br"));
variant = new MozVariant(obj[1]);
m_anchor = MozDomElement.Create(variant).AsAnchorElement();
if (m_anchor != null)
CurrentBrowser.Document.Body.AppendChild(m_anchor);
string test_value = (new MozVariant(obj[2])).AsString;
int number = (new MozVariant(obj[3])).AsInt32;
MessageBox.Show(test_value + "\r\nThe answer to everything is " + number.ToString());
}
MozImageUtils has had a new static method added to fetch images via absolute Url. The method does not rely on any .net framework classes such as WebClient or WebRequest. XulRunner does all the work. It will not
block the MozWebView control so you can fetch an image and still use the browser while waiting for the method to return. The method, FetchImage does exactly that; grabs an image from the internet via the specified Url.
The method is also overloaded so it will accept, in addition to the image url, a width and height value to scale the image to.
The R19.1 build is an interim build to provide fixes for several reported and non-reported issues.
This release addresses the issue with printing and only being able to print once - the component will now print pages until you run out of paper, ink or patience; whichever you run out of first, if you want. Also fixed up is the MozDomElement.SetStyle method.
Newly added is MozDomElement.GetStyleSelectorValue(string _selector). This method lets you grab the value of a particular bit of an inline style applied to an element. For example, calling the method and passing "color" the method would return either
the inline applied color, eg:#FFFFFF or rgb(0,0,0), etc., or it may return null if the particular selector wasn't found in the inline style or if there simply isn't an inline style applied. Another newly added method is MozDomElement.HasAttribute(string attribute_name).
This method allows you to pass in the name of an attribute that you'd like to know exists or not and the method will return a simple true/false value. Passing a null value will result in an ArgumentNullException being thrown.
For those of you that need or want to enumerate the attributes of a MozDomElement and don't want to mess with the nsIDOMNamedNodeMap interface, I've got good news for you! MozDomElement now contains a simple, read-only, Dictionary that
contains all of the elements attributes and their values. The dictionary is exposed as a property, aptly named Attributes. Keep in mind that MozDomNode also contains an Attributes property but, you have to use the interface on it.
I'll added a few new properties to MozDomElement to make working with some of the basic things a bit easier and more HTML5 friendly. So far, I've added a new property, aptly named, BorderRadius.
This new property has both a getter and a setter and operates on the -moz-border-radius style selector. This is just one of the new properties that the class has received.
A couple more property additions to MozDomElement.. First up, Color. I've added a new, nullable, property named Color to the MozDomElement class. This property has both a getter and a setter
allowing you to both set and retrieve the inline color of an elements style. This property works with the System.Drawing.Color class so you don't have to mess around with strings or hex or anything like that.
Also new on the property additions list is FontSize. This property has a getter and a setter and is nullable, as well. I've added a custom struct to MozInterfaces named CSSFontSize.
The struct consists of a simple double field and a field named FontSizeType which accepts a member of the new enum named CSSSizeType. The enum allows you to specify what type of sizing to use when
setting the size and tells you what sizing was used when the size was set. Choices in the enum are: Point, Pixel, EMs & Percent.
Since both of the new properties are nullable, setting the value of them to null will remove the respective selector from the inline style, if found.
Several more properties have been added to the MozDomElement class. I've just completed the addition of Background and Border CSS properties. Both properties are get/set and they both use a custom class to define their
data. Background works off of the new CSSBackgroundStyle class, which simply encapsulates values. This property allows you to set/get the following values of the inline Background style selector: url, repeat, position, attachment and background color.
At this time I consider the property to be a work in progress but, it does work - it's just not *complete*. The new Border property is similar to the Background property. It uses the new CSSBorderStyle class to encapsulate its data.
The property allows you to both get/set and works with the following values of the border CSS selector: width (as a double value), border style (enum - dotted, dashed, double, groove, inset, outset, ridge, solid or none) and color (system.drawing.color).
I've just added yet another CSS property to MozDomElement, Opacity. Now you can get/set the inline style value for an element's opacity. This is just one of several new properties added and there are more to come!
Fresh off the press is the ability to get and set transforms. I've just completed a new MozDomElement property, aptly named Transform. This new property operates on the -moz-transform style selector allowing you to both get and set
transforms on elements. Available transforms are: Matrix, Rotate, Scale, ScaleX, ScaleY, Skew, SkewX, SkewY, Translate, TranslateX and TranslateY. That's the full gamut, there! The example project will be updated to contain a bit of code showing you how to use this new property.
Just now, I've finished up adding preliminary support for -moz-transform-origin. This has been added into the Transform property for simplicity. Also, as of the time of this writing, it only supports numeric positioning values and not the generic strings (eg. 'left' or 'top').
MozRadialGradient mrg = new MozRadialGradient();
mrg.RadialType = MozRadialGradient.RadialTypes.Ellipse;
mrg.Angle = new CSSAngle(42, CSSSizeTypes.Degrees);
mrg.IsRepeatingGradient = true;
mrg.Origin = new CSSTransformOrigin(10, CSSSizeTypes.Percent, 200, CSSSizeTypes.Pixels);
CSSGradientStop gs = new CSSGradientStop();
gs.Color = System.Drawing.Color.Blue;
gs.Position = 10;
gs.StopType = CSSSizeTypes.Percent;
mrg.AddGradientStop(gs);
gs = new CSSGradientStop();
gs.Color = System.Drawing.Color.Orange;
gs.Position = 100;
gs.StopType = CSSSizeTypes.Percent;
gs.Name = "gsOrange"; //supports named stops
mrg.AddGradientStop(gs);
gs = new CSSGradientStop();
gs.Color = System.Drawing.Color.Red;
gs.Position = 15;
gs.StopType = CSSSizeTypes.Percent;
mrg.AddGradientStop(gs);
gs = new CSSGradientStop();
gs.Color = System.Drawing.Color.Green;
gs.Position = 35;
gs.StopType = CSSSizeTypes.Percent;
mrg.AddGradientStop(gs);
CurrentBrowser.Document.GetElementsByTagName("body")[0].ApplyGradientBackground(mrg);
I've just added something that I'm sure a lot of you have been waiting a long time for... The ability to easily create linear gradients! Still in the preliminary coding phase, I've already gotten a working class around
-moz-linear-gradient which builds up the gradient in a similar fashion to
creating one in Windows Forms (you know, that old GDI+ shit). I'm going to add support for radial gradients as well. - Done. There is also support for radial gradients!
Fast forward 1/2 an hour and I've added support for both repeating linear gradients as well as repeating radial gradients.
I thought you might like a quick glimpse of the gradients in action so, here they are!
I've even taken a few minutes to write a couple of simple conversion methods to go from either a LinearGradientBrush to a MozLinearGradient or from a RadialGradientBrush to a MozRadialGradient - both WPF - in the example project. While they
don't provide a *complete* conversion from one to the other, due to constraints between WPF properties and CSS, they do provide very nice, basic, starting points for further processing or just using as-is. As a further bonus, I've overridden the ToString() methods in the MozCSSGradient classes so that it returns the '-moz' prefixed style selector,
e.g. -moz-linear-gradient(25% 25% -45deg, rgba(255,0,0,1) 0%, rgba(0,255,0,1) 50%, rgba(0,0,255,1) 100%).
The image of the radial gradient shown above is an example of a WPF
RadialGradientBrush converted to a MozRadialGradient, using one of the conversion methods, and then applied to the document body background.
In keeping up with making some CSS properties more natural to use from managed code I've wrapped up the following properties: Padding, Margin, Font-Size and Font-Family. The managed properties use their own data formats
to make specifying all parts of each property easier. Eg. the new CSSPadding and CSSMargin properties use the new MozThickness structures so that not only can the (up to) four numeric values be applied but also the type of sizing such as
one of these: Centimeters, EMS, Inches, Millimeters, Picas, Pixels, Points, Percent, Degrees, Gradians, Radians.
The newest kids on the MozDomElement block are the methods ApplyGradientBackground(MozCSSGradient) and RemoveGradientBackground() and the property HasInlineGradientBackground. I think the names of the methods and property pretty much
speak for themselves but, I'll throw you a quick explaination anyway. ApplyGradientBackground(MozCSSGradient) takes a param value of type MozCSSGradient, which is new for R19.2, and applies it to the inline style of the element - providing that the element supports the 'Background' css
style property. MozCSSGradient is an abstract class of which both MozLinearGradient and MozRadialGradient classes derive from.
RemoveGradientBackground() does exactly the opposite and removes an inline gradient if it exists. And finally, HasInlineGradientBackground.
This one is so simple I don't think I'll even bother with it - self explainatory.
I've just added a new feature to the MozNET example project. Hosted on the web site, and accessible only to the MozNET example project browser, is a simple CSS playground page. When accessed within the project browser it allows you to modify several of the new properties, on a handful of elements on the page, in real-time with WPF based controls.
This is to help you learn how to use the properties in your own applications. You can tear apart the custom controls I created for this to help you with your own projects.
The R19.2 build scores higher, on the Acid 3 test, than any previous build before it! Just have a look for yourself..