MCPcopy Create free account
hub / github.com/Snapchat/Valdi / updateCSS

Method updateCSS

valdi/src/valdi/runtime/Context/ViewNode.cpp:3166–3197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3164bool ViewNode::handleCSSChange(bool cssChanged) {
3165 if (cssChanged) {
3166 setCSSNeedsUpdate();
3167 }
3168 return cssChanged;
3169}
3170
3171bool ViewNode::isHorizontal() {
3172 auto flexDirection = getYogaStyle(getYogaNodeForInsertingChildren()).flexDirection();
3173 return flexDirection == facebook::yoga::FlexDirection::Row ||
3174 flexDirection == facebook::yoga::FlexDirection::RowReverse;
3175}
3176
3177bool ViewNode::setAttribute(ViewTransactionScope& viewTransactionScope,
3178 AttributeId attributeId,
3179 const AttributeOwner* attributeOwner,
3180 const Value& attributeValue,
3181 const Ref<Animator>& animator) {
3182 return setAttribute(viewTransactionScope, attributeId, attributeOwner, attributeValue, animator, false);
3183}
3184
3185bool ViewNode::setAttribute(ViewTransactionScope& viewTransactionScope,
3186 AttributeId attributeId,
3187 const AttributeOwner* attributeOwner,
3188 const Value& attributeValue,
3189 const Ref<Animator>& animator,
3190 bool isOverridenFromParent) {
3191 if (attributeId == DefaultAttributeId) {
3192 return handleCSSChange(
3193 getCSSAttributesManager().setElementId(attributeValue.toStringBox(), isOverridenFromParent));
3194 } else if (attributeId == DefaultAttributeElementTag) {
3195 return handleCSSChange(
3196 getCSSAttributesManager().setElementTag(attributeValue.toStringBox(), isOverridenFromParent));
3197 } else if (attributeId == DefaultAttributeCSSDocument) {
3198 return handleCSSChange(getCSSAttributesManager().setCSSDocument(attributeValue, isOverridenFromParent));
3199 } else if (attributeId == DefaultAttributeCSSClass) {
3200 return handleCSSChange(getCSSAttributesManager().setCSSClass(attributeValue, isOverridenFromParent));

Callers 1

UpdateCSSFunction · 0.45

Calls 6

getChildCountFunction · 0.85
setSiblingsIndexesMethod · 0.80
flushMethod · 0.65
startMethod · 0.65
elapsedMethod · 0.45

Tested by 1

UpdateCSSFunction · 0.36