| 1 21 package org.lobobrowser.html.renderer; 22 23 import org.lobobrowser.html.HtmlRendererContext; 24 import org.lobobrowser.html.UserAgentContext; 25 import org.lobobrowser.html.domimpl.HTMLElementImpl; 26 import org.lobobrowser.html.domimpl.NodeImpl; 27 import org.lobobrowser.html.style.CSS2PropertiesImpl; 28 import org.lobobrowser.html.style.HtmlValues; 29 import org.lobobrowser.html.style.ListStyle; 30 31 class BaseRListElement extends RBlock { 32 protected static final String DEFAULT_COUNTER_NAME = "$cobra.counter"; 33 protected ListStyle listStyle = null; 34 35 public BaseRListElement(NodeImpl modelNode, int listNesting, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext, RenderableContainer parentContainer) { 36 super(modelNode, listNesting, pcontext, rcontext, frameContext, parentContainer); 37 } 38 39 protected void applyStyle() { 40 this.listStyle = null; 41 super.applyStyle(); 42 Object rootNode = this.modelNode; 43 if(!(rootNode instanceof HTMLElementImpl)) { 44 return; 45 } 46 HTMLElementImpl rootElement = (HTMLElementImpl) rootNode; 47 CSS2PropertiesImpl props = rootElement.getCurrentStyle(); 48 if(props == null) { 49 return; 50 } 51 ListStyle listStyle = null; 52 String listStyleText = props.getListStyle(); 53 if(listStyleText != null) { 54 listStyle = HtmlValues.getListStyle(listStyleText); 55 } 56 String listStyleTypeText = props.getListStyleType(); 57 if(listStyleTypeText != null) { 58 int listType = HtmlValues.getListStyleType(listStyleTypeText); 59 if(listType != ListStyle.TYPE_UNSET) { 60 if(listStyle == null) { 61 listStyle = new ListStyle(); 62 } 63 listStyle.type = listType; 64 } 65 } 66 if(listStyle == null || listStyle.type == ListStyle.TYPE_UNSET) 67 { 68 String typeAttributeText = rootElement.getAttribute("type"); 69 if(typeAttributeText != null) { 70 int newStyleType = HtmlValues.getListStyleTypeDeprecated(typeAttributeText); 71 if(newStyleType != ListStyle.TYPE_UNSET) { 72 if(listStyle == null) { 73 listStyle = new ListStyle(); 74 this.listStyle = listStyle; 75 } 76 listStyle.type = newStyleType; 77 } 78 } 79 } 80 this.listStyle = listStyle; 81 } 82 } 83 | Popular Tags |