C++ style enums 14/N: Overflow (#1398)
Summary: X-link: https://github.com/facebook/react-native/pull/39537 Pull Request resolved: https://github.com/facebook/yoga/pull/1398 Moves internal usages of YGOverflow to Overflow bypass-github-export-checks Changelog: [Internal] Reviewed By: rshest Differential Revision: D49361843 fbshipit-source-id: 42161aa8a26f64f052587b861120cdad0290ae46
This commit is contained in:
committed by
Facebook GitHub Bot
parent
03d0523996
commit
75bbfb0b71
@@ -137,12 +137,7 @@ ACCESSOR_TEST(
|
|||||||
|
|
||||||
ACCESSOR_TEST(flexWrap, Wrap::NoWrap, Wrap::Wrap, Wrap::WrapReverse)
|
ACCESSOR_TEST(flexWrap, Wrap::NoWrap, Wrap::Wrap, Wrap::WrapReverse)
|
||||||
|
|
||||||
ACCESSOR_TEST(
|
ACCESSOR_TEST(overflow, Overflow::Visible, Overflow::Hidden, Overflow::Scroll)
|
||||||
overflow,
|
|
||||||
YGOverflowVisible,
|
|
||||||
YGOverflowHidden,
|
|
||||||
YGOverflowScroll,
|
|
||||||
YGOverflowVisible)
|
|
||||||
|
|
||||||
ACCESSOR_TEST(display, YGDisplayFlex, YGDisplayNone, YGDisplayFlex)
|
ACCESSOR_TEST(display, YGDisplayFlex, YGDisplayNone, YGDisplayFlex)
|
||||||
|
|
||||||
|
@@ -500,10 +500,11 @@ YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetOverflow(const YGNodeRef node, const YGOverflow overflow) {
|
void YGNodeStyleSetOverflow(const YGNodeRef node, const YGOverflow overflow) {
|
||||||
updateStyle<MSVC_HINT(overflow)>(node, &Style::overflow, overflow);
|
updateStyle<MSVC_HINT(overflow)>(
|
||||||
|
node, &Style::overflow, scopedEnum(overflow));
|
||||||
}
|
}
|
||||||
YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
|
YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
|
||||||
return resolveRef(node)->getStyle().overflow();
|
return unscopedEnum(resolveRef(node)->getStyle().overflow());
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) {
|
void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) {
|
||||||
|
@@ -211,16 +211,16 @@ static void computeFlexBasisForChild(
|
|||||||
|
|
||||||
// The W3C spec doesn't say anything about the 'overflow' property, but all
|
// The W3C spec doesn't say anything about the 'overflow' property, but all
|
||||||
// major browsers appear to implement the following logic.
|
// major browsers appear to implement the following logic.
|
||||||
if ((!isMainAxisRow && node->getStyle().overflow() == YGOverflowScroll) ||
|
if ((!isMainAxisRow && node->getStyle().overflow() == Overflow::Scroll) ||
|
||||||
node->getStyle().overflow() != YGOverflowScroll) {
|
node->getStyle().overflow() != Overflow::Scroll) {
|
||||||
if (yoga::isUndefined(childWidth) && !yoga::isUndefined(width)) {
|
if (yoga::isUndefined(childWidth) && !yoga::isUndefined(width)) {
|
||||||
childWidth = width;
|
childWidth = width;
|
||||||
childWidthMeasureMode = MeasureMode::AtMost;
|
childWidthMeasureMode = MeasureMode::AtMost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isMainAxisRow && node->getStyle().overflow() == YGOverflowScroll) ||
|
if ((isMainAxisRow && node->getStyle().overflow() == Overflow::Scroll) ||
|
||||||
node->getStyle().overflow() != YGOverflowScroll) {
|
node->getStyle().overflow() != Overflow::Scroll) {
|
||||||
if (yoga::isUndefined(childHeight) && !yoga::isUndefined(height)) {
|
if (yoga::isUndefined(childHeight) && !yoga::isUndefined(height)) {
|
||||||
childHeight = height;
|
childHeight = height;
|
||||||
childHeightMeasureMode = MeasureMode::AtMost;
|
childHeightMeasureMode = MeasureMode::AtMost;
|
||||||
@@ -2242,7 +2242,7 @@ static void calculateLayoutImpl(
|
|||||||
// If the user didn't specify a width or height for the node, set the
|
// If the user didn't specify a width or height for the node, set the
|
||||||
// dimensions based on the children.
|
// dimensions based on the children.
|
||||||
if (measureModeMainDim == MeasureMode::Undefined ||
|
if (measureModeMainDim == MeasureMode::Undefined ||
|
||||||
(node->getStyle().overflow() != YGOverflowScroll &&
|
(node->getStyle().overflow() != Overflow::Scroll &&
|
||||||
measureModeMainDim == MeasureMode::AtMost)) {
|
measureModeMainDim == MeasureMode::AtMost)) {
|
||||||
// Clamp the size to the min/max size, if specified, and make sure it
|
// Clamp the size to the min/max size, if specified, and make sure it
|
||||||
// doesn't go below the padding and border amount.
|
// doesn't go below the padding and border amount.
|
||||||
@@ -2253,7 +2253,7 @@ static void calculateLayoutImpl(
|
|||||||
|
|
||||||
} else if (
|
} else if (
|
||||||
measureModeMainDim == MeasureMode::AtMost &&
|
measureModeMainDim == MeasureMode::AtMost &&
|
||||||
node->getStyle().overflow() == YGOverflowScroll) {
|
node->getStyle().overflow() == Overflow::Scroll) {
|
||||||
node->setLayoutMeasuredDimension(
|
node->setLayoutMeasuredDimension(
|
||||||
yoga::maxOrDefined(
|
yoga::maxOrDefined(
|
||||||
yoga::minOrDefined(
|
yoga::minOrDefined(
|
||||||
@@ -2269,7 +2269,7 @@ static void calculateLayoutImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (measureModeCrossDim == MeasureMode::Undefined ||
|
if (measureModeCrossDim == MeasureMode::Undefined ||
|
||||||
(node->getStyle().overflow() != YGOverflowScroll &&
|
(node->getStyle().overflow() != Overflow::Scroll &&
|
||||||
measureModeCrossDim == MeasureMode::AtMost)) {
|
measureModeCrossDim == MeasureMode::AtMost)) {
|
||||||
// Clamp the size to the min/max size, if specified, and make sure it
|
// Clamp the size to the min/max size, if specified, and make sure it
|
||||||
// doesn't go below the padding and border amount.
|
// doesn't go below the padding and border amount.
|
||||||
@@ -2284,7 +2284,7 @@ static void calculateLayoutImpl(
|
|||||||
|
|
||||||
} else if (
|
} else if (
|
||||||
measureModeCrossDim == MeasureMode::AtMost &&
|
measureModeCrossDim == MeasureMode::AtMost &&
|
||||||
node->getStyle().overflow() == YGOverflowScroll) {
|
node->getStyle().overflow() == Overflow::Scroll) {
|
||||||
node->setLayoutMeasuredDimension(
|
node->setLayoutMeasuredDimension(
|
||||||
yoga::maxOrDefined(
|
yoga::maxOrDefined(
|
||||||
yoga::minOrDefined(
|
yoga::minOrDefined(
|
||||||
|
@@ -170,8 +170,7 @@ void nodeToString(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (style.overflow() != yoga::Node{}.getStyle().overflow()) {
|
if (style.overflow() != yoga::Node{}.getStyle().overflow()) {
|
||||||
appendFormattedString(
|
appendFormattedString(str, "overflow: %s; ", toString(style.overflow()));
|
||||||
str, "overflow: %s; ", YGOverflowToString(style.overflow()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.display() != yoga::Node{}.getStyle().display()) {
|
if (style.display() != yoga::Node{}.getStyle().display()) {
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include <yoga/enums/Direction.h>
|
#include <yoga/enums/Direction.h>
|
||||||
#include <yoga/enums/FlexDirection.h>
|
#include <yoga/enums/FlexDirection.h>
|
||||||
#include <yoga/enums/Justify.h>
|
#include <yoga/enums/Justify.h>
|
||||||
|
#include <yoga/enums/Overflow.h>
|
||||||
#include <yoga/enums/PositionType.h>
|
#include <yoga/enums/PositionType.h>
|
||||||
#include <yoga/enums/Wrap.h>
|
#include <yoga/enums/Wrap.h>
|
||||||
#include <yoga/numeric/FloatOptional.h>
|
#include <yoga/numeric/FloatOptional.h>
|
||||||
@@ -122,7 +123,7 @@ class YG_EXPORT Style {
|
|||||||
static constexpr uint8_t overflowOffset =
|
static constexpr uint8_t overflowOffset =
|
||||||
flexWrapOffset + minimumBitCount<Wrap>();
|
flexWrapOffset + minimumBitCount<Wrap>();
|
||||||
static constexpr uint8_t displayOffset =
|
static constexpr uint8_t displayOffset =
|
||||||
overflowOffset + minimumBitCount<YGOverflow>();
|
overflowOffset + minimumBitCount<Overflow>();
|
||||||
|
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
|
||||||
@@ -201,10 +202,10 @@ class YG_EXPORT Style {
|
|||||||
return {*this, flexWrapOffset};
|
return {*this, flexWrapOffset};
|
||||||
}
|
}
|
||||||
|
|
||||||
YGOverflow overflow() const {
|
Overflow overflow() const {
|
||||||
return getEnumData<YGOverflow>(flags, overflowOffset);
|
return getEnumData<Overflow>(flags, overflowOffset);
|
||||||
}
|
}
|
||||||
BitfieldRef<YGOverflow> overflow() {
|
BitfieldRef<Overflow> overflow() {
|
||||||
return {*this, overflowOffset};
|
return {*this, overflowOffset};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user