Skip to content

Commit

Permalink
fixed text measurement regression (#978)
Browse files Browse the repository at this point in the history
* fixed text measurement regression

* also apply fix to UWP text

* also applied fix to textinput
  • Loading branch information
kevinvangelder authored and rozele committed Feb 10, 2017
1 parent 1c48cc7 commit b4e5d8a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b4e5d8a

Please sign in to comment.