/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_PERCENTAGE) { sm.putLineHeightRelative(idx, true); int fsi = engine.getLineHeightIndex(); CSSStylableElement parent; parent = (CSSStylableElement)elt.getParentNode(); if (parent == null) { // Hmmm somthing pretty odd - can't happen accordint to spec, // should always have text parent. // http://www.w3.org/TR/SVG11/text.html#BaselineShiftProperty parent = elt; } Value fs = engine.getComputedStyle(parent, pseudo, fsi); float fsv = fs.getFloatValue(); float v = value.getFloatValue(); return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, (fsv * v) / 100f); } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_PERCENTAGE) { sm.putLineHeightRelative(idx, true); int fsi = engine.getLineHeightIndex(); CSSStylableElement parent; parent = (CSSStylableElement)elt.getParentNode(); if (parent == null) { // Hmmm somthing pretty odd - can't happen accordint to spec, // should always have text parent. // http://www.w3.org/TR/SVG11/text.html#BaselineShiftProperty parent = elt; } Value fs = engine.getComputedStyle(parent, pseudo, fsi); float fsv = fs.getFloatValue(); float v = value.getFloatValue(); return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, (fsv * v) / 100f); } return super.computeValue(elt, pseudo, engine, idx, sm, value); }
/** * Implements {@link * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. */ public Value computeValue(CSSStylableElement elt, String pseudo, CSSEngine engine, int idx, StyleMap sm, Value value) { if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_PERCENTAGE) { sm.putLineHeightRelative(idx, true); int fsi = engine.getLineHeightIndex(); CSSStylableElement parent; parent = (CSSStylableElement)elt.getParentNode(); if (parent == null) { // Hmmm somthing pretty odd - can't happen accordint to spec, // should always have text parent. // http://www.w3.org/TR/SVG11/text.html#BaselineShiftProperty parent = elt; } Value fs = engine.getComputedStyle(parent, pseudo, fsi); float fsv = fs.getFloatValue(); float v = value.getFloatValue(); return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, (fsv * v) / 100f); } return super.computeValue(elt, pseudo, engine, idx, sm, value); }