/** * Called when an Attr node has been removed. */ public void attrRemoved(Attr node, String oldv) { if (!mutate) { declaration = new org.apache.batik.css.engine.StyleDeclaration(); } }
/** * Sets a main property value in response to a shorthand property * being set. */ public void setMainProperty(String name, Value v, boolean important) { int idx = cssEngine.getPropertyIndex(name); if (idx == -1) return; // unknown property int i; for (i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) break; } if (i < declaration.size()) declaration.put(i, v, idx, important); else declaration.append(v, idx, important); } }
/** * Tells whether the given property is important. */ public boolean isImportant(String name) { int idx = cssEngine.getPropertyIndex(name); for (int i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) { return declaration.getPriority(i); } } return false; }
StyleRule sr = (StyleRule)rules.get(r); StyleDeclaration sd = sr.getStyleDeclaration(); int len = sd.size(); for (int i = 0; i < len; i++) { putAuthorProperty(sm, sd.getIndex(i), sd.getValue(i), sd.getPriority(i), origin); StyleRule sr = (StyleRule)rules.get(r); StyleDeclaration sd = sr.getStyleDeclaration(); int len = sd.size(); for (int i = 0; i < len; i++) { int idx = sd.getIndex(i); sm.putValue(idx, sd.getValue(i)); sm.putImportant(idx, sd.getPriority(i)); sm.putOrigin(idx, origin);
/** * Called when a property was removed. */ public void propertyRemoved(String name) throws DOMException { int idx = cssEngine.getPropertyIndex(name); for (int i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) { declaration.remove(i); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, declaration.toString(cssEngine)); mutate = false; return; } } }
/** * A property in the override style declaration has been removed. */ public void overrideStylePropertyRemoved(CSSStylableElement elt, String name) { StyleDeclarationProvider p = elt.getOverrideStyleDeclarationProvider(); StyleDeclaration declaration = p.getStyleDeclaration(); int idx = getPropertyIndex(name); int ds = declaration.size(); for (int i = 0; i < ds; i++) { if (idx == declaration.getIndex(i)) { declaration.remove(i); StyleMap style = elt.getComputedStyleMap(null); if (style != null && style.getOrigin(idx) == StyleMap.OVERRIDE_ORIGIN /* && style.isComputed(idx) */) { invalidateProperties (elt, new int[] { idx }, null, true); } break; } } }
/** * The text of the override style declaration for this element has been * modified. */ public void overrideStyleTextChanged(CSSStylableElement elt, String text) { StyleDeclarationProvider p = elt.getOverrideStyleDeclarationProvider(); StyleDeclaration declaration = p.getStyleDeclaration(); int ds = declaration.size(); boolean[] updated = new boolean[getNumberOfProperties()]; for (int i = 0; i < ds; i++) { updated[declaration.getIndex(i)] = true; } declaration = parseStyleDeclaration(elt, text); p.setStyleDeclaration(declaration); ds = declaration.size(); for (int i = 0; i < ds; i++) { updated[declaration.getIndex(i)] = true; } invalidateProperties(elt, null, updated, true); }
/** * Returns the text of the declaration. */ public String getText() { return declaration.toString(cssEngine); }
/** * Returns the length of the declaration. */ public int getLength() { return declaration.size(); }
/** * Returns the value at the given. */ public String item(int idx) { return cssEngine.getPropertyName(declaration.getIndex(idx)); } }
/** * <b>SAC</b>: Implements {@link * DocumentHandler#property(String,LexicalUnit,boolean)}. */ public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } } }
StyleRule sr = (StyleRule) rule; StyleDeclaration sd = sr.getStyleDeclaration(); int len = sd.size(); for (int i = 0; i < len; i++) { putAuthorProperty(sm, sd.getIndex(i), sd.getValue(i), sd.getPriority(i), origin); StyleRule sr = (StyleRule) rule; StyleDeclaration sd = sr.getStyleDeclaration(); int len = sd.size(); for (int i = 0; i < len; i++) { int idx = sd.getIndex(i); sm.putValue(idx, sd.getValue(i)); sm.putImportant(idx, sd.getPriority(i)); sm.putOrigin(idx, origin);
/** * Called when a property was removed. */ public void propertyRemoved(String name) throws DOMException { int idx = cssEngine.getPropertyIndex(name); for (int i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) { declaration.remove(i); mutate = true; setAttributeNS(null, SVG_STYLE_ATTRIBUTE, declaration.toString(cssEngine)); mutate = false; return; } } }
/** * Tells whether the given property is important. */ public boolean isImportant(String name) { int idx = cssEngine.getPropertyIndex(name); for (int i = 0; i < declaration.size(); i++) { if (idx == declaration.getIndex(i)) { return declaration.getPriority(i); } } return false; }
/** * A property in the override style declaration has been removed. */ public void overrideStylePropertyRemoved(CSSStylableElement elt, String name) { StyleDeclarationProvider p = elt.getOverrideStyleDeclarationProvider(); StyleDeclaration declaration = p.getStyleDeclaration(); int idx = getPropertyIndex(name); int ds = declaration.size(); for (int i = 0; i < ds; i++) { if (idx == declaration.getIndex(i)) { declaration.remove(i); StyleMap style = elt.getComputedStyleMap(null); if (style != null && style.getOrigin(idx) == StyleMap.OVERRIDE_ORIGIN /* && style.isComputed(idx) */) { invalidateProperties (elt, new int[] { idx }, null, true); } break; } } }
/** * The text of the override style declaration for this element has been * modified. */ public void overrideStyleTextChanged(CSSStylableElement elt, String text) { StyleDeclarationProvider p = elt.getOverrideStyleDeclarationProvider(); StyleDeclaration declaration = p.getStyleDeclaration(); int ds = declaration.size(); boolean[] updated = new boolean[getNumberOfProperties()]; for (int i = 0; i < ds; i++) { updated[declaration.getIndex(i)] = true; } declaration = parseStyleDeclaration(elt, text); p.setStyleDeclaration(declaration); ds = declaration.size(); for (int i = 0; i < ds; i++) { updated[declaration.getIndex(i)] = true; } invalidateProperties(elt, null, updated, true); }
/** * Returns the text of the declaration. */ public String getText() { return declaration.toString(cssEngine); }
/** * Returns the length of the declaration. */ public int getLength() { return declaration.size(); }
/** * Returns the value at the given. */ public String item(int idx) { return cssEngine.getPropertyName(declaration.getIndex(idx)); } }