예제 #1
0
/**
 * Convert a range to a node
 * @param d the dom we are associated with
 * @param r the range to convert
 * @return the finished node
 */
static node *dom_range_to_node( dom *d, range *r )
{
    char *html_name = range_html_name(r);
    node *n = node_create( range_name(r),range_html_name(r),range_start(r),
        range_len(r), (html_name==NULL)?0:html_is_empty(html_name), 
        range_get_rightmost(r) );
    if ( n != NULL )
    {
        annotation *ann = range_get_annotations( r );
        while ( ann != NULL )
        {
            attribute *attr = annotation_to_attribute( ann, range_name(r), 
                d->css_rules );
            if ( attr != NULL )
                node_add_attribute( n, attr );
            ann = annotation_get_next( ann );
        }
    }
    return n;
}
예제 #2
0
파일: range.c 프로젝트: Ecdosis/calliope
/**
 * Is a range inside another. Inside can be equal
 * @param r1 the first range (is it inside r2?)
 * @param r2 the second range being the outside one
 * @return 1 if r1 is inside r2, else 0
 */
int range_inside( range *r1, range *r2 )
{
    return range_start(r1)>=range_start(r2)&&range_end(r1)<=range_end(r2);
}