From b4e5d8a5dd02f41a603ce3e893500abe93770a80 Mon Sep 17 00:00:00 2001 From: Kevin VanGelder Date: Thu, 9 Feb 2017 15:07:00 -0800 Subject: [PATCH] fixed text measurement regression (#978) * fixed text measurement regression * also apply fix to UWP text * also applied fix to textinput --- .../ReactNative.Net46/Views/Text/ReactTextShadowNode.cs | 4 ++-- .../Views/TextInput/ReactPasswordBoxShadowNode.cs | 4 +++- .../Views/TextInput/ReactTextInputShadowNode.cs | 4 +++- ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ReactWindows/ReactNative.Net46/Views/Text/ReactTextShadowNode.cs b/ReactWindows/ReactNative.Net46/Views/Text/ReactTextShadowNode.cs index 140f7c911b3..e2559775152 100644 --- a/ReactWindows/ReactNative.Net46/Views/Text/ReactTextShadowNode.cs +++ b/ReactWindows/ReactNative.Net46/Views/Text/ReactTextShadowNode.cs @@ -213,8 +213,8 @@ private static YogaSize MeasureText(ReactTextShadowNode textNode, YogaNode node, var normalizedHeight = YogaConstants.IsUndefined(height) ? double.PositiveInfinity : height; textBlock.Measure(new Size(normalizedWidth, normalizedHeight)); return MeasureOutput.Make( - (float)textBlock.DesiredSize.Width, - (float)textBlock.DesiredSize.Height); + (float)Math.Ceiling(textBlock.DesiredSize.Width), + (float)Math.Ceiling(textBlock.DesiredSize.Height)); }); return task.Result; diff --git a/ReactWindows/ReactNative.Shared/Views/TextInput/ReactPasswordBoxShadowNode.cs b/ReactWindows/ReactNative.Shared/Views/TextInput/ReactPasswordBoxShadowNode.cs index 3f59546706c..895b2ab2a15 100644 --- a/ReactWindows/ReactNative.Shared/Views/TextInput/ReactPasswordBoxShadowNode.cs +++ b/ReactWindows/ReactNative.Shared/Views/TextInput/ReactPasswordBoxShadowNode.cs @@ -258,7 +258,9 @@ private static YogaSize MeasureTextInput(ReactPasswordBoxShadowNode textInputNod finalizedHeight += YogaConstants.IsUndefined(borderTopWidth) ? 0 : borderTopWidth; finalizedHeight += YogaConstants.IsUndefined(borderBottomWidth) ? 0 : borderBottomWidth; - return MeasureOutput.Make(width, finalizedHeight); + return MeasureOutput.Make( + (float)Math.Ceiling(width), + (float)Math.Ceiling(finalizedHeight)); }); return task.Result; diff --git a/ReactWindows/ReactNative.Shared/Views/TextInput/ReactTextInputShadowNode.cs b/ReactWindows/ReactNative.Shared/Views/TextInput/ReactTextInputShadowNode.cs index 6c3e74e92ab..db14282903f 100644 --- a/ReactWindows/ReactNative.Shared/Views/TextInput/ReactTextInputShadowNode.cs +++ b/ReactWindows/ReactNative.Shared/Views/TextInput/ReactTextInputShadowNode.cs @@ -319,7 +319,9 @@ private static YogaSize MeasureTextInput(ReactTextInputShadowNode textInputNode, finalizedHeight += YogaConstants.IsUndefined(borderTopWidth) ? 0 : borderTopWidth; finalizedHeight += YogaConstants.IsUndefined(borderBottomWidth) ? 0 : borderBottomWidth; - return MeasureOutput.Make(width, (float)finalizedHeight); + return MeasureOutput.Make( + (float)Math.Ceiling(width), + (float)Math.Ceiling(finalizedHeight)); }); return task.Result; diff --git a/ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs b/ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs index 5c5e1efd585..d29edd240d5 100644 --- a/ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs +++ b/ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs @@ -217,8 +217,8 @@ private static YogaSize MeasureText(ReactTextShadowNode textNode, YogaNode node, var normalizedHeight = YogaConstants.IsUndefined(height) ? double.PositiveInfinity : height; textBlock.Measure(new Size(normalizedWidth, normalizedHeight)); return MeasureOutput.Make( - (float)textBlock.DesiredSize.Width, - (float)textBlock.DesiredSize.Height); + (float)Math.Ceiling(textBlock.DesiredSize.Width), + (float)Math.Ceiling(textBlock.DesiredSize.Height)); }); return task.Result;