static void import_style (CRDocHandler * a_this, GList * a_media_list, CRString * a_uri, CRString * a_uri_default_ns, CRParsingLocation *a_location) { enum CRStatus status = CR_OK; CRString *uri = NULL; CRStatement *stmt = NULL, *stmt2 = NULL; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; GList *media_list = NULL ; g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->stylesheet); uri = cr_string_dup (a_uri) ; if (a_media_list) media_list = cr_utils_dup_glist_of_cr_string (a_media_list) ; stmt = cr_statement_new_at_import_rule (ctxt->stylesheet, uri, media_list, NULL); if (!stmt) goto error; if (ctxt->cur_stmt) { stmt2 = cr_statement_append (ctxt->cur_stmt, stmt); if (!stmt2) goto error; ctxt->cur_stmt = stmt2; stmt2 = NULL; stmt = NULL; } else { stmt2 = cr_statement_append (ctxt->stylesheet->statements, stmt); if (!stmt2) goto error; ctxt->stylesheet->statements = stmt2; stmt2 = NULL; stmt = NULL; } return; error: if (uri) { cr_string_destroy (uri); } if (stmt) { cr_statement_destroy (stmt); stmt = NULL; } a_uri_default_ns = NULL; /*keep compiler happy */ }
static void end_selector (CRDocHandler * a_this, CRSelector * a_selector_list) { enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; (void) a_selector_list; g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet); if (ctxt->cur_stmt) { CRStatement *stmts = NULL; if (ctxt->cur_media_stmt) { CRAtMediaRule *media_rule = NULL; media_rule = ctxt->cur_media_stmt->kind.media_rule; stmts = cr_statement_append (media_rule->rulesets, ctxt->cur_stmt); if (!stmts) { cr_utils_trace_info ("Could not append a new statement"); cr_statement_destroy (media_rule->rulesets); ctxt->cur_media_stmt-> kind.media_rule->rulesets = NULL; return; } media_rule->rulesets = stmts; ctxt->cur_stmt = NULL; } else { stmts = cr_statement_append (ctxt->stylesheet->statements, ctxt->cur_stmt); if (!stmts) { cr_utils_trace_info ("Could not append a new statement"); cr_statement_destroy (ctxt->cur_stmt); ctxt->cur_stmt = NULL; return; } ctxt->stylesheet->statements = stmts; ctxt->cur_stmt = NULL; } } a_selector_list = NULL; /*keep compiler happy */ }
static void end_media (CRDocHandler * a_this, GList * a_media_list) { enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; CRStatement *stmts = NULL; g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt && ctxt->cur_media_stmt && ctxt->cur_media_stmt->type == AT_MEDIA_RULE_STMT && ctxt->stylesheet); stmts = cr_statement_append (ctxt->stylesheet->statements, ctxt->cur_media_stmt); if (!stmts) { cr_statement_destroy (ctxt->cur_media_stmt); ctxt->cur_media_stmt = NULL; } ctxt->stylesheet->statements = stmts; stmts = NULL; ctxt->cur_stmt = NULL ; ctxt->cur_media_stmt = NULL ; a_media_list = NULL; }
static void end_page (CRDocHandler * a_this, CRString * a_page, CRString * a_pseudo_page) { enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; CRStatement *stmt = NULL; g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt && ctxt->cur_stmt->type == AT_PAGE_RULE_STMT && ctxt->stylesheet); stmt = cr_statement_append (ctxt->stylesheet->statements, ctxt->cur_stmt); if (stmt) { ctxt->stylesheet->statements = stmt; stmt = NULL; ctxt->cur_stmt = NULL; } if (ctxt->cur_stmt) { cr_statement_destroy (ctxt->cur_stmt); ctxt->cur_stmt = NULL; } a_page = NULL; /*keep compiler happy */ a_pseudo_page = NULL; /*keep compiler happy */ }
static void charset (CRDocHandler * a_this, CRString * a_charset, CRParsingLocation *a_location) { enum CRStatus status = CR_OK; CRStatement *stmt = NULL, *stmt2 = NULL; CRString *charset = NULL; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->stylesheet); charset = cr_string_dup (a_charset) ; stmt = cr_statement_new_at_charset_rule (ctxt->stylesheet, charset); g_return_if_fail (stmt); stmt2 = cr_statement_append (ctxt->stylesheet->statements, stmt); if (!stmt2) { if (stmt) { cr_statement_destroy (stmt); stmt = NULL; } if (charset) { cr_string_destroy (charset); } return; } ctxt->stylesheet->statements = stmt2; stmt2 = NULL; }
static void end_font_face (CRDocHandler * a_this) { enum CRStatus status = CR_OK; ParsingContext *ctxt = NULL; ParsingContext **ctxtptr = NULL; CRStatement *stmts = NULL; g_return_if_fail (a_this); g_return_if_fail (a_this); ctxtptr = &ctxt; status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr); g_return_if_fail (status == CR_OK && ctxt); g_return_if_fail (ctxt->cur_stmt && ctxt->cur_stmt->type == AT_FONT_FACE_RULE_STMT && ctxt->stylesheet); stmts = cr_statement_append (ctxt->stylesheet->statements, ctxt->cur_stmt); if (!stmts) goto error; ctxt->stylesheet->statements = stmts; stmts = NULL; ctxt->cur_stmt = NULL; return; error: if (ctxt->cur_stmt) { cr_statement_destroy (ctxt->cur_stmt); ctxt->cur_stmt = NULL; } if (!stmts) { cr_statement_destroy (stmts); stmts = NULL; } }