public RenderComparison compareTo(TextSpan other) { if (this.Equals(other)) { return(RenderComparison.identical); } if (other.text != this.text || ((this.children == null) != (other.children == null)) || (this.children != null && other.children != null && this.children.Count != other.children.Count) || ((this.style == null) != (other.style != null)) ) { return(RenderComparison.layout); } RenderComparison result = Equals(this.recognizer, other.recognizer) ? RenderComparison.identical : RenderComparison.metadata; if (!Equals(this.hoverRecognizer, other.hoverRecognizer)) { result = RenderComparison.function > result ? RenderComparison.function : result; } if (this.style != null) { var candidate = this.style.compareTo(other.style); if (candidate > result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } if (this.children != null) { for (var index = 0; index < this.children.Count; index++) { var candidate = this.children[index].compareTo(other.children[index]); if (candidate > result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } } return(result); }
public override RenderComparison compareTo(InlineSpan other) { if (Equals(this, other)) { return(RenderComparison.identical); } if (other.GetType() != GetType()) { return(RenderComparison.layout); } TextSpan textSpan = other as TextSpan; if (textSpan.text != text || children?.Count != textSpan.children?.Count || (style == null) != (textSpan.style == null)) { return(RenderComparison.layout); } RenderComparison result = recognizer == textSpan.recognizer ? RenderComparison.identical : RenderComparison.metadata; if (style != null) { RenderComparison candidate = style.compareTo(textSpan.style); if (candidate > result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } if (children != null) { for (int index = 0; index < children.Count; index += 1) { RenderComparison candidate = children[index].compareTo(textSpan.children[index]); if (candidate > result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } } return(result); }
public override RenderComparison compareTo(InlineSpan other) { if (this == other) { return(RenderComparison.identical); } if (other.GetType() != GetType()) { return(RenderComparison.layout); } if ((style == null) != (other.style == null)) { return(RenderComparison.layout); } WidgetSpan typedOther = other as WidgetSpan; if (!child.Equals(typedOther.child) || alignment != typedOther.alignment) { return(RenderComparison.layout); } RenderComparison result = RenderComparison.identical; if (style != null) { RenderComparison candidate = style.compareTo(other.style); if ((int)candidate > (int)result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } return(result); }