C++ style enums 15/N: Display (#1397)
Summary: X-link: https://github.com/facebook/react-native/pull/39541 Pull Request resolved: https://github.com/facebook/yoga/pull/1397 Moves internal usages of YGDisplay to Display bypass-github-export-checks Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D49361952 fbshipit-source-id: a961efaa35a3fed01659d23783bf90e0b47656f0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
75bbfb0b71
commit
6bc896e549
@@ -139,7 +139,7 @@ ACCESSOR_TEST(flexWrap, Wrap::NoWrap, Wrap::Wrap, Wrap::WrapReverse)
|
||||
|
||||
ACCESSOR_TEST(overflow, Overflow::Visible, Overflow::Hidden, Overflow::Scroll)
|
||||
|
||||
ACCESSOR_TEST(display, YGDisplayFlex, YGDisplayNone, YGDisplayFlex)
|
||||
ACCESSOR_TEST(display, Display::Flex, Display::None, Display::Flex)
|
||||
|
||||
ACCESSOR_TEST(
|
||||
flex,
|
||||
|
@@ -508,10 +508,10 @@ YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
|
||||
}
|
||||
|
||||
void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) {
|
||||
updateStyle<MSVC_HINT(display)>(node, &Style::display, display);
|
||||
updateStyle<MSVC_HINT(display)>(node, &Style::display, scopedEnum(display));
|
||||
}
|
||||
YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().display();
|
||||
return unscopedEnum(resolveRef(node)->getStyle().display());
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
|
@@ -804,7 +804,7 @@ static float computeFlexBasisForChildren(
|
||||
|
||||
for (auto child : children) {
|
||||
child->resolveDimension();
|
||||
if (child->getStyle().display() == YGDisplayNone) {
|
||||
if (child->getStyle().display() == Display::None) {
|
||||
zeroOutLayoutRecursively(child);
|
||||
child->setHasNewLayout(true);
|
||||
child->setDirty(false);
|
||||
@@ -1307,7 +1307,7 @@ static void justifyMainAxis(
|
||||
const auto child = node->getChild(i);
|
||||
const Style& childStyle = child->getStyle();
|
||||
const LayoutResults& childLayout = child->getLayout();
|
||||
if (childStyle.display() == YGDisplayNone) {
|
||||
if (childStyle.display() == Display::None) {
|
||||
continue;
|
||||
}
|
||||
if (childStyle.positionType() == PositionType::Absolute &&
|
||||
@@ -1863,7 +1863,7 @@ static void calculateLayoutImpl(
|
||||
if (performLayout) {
|
||||
for (size_t i = startOfLineIndex; i < endOfLineIndex; i++) {
|
||||
const auto child = node->getChild(i);
|
||||
if (child->getStyle().display() == YGDisplayNone) {
|
||||
if (child->getStyle().display() == Display::None) {
|
||||
continue;
|
||||
}
|
||||
if (child->getStyle().positionType() == PositionType::Absolute) {
|
||||
@@ -2069,7 +2069,7 @@ static void calculateLayoutImpl(
|
||||
float maxDescentForCurrentLine = 0;
|
||||
for (ii = startIndex; ii < childCount; ii++) {
|
||||
const auto child = node->getChild(ii);
|
||||
if (child->getStyle().display() == YGDisplayNone) {
|
||||
if (child->getStyle().display() == Display::None) {
|
||||
continue;
|
||||
}
|
||||
if (child->getStyle().positionType() != PositionType::Absolute) {
|
||||
@@ -2112,7 +2112,7 @@ static void calculateLayoutImpl(
|
||||
if (performLayout) {
|
||||
for (ii = startIndex; ii < endIndex; ii++) {
|
||||
const auto child = node->getChild(ii);
|
||||
if (child->getStyle().display() == YGDisplayNone) {
|
||||
if (child->getStyle().display() == Display::None) {
|
||||
continue;
|
||||
}
|
||||
if (child->getStyle().positionType() != PositionType::Absolute) {
|
||||
@@ -2318,7 +2318,7 @@ static void calculateLayoutImpl(
|
||||
if (performLayout) {
|
||||
// STEP 10: SIZING AND POSITIONING ABSOLUTE CHILDREN
|
||||
for (auto child : node->getChildren()) {
|
||||
if (child->getStyle().display() == YGDisplayNone ||
|
||||
if (child->getStyle().display() == Display::None ||
|
||||
child->getStyle().positionType() != PositionType::Absolute) {
|
||||
continue;
|
||||
}
|
||||
@@ -2352,7 +2352,7 @@ static void calculateLayoutImpl(
|
||||
if (needsMainTrailingPos || needsCrossTrailingPos) {
|
||||
for (size_t i = 0; i < childCount; i++) {
|
||||
const auto child = node->getChild(i);
|
||||
if (child->getStyle().display() == YGDisplayNone) {
|
||||
if (child->getStyle().display() == Display::None) {
|
||||
continue;
|
||||
}
|
||||
if (needsMainTrailingPos) {
|
||||
|
@@ -38,7 +38,7 @@ FlexLine calculateFlexLine(
|
||||
// Add items to the current line until it's full or we run out of items.
|
||||
for (; endOfLineIndex < node->getChildren().size(); endOfLineIndex++) {
|
||||
auto child = node->getChild(endOfLineIndex);
|
||||
if (child->getStyle().display() == YGDisplayNone ||
|
||||
if (child->getStyle().display() == Display::None ||
|
||||
child->getStyle().positionType() == PositionType::Absolute) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -174,8 +174,7 @@ void nodeToString(
|
||||
}
|
||||
|
||||
if (style.display() != yoga::Node{}.getStyle().display()) {
|
||||
appendFormattedString(
|
||||
str, "display: %s; ", YGDisplayToString(style.display()));
|
||||
appendFormattedString(str, "display: %s; ", toString(style.display()));
|
||||
}
|
||||
appendEdges(str, "margin", style.margin());
|
||||
appendEdges(str, "padding", style.padding());
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <yoga/bits/NumericBitfield.h>
|
||||
#include <yoga/enums/Align.h>
|
||||
#include <yoga/enums/Direction.h>
|
||||
#include <yoga/enums/Display.h>
|
||||
#include <yoga/enums/FlexDirection.h>
|
||||
#include <yoga/enums/Justify.h>
|
||||
#include <yoga/enums/Overflow.h>
|
||||
@@ -209,10 +210,10 @@ class YG_EXPORT Style {
|
||||
return {*this, overflowOffset};
|
||||
}
|
||||
|
||||
YGDisplay display() const {
|
||||
return getEnumData<YGDisplay>(flags, displayOffset);
|
||||
Display display() const {
|
||||
return getEnumData<Display>(flags, displayOffset);
|
||||
}
|
||||
BitfieldRef<YGDisplay> display() {
|
||||
BitfieldRef<Display> display() {
|
||||
return {*this, displayOffset};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user