/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.DocumentHandler#endFontFace()}. */ public void endFontFace() throws CSSException { StyleMap sm = new StyleMap(getNumberOfProperties()); int len = styleDeclaration.size(); for (int i=0; i<len; i++) { int idx = styleDeclaration.getIndex(i); sm.putValue(idx, styleDeclaration.getValue(i)); sm.putImportant(idx, styleDeclaration.getPriority(i)); // Not sure on this.. sm.putOrigin(idx, StyleMap.AUTHOR_ORIGIN); } styleDeclaration = null; int pidx = getPropertyIndex(CSSConstants.CSS_FONT_FAMILY_PROPERTY); Value fontFamily = sm.getValue(pidx); if (fontFamily == null) return; ParsedURL base = getCSSBaseURI(); fontFaces.add(new FontFaceRule(sm, base)); }
boolean imp, short origin) { Value dval = dest.getValue(idx); short dorg = dest.getOrigin(idx); boolean dimp = dest.isImportant(idx); dest.putValue(idx, sval); dest.putImportant(idx, imp); dest.putOrigin(idx, origin);
private static void clearComputedValue(StyleMap style, int n) { if (style.isNullCascaded(n)) { style.putValue(n, null); } else { Value v = style.getValue(n); if (v instanceof ComputedValue) { ComputedValue cv = (ComputedValue)v; v = cv.getCascadedValue(); style.putValue(n, v); } } style.putComputed(n, false); }
public boolean isInlineStyleValue(Element element, int propidx) { if (!(element instanceof CSSStylableElement)) { return false; } CSSStylableElement elt = (CSSStylableElement)element; String pseudo = ""; // Pending // NOI18N StyleMap sm = elt.getComputedStyleMap(pseudo); if (sm == null) { return false; } Value value = sm.getValue(propidx); if (value == null) { return false; } return sm.getOrigin(propidx) == StyleMap.INLINE_AUTHOR_ORIGIN; } // </Non engine methods, might be separated>
int idx = getPropertyIndex(property); if (style.isImportant(idx)) { if (style.getOrigin(idx) >= StyleMap.AUTHOR_ORIGIN) { ValueManager vm = valueManagers[idx]; Value v = vm.createValue(lu, CSSEngine.this); style.putMask(idx, (short)0); style.putValue(idx, v); style.putOrigin(idx, StyleMap.NON_CSS_ORIGIN); } catch (Exception e) { String m = e.getMessage(); count++; else if ((fs && style.isFontSizeRelative(i)) || (lh && style.isLineHeightRelative(i)) || (cl && style.isColorRelative(i))) { updated[i] = true; clearComputedValue(style, i);
Value value = sm.getValue(propidx); if (sm.isComputed(propidx)) return value; sm.putParentRelative(propidx, true); sm.putInherited (propidx, true); } else { sm.putValue(propidx, result); sm.putNullCascaded(propidx, true); } else if (result != value) { ComputedValue cv = new ComputedValue(value); cv.setComputedValue(result); sm.putValue(propidx, cv); result = cv; sm.putComputed(propidx, true); return result;
String pseudo) { int props = getNumberOfProperties(); final StyleMap result = new StyleMap(props); Value value = over.getValue(i); boolean important = over.getPriority(i); if (!result.isImportant(idx) || important) { result.putValue(idx, value); result.putImportant(idx, important); result.putOrigin(idx, StyleMap.OVERRIDE_ORIGIN);
if (style.isComputed(i) && !updated[i]) { short origin = style.getOrigin(i); if (origin >= StyleMap.INLINE_AUTHOR_ORIGIN) { // ToDo Jlint says: always same result ?? removed = true; count++; else if ((fs && style.isFontSizeRelative(i)) || (lh && style.isLineHeightRelative(i)) || (cl && style.isColorRelative(i))) { updated[i] = true; clearComputedValue(style, i);
important); } else { if (styleMap.isImportant(i)) { styleMap.putMask(i, (short)0); styleMap.putValue(i, v); styleMap.putOrigin(i, StyleMap.INLINE_AUTHOR_ORIGIN);
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);
sm.putFontSizeRelative(idx, true); sm.putFontSizeRelative(idx, true); switch (getOrientation()) { case HORIZONTAL_ORIENTATION: sm.putBlockWidthRelative(idx, true); fs = value.getFloatValue() * ctx.getBlockWidth(elt) / 100f; break; case VERTICAL_ORIENTATION: sm.putBlockHeightRelative(idx, true); fs = value.getFloatValue() * ctx.getBlockHeight(elt) / 100f; break; default: // Both sm.putBlockWidthRelative(idx, true); sm.putBlockHeightRelative(idx, true); double w = ctx.getBlockWidth(elt); double h = ctx.getBlockHeight(elt);
public void uncomputeValueForElement(Element element, int propIndex) { if (!(element instanceof CSSStylableElement)) { return; } Document document = element.getOwnerDocument(); XhtmlCssEngine engine = getCssEngine(document); if (engine == null) { return; } // RaveElement xel = (RaveElement)e; CSSStylableElement elt = (CSSStylableElement)element; StyleMap sm = elt.getComputedStyleMap(null); if (sm != null) { Value v = sm.getValue(propIndex); if (v instanceof ComputedValue) { ComputedValue cv = (ComputedValue)v; sm.putComputed(propIndex, false); sm.putValue(propIndex, cv.getCascadedValue()); } } }
for (int i = 0, n = map.getSize(true); i < n; i++) { Value v = engine.getComputedStyle((CSSStylableElement)element, null, i); if (cascaded.getOrigin(i) == StyleMap.NON_CSS_ORIGIN) { sb.append("(from HTML attribute) "); if (cascaded.getValue(i) == InheritValue.INSTANCE) { sb.append("(inherited) "); if (map.isImportant(i)) { sb.append("!important ");
Value nv = newStyle.getValue(i); Value ov = null; if (!style.isNullCascaded(i)) { ov = style.getValue(i); if (ov instanceof ComputedValue) { ov = ((ComputedValue)ov).getCascadedValue();
count++; else if ((fs && style.isFontSizeRelative(i)) || (lh && style.isLineHeightRelative(i)) || (cl && style.isColorRelative(i))) { updated[i] = true; clearComputedValue(style, i);
v = sm.getValue(SVGCSSEngine.FONT_WEIGHT_INDEX); if (v != null) ret.fontWeight = v.getCssText(); v = sm.getValue(SVGCSSEngine.FONT_STYLE_INDEX); if (v != null) ret.fontStyle = v.getCssText(); v = sm.getValue(SVGCSSEngine.FONT_VARIANT_INDEX); if (v != null) ret.fontVariant = v.getCssText(); v = sm.getValue(SVGCSSEngine.FONT_STRETCH_INDEX); if (v != null) ret.fontStretch = v.getCssText(); v = sm.getValue(SVGCSSEngine.SRC_INDEX);
int size = map.getSize(true); boolean[] used = new boolean[size]; StringBuffer sb = new StringBuffer(); (map.getValue(XhtmlCss.BORDER_LEFT_WIDTH_INDEX) != null) && (map.getValue(XhtmlCss.BORDER_TOP_WIDTH_INDEX) != null) && (map.getValue(XhtmlCss.BORDER_RIGHT_WIDTH_INDEX) != null) && (map.getValue(XhtmlCss.BORDER_BOTTOM_WIDTH_INDEX) != null); boolean sameBorderWidth = allBorderWidths && map.getValue(XhtmlCss.BORDER_LEFT_WIDTH_INDEX).equals(map.getValue( XhtmlCss.BORDER_TOP_WIDTH_INDEX)) && map.getValue(XhtmlCss.BORDER_TOP_WIDTH_INDEX).equals(map.getValue( XhtmlCss.BORDER_RIGHT_WIDTH_INDEX)) && map.getValue(XhtmlCss.BORDER_RIGHT_WIDTH_INDEX).equals(map.getValue( XhtmlCss.BORDER_BOTTOM_WIDTH_INDEX)); boolean allBorderColors = (map.getValue(XhtmlCss.BORDER_LEFT_COLOR_INDEX) != null) && (map.getValue(XhtmlCss.BORDER_TOP_COLOR_INDEX) != null) && (map.getValue(XhtmlCss.BORDER_RIGHT_COLOR_INDEX) != null) && (map.getValue(XhtmlCss.BORDER_BOTTOM_COLOR_INDEX) != null); boolean sameBorderColor = allBorderColors && map.getValue(XhtmlCss.BORDER_LEFT_COLOR_INDEX).equals(map.getValue( XhtmlCss.BORDER_TOP_COLOR_INDEX)) && map.getValue(XhtmlCss.BORDER_TOP_COLOR_INDEX).equals(map.getValue( XhtmlCss.BORDER_RIGHT_COLOR_INDEX)) && map.getValue(XhtmlCss.BORDER_RIGHT_COLOR_INDEX).equals(map.getValue( XhtmlCss.BORDER_BOTTOM_COLOR_INDEX));
/** * Constructs a TextDecoration object for the specified element. This will * contain all of the decoration properties to be used when drawing the * text. */ protected TextPaintInfo getTextPaintInfo(Element element, GraphicsNode node, TextPaintInfo parentTPI, BridgeContext ctx) { // Force the engine to update stuff.. CSSUtilities.getComputedStyle (element, SVGCSSEngine.TEXT_DECORATION_INDEX); TextPaintInfo pi = new TextPaintInfo(parentTPI); // Was text-decoration explicity set on this element? StyleMap sm = ((CSSStylableElement)element).getComputedStyleMap(null); if ((sm.isNullCascaded(SVGCSSEngine.TEXT_DECORATION_INDEX)) && (sm.isNullCascaded(SVGCSSEngine.FILL_INDEX)) && (sm.isNullCascaded(SVGCSSEngine.STROKE_INDEX)) && (sm.isNullCascaded(SVGCSSEngine.STROKE_WIDTH_INDEX)) && (sm.isNullCascaded(SVGCSSEngine.OPACITY_INDEX))) { // If not, keep the same decorations. return pi; } setBaseTextPaintInfo(pi, element, node, ctx); if (!sm.isNullCascaded(SVGCSSEngine.TEXT_DECORATION_INDEX)) setDecorationTextPaintInfo(pi, element); return pi; }
/** * Creates a new SVGAnimationEngine. */ public SVGAnimationEngine(Document doc, BridgeContext ctx) { super(doc); this.ctx = ctx; SVGOMDocument d = (SVGOMDocument) doc; cssEngine = d.getCSSEngine(); dummyStyleMap = new StyleMap(cssEngine.getNumberOfProperties()); isSVG12 = d.isSVG12(); }