public Selector(StyleSheet sheet,string selectorText,string modifier){ SelectorText=selectorText; Modifier=modifier; // Start it off immediately: Style=sheet.StartSelector(selectorText,modifier); }
/// <summary>Loads external CSS if a href is available and it's known to be css.</summary> public void LoadContent() { if (!IsCSS || string.IsNullOrEmpty(Href) || styleSheet != null) { return; } // Let's go get it! styleSheet = htmlDocument.AddStyle(this, null); DataPackage package = new DataPackage(Href, document.basepath); styleSheet.Location = package.location; package.onload = delegate(UIEvent e){ if (document == null || styleSheet == null) { return; } // The element is still somewhere on the UI. // Load it now: styleSheet.ParseCss(package.responseText); // Redraw: htmlDocument.RequestLayout(); }; package.send(); }
/// <summary>Creates a new document which will be rendered with the given renderer.</summary> /// <param name="renderer">The renderer to use when rendering this document.</param> /// <param name="parentWindow">The window that will become the parent window. Used in e.g. iframes.</param> /// <param name="aot">True if this is a Nitro AOT document (used in the Editor only).</param> public Document(Renderman renderer, Window parentWindow, bool aot) : base() { AotDocument = aot; if (!aot && DefaultStyleSheet == null) { // No default styles loaded yet. Load them now. string styleText = ((TextAsset)Resources.Load("style")).text; // Have they applied any overrides? TextAsset extraStyle = Resources.Load("customStyle") as TextAsset; if (extraStyle != null && extraStyle.text != null) { styleText += "\n\n" + extraStyle.text; } DefaultStyleSheet = new Css.StyleSheet(this); DefaultStyleSheet.ParseCss(styleText); } #if !NoNitroRuntime // Get the default security domain: SecurityDomain = UI.DefaultSecurityDomain; #endif Renderer = renderer; window = new Window(); window.document = this; window.parent = parentWindow; if (parentWindow != null) { window.top = parentWindow.top; } else { window.top = window; } ActiveFonts = new Dictionary <string, DynamicFont>(); Style = new Css.StyleSheet(this); html = new Element(this, null); html.SetTag("html"); string ddbox = ""; if (parentWindow == null) { // Dropdown box belongs to the top window only: ddbox = "<ddbox></ddbox>"; } html.innerHTML = "<body></body>" + ddbox; }
/// <summary>Clears all css style definitions from this document.</summary> public void ClearStyle() { Style = new Css.StyleSheet(this); StyleBuffer = null; }
//--------------------------------------