| 10020 | } |
| 10021 | |
| 10022 | bool ldomNode::initNodeFont() |
| 10023 | { |
| 10024 | if ( !isElement() ) |
| 10025 | return false; |
| 10026 | lUInt16 style = getDocument()->getNodeStyleIndex( _handle._dataIndex ); |
| 10027 | lUInt16 font = getDocument()->getNodeFontIndex( _handle._dataIndex ); |
| 10028 | lUInt16 fntIndex = getDocument()->_fontMap.get( style ); |
| 10029 | if ( fntIndex==0 ) { |
| 10030 | css_style_ref_t s = getDocument()->_styles.get( style ); |
| 10031 | if ( s.isNull() ) { |
| 10032 | CRLog::error("style not found for index %d", style); |
| 10033 | s = getDocument()->_styles.get( style ); |
| 10034 | } |
| 10035 | LVFontRef fnt = ::getFont( s.get() ); |
| 10036 | fntIndex = getDocument()->_fonts.cache( fnt ); |
| 10037 | if ( fnt.isNull() ) { |
| 10038 | CRLog::error("font not found for style!"); |
| 10039 | return false; |
| 10040 | } else { |
| 10041 | getDocument()->_fontMap.set(style, fntIndex); |
| 10042 | } |
| 10043 | if ( font != 0 ) { |
| 10044 | if ( font!=fntIndex ) // ??? |
| 10045 | getDocument()->_fonts.release(font); |
| 10046 | } |
| 10047 | getDocument()->setNodeFontIndex( _handle._dataIndex, fntIndex); |
| 10048 | return true; |
| 10049 | } else { |
| 10050 | if ( font!=fntIndex ) |
| 10051 | getDocument()->_fonts.addIndexRef( fntIndex ); |
| 10052 | } |
| 10053 | if ( fntIndex<=0 ) { |
| 10054 | CRLog::error("font caching failed for style!"); |
| 10055 | return false;; |
| 10056 | } else { |
| 10057 | getDocument()->setNodeFontIndex( _handle._dataIndex, fntIndex); |
| 10058 | } |
| 10059 | return true; |
| 10060 | } |
| 10061 | |
| 10062 | void ldomNode::initNodeStyle() |
| 10063 | { |
no test coverage detected