@@ -555,6 +555,62 @@ int lh_font_description_decoration_line(const lh_font_description_t* fd)
555555 return d->decoration_line ;
556556}
557557
558+ int lh_font_description_decoration_thickness_is_predefined (const lh_font_description_t * fd)
559+ {
560+ if (!fd) return 1 ;
561+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
562+ return d->decoration_thickness .is_predefined () ? 1 : 0 ;
563+ }
564+
565+ int lh_font_description_decoration_thickness_predef (const lh_font_description_t * fd)
566+ {
567+ if (!fd) return 0 ;
568+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
569+ return d->decoration_thickness .is_predefined () ? d->decoration_thickness .predef () : 0 ;
570+ }
571+
572+ float lh_font_description_decoration_thickness_value (const lh_font_description_t * fd)
573+ {
574+ if (!fd) return 0 .0f ;
575+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
576+ return d->decoration_thickness .is_predefined () ? 0 .0f : d->decoration_thickness .val ();
577+ }
578+
579+ int lh_font_description_decoration_style (const lh_font_description_t * fd)
580+ {
581+ if (!fd) return 0 ;
582+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
583+ return static_cast <int >(d->decoration_style );
584+ }
585+
586+ lh_web_color_t lh_font_description_decoration_color (const lh_font_description_t * fd)
587+ {
588+ if (!fd) return {};
589+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
590+ return to_c (d->decoration_color );
591+ }
592+
593+ const char * lh_font_description_emphasis_style (const lh_font_description_t * fd)
594+ {
595+ if (!fd) return " " ;
596+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
597+ return d->emphasis_style .c_str ();
598+ }
599+
600+ lh_web_color_t lh_font_description_emphasis_color (const lh_font_description_t * fd)
601+ {
602+ if (!fd) return {};
603+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
604+ return to_c (d->emphasis_color );
605+ }
606+
607+ int lh_font_description_emphasis_position (const lh_font_description_t * fd)
608+ {
609+ if (!fd) return 0 ;
610+ const auto * d = reinterpret_cast <const litehtml::font_description*>(fd);
611+ return d->emphasis_position ;
612+ }
613+
558614/* --------------------------------------------------------------------------
559615 * Accessor functions -- list_marker
560616 * -------------------------------------------------------------------------- */
@@ -714,6 +770,22 @@ lh_web_color_t lh_linear_gradient_color_point_color(
714770 return to_c (lg->color_points [idx].color );
715771}
716772
773+ int lh_linear_gradient_color_space (const lh_linear_gradient_t * g)
774+ {
775+ if (!g) return 0 ;
776+ const auto * lg = reinterpret_cast <
777+ const litehtml::background_layer::linear_gradient*>(g);
778+ return static_cast <int >(lg->color_space );
779+ }
780+
781+ int lh_linear_gradient_hue_interpolation (const lh_linear_gradient_t * g)
782+ {
783+ if (!g) return 0 ;
784+ const auto * lg = reinterpret_cast <
785+ const litehtml::background_layer::linear_gradient*>(g);
786+ return static_cast <int >(lg->hue_interpolation );
787+ }
788+
717789/* --------------------------------------------------------------------------
718790 * Accessor functions -- radial_gradient
719791 * -------------------------------------------------------------------------- */
@@ -767,6 +839,22 @@ lh_web_color_t lh_radial_gradient_color_point_color(
767839 return to_c (rg->color_points [idx].color );
768840}
769841
842+ int lh_radial_gradient_color_space (const lh_radial_gradient_t * g)
843+ {
844+ if (!g) return 0 ;
845+ const auto * rg = reinterpret_cast <
846+ const litehtml::background_layer::radial_gradient*>(g);
847+ return static_cast <int >(rg->color_space );
848+ }
849+
850+ int lh_radial_gradient_hue_interpolation (const lh_radial_gradient_t * g)
851+ {
852+ if (!g) return 0 ;
853+ const auto * rg = reinterpret_cast <
854+ const litehtml::background_layer::radial_gradient*>(g);
855+ return static_cast <int >(rg->hue_interpolation );
856+ }
857+
770858/* --------------------------------------------------------------------------
771859 * Accessor functions -- conic_gradient
772860 * -------------------------------------------------------------------------- */
@@ -787,6 +875,14 @@ float lh_conic_gradient_angle(const lh_conic_gradient_t* g)
787875 return cg->angle ;
788876}
789877
878+ float lh_conic_gradient_radius (const lh_conic_gradient_t * g)
879+ {
880+ if (!g) return 0 .0f ;
881+ const auto * cg = reinterpret_cast <
882+ const litehtml::background_layer::conic_gradient*>(g);
883+ return cg->radius ;
884+ }
885+
790886int lh_conic_gradient_color_points_count (const lh_conic_gradient_t * g)
791887{
792888 if (!g) return 0 ;
@@ -820,6 +916,22 @@ lh_web_color_t lh_conic_gradient_color_point_color(
820916 return to_c (cg->color_points [idx].color );
821917}
822918
919+ int lh_conic_gradient_color_space (const lh_conic_gradient_t * g)
920+ {
921+ if (!g) return 0 ;
922+ const auto * cg = reinterpret_cast <
923+ const litehtml::background_layer::conic_gradient*>(g);
924+ return static_cast <int >(cg->color_space );
925+ }
926+
927+ int lh_conic_gradient_hue_interpolation (const lh_conic_gradient_t * g)
928+ {
929+ if (!g) return 0 ;
930+ const auto * cg = reinterpret_cast <
931+ const litehtml::background_layer::conic_gradient*>(g);
932+ return static_cast <int >(cg->hue_interpolation );
933+ }
934+
823935/* --------------------------------------------------------------------------
824936 * Document lifecycle
825937 * -------------------------------------------------------------------------- */
@@ -903,6 +1015,58 @@ float lh_document_height(const lh_document_t* doc)
9031015 return internal->doc ->height ();
9041016}
9051017
1018+ /* --------------------------------------------------------------------------
1019+ * Document content manipulation
1020+ * -------------------------------------------------------------------------- */
1021+
1022+ void lh_document_add_stylesheet (lh_document_t * doc,
1023+ const char * css_text,
1024+ const char * baseurl,
1025+ const char * media)
1026+ {
1027+ if (!doc || !css_text || !css_text[0 ]) return ;
1028+ auto * internal = reinterpret_cast <lh_document_internal*>(doc);
1029+
1030+ litehtml::css stylesheet;
1031+ litehtml::media_query_list_list::ptr mq;
1032+ if (media && media[0 ]) {
1033+ auto mq_list = litehtml::parse_media_query_list (media, internal->doc );
1034+ mq = std::make_shared<litehtml::media_query_list_list>();
1035+ mq->add (mq_list);
1036+ }
1037+ stylesheet.parse_css_stylesheet (
1038+ css_text,
1039+ baseurl ? baseurl : " " ,
1040+ internal->doc ,
1041+ mq);
1042+ stylesheet.sort_selectors ();
1043+
1044+ auto root = internal->doc ->root ();
1045+ if (root) {
1046+ root->apply_stylesheet (stylesheet);
1047+ root->compute_styles ();
1048+ }
1049+ }
1050+
1051+ lh_element_t * lh_document_root (lh_document_t * doc)
1052+ {
1053+ if (!doc) return nullptr ;
1054+ auto * internal = reinterpret_cast <lh_document_internal*>(doc);
1055+ auto root = internal->doc ->root ();
1056+ return reinterpret_cast <lh_element_t *>(root.get ());
1057+ }
1058+
1059+ void lh_document_append_children_from_string (lh_document_t * doc,
1060+ lh_element_t * parent,
1061+ const char * html,
1062+ int replace_existing)
1063+ {
1064+ if (!doc || !parent || !html) return ;
1065+ auto * internal = reinterpret_cast <lh_document_internal*>(doc);
1066+ auto * elem = reinterpret_cast <litehtml::element*>(parent);
1067+ internal->doc ->append_children_from_string (*elem, html, replace_existing != 0 );
1068+ }
1069+
9061070/* --------------------------------------------------------------------------
9071071 * Mouse / interaction
9081072 * -------------------------------------------------------------------------- */
0 commit comments