/* Returns the newly built instance of CRCascade or NULL if an error arose during constrution.  */
CRCascade* cr_cascade_new(CRStyleSheet *a_author_sheet, CRStyleSheet *a_user_sheet, CRStyleSheet *a_ua_sheet)
/* Returns the newly built instance of CRCascade or NULL if an error arose during constrution.  */
CRCascade* cr_cascade_new(CRStyleSheet *a_author_sheet, CRStyleSheet *a_user_sheet, CRStyleSheet *a_ua_sheet)
{
        CRCascade *result = NULL;
        result = g_try_malloc (sizeof (CRCascade));
        if (!result) {
                cr_utils_trace_info ("Out of memory");
                return NULL;
        }
        memset (result, 0, sizeof (CRCascade));
        PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv));
        if (!PRIVATE (result)) {
                cr_utils_trace_info ("Out of memory");
                return NULL;
        }
        memset (PRIVATE (result), 0, sizeof (CRCascadePriv));
        if (a_author_sheet) {
                cr_cascade_set_sheet (result, a_author_sheet, ORIGIN_AUTHOR);
        }
        if (a_user_sheet) {
                cr_cascade_set_sheet (result, a_user_sheet, ORIGIN_USER);
        }
        if (a_ua_sheet) {
                cr_cascade_set_sheet (result, a_ua_sheet, ORIGIN_UA);
        }
        return result;
}