Remove bitfield from YGNode.h
Summary: ##Changelog: [Internal][Yoga] remove Bitfield from YGNode.h Reviewed By: astreet Differential Revision: D18519633 fbshipit-source-id: b5a7d8d5ee960c5618df382900c4ded3da0587a6
This commit is contained in:
committed by
Facebook Github Bot
parent
aeb9549af7
commit
f7f134274c
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <stdio.h>
|
||||
#include "Bitfield.h"
|
||||
#include "BitUtils.h"
|
||||
#include "CompactValue.h"
|
||||
#include "YGConfig.h"
|
||||
#include "YGLayout.h"
|
||||
@@ -35,10 +35,7 @@ private:
|
||||
static constexpr size_t useWebDefaults_ = 7;
|
||||
|
||||
void* context_ = nullptr;
|
||||
using Flags = facebook::yoga::
|
||||
Bitfield<uint8_t, bool, bool, bool, YGNodeType, bool, bool, bool, bool>;
|
||||
Flags flags_ =
|
||||
{true, false, false, YGNodeTypeDefault, false, false, false, false};
|
||||
uint8_t flags = 1;
|
||||
uint8_t reserved_ = 0;
|
||||
union {
|
||||
YGMeasureFunc noContext;
|
||||
@@ -70,7 +67,7 @@ private:
|
||||
void setBaselineFunc(decltype(baseline_));
|
||||
|
||||
void useWebDefaults() {
|
||||
flags_.at<useWebDefaults_>() = true;
|
||||
facebook::yoga::detail::setBooleanData(flags, useWebDefaults_, true);
|
||||
style_.flexDirection() = YGFlexDirectionRow;
|
||||
style_.alignContent() = YGAlignStretch;
|
||||
}
|
||||
@@ -114,9 +111,13 @@ public:
|
||||
|
||||
void print(void*);
|
||||
|
||||
bool getHasNewLayout() const { return flags_.at<hasNewLayout_>(); }
|
||||
bool getHasNewLayout() const {
|
||||
return facebook::yoga::detail::getBooleanData(flags, hasNewLayout_);
|
||||
}
|
||||
|
||||
YGNodeType getNodeType() const { return flags_.at<nodeType_>(); }
|
||||
YGNodeType getNodeType() const {
|
||||
return facebook::yoga::detail::getEnumData<YGNodeType>(flags, nodeType_);
|
||||
}
|
||||
|
||||
bool hasMeasureFunc() const noexcept { return measure_.noContext != nullptr; }
|
||||
|
||||
@@ -142,7 +143,9 @@ public:
|
||||
|
||||
uint32_t getLineIndex() const { return lineIndex_; }
|
||||
|
||||
bool isReferenceBaseline() { return flags_.at<isReferenceBaseline_>(); }
|
||||
bool isReferenceBaseline() {
|
||||
return facebook::yoga::detail::getBooleanData(flags, isReferenceBaseline_);
|
||||
}
|
||||
|
||||
// returns the YGNodeRef that owns this YGNode. An owner is used to identify
|
||||
// the YogaTree that a YGNode belongs to. This method will return the parent
|
||||
@@ -175,7 +178,9 @@ public:
|
||||
|
||||
YGConfigRef getConfig() const { return config_; }
|
||||
|
||||
bool isDirty() const { return flags_.at<isDirty_>(); }
|
||||
bool isDirty() const {
|
||||
return facebook::yoga::detail::getBooleanData(flags, isDirty_);
|
||||
}
|
||||
|
||||
std::array<YGValue, 2> getResolvedDimensions() const {
|
||||
return resolvedDimensions_;
|
||||
@@ -223,19 +228,22 @@ public:
|
||||
|
||||
void setPrintFunc(YGPrintFunc printFunc) {
|
||||
print_.noContext = printFunc;
|
||||
flags_.at<printUsesContext_>() = false;
|
||||
facebook::yoga::detail::setBooleanData(flags, printUsesContext_, false);
|
||||
}
|
||||
void setPrintFunc(PrintWithContextFn printFunc) {
|
||||
print_.withContext = printFunc;
|
||||
flags_.at<printUsesContext_>() = true;
|
||||
facebook::yoga::detail::setBooleanData(flags, printUsesContext_, true);
|
||||
}
|
||||
void setPrintFunc(std::nullptr_t) { setPrintFunc(YGPrintFunc{nullptr}); }
|
||||
|
||||
void setHasNewLayout(bool hasNewLayout) {
|
||||
flags_.at<hasNewLayout_>() = hasNewLayout;
|
||||
facebook::yoga::detail::setBooleanData(flags, hasNewLayout_, hasNewLayout);
|
||||
}
|
||||
|
||||
void setNodeType(YGNodeType nodeType) { flags_.at<nodeType_>() = nodeType; }
|
||||
void setNodeType(YGNodeType nodeType) {
|
||||
return facebook::yoga::detail::setEnumData<YGNodeType>(
|
||||
flags, nodeType_, nodeType);
|
||||
}
|
||||
|
||||
void setMeasureFunc(YGMeasureFunc measureFunc);
|
||||
void setMeasureFunc(MeasureWithContextFn);
|
||||
@@ -244,11 +252,11 @@ public:
|
||||
}
|
||||
|
||||
void setBaselineFunc(YGBaselineFunc baseLineFunc) {
|
||||
flags_.at<baselineUsesContext_>() = false;
|
||||
facebook::yoga::detail::setBooleanData(flags, baselineUsesContext_, false);
|
||||
baseline_.noContext = baseLineFunc;
|
||||
}
|
||||
void setBaselineFunc(BaselineWithContextFn baseLineFunc) {
|
||||
flags_.at<baselineUsesContext_>() = true;
|
||||
facebook::yoga::detail::setBooleanData(flags, baselineUsesContext_, true);
|
||||
baseline_.withContext = baseLineFunc;
|
||||
}
|
||||
void setBaselineFunc(std::nullptr_t) {
|
||||
@@ -264,7 +272,8 @@ public:
|
||||
void setLineIndex(uint32_t lineIndex) { lineIndex_ = lineIndex; }
|
||||
|
||||
void setIsReferenceBaseline(bool isReferenceBaseline) {
|
||||
flags_.at<isReferenceBaseline_>() = isReferenceBaseline;
|
||||
facebook::yoga::detail::setBooleanData(
|
||||
flags, isReferenceBaseline_, isReferenceBaseline);
|
||||
}
|
||||
|
||||
void setOwner(YGNodeRef owner) { owner_ = owner; }
|
||||
|
Reference in New Issue
Block a user