public override ApplyState Apply(ComputedStyle style, Value value) { style.RequestLayout(); // Ok! return(ApplyState.Ok); }
public override void Apply(ComputedStyle style, Value value) { // Is it lit? bool lit = (value != null && value.Boolean); if (!lit && style.Shading == null) { // Essentially ignore it anyway. return; } if (style.Shading == null) { // It's lit: style.RequireShading().Lit = true; } else { // It's not lit: style.Shading.Lit = false; // Optimise - might no longer need the shading info: style.Shading.Optimise(); } // Request a layout now: style.RequestLayout(); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { // Ok! return(ApplyState.Ok); } float adjust = -1f; if (value != null && value.Text != "none") { adjust = (float)value.GetDecimal(style.RenderData, this); } text.FontSizeAdjust = adjust; // Clear dimensions so they get re-computed: text.ClearDimensions(); // Request a redraw: style.RequestLayout(); // Ok! return(ApplyState.Ok); }
public override ApplyState Apply(ComputedStyle style, Value value) { if (value == null || value.IsType(typeof(Css.Keywords.None))) { style.RenderData.BGColour = null; } else { UnityEngine.Color col = value.GetColour(style.RenderData, this); if (col.a == 0f) { style.RenderData.BGColour = null; } else { BackgroundColour colour = style.RenderData.BGColour; if (colour == null) { // Create one: style.RenderData.BGColour = colour = new BackgroundColour(style.RenderData); } // Change the base colour: colour.BaseColour = col; } } style.RequestLayout(); // Ok! return(ApplyState.Ok); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ // Assume auto: style.HorizontalAlignLast=HorizontalAlignType.Auto; }else{ if(value.Text=="right"){ style.HorizontalAlignLast=HorizontalAlignType.Right; }else if(value.Text=="justify"){ style.HorizontalAlignLast=HorizontalAlignType.Justify; }else if(value.Text=="center"){ style.HorizontalAlignLast=HorizontalAlignType.Center; }else if(value.Text=="left"){ style.HorizontalAlignLast=HorizontalAlignType.Left; }else if(value.Text=="start"){ style.HorizontalAlignLast=HorizontalAlignType.Start; }else if(value.Text=="end"){ style.HorizontalAlignLast=HorizontalAlignType.End; }else{ style.HorizontalAlignLast=HorizontalAlignType.Auto; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.PaddingTop = style.PaddingLeft = 0; style.PaddingRight = style.PaddingBottom = 0; } else { // Top: style.PaddingTop = value.GetPX(0); // Right: style.PaddingRight = value.GetPX(1); // Bottom: style.PaddingBottom = value.GetPX(2); // Left: style.PaddingLeft = value.GetPX(3); } style.SetSize(); // Fire percent passes: style.Element.SetHeightForKids(style); style.Element.SetWidthForKids(style); style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ // Get the text: TextRenderingProperty text=GetText(style); if(text==null){ return; } bool auto=(value==null || value.Text=="auto" || value.Text=="anti-alias"); if(auto){ text.Alias=float.MaxValue; }else if(value.PX!=0){ text.Alias=(float)value.PX; }else{ text.Alias=value.Single; } // Set width/height directly to the computed style: text.SetDimensions(); // Request a redraw: style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.PaddingTop=style.PaddingLeft=0; style.PaddingRight=style.PaddingBottom=0; }else{ // Top: style.PaddingTop=value.GetPX(0); // Right: style.PaddingRight=value.GetPX(1); // Bottom: style.PaddingBottom=value.GetPX(2); // Left: style.PaddingLeft=value.GetPX(3); } style.SetSize(); // Fire percent passes: style.Element.SetHeightForKids(style); style.Element.SetWidthForKids(style); style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.BGColour = null; } else { BackgroundColour colour = style.BGColour; if (colour == null) { // Create one: style.BGColour = colour = new BackgroundColour(style.Element); } // Change the base colour: colour.BaseColour = value.ToColor(); // Tell it a colour changed: colour.ColourChanged(); // display:inline can't have a bg-colour: style.EnforceNoInline(); } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } bool auto = (value == null || value.Text == "auto" || value.Text == "anti-alias"); if (auto) { text.Alias = float.MaxValue; } else if (value.PX != 0) { text.Alias = (float)value.PX; } else { text.Alias = value.Single; } // Set width/height directly to the computed style: text.SetDimensions(); // Request a redraw: style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { // Assume auto: style.HorizontalAlign = HorizontalAlignType.Auto; } else { switch (value.Text) { case "right": style.HorizontalAlign = HorizontalAlignType.Right; break; case "justify": style.HorizontalAlign = HorizontalAlignType.Justify; break; case "center": style.HorizontalAlign = HorizontalAlignType.Center; break; case "left": style.HorizontalAlign = HorizontalAlignType.Left; break; default: style.HorizontalAlign = HorizontalAlignType.Auto; break; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ // Assume none if blank: style.Float=FloatType.None; }else{ switch(value.Text){ case "left": // Float left: style.Float=FloatType.Left; break; case "right": // Float right: style.Float=FloatType.Right; break; default: // No float (default): style.Float=FloatType.None; break; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ // Assume auto: style.HorizontalAlign=HorizontalAlignType.Auto; }else{ switch(value.Text){ case "right": style.HorizontalAlign=HorizontalAlignType.Right; break; case "justify": style.HorizontalAlign=HorizontalAlignType.Justify; break; case "center": style.HorizontalAlign=HorizontalAlignType.Center; break; case "left": style.HorizontalAlign=HorizontalAlignType.Left; break; default: style.HorizontalAlign=HorizontalAlignType.Auto; break; } } style.RequestLayout(); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Request a layout: style.RequestLayout(); // Convert to shaderset if it's text: Css.Units.TextUnit text = (value as Css.Units.TextUnit); if (text != null) { // is style[GlobalProperty]==value? // Otherwise we've just got inherit. if (style[GlobalProperty] == value) { // Auto-wrap in shaderset("name") style[GlobalProperty] = new ShaderSetFunction(text.Text); // Reload value from computed: return(ApplyState.ReloadValue); } } // Ok! return(ApplyState.Ok); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { // Assume relative: style.Position = PositionType.Relative; } else { if (value.Text == "fixed") { style.Position = PositionType.Fixed; } else if (value.Text == "absolute") { style.Position = PositionType.Absolute; } else { style.Position = PositionType.Relative; } } style.RequestLayout(); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { // Ok! return(ApplyState.Ok); } bool auto = (value == null || value.IsAuto || value.Text == "anti-alias"); if (auto) { text.Alias = float.MaxValue; } else { text.Alias = value.GetDecimal(style.RenderData, this); } // Clear dimensions so they get re-computed: text.ClearDimensions(); // Request a redraw: style.RequestLayout(); // Ok! return(ApplyState.Ok); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Just request a layout: style.RequestLayout(); // Ok! return(ApplyState.ReloadValue); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Apply the changes - doesn't change anything about the text: style.RequestLayout(); // Ok! return(ApplyState.Ok); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.MinimumWidth=int.MinValue; }else{ style.MinimumWidth=value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.MaximumHeight=int.MaxValue; }else{ style.MaximumHeight=value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ style.BottomPositioned=true; if(value==null){ style.PositionBottom=0; }else{ style.PositionBottom=value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ style.RightPositioned=false; if(value==null){ style.PositionLeft=0; }else{ style.PositionLeft=value.PX; } style.RequestLayout(); }
public override ApplyState Apply(ComputedStyle style, Value value) { // If we've got a writing system property, reset it: SparkWritingSystem.GlobalProperty.UpdateMap(style); // Request a layout now: style.RequestLayout(); // Ok! return(ApplyState.Ok); }
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 void Apply(ComputedStyle style,Value value){ if(value==null){ style.FixedDepth=false; style.ZIndex=0f; }else{ style.FixedDepth=true; style.FixedZIndex=value.ToFloat() * style.Element.Document.Renderer.DepthResolution; } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.MaximumHeight = int.MaxValue; } else { style.MaximumHeight = value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.MinimumWidth = int.MinValue; } else { style.MinimumWidth = value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.OverflowX=OverflowType.Visible; style.OverflowY=OverflowType.Visible; }else{ style.OverflowX=GetOverflowType(value.GetText(0)); style.OverflowY=GetOverflowType(value.GetText(1)); } style.ResetScrollbars(); style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } // Apply the property: if (value == null) { text.FontSize = 12f; } else { if (value.Type == ValueType.Text) { if (string.IsNullOrEmpty(value.Text)) { text.FontSize = 12f; } else { text.FontSize = float.Parse(value.Text); } } else { text.FontSize = (float)value.PX; } } // Got any letter spacing that needs updating? Css.Value spacing = style["letter-spacing"]; if (spacing != null && spacing.Single != 0f) { // Apply a relative %: text.LetterSpacing = text.FontSize * (value.Single - 1f); } // Set width/height directly to the computed style: text.SetDimensions(); // Request a redraw: style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { style.BottomPositioned = true; if (value == null) { style.PositionBottom = 0; } else { style.PositionBottom = value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { style.RightPositioned = false; if (value == null) { style.PositionLeft = 0; } else { style.PositionLeft = value.PX; } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.FixedDepth = false; style.ZIndex = 0f; } else { style.FixedDepth = true; style.FixedZIndex = value.ToFloat() * style.Element.Document.Renderer.DepthResolution; } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null || value.Boolean == false) { style.Clip = false; // Clear screen clip state: style.Element.Document.Renderer.ScreenClip = false; } else { style.Clip = true; } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { int previousTop = style.ScrollTop; int previousLeft = style.ScrollLeft; if (value == null) { // Clear scroll: style.ScrollTop = 0; style.ScrollLeft = 0; } else { // (CSS order T,L) // Top is #0: style.ScrollTop = value.GetPX(0); // Left is #3: style.ScrollLeft = value.GetPX(3); } if (style.ScrollLeft == previousLeft && style.ScrollTop == previousTop) { return; } // Grab the element: Element element = style.Element; // The below block of code comes from inside the scrollTo function: // Recompute the size: style.SetSize(); // And request a redraw: style.RequestLayout(); if (element.VScrollbar) { element.VerticalScrollbar.ElementScrolled(); } else if (element.HScrollbar) { element.HorizontalScrollbar.ElementScrolled(); } }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.FixedWidth=false; style.InnerWidth=0; }else{ style.FixedWidth=true; style.InnerWidth=value.PX; } style.SetSize(); // Fire percent pass: style.Element.SetWidthForKids(style); style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { // Assume none if blank: style.DisplayNone(); } else { switch (value.Text) { case "block": style.Display = DisplayType.Block; if (!style.FixedWidth && style.Element.parentNode != null) { // Inherit the width here. style.SetPixelWidth(true); // And bubble upwards: style.Element.SetWidthForKids(style); } break; case "table-cell": style.Display = DisplayType.TableCell; break; case "inline-block": style.Display = DisplayType.InlineBlock; break; case "inline": style.Display = DisplayType.Inline; style.EnforceNoInline(); break; default: style.DisplayNone(); break; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.OverflowX = OverflowType.Visible; style.OverflowY = OverflowType.Visible; } else { style.OverflowX = GetOverflowType(value.GetText(0)); style.OverflowY = GetOverflowType(value.GetText(1)); } style.ResetScrollbars(); style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ int previousTop=style.ScrollTop; int previousLeft=style.ScrollLeft; if(value==null){ // Clear scroll: style.ScrollTop=0; style.ScrollLeft=0; }else{ // (CSS order T,L) // Top is #0: style.ScrollTop=value.GetPX(0); // Left is #3: style.ScrollLeft=value.GetPX(3); } if(style.ScrollLeft==previousLeft && style.ScrollTop==previousTop){ return; } // Grab the element: Element element=style.Element; // The below block of code comes from inside the scrollTo function: // Recompute the size: style.SetSize(); // And request a redraw: style.RequestLayout(); if(element.VScrollbar){ element.VerticalScrollbar.ElementScrolled(); }else if(element.HScrollbar){ element.HorizontalScrollbar.ElementScrolled(); } }
public override void Apply(ComputedStyle style,Value value){ // Get the text: TextRenderingProperty text=GetText(style); if(text==null){ return; } // Apply the property: if(value==null){ text.FontSize=12f; }else{ if(value.Type==ValueType.Text){ if(string.IsNullOrEmpty(value.Text)){ text.FontSize=12f; }else{ text.FontSize=float.Parse(value.Text); } }else{ text.FontSize=(float)value.PX; } } // Got any letter spacing that needs updating? Css.Value spacing=style["letter-spacing"]; if(spacing!=null && spacing.Single!=0f){ // Apply a relative %: text.LetterSpacing=text.FontSize*(value.Single-1f); } // Set width/height directly to the computed style: text.SetDimensions(); // Request a redraw: style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.DrawDirection=DirectionType.LTR; }else{ if(value.Text=="rtl"){ style.DrawDirection=DirectionType.RTL; }else{ style.DrawDirection=DirectionType.LTR; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ // Assume visible if blank: style.Visibility=VisibilityType.Visible; }else{ if(value.Text=="hidden"){ style.VisibilityNone(); }else{ style.Visibility=VisibilityType.Visible; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.WhiteSpace=WhiteSpaceType.Normal; }else{ if(value.Text=="nowrap"){ style.WhiteSpace=WhiteSpaceType.NoWrap; }else{ style.WhiteSpace=WhiteSpaceType.Normal; } } style.RequestLayout(); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Resolve overflow: int overflowX; int overflowY; Css.Value overflowValue = style.Resolve(Css.Properties.Overflow.GlobalProperty); GetOverflow(overflowValue, out overflowX, out overflowY); // Add/ remove scrollbars: style.ResetScrollbars(overflowX, overflowY); // Request a layout: style.RequestLayout(); // Ok! return(ApplyState.Ok); }
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 void Apply(ComputedStyle style,Value value){ if(value==null){ // Assume relative: style.Position=PositionType.Relative; }else{ if(value.Text=="fixed"){ style.Position=PositionType.Fixed; }else if(value.Text=="absolute"){ style.Position=PositionType.Absolute; }else{ style.Position=PositionType.Relative; } } style.RequestLayout(); }
public override ApplyState Apply(ComputedStyle style, Value value) { // Get the document: ReflowDocument doc = style.document; // Watch out for none: if (!(value is Css.Units.FontFamilyUnit) && !(value.IsType(typeof(Css.Keywords.None)))) { // Cache our fonts: style[this] = new Css.Units.FontFamilyUnit(doc, value); // Require a reload: return(ApplyState.ReloadValue); } style.RequestLayout(); // Ok! return(ApplyState.Ok); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.FixedWidth = false; style.InnerWidth = 0; } else { style.FixedWidth = true; style.InnerWidth = value.PX; } style.SetSize(); // Fire percent pass: style.Element.SetWidthForKids(style); style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.VerticalAlign=VerticalAlignType.Top; }else{ if(value.Text=="middle"){ style.VerticalAlign=VerticalAlignType.Middle; }else if(value.Text=="bottom"){ style.VerticalAlign=VerticalAlignType.Bottom; }else{ style.VerticalAlign=VerticalAlignType.Top; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { if (value == null) { style.DrawDirection = DirectionType.LTR; } else { if (value.Text == "rtl") { style.DrawDirection = DirectionType.RTL; } else { style.DrawDirection = DirectionType.LTR; } } style.RequestLayout(); }
public override void Apply(ComputedStyle style,Value value){ if(value==null){ style.BGColour=null; }else{ BackgroundColour colour=style.BGColour; if(colour==null){ // Create one: style.BGColour=colour=new BackgroundColour(style.Element); } // Change the base colour: colour.BaseColour=value.ToColor(); // Tell it a colour changed: colour.ColourChanged(); // display:inline can't have a bg-colour: style.EnforceNoInline(); } style.RequestLayout(); }
//--------------------------------------