Revert D74292949: Expose Unsnapped Dimensions
Differential Revision: D74292949 Original commit changeset: 05011c66a9a9 Original Phabricator Diff: D74292949 fbshipit-source-id: c6ca51c7b882950d54b6a43e206973774db40429
This commit is contained in:
committed by
Facebook GitHub Bot
parent
37a94a86de
commit
624325302c
@@ -161,23 +161,3 @@ TEST(YogaTest, per_node_point_scale_factor) {
|
|||||||
YGConfigFree(config2);
|
YGConfigFree(config2);
|
||||||
YGConfigFree(config3);
|
YGConfigFree(config3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, raw_layout_dimensions) {
|
|
||||||
YGConfigRef config = YGConfigNew();
|
|
||||||
YGConfigSetPointScaleFactor(config, 0.5f);
|
|
||||||
|
|
||||||
YGNodeRef root = YGNodeNewWithConfig(config);
|
|
||||||
YGNodeStyleSetWidth(root, 11.5f);
|
|
||||||
YGNodeStyleSetHeight(root, 9.5f);
|
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
|
||||||
|
|
||||||
ASSERT_EQ(YGNodeLayoutGetWidth(root), 12.0f);
|
|
||||||
ASSERT_EQ(YGNodeLayoutGetHeight(root), 10.0f);
|
|
||||||
ASSERT_EQ(YGNodeLayoutGetRawWidth(root), 11.5f);
|
|
||||||
ASSERT_EQ(YGNodeLayoutGetRawHeight(root), 9.5f);
|
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
|
||||||
|
|
||||||
YGConfigFree(config);
|
|
||||||
}
|
|
||||||
|
@@ -90,11 +90,3 @@ float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge) {
|
|||||||
return getResolvedLayoutProperty<&LayoutResults::padding>(
|
return getResolvedLayoutProperty<&LayoutResults::padding>(
|
||||||
node, scopedEnum(edge));
|
node, scopedEnum(edge));
|
||||||
}
|
}
|
||||||
|
|
||||||
float YGNodeLayoutGetRawHeight(YGNodeConstRef node) {
|
|
||||||
return resolveRef(node)->getLayout().rawDimension(Dimension::Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
float YGNodeLayoutGetRawWidth(YGNodeConstRef node) {
|
|
||||||
return resolveRef(node)->getLayout().rawDimension(Dimension::Width);
|
|
||||||
}
|
|
||||||
|
@@ -32,14 +32,4 @@ YG_EXPORT float YGNodeLayoutGetMargin(YGNodeConstRef node, YGEdge edge);
|
|||||||
YG_EXPORT float YGNodeLayoutGetBorder(YGNodeConstRef node, YGEdge edge);
|
YG_EXPORT float YGNodeLayoutGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||||
YG_EXPORT float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge);
|
YG_EXPORT float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the measured height of the node, before layout rounding
|
|
||||||
*/
|
|
||||||
YG_EXPORT float YGNodeLayoutGetRawHeight(YGNodeConstRef node);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the measured width of the node, before layout rounding
|
|
||||||
*/
|
|
||||||
YG_EXPORT float YGNodeLayoutGetRawWidth(YGNodeConstRef node);
|
|
||||||
|
|
||||||
YG_EXTERN_C_END
|
YG_EXTERN_C_END
|
||||||
|
@@ -106,25 +106,25 @@ void roundLayoutResultsToPixelGrid(
|
|||||||
const bool hasFractionalHeight =
|
const bool hasFractionalHeight =
|
||||||
!yoga::inexactEquals(round(scaledNodeHeight), scaledNodeHeight);
|
!yoga::inexactEquals(round(scaledNodeHeight), scaledNodeHeight);
|
||||||
|
|
||||||
node->getLayout().setDimension(
|
node->setLayoutDimension(
|
||||||
Dimension::Width,
|
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeRight,
|
absoluteNodeRight,
|
||||||
pointScaleFactor,
|
pointScaleFactor,
|
||||||
(textRounding && hasFractionalWidth),
|
(textRounding && hasFractionalWidth),
|
||||||
(textRounding && !hasFractionalWidth)) -
|
(textRounding && !hasFractionalWidth)) -
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeLeft, pointScaleFactor, false, textRounding));
|
absoluteNodeLeft, pointScaleFactor, false, textRounding),
|
||||||
|
Dimension::Width);
|
||||||
|
|
||||||
node->getLayout().setDimension(
|
node->setLayoutDimension(
|
||||||
Dimension::Height,
|
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeBottom,
|
absoluteNodeBottom,
|
||||||
pointScaleFactor,
|
pointScaleFactor,
|
||||||
(textRounding && hasFractionalHeight),
|
(textRounding && hasFractionalHeight),
|
||||||
(textRounding && !hasFractionalHeight)) -
|
(textRounding && !hasFractionalHeight)) -
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeTop, pointScaleFactor, false, textRounding));
|
absoluteNodeTop, pointScaleFactor, false, textRounding),
|
||||||
|
Dimension::Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (yoga::Node* child : node->getChildren()) {
|
for (yoga::Node* child : node->getChildren()) {
|
||||||
|
@@ -66,18 +66,10 @@ struct LayoutResults {
|
|||||||
return measuredDimensions_[yoga::to_underlying(axis)];
|
return measuredDimensions_[yoga::to_underlying(axis)];
|
||||||
}
|
}
|
||||||
|
|
||||||
float rawDimension(Dimension axis) const {
|
|
||||||
return rawDimensions_[yoga::to_underlying(axis)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void setMeasuredDimension(Dimension axis, float dimension) {
|
void setMeasuredDimension(Dimension axis, float dimension) {
|
||||||
measuredDimensions_[yoga::to_underlying(axis)] = dimension;
|
measuredDimensions_[yoga::to_underlying(axis)] = dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRawDimension(Dimension axis, float dimension) {
|
|
||||||
rawDimensions_[yoga::to_underlying(axis)] = dimension;
|
|
||||||
}
|
|
||||||
|
|
||||||
float position(PhysicalEdge physicalEdge) const {
|
float position(PhysicalEdge physicalEdge) const {
|
||||||
return position_[yoga::to_underlying(physicalEdge)];
|
return position_[yoga::to_underlying(physicalEdge)];
|
||||||
}
|
}
|
||||||
@@ -121,7 +113,6 @@ struct LayoutResults {
|
|||||||
|
|
||||||
std::array<float, 2> dimensions_ = {{YGUndefined, YGUndefined}};
|
std::array<float, 2> dimensions_ = {{YGUndefined, YGUndefined}};
|
||||||
std::array<float, 2> measuredDimensions_ = {{YGUndefined, YGUndefined}};
|
std::array<float, 2> measuredDimensions_ = {{YGUndefined, YGUndefined}};
|
||||||
std::array<float, 2> rawDimensions_ = {{YGUndefined, YGUndefined}};
|
|
||||||
std::array<float, 4> position_ = {};
|
std::array<float, 4> position_ = {};
|
||||||
std::array<float, 4> margin_ = {};
|
std::array<float, 4> margin_ = {};
|
||||||
std::array<float, 4> border_ = {};
|
std::array<float, 4> border_ = {};
|
||||||
|
@@ -247,7 +247,6 @@ void Node::setLayoutHadOverflow(bool hadOverflow) {
|
|||||||
|
|
||||||
void Node::setLayoutDimension(float lengthValue, Dimension dimension) {
|
void Node::setLayoutDimension(float lengthValue, Dimension dimension) {
|
||||||
layout_.setDimension(dimension, lengthValue);
|
layout_.setDimension(dimension, lengthValue);
|
||||||
layout_.setRawDimension(dimension, lengthValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If both left and right are defined, then use left. Otherwise return +left or
|
// If both left and right are defined, then use left. Otherwise return +left or
|
||||||
|
Reference in New Issue
Block a user