Fix rounding issue when setting padding

Summary:
Changelog: [Internal]

Padding needs to be rounded down (floor function), not rounded to the closest natural number.
Otherwise the content of the view might not fit.

Reviewed By: JoshuaGross

Differential Revision: D23905145

fbshipit-source-id: e84d70155b207144b98646dd0c4fea7a8c4bd876
This commit is contained in:
Samuel Susla
2020-09-24 10:36:21 -07:00
committed by Facebook GitHub Bot
parent 663b5a878b
commit d5f7622611
@@ -442,10 +442,10 @@ local_ref<JMountItem::javaobject> createUpdatePaddingMountItem(
auto pointScaleFactor = layoutMetrics.pointScaleFactor;
auto contentInsets = layoutMetrics.contentInsets;
int left = round(contentInsets.left * pointScaleFactor);
int top = round(contentInsets.top * pointScaleFactor);
int right = round(contentInsets.right * pointScaleFactor);
int bottom = round(contentInsets.bottom * pointScaleFactor);
int left = floor(contentInsets.left * pointScaleFactor);
int top = floor(contentInsets.top * pointScaleFactor);
int right = floor(contentInsets.right * pointScaleFactor);
int bottom = floor(contentInsets.bottom * pointScaleFactor);
return updatePaddingInstruction(
javaUIManager, newChildShadowView.tag, left, top, right, bottom);