| 438 | } |
| 439 | |
| 440 | void PiuTextComputeStyles(PiuText* self, PiuApplication* application, PiuView* view) |
| 441 | { |
| 442 | xsMachine *the = (*self)->the; |
| 443 | PiuTextBuffer* nodeBuffer = (*self)->nodeBuffer; |
| 444 | PiuTextOffset nodeOffset = sizeof(PiuTextBufferRecord); |
| 445 | PiuTextOffset nodeLimit = (PiuTextOffset)(*nodeBuffer)->current; |
| 446 | PiuStyle* style; |
| 447 | (*self)->flags |= piuTextStyled; |
| 448 | while (nodeOffset < nodeLimit) { |
| 449 | switch (KIND(nodeOffset)) { |
| 450 | case piuTextNodeBeginBlockKind: |
| 451 | case piuTextNodeBeginSpanKind: { |
| 452 | PiuStyleLink* list = (*application)->styleList; |
| 453 | PiuStyleLink* chain = NULL; |
| 454 | PiuTextNodeBegin node = NODE(nodeOffset); |
| 455 | while (node) { |
| 456 | PiuTextOffset parentOffset = node->parentOffset; |
| 457 | style = node->style; |
| 458 | if (style) { |
| 459 | list = PiuStyleLinkMatch(the, list, chain, style); |
| 460 | chain = list; |
| 461 | } |
| 462 | if (parentOffset >= 0) |
| 463 | node = NODE(parentOffset); |
| 464 | else { |
| 465 | PiuContainer* container = (PiuContainer*)self; |
| 466 | while (container) { |
| 467 | style = (*container)->style; |
| 468 | if (style) { |
| 469 | list = PiuStyleLinkMatch(the, list, chain, style); |
| 470 | chain = list; |
| 471 | } |
| 472 | container = (*container)->container; |
| 473 | } |
| 474 | break; |
| 475 | } |
| 476 | } |
| 477 | if (chain) { |
| 478 | style = PiuStyleLinkCompute(the, chain, application); |
| 479 | node = NODE(nodeOffset); |
| 480 | node->computedStyle = style; |
| 481 | #ifdef piuGPU |
| 482 | PiuStyleBind(node->computedStyle, application, view); |
| 483 | #endif |
| 484 | } |
| 485 | else { |
| 486 | (*self)->flags &= ~piuTextStyled; |
| 487 | } |
| 488 | nodeOffset += sizeof(PiuTextNodeBeginRecord); |
| 489 | } break; |
| 490 | case piuTextNodeEndBlockKind: |
| 491 | case piuTextNodeEndSpanKind: |
| 492 | nodeOffset += sizeof(PiuTextNodeEndRecord); |
| 493 | break; |
| 494 | case piuTextNodeStringKind: |
| 495 | nodeOffset += sizeof(PiuTextNodeStringRecord); |
| 496 | break; |
| 497 | } |
no test coverage detected