Permalink
Browse files

Fix text node rounding with fractional dimensions matching the roundi…

…ng factor

Summary:
If we have a fractional measure output which matches the subpixel rounding factor, we still should round both dimension into the same direction.

Fixes facebook/yoga#580.
Closes facebook/yoga#583

Reviewed By: marco-cova

Differential Revision: D5274212

Pulled By: emilsjolander

fbshipit-source-id: 1febf9194210437ab77f91319d10d4da9b284b79
  • Loading branch information...
woehrl01 authored and facebook-github-bot committed Jul 4, 2017
1 parent 3525998 commit b437d614759fea3c8b0ee6488aafff59a7b5c817
Showing with 2 additions and 2 deletions.
  1. +2 −2 ReactCommon/yoga/yoga/Yoga.c
@@ -3471,8 +3471,8 @@ static void YGRoundToPixelGrid(const YGNodeRef node,
node->layout.position[YGEdgeTop] =
YGRoundValueToPixelGrid(nodeTop, pointScaleFactor, false, textRounding);
const bool hasFractionalWidth = !YGFloatsEqual(fmodf(nodeWidth, 1.0), 0);
const bool hasFractionalHeight = !YGFloatsEqual(fmodf(nodeHeight, 1.0), 0);
const bool hasFractionalWidth = !YGFloatsEqual(fmodf(nodeWidth, 1 / pointScaleFactor), 0);
const bool hasFractionalHeight = !YGFloatsEqual(fmodf(nodeHeight, 1 / pointScaleFactor), 0);
node->layout.dimensions[YGDimensionWidth] =
YGRoundValueToPixelGrid(

0 comments on commit b437d61

Please sign in to comment.