/// <summary>Runs a mouseover which may bubble all the way to the root from the given element.</summary> /// <param name="element">The element to run a mouseover on.</param> /// <param name="uiEvent">The event that represents the click.</param> public static void MouseOn(Element element, UIEvent uiEvent) { if (uiEvent.cancelBubble || element == null || element.Handler.IgnoreSelfClick) { return; } if (element.GetType() != typeof(TextElement)) { element.MouseOver(uiEvent); } MouseOn(element.ParentNode, uiEvent); }
internal void Lettering(List <Element> into, Element parent) { if (ChildNodes == null) { return; } int count = ChildNodes.Count; for (int i = 0; i < count; i++) { // Grab the child node: Element child = ChildNodes[i]; // Get the element type: Type type = child.GetType(); if (type == typeof(TextElement)) { // Apply to each word: child.Lettering(into, parent); } else if (type == typeof(WordElement)) { // Split the word into its chars: WordElement word = (WordElement)child; // Grab the text object: TextRenderingProperty textProperty = word.Style.Computed.Text; if (textProperty == null || textProperty.Text == null) { continue; } // Get the characters: char[] characters = textProperty.Text.ToCharArray(); // How many chars? int characterCount = characters.Length; // Add each letter as a new element: for (int c = 0; c < characterCount; c++) { // The character(s) as a string: string charString; // Grab the character: char character = characters[c]; // Surrogate pair? if (char.IsHighSurrogate(character) && c != characters.Length - 1) { // Low surrogate follows: char lowChar = characters[c + 1]; c++; // Get the charcode: int code = char.ConvertToUtf32(character, lowChar); // Turn it back into a string: charString = char.ConvertFromUtf32(code); } else { charString = "" + character; } // Create a word ele: WordElement result = new WordElement(Document, parent, charString); // Add it: into.Add(result); } } else { // Direct add: into.Add(child); } } }
/// <summary>Runs a mouseover which may bubble all the way to the root from the given element.</summary> /// <param name="element">The element to run a mouseover on.</param> /// <param name="uiEvent">The event that represents the click.</param> public static void MouseOn(Element element,UIEvent uiEvent){ if(uiEvent.cancelBubble || element==null || element.Handler.IgnoreSelfClick){ return; } if(element.GetType()!=typeof(TextElement)){ element.MouseOver(uiEvent); } MouseOn(element.ParentNode,uiEvent); }