public override ApplyState Apply(ComputedStyle style, Value value) { // Assume HorizontalTB if blank: int mode = Css.WritingMode.HorizontalTB; if (value != null) { switch (value.Text) { case "tb": // SVG case "tb-rl": // SVG case "vertical-rl": mode = Css.WritingMode.VerticalRL; break; case "vertical-lr": mode = Css.WritingMode.VerticalLR; break; case "sideways-rl": mode = Css.WritingMode.SidewaysRL; break; case "sideways-lr": mode = Css.WritingMode.SidewaysLR; break; default: // case "horizontal-tb": mode = Css.WritingMode.HorizontalTB; break; } } if (mode == Css.WritingMode.HorizontalTB) { // Delete: style.Properties.Remove(GlobalProperty); } else { // Write the mode value to the style: style[GlobalProperty] = new Css.Units.CachedIntegerUnit(value, mode); } // If we've got a writing system property, reset it: SparkWritingSystem.GlobalProperty.UpdateMap(style); style.RequestLayout(); // Ok! return(ApplyState.ReloadValue); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null || value == null) { // Ok! return(ApplyState.Ok); } int synthMode = 0; for (int i = 0; i < value.Count; i++) { switch (value[i].Text) { case "none": synthMode = FontSynthesisFlags.None; break; case "weight": synthMode |= FontSynthesisFlags.Weight; break; case "style": synthMode |= FontSynthesisFlags.Style; break; case "stretch": synthMode |= FontSynthesisFlags.Stretch; break; } } if (synthMode == FontSynthesisFlags.All) { // Delete: style.Properties.Remove(GlobalProperty); } else { // Write the value to the style: style[GlobalProperty] = new Css.Units.CachedIntegerUnit(value, synthMode); } // Ok! return(ApplyState.ReloadValue); }
public override ApplyState Apply(ComputedStyle style, Value value) { int orient = TextOrientationMode.Mixed; if (value != null) { switch (value.Text) { case "upright": orient = TextOrientationMode.Upright; break; case "sideways": case "sideways-left": case "sideways-right": orient = TextOrientationMode.Sideways; break; default: case "mixed": orient = TextOrientationMode.Mixed; break; } } if (orient == TextOrientationMode.Mixed) { // Delete: style.Properties.Remove(GlobalProperty); } else { // Write the value to the style: style[GlobalProperty] = new Css.Units.CachedIntegerUnit(value, orient); } // If we've got a writing system property, reset it: SparkWritingSystem.GlobalProperty.UpdateMap(style); style.RequestLayout(); // Ok! return(ApplyState.ReloadValue); }
public override ApplyState Apply(ComputedStyle style, Value value) { int display = 0; if (value == null) { // Assume inline if blank: display = DisplayMode.Inline; } else if (value is ValueSet) { // Outside + Inside or list-item int first = value[0].GetInteger(null, null); if (first == DisplayMode.ListItem) { // Get outside mode: display = DisplayMode.InternalListItem | value[1].GetInteger(null, null); if (value.Count > 2) { // Get inside mode (just flow or flow-root allowed): int insideMode = value[2].GetInteger(null, null); if ((insideMode & InsideFlowOrRoot) != 0) { display |= insideMode; } } } else { display = first | value[1].GetInteger(null, null); } } else { // "Legacy" or other shortform. display = value.GetInteger(null, null); // special case for list-item as we'll be creating the marker too: if (display == DisplayMode.ListItem) { // Update the marker selector: MarkerSelector.Update(style); } else { // (Remove marker if there is one) style.RemoveVirtual(MarkerSelector.Priority); } } // Write the display value to the style: style[GlobalProperty] = new Css.Units.CachedIntegerUnit(value, display); style.RequestLayout(); // Ok! return(ApplyState.ReloadValue); }