[librsvg: 2/2] Merge branch 'svenfoo/librsvg-cleanup-filter-value-list'




commit e110fa2013ab69b9ff5f972710f8ba539b465e39
Merge: a5f78da0 a9c46506
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Sep 9 11:51:31 2020 -0500

    Merge branch 'svenfoo/librsvg-cleanup-filter-value-list'

 rsvg_internals/src/drawing_ctx.rs | 1 -
 rsvg_internals/src/filter.rs      | 9 +++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --cc rsvg_internals/src/filter.rs
index 6af6a9d2,e945e048..eb44766b
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@@ -2,8 -2,8 +2,9 @@@
  
  use cssparser::Parser;
  use markup5ever::{expanded_name, local_name, namespace_url, ns};
+ use std::slice::Iter;
  
 +use crate::allowed_url::Fragment;
  use crate::bbox::BoundingBox;
  use crate::coord_units::CoordUnits;
  use crate::document::AcquiredNodes;
@@@ -193,10 -193,10 +194,10 @@@ impl Draw for Filter {
  
  #[derive(Debug, Clone, PartialEq)]
  pub enum FilterValue {
 -    URL(IRI),
 +    URL(Fragment),
  }
  #[derive(Debug, Clone, PartialEq)]
- pub struct FilterValueList(pub Vec<FilterValue>);
+ pub struct FilterValueList(Vec<FilterValue>);
  
  impl Default for FilterValueList {
      fn default() -> FilterValueList {
@@@ -216,32 -220,37 +221,32 @@@ impl FilterValueList 
              return false;
          }
  
-         self.0.iter().all(|filter| match filter {
+         self.iter().all(|filter| match filter {
 -            FilterValue::URL(IRI::Resource(filter_uri)) => {
 -                match acquired_nodes.acquire(filter_uri) {
 -                    Ok(acquired) => {
 -                        let filter_node = acquired.get();
 -
 -                        match *filter_node.borrow_element() {
 -                            Element::Filter(_) => true,
 -                            _ => {
 -                                rsvg_log!(
 -                                    "element {} will not be filtered since \"{}\" is not a filter",
 -                                    node,
 -                                    filter_uri,
 -                                );
 -                                false
 -                            }
 +            FilterValue::URL(filter_uri) => match acquired_nodes.acquire(filter_uri) {
 +                Ok(acquired) => {
 +                    let filter_node = acquired.get();
 +
 +                    match *filter_node.borrow_element() {
 +                        Element::Filter(_) => true,
 +                        _ => {
 +                            rsvg_log!(
 +                                "element {} will not be filtered since \"{}\" is not a filter",
 +                                node,
 +                                filter_uri,
 +                            );
 +                            false
                          }
                      }
 -                    _ => {
 -                        rsvg_log!(
 -                            "element {} will not be filtered since its filter \"{}\" was not found",
 -                            node,
 -                            filter_uri,
 -                        );
 -                        false
 -                    }
                  }
 -            }
 -            FilterValue::URL(IRI::None) => {
 -                unreachable!("Unexpected IRI::None in FilterValueList");
 -            }
 +                _ => {
 +                    rsvg_log!(
 +                        "element {} will not be filtered since its filter \"{}\" was not found",
 +                        node,
 +                        filter_uri,
 +                    );
 +                    false
 +                }
 +            },
          })
      }
  }


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