MCPcopy Create free account
hub / github.com/buggins/coolreader / initNodeRendMethod

Method initNodeRendMethod

crengine/src/lvtinydom.cpp:3837–3954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3835}
3836
3837void ldomNode::initNodeRendMethod()
3838{
3839 if ( !isElement() )
3840 return;
3841 if ( isRoot() ) {
3842 setRendMethod(erm_block);
3843 return;
3844 }
3845
3846 // DEBUG TEST
3847// if ( getParentNode()->getChildIndex( getDataIndex() )<0 ) {
3848// CRLog::error("Invalid parent->child relation for nodes %d->%d", getParentNode()->getDataIndex(), getDataIndex() );
3849// }
3850// if ( getNodeName()==L"image" ) {
3851// CRLog::trace("Init log for image");
3852// }
3853
3854 int d = getStyle()->display;
3855
3856 if ( hasInvisibleParent(this) ) {
3857 // invisible
3858 //recurseElements( resetRendMethodToInvisible );
3859 setRendMethod(erm_invisible);
3860 } else if ( d==css_d_inline ) {
3861 // inline
3862 //CRLog::trace("switch all children elements of <%s> to inline", LCSTR(getNodeName()));
3863 recurseElements( resetRendMethodToInline );
3864 } else if ( d==css_d_run_in ) {
3865 // runin
3866 //CRLog::trace("switch all children elements of <%s> to inline", LCSTR(getNodeName()));
3867 recurseElements( resetRendMethodToInline );
3868 setRendMethod(erm_runin);
3869 } else if ( d==css_d_list_item ) {
3870 // list item
3871 setRendMethod(erm_list_item);
3872 } else if (d == css_d_table) {
3873 // table
3874 initTableRendMethods( this, 0 );
3875 } else {
3876 // block or final
3877 // remove last empty space text nodes
3878 bool hasBlockItems = false;
3879 bool hasInline = false;
3880 detectChildTypes( this, hasBlockItems, hasInline );
3881 const css_elem_def_props_t * ntype = getElementTypePtr();
3882 if (ntype && ntype->is_object) {
3883 switch ( d )
3884 {
3885 case css_d_block:
3886 case css_d_inline:
3887 case css_d_run_in:
3888 setRendMethod( erm_final );
3889 break;
3890 default:
3891 //setRendMethod( erm_invisible );
3892 recurseElements( resetRendMethodToInvisible );
3893 break;
3894 }

Callers 2

onBodyExitMethod · 0.80
updateRendMethodFunction · 0.80

Calls 7

hasInvisibleParentFunction · 0.85
initTableRendMethodsFunction · 0.85
detectChildTypesFunction · 0.85
isInlineNodeFunction · 0.85
getNodeIdMethod · 0.80
getRendMethodMethod · 0.80
isElementMethod · 0.45

Tested by

no test coverage detected