MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / css

Method css

Source/Node/AlignNode.cpp:349–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void AlignNode::css(String css) {
350 AssertUnless(_yogaNode, "Yoga node is destroyed");
351 auto styles = parseCssStyle(css.toView());
352 for (const auto& [key, value] : styles) {
353 switch (Switch::hash(key)) {
354 case "direction"_hash: {
355 if (auto var = mapDirection(value)) {
356 YGNodeStyleSetDirection(_yogaNode, var.value());
357 }
358 break;
359 }
360 case "align-content"_hash: {
361 if (auto var = mapAlign(value)) {
362 YGNodeStyleSetAlignContent(_yogaNode, var.value());
363 }
364 break;
365 }
366 case "align-items"_hash: {
367 if (auto var = mapAlign(value)) {
368 YGNodeStyleSetAlignItems(_yogaNode, var.value());
369 }
370 break;
371 }
372 case "align-self"_hash: {
373 if (auto var = mapAlign(value)) {
374 YGNodeStyleSetAlignSelf(_yogaNode, var.value());
375 }
376 break;
377 }
378 case "flex-direction"_hash: {
379 if (auto var = mapFlexDirection(value)) {
380 YGNodeStyleSetFlexDirection(_yogaNode, var.value());
381 }
382 break;
383 }
384 case "justify-content"_hash: {
385 if (auto var = mapJustifyContent(value)) {
386 YGNodeStyleSetJustifyContent(_yogaNode, var.value());
387 }
388 break;
389 }
390 case "flex-wrap"_hash: {
391 if (auto var = mapWrap(value)) {
392 YGNodeStyleSetFlexWrap(_yogaNode, var.value());
393 }
394 break;
395 }
396 case "flex"_hash: {
397 if (auto num = safeStringToFloat(value)) {
398 YGNodeStyleSetFlex(_yogaNode, num.value());
399 } else {
400 Warn("invalid CSS Flex: \"{}\", should be a number", value);
401 }
402 break;
403 }
404 case "flex-basis"_hash: {
405 if (!value.empty() && value.back() == '%') {
406 Slice numStr{value};

Callers 4

DoraX.tsFile · 0.45
patchAlignNodePropsFunction · 0.45
YarnTester.tsFile · 0.45
alignnode_cssFunction · 0.45

Calls 15

mapDirectionFunction · 0.85
YGNodeStyleSetDirectionFunction · 0.85
mapAlignFunction · 0.85
YGNodeStyleSetAlignItemsFunction · 0.85
YGNodeStyleSetAlignSelfFunction · 0.85
mapFlexDirectionFunction · 0.85
mapJustifyContentFunction · 0.85
mapWrapFunction · 0.85
YGNodeStyleSetFlexWrapFunction · 0.85

Tested by

no test coverage detected