Ignore:
Timestamp:
2020-02-22T19:40:29+01:00 (4 years ago)
Author:
simon04
Message:

see #18749 - SVGElement: store String instead of StyleAttribute in map

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/kitfox/svg/SVGElement.java

    r15901 r15904  
    8989     * Styles defined for this elemnt via the <b>style</b> attribute.
    9090     */
    91     protected final HashMap<String, StyleAttribute> inlineStyles = new HashMap<>();
     91    protected final HashMap<String, String> inlineStyles = new HashMap<>();
    9292    /**
    9393     * Presentation attributes set for this element. Ie, any attribute other
    9494     * than the <b>style</b> attribute.
    9595     */
    96     protected final HashMap<String, StyleAttribute> presAttribs = new HashMap<>();
     96    protected final HashMap<String, String> presAttributes = new HashMap<>();
    9797    /**
    9898     * A list of presentation attributes to not include in the presentation
     
    273273        if (style != null)
    274274        {
    275             HashMap<?, ?> map = XMLParseUtil.parseStyle(style, inlineStyles);
     275            XMLParseUtil.parseStyle(style, inlineStyles);
    276276        }
    277277
     
    299299            String value = attrs.getValue(i);
    300300
    301             presAttribs.put(name, new StyleAttribute(name, value == null ? null : value.intern()));
     301            presAttributes.put(name, value == null ? null : value.intern());
    302302        }
    303303    }
     
    316316    public Set<String> getPresentationAttributes()
    317317    {
    318         return presAttribs.keySet();
     318        return presAttributes.keySet();
    319319    }
    320320
     
    486486
    487487        //Check for local inline styles
    488         StyleAttribute styAttr = inlineStyles.get(styName);
    489 
    490         attrib.setStringValue(styAttr == null ? "" : styAttr.getStringValue());
     488        String styAttr = inlineStyles.get(styName);
     489
     490        attrib.setStringValue(styAttr == null ? "" : styAttr);
    491491
    492492        //Return if we've found a non animated style
     
    498498
    499499        //Check for presentation attribute
    500         StyleAttribute presAttr = presAttribs.get(styName);
    501 
    502         attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue());
     500        String presAttr = presAttributes.get(styName);
     501
     502        attrib.setStringValue(presAttr == null ? "" : presAttr);
    503503
    504504        //Return if we've found a presentation attribute instead
     
    546546    {
    547547        //Check for local inline styles
    548         return inlineStyles.get(styName);
     548        final String value = inlineStyles.get(styName);
     549        return value != null ? new StyleAttribute(styName, value) : null;
    549550    }
    550551
     
    561562
    562563        //Make sure we have a coresponding presentation attribute
    563         StyleAttribute presAttr = presAttribs.get(presName);
     564        String presAttr = presAttributes.get(presName);
    564565
    565566        //Copy presentation value directly
    566         attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue());
     567        attrib.setStringValue(presAttr == null ? "" : presAttr);
    567568
    568569        //Return if we found presentation attribute
    569         if (presAttr != null)
    570         {
    571             return true;
    572         }
    573 
    574         return false;
     570        return presAttr != null;
    575571    }
    576572
     
    584580    {
    585581        //Check for local inline styles
    586         return presAttribs.get(styName);
     582        final String value = presAttributes.get(styName);
     583        return value != null ? new StyleAttribute(styName, value) : null;
    587584    }
    588585
Note: See TracChangeset for help on using the changeset viewer.