本文整理汇总了Java中org.w3c.dom.css.CSSValue.CSS_INHERIT属性的典型用法代码示例。如果您正苦于以下问题:Java CSSValue.CSS_INHERIT属性的具体用法?Java CSSValue.CSS_INHERIT怎么用?Java CSSValue.CSS_INHERIT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.css.CSSValue
的用法示例。
在下文中一共展示了CSSValue.CSS_INHERIT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeValue
/**
* Computes a CSS {@link Value} and performance inheritance if the
* specified value is 'inherit'.
*/
protected Value computeValue(CSSStylableElement elt, String pn,
Value v) {
ValueManager[] vms = cssEngine.getValueManagers();
int idx = cssEngine.getPropertyIndex(pn);
if (idx != -1) {
if (v.getCssValueType() == CSSValue.CSS_INHERIT) {
elt = CSSEngine.getParentCSSStylableElement(elt);
if (elt != null) {
return cssEngine.getComputedStyle(elt, null, idx);
}
return vms[idx].getDefaultValue();
}
v = vms[idx].computeValue(elt, null, cssEngine, idx,
dummyStyleMap, v);
}
return v;
}
示例2: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentOrURIType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, ALLOWED, ident);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例3: buildDeclarations
@Override
public List buildDeclarations(
CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue)values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentLengthOrPercentType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, getAllowed(), ident);
} else if (! isNegativeValuesAllowed() && value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(
new PropertyDeclaration(cssName, value, important, origin));
}
示例4: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentType(cssName, value);
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, getAllowed(), ident);
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例5: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentNumberOrPercentType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, allowed, ident);
} else if (value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例6: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkLengthOrPercentType(cssName, value);
if (!isNegativeValuesAllowed() && value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例7: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentNumberType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, allowed, ident);
} else if (value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例8: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkIdentOrColorType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
FSRGBColor color = Conversions.getColor(value.getStringValue());
if (color != null) {
return Collections.singletonList(
new PropertyDeclaration(cssName, new PropertyValue(color), important, origin));
}
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, ALLOWED, ident);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例9: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
return Collections.emptyList();
}
示例10: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkDuration(cssName, value);
// String strv = value.getStringValue();
// if (strv != null strv.endsWith("s")) {
// strv = strv.substring(0, strv.length() - 1);
// }
// try {
// float val = Float.parseFloat(strv);
// if (!isNegativeValuesAllowed() && value.getFloatValue() <
// 0.0f) {
// throw new CSSParseException(cssName + " may not be negative",
// -1);
// }
// PropertyValue v = new PropertyValue(CSSPrimitiveValue.CSS_S,
// val, String.format("%fs", val));
// return Collections.singletonList(new
// PropertyDeclaration(cssName, v, important, origin));
// } catch (NumberFormatException nfe) {
// throw new CSSParseException(cssName + " is not a duration in
// seconds (float suffixed by s)", -1);
// }
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例11: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) {
CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
return Collections.emptyList();
}
示例12: buildDeclarations
@Override
public List buildDeclarations(CSSName cssName, List values, int origin, boolean important,
boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue) values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSValue.CSS_INHERIT) {
checkNumberType(cssName, value);
if (!isNegativeValuesAllowed() && value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin));
}
示例13: applyCss
@Override
public void applyCss(PropertyDeclaration decl) {
String n = decl.getPropertyName();
CSSPrimitiveValue v = decl.getValue();
CSSName cssName = decl.getCSSName();
if (cssName == CSSName.COLOR) {
ColorRGBA col = CssUtil.toFontColor(decl, this);
if (!Objects.equals(col, fontColor)) {
fontColor = col;
dirtyLayout(true, LayoutType.text);
}
} else if (cssName == CSSName.FONT_SIZE) {
float fs;
if (decl.getValue().getPrimitiveType() == CSSValue.CSS_INHERIT) {
fs = -1;
} else
fs = v.getFloatValue(CSSPrimitiveValue.CSS_PT);
if (fs != fontSize) {
fontSize = fs;
dirtyLayout(true, LayoutType.text);
}
} else if (cssName == CSSName.FONT_FAMILY) {
String fn = null;
if (decl.getValue().getPrimitiveType() != CSSValue.CSS_INHERIT) {
fn = v.getStringValue();
}
if (!Objects.equals(fn, fontFamily)) {
fontFamily = fn;
dirtyLayout(true, LayoutType.text);
}
} else {
// LOG.warning(String.format("Unknown style %s (%s) in %s", n,
// v.getStringValue(), toString()));
}
}
示例14: getCssValueType
/**
* A code defining the type of the value.
*/
public short getCssValueType() {
return CSSValue.CSS_INHERIT;
}
示例15: getCssValueType
/**
* A code defining the type of the value.
*/
public short getCssValueType( )
{
return CSSValue.CSS_INHERIT;
}