[librsvg] rsvg_handle_load_css(): Take in the css_styles to modify



commit a275144c0833cf1d5e222b95f2a57e9e1072716c
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Nov 27 08:22:45 2018 -0600

    rsvg_handle_load_css(): Take in the css_styles to modify

 librsvg/rsvg-load.c          |  4 +++-
 librsvg/rsvg-private.h       |  2 +-
 rsvg_internals/src/handle.rs | 11 +++++++++--
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/librsvg/rsvg-load.c b/librsvg/rsvg-load.c
index caf5678d..8d2b806f 100644
--- a/librsvg/rsvg-load.c
+++ b/librsvg/rsvg-load.c
@@ -548,7 +548,9 @@ sax_processing_instruction_cb (void *user_data, const xmlChar * target, const xm
                 && type && strcmp (type, "text/css") == 0
                 && href)
             {
-                rsvg_handle_load_css (load->handle, href);
+                rsvg_handle_load_css (load->handle,
+                                      rsvg_handle_get_css_styles(load->handle),
+                                      href);
             }
 
             rsvg_property_bag_free (atts);
diff --git a/librsvg/rsvg-private.h b/librsvg/rsvg-private.h
index d69c75dd..55c43826 100644
--- a/librsvg/rsvg-private.h
+++ b/librsvg/rsvg-private.h
@@ -257,7 +257,7 @@ RsvgCssStyles *rsvg_handle_get_css_styles (RsvgHandle *handle);
 
 /* Implemented in rsvg_internals/src/handle.rs */
 G_GNUC_INTERNAL
-void rsvg_handle_load_css(RsvgHandle *handle, const char *href);
+void rsvg_handle_load_css(RsvgHandle *handle, RsvgCssStyles *css_styles, const char *href);
 
 /* Implemented in rsvg_internals/src/handle.rs */
 G_GNUC_INTERNAL
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index a5ce8738..ee4de245 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -226,12 +226,19 @@ pub fn load_css(css_styles: &mut CssStyles, handle: *mut RsvgHandle, href: &str)
 // This function just slurps CSS data from a possibly-relative href
 // and parses it.  We'll move it to a better place in the end.
 #[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_load_css(handle: *mut RsvgHandle, href: *const libc::c_char) {
+pub unsafe extern "C" fn rsvg_handle_load_css(
+    handle: *mut RsvgHandle,
+    css_styles: *mut RsvgCssStyles,
+    href: *const libc::c_char,
+) {
     assert!(!handle.is_null());
+    assert!(!css_styles.is_null());
     assert!(!href.is_null());
 
+    let css_styles = &mut *(css_styles as *mut CssStyles);
+
     let href = utf8_cstr(href);
-    load_css(get_css_styles_mut(handle), handle, href);
+    load_css(css_styles, handle, href);
 }
 
 #[no_mangle]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]