Skip to content

Commit b437d61

Browse files
woehrl01facebook-github-bot
authored andcommitted
Fix text node rounding with fractional dimensions matching the rounding 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 react/yoga#580. Closes react/yoga#583 Reviewed By: marco-cova Differential Revision: D5274212 Pulled By: emilsjolander fbshipit-source-id: 1febf9194210437ab77f91319d10d4da9b284b79
1 parent 3525998 commit b437d61

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ReactCommon/yoga/yoga/Yoga.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3471,8 +3471,8 @@ static void YGRoundToPixelGrid(const YGNodeRef node,
34713471
node->layout.position[YGEdgeTop] =
34723472
YGRoundValueToPixelGrid(nodeTop, pointScaleFactor, false, textRounding);
34733473

3474-
const bool hasFractionalWidth = !YGFloatsEqual(fmodf(nodeWidth, 1.0), 0);
3475-
const bool hasFractionalHeight = !YGFloatsEqual(fmodf(nodeHeight, 1.0), 0);
3474+
const bool hasFractionalWidth = !YGFloatsEqual(fmodf(nodeWidth, 1 / pointScaleFactor), 0);
3475+
const bool hasFractionalHeight = !YGFloatsEqual(fmodf(nodeHeight, 1 / pointScaleFactor), 0);
34763476

34773477
node->layout.dimensions[YGDimensionWidth] =
34783478
YGRoundValueToPixelGrid(

0 commit comments

Comments
 (0)