@geastack/engine 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ui/text.cpp CHANGED
@@ -51,30 +51,30 @@ struct ScopedRefreshStat
51
51
 
52
52
  bool hasTransformState(const Node &node)
53
53
  {
54
- return hasIndividualLinearTransform(rstyle(node.style)) || hadIndividualLinearTransform(node.render) ||
55
- rstyle(node.style).transform_rotate != 0 ||
54
+ return hasIndividualLinearTransform(rstyle(node.computedStyle())) || hadIndividualLinearTransform(node.render) ||
55
+ rstyle(node.computedStyle()).transform_rotate != 0 ||
56
56
  node.render.previous_transform_rotate != 0 ||
57
- rstyle(node.style).transform_rotate_x != 0 ||
57
+ rstyle(node.computedStyle()).transform_rotate_x != 0 ||
58
58
  node.render.previous_transform_rotate_x != 0 ||
59
- rstyle(node.style).transform_rotate_y != 0 ||
59
+ rstyle(node.computedStyle()).transform_rotate_y != 0 ||
60
60
  node.render.previous_transform_rotate_y != 0 ||
61
- composedTranslateX(rstyle(node.style)) != 0 ||
61
+ composedTranslateX(rstyle(node.computedStyle())) != 0 ||
62
62
  node.render.previous_transform_translate_x != 0 ||
63
- composedTranslateY(rstyle(node.style)) != 0 ||
63
+ composedTranslateY(rstyle(node.computedStyle())) != 0 ||
64
64
  node.render.previous_transform_translate_y != 0 ||
65
- composedTranslateZ(rstyle(node.style)) != 0 ||
65
+ composedTranslateZ(rstyle(node.computedStyle())) != 0 ||
66
66
  node.render.previous_transform_translate_z != 0 ||
67
- composedTranslateXPercent(rstyle(node.style)) != 0 ||
67
+ composedTranslateXPercent(rstyle(node.computedStyle())) != 0 ||
68
68
  node.render.previous_transform_translate_x_percent != 0 ||
69
- composedTranslateYPercent(rstyle(node.style)) != 0 ||
69
+ composedTranslateYPercent(rstyle(node.computedStyle())) != 0 ||
70
70
  node.render.previous_transform_translate_y_percent != 0 ||
71
- rstyle(node.style).transform_scale_x != 1000 ||
71
+ rstyle(node.computedStyle()).transform_scale_x != 1000 ||
72
72
  node.render.previous_transform_scale_x != 1000 ||
73
- rstyle(node.style).transform_scale_y != 1000 ||
74
- rstyle(node.style).transform_scale_z != 1000 ||
73
+ rstyle(node.computedStyle()).transform_scale_y != 1000 ||
74
+ rstyle(node.computedStyle()).transform_scale_z != 1000 ||
75
75
  node.render.previous_transform_scale_y != 1000 ||
76
76
  node.render.previous_transform_scale_z != 1000 ||
77
- rstyle(node.style).perspective > 0 ||
77
+ rstyle(node.computedStyle()).perspective > 0 ||
78
78
  node.render.previous_perspective > 0;
79
79
  }
80
80
 
@@ -124,7 +124,6 @@ struct LineBreakCacheEntry {
124
124
  int fontId = -2;
125
125
  int fontSize = -1;
126
126
  int lineHeight = 0;
127
- int scaleQ8 = 0; // scale * 256, integer key for bitmap-font variant
128
127
  int lineCount = 0;
129
128
  std::uint16_t renderBytes[kMaxCachedLines];
130
129
  std::uint16_t consumedBytes[kMaxCachedLines];
@@ -215,20 +214,20 @@ bool currentTransformChainIsPureTranslate(const Node &node, float *outX, float *
215
214
  bool anyTranslate = false;
216
215
  for (;;) {
217
216
  const Node &n = id >= 0 ? tree.node(id) : node;
218
- if (hasIndividualLinearTransform(rstyle(n.style)) || (rstyle(n.style).transform_rotate % 3600) != 0 ||
219
- (rstyle(n.style).transform_rotate_x % 3600) != 0 ||
220
- (rstyle(n.style).transform_rotate_y % 3600) != 0 ||
221
- composedTranslateZ(rstyle(n.style)) != 0 ||
222
- rstyle(n.style).transform_scale_x != 1000 ||
223
- rstyle(n.style).transform_scale_y != 1000 ||
224
- rstyle(n.style).transform_scale_z != 1000 ||
225
- rstyle(n.style).perspective > 0)
217
+ if (hasIndividualLinearTransform(rstyle(n.computedStyle())) || (rstyle(n.computedStyle()).transform_rotate % 3600) != 0 ||
218
+ (rstyle(n.computedStyle()).transform_rotate_x % 3600) != 0 ||
219
+ (rstyle(n.computedStyle()).transform_rotate_y % 3600) != 0 ||
220
+ composedTranslateZ(rstyle(n.computedStyle())) != 0 ||
221
+ rstyle(n.computedStyle()).transform_scale_x != 1000 ||
222
+ rstyle(n.computedStyle()).transform_scale_y != 1000 ||
223
+ rstyle(n.computedStyle()).transform_scale_z != 1000 ||
224
+ rstyle(n.computedStyle()).perspective > 0)
226
225
  return false;
227
226
 
228
- const float localDx = static_cast<float>(composedTranslateX(rstyle(n.style))) +
229
- static_cast<float>(n.layout.width) * static_cast<float>(composedTranslateXPercent(rstyle(n.style))) * 0.001f;
230
- const float localDy = static_cast<float>(composedTranslateY(rstyle(n.style))) +
231
- static_cast<float>(n.layout.height) * static_cast<float>(composedTranslateYPercent(rstyle(n.style))) * 0.001f;
227
+ const float localDx = static_cast<float>(composedTranslateX(rstyle(n.computedStyle()))) +
228
+ static_cast<float>(n.layout.width) * static_cast<float>(composedTranslateXPercent(rstyle(n.computedStyle()))) * 0.001f;
229
+ const float localDy = static_cast<float>(composedTranslateY(rstyle(n.computedStyle()))) +
230
+ static_cast<float>(n.layout.height) * static_cast<float>(composedTranslateYPercent(rstyle(n.computedStyle()))) * 0.001f;
232
231
  if (localDx != 0.0f || localDy != 0.0f) {
233
232
  anyTranslate = true;
234
233
  dx += localDx;
@@ -711,10 +710,10 @@ int rasterizedSingleLineInkCenterOffsetY(const char *text,
711
710
 
712
711
  bool recordProjectedRasterText(const Node &node, const char *text, uint8_t /*parentAlpha*/, int tx, int ty, int tw)
713
712
  {
714
- if (node.style.font_id < 0 || std::strchr(text, '\n')) return false;
715
- const int fontSize = node.style.font_size > 0 ? node.style.font_size : kBitmapFontHeight;
713
+ if (node.computedStyle().font_id < 0 || std::strchr(text, '\n')) return false;
714
+ const int fontSize = node.computedStyle().font_size > 0 ? node.computedStyle().font_size : kBitmapFontHeight;
716
715
  gea::framework::graphics::RasterizedFont font =
717
- gea::framework::graphics::FontRegistry::rasterizedFamily(node.style.font_id, fontSize);
716
+ gea::framework::graphics::FontRegistry::rasterizedFamily(node.computedStyle().font_id, fontSize);
718
717
  if (!font.valid()) return false;
719
718
 
720
719
  int lineWidth = 0;
@@ -730,9 +729,9 @@ bool recordProjectedRasterText(const Node &node, const char *text, uint8_t /*par
730
729
  if (lineWidth <= 0) return true;
731
730
 
732
731
  const int fontLineHeight = font.lineHeight();
733
- const int lineAdvance = node.style.line_height > 0 ? node.style.line_height : fontLineHeight;
734
- const int lineBoxOffset = node.style.line_height > 0 ? (lineAdvance - fontLineHeight) / 2 : 0;
735
- const int srcX = tx + alignedOffset(node.style.text_align, tw, lineWidth);
732
+ const int lineAdvance = node.computedStyle().line_height > 0 ? node.computedStyle().line_height : fontLineHeight;
733
+ const int lineBoxOffset = node.computedStyle().line_height > 0 ? (lineAdvance - fontLineHeight) / 2 : 0;
734
+ const int srcX = tx + alignedOffset(node.computedStyle().text_align, tw, lineWidth);
736
735
  const int srcY = ty + lineBoxOffset;
737
736
  const int srcW = lineWidth;
738
737
  const int srcH = fontLineHeight;
@@ -762,15 +761,15 @@ bool recordProjectedRasterText(const Node &node, const char *text, uint8_t /*par
762
761
  cmd->projectedText.y2 = ys[2];
763
762
  cmd->projectedText.x3 = xs[3];
764
763
  cmd->projectedText.y3 = ys[3];
765
- cmd->projectedText.fontId = node.style.font_id;
764
+ cmd->projectedText.fontId = node.computedStyle().font_id;
766
765
  cmd->projectedText.fontSize = fontSize;
767
- cmd->projectedText.color = node.style.text_color;
768
- cmd->projectedText.alpha = node.style.text_alpha;
769
- cmd->projectedText.textTransform = node.style.text_transform;
770
- cmd->projectedText.whiteSpace = node.style.white_space;
766
+ cmd->projectedText.color = node.computedStyle().text_color;
767
+ cmd->projectedText.alpha = node.computedStyle().text_alpha;
768
+ cmd->projectedText.textTransform = node.computedStyle().text_transform;
769
+ cmd->projectedText.whiteSpace = node.computedStyle().white_space;
771
770
  // Flattened ancestor groups are culled by the recorder for every paint type.
772
771
  // This command's flag describes only its own face in a preserve-3d group.
773
- cmd->projectedText.backfaceHidden = node.style.backface_hidden ? 1 : 0;
772
+ cmd->projectedText.backfaceHidden = node.computedStyle().backface_hidden ? 1 : 0;
774
773
  return true;
775
774
  }
776
775
  #endif
@@ -953,14 +952,14 @@ struct GlyphAdvanceSource {
953
952
  GlyphAdvanceSource advanceSourceForNode(const Node &node)
954
953
  {
955
954
  GlyphAdvanceSource src;
956
- const int fontSize = node.style.font_size > 0 ? node.style.font_size : kBitmapFontHeight;
955
+ const int fontSize = node.computedStyle().font_size > 0 ? node.computedStyle().font_size : kBitmapFontHeight;
957
956
  #ifdef GEA_EMBEDDED_HAS_GENERATED_FONTS
958
- if (node.style.font_id >= 0) {
959
- src.font = gea::framework::graphics::FontRegistry::rasterizedFamily(node.style.font_id, fontSize);
957
+ if (node.computedStyle().font_id >= 0) {
958
+ src.font = gea::framework::graphics::FontRegistry::rasterizedFamily(node.computedStyle().font_id, fontSize);
960
959
  if (src.font.valid()) {
961
960
  src.rasterized = true;
962
961
  src.valid = true;
963
- src.lineAdvance = node.style.line_height > 0 ? node.style.line_height : src.font.lineHeight();
962
+ src.lineAdvance = node.computedStyle().line_height > 0 ? node.computedStyle().line_height : src.font.lineHeight();
964
963
  return src;
965
964
  }
966
965
  }
@@ -970,7 +969,7 @@ GlyphAdvanceSource advanceSourceForNode(const Node &node)
970
969
  if (src.glyphWidth < 1) src.glyphWidth = 1;
971
970
  int glyphHeight = static_cast<int>(kBitmapFontHeight * scale + 0.5f);
972
971
  if (glyphHeight < 1) glyphHeight = 1;
973
- src.lineAdvance = node.style.line_height > 0 ? node.style.line_height : glyphHeight;
972
+ src.lineAdvance = node.computedStyle().line_height > 0 ? node.computedStyle().line_height : glyphHeight;
974
973
  src.valid = true;
975
974
  return src;
976
975
  }
@@ -994,26 +993,26 @@ TextLayoutMeasure measureTextLayoutForNode(const Node &node, const char *text, i
994
993
  {
995
994
  if (contentWidth < 0) contentWidth = 0;
996
995
  std::string transformed;
997
- const char *measureText = textWithTransform(text, node.style.text_transform, transformed, node.style.white_space);
996
+ const char *measureText = textWithTransform(text, node.computedStyle().text_transform, transformed, node.computedStyle().white_space);
998
997
  // white-space: nowrap lays the run out as a single line — measure against an
999
998
  // unbounded width so the content box sizes to the full text (then max-width /
1000
999
  // the parent box clamps it). Drawing truncates/ellipsizes the overflow.
1001
- const int measureWidth = (node.style.white_space == 1 || node.style.white_space == 2) ? 32767 : contentWidth;
1000
+ const int measureWidth = (node.computedStyle().white_space == 1 || node.computedStyle().white_space == 2) ? 32767 : contentWidth;
1002
1001
  const TextMeasure measured = TextMetrics::measure(measureText,
1003
1002
  measureWidth,
1004
- node.style.font_id,
1005
- node.style.font_size,
1006
- node.style.line_height,
1007
- node.style.font_weight);
1003
+ node.computedStyle().font_id,
1004
+ node.computedStyle().font_size,
1005
+ node.computedStyle().line_height,
1006
+ node.computedStyle().font_weight);
1008
1007
  TextLayoutMeasure out;
1009
- out.width = measured.width + boxInset(node.style, 1) + boxInset(node.style, 3);
1010
- out.height = measured.height + boxInset(node.style, 0) + boxInset(node.style, 2);
1011
- if (node.style.width != kUnset) out.width = contentSizeToBorderSize(node.style, node.style.width, true);
1012
- else if ((node.style.width_percent != kUnset || node.style.width_expression >= 0) && node.layout.width > 0) out.width = node.layout.width;
1013
- if (node.style.height != kUnset) out.height = contentSizeToBorderSize(node.style, node.style.height, false);
1014
- else if ((node.style.height_percent != kUnset || node.style.height_expression >= 0) && node.layout.height > 0) out.height = node.layout.height;
1015
- out.width = clampBorderBoxSize(node.style, out.width, true);
1016
- out.height = clampBorderBoxSize(node.style, out.height, false);
1008
+ out.width = measured.width + boxInset(node.computedStyle(), 1) + boxInset(node.computedStyle(), 3);
1009
+ out.height = measured.height + boxInset(node.computedStyle(), 0) + boxInset(node.computedStyle(), 2);
1010
+ if (node.computedStyle().width != kUnset) out.width = contentSizeToBorderSize(node.computedStyle(), node.computedStyle().width, true);
1011
+ else if ((node.computedStyle().width_percent != kUnset || node.computedStyle().width_expression >= 0) && node.layout.width > 0) out.width = node.layout.width;
1012
+ if (node.computedStyle().height != kUnset) out.height = contentSizeToBorderSize(node.computedStyle(), node.computedStyle().height, false);
1013
+ else if ((node.computedStyle().height_percent != kUnset || node.computedStyle().height_expression >= 0) && node.layout.height > 0) out.height = node.layout.height;
1014
+ out.width = clampBorderBoxSize(node.computedStyle(), out.width, true);
1015
+ out.height = clampBorderBoxSize(node.computedStyle(), out.height, false);
1017
1016
  return out;
1018
1017
  }
1019
1018
 
@@ -1021,13 +1020,13 @@ int measureSingleLineTextWidthForNode(const Node &node, const char *text)
1021
1020
  {
1022
1021
  if (!text || !text[0]) return 0;
1023
1022
  std::string transformed;
1024
- const char *measureText = textWithTransform(text, node.style.text_transform, transformed, node.style.white_space);
1023
+ const char *measureText = textWithTransform(text, node.computedStyle().text_transform, transformed, node.computedStyle().white_space);
1025
1024
  return TextMetrics::measure(measureText,
1026
1025
  32767,
1027
- node.style.font_id,
1028
- node.style.font_size,
1029
- node.style.line_height,
1030
- node.style.font_weight).width;
1026
+ node.computedStyle().font_id,
1027
+ node.computedStyle().font_size,
1028
+ node.computedStyle().line_height,
1029
+ node.computedStyle().font_weight).width;
1031
1030
  }
1032
1031
 
1033
1032
  struct TextCoverageSink {
@@ -1221,7 +1220,6 @@ private:
1221
1220
  entry.fontId = fontId;
1222
1221
  entry.fontSize = fontSize;
1223
1222
  entry.lineHeight = lineAdvance;
1224
- entry.scaleQ8 = 0;
1225
1223
  entry.lineCount = 0;
1226
1224
 
1227
1225
  const char *p = text;
@@ -1515,11 +1513,11 @@ void Tree::setText(int node, const char *text)
1515
1513
  {
1516
1514
  auto &perf = refreshPerfStatsMutable();
1517
1515
  ScopedRefreshStat timer(perf.treeSetTextUs);
1518
- perf.treeSetTextCalls++;
1516
+ GEA_REFRESH_PERF(perf.treeSetTextCalls++);
1519
1517
  if (node < 0 || node >= nodeCount() || !text) return;
1520
1518
  Node &target = this->node(node);
1521
1519
  if (target.text == text) return;
1522
- perf.treeSetTextChanged++;
1520
+ GEA_REFRESH_PERF(perf.treeSetTextChanged++);
1523
1521
  // Hidden subtree: just store the text. A display:none node paints nothing, so
1524
1522
  // dirtying it for a text change would churn layout (its zero-size box defeats
1525
1523
  // the bbox prediction below -> full relayout) and drop the static-backdrop
@@ -1530,14 +1528,14 @@ void Tree::setText(int node, const char *text)
1530
1528
  int guard = 0;
1531
1529
  for (int a = node; a >= 0 && a < nodeCount() && guard <= nodeCount(); a = this->node(a).parent, ++guard)
1532
1530
  {
1533
- if (this->node(a).style.display == 1)
1531
+ if (this->node(a).computedStyle().display == 1)
1534
1532
  {
1535
1533
  // Same realloc-dangle guard as the visible path below: a node hidden
1536
1534
  // NOW may still have retained commands from when it was visible.
1537
1535
  const char *gid_oldBuffer = target.text.c_str();
1538
1536
  target.text.assign(text);
1539
1537
  if (target.text.c_str() != gid_oldBuffer) DisplayList::instance().scrubNodeText(gid_oldBuffer);
1540
- perf.treeSetTextHidden++;
1538
+ GEA_REFRESH_PERF(perf.treeSetTextHidden++);
1541
1539
  return;
1542
1540
  }
1543
1541
  }
@@ -1596,8 +1594,8 @@ void Tree::setText(int node, const char *text)
1596
1594
  const int gid_previousX0 = gid_hadPartial ? target.render.text_dirty.x0 : 0;
1597
1595
  const int gid_previousX1 = gid_hadPartial ? target.render.text_dirty.x1 : 0;
1598
1596
  const bool gid_canPartial = (!target.render.dirty || gid_hadPartial) &&
1599
- !target.render.bg_recolor_pending && gid_singleLine && target.style.white_space == 1 &&
1600
- target.style.text_align == 0 && gid_prefix < gid_newLen;
1597
+ !target.render.bg_recolor_pending && gid_singleLine && target.computedStyle().white_space == 1 &&
1598
+ target.computedStyle().text_align == 0 && gid_prefix < gid_newLen;
1601
1599
  // Text and recolor shortcuts share their payload. Other pending paint
1602
1600
  // changes require a full node repaint, while consecutive text runs union
1603
1601
  // their extents so none of the earlier changes is forgotten.
@@ -1656,12 +1654,12 @@ void Tree::setText(int node, const char *text)
1656
1654
  if (target.layout.width > 0 && target.layout.height > 0 &&
1657
1655
  target.parent >= 0 && target.first_child < 0 &&
1658
1656
  !hasTransformState(target)) {
1659
- const bool absolute = target.style.position == 1;
1660
- const bool fixedWidth = target.style.width != kUnset || target.style.width_percent != kUnset;
1657
+ const bool absolute = target.computedStyle().position == 1;
1658
+ const bool fixedWidth = target.computedStyle().width != kUnset || target.computedStyle().width_percent != kUnset;
1661
1659
  if (absolute || fixedWidth) {
1662
- const int fixedBoxWidth = target.style.width != kUnset ? target.style.width : target.layout.width;
1660
+ const int fixedBoxWidth = target.computedStyle().width != kUnset ? target.computedStyle().width : target.layout.width;
1663
1661
  const int content_w = fixedWidth
1664
- ? fixedBoxWidth - target.style.padding[1] - target.style.padding[3]
1662
+ ? fixedBoxWidth - target.computedStyle().padding[1] - target.computedStyle().padding[3]
1665
1663
  : 0x4000; // 16384 px — well beyond any panel dimension
1666
1664
  const TextLayoutMeasure measured = measureTextLayoutForNode(target, target.text.c_str(), content_w);
1667
1665
  if (absolute) {
@@ -1679,7 +1677,7 @@ void Tree::setText(int node, const char *text)
1679
1677
  // shift the tail), cover both the old and new extents so no stale pixels remain.
1680
1678
  const bool gid_sameHeight = (measured.height == gid_oldH);
1681
1679
  if (gid_sameHeight && gid_canPartial) {
1682
- const int gid_originX = target.layout.x + target.style.padding[3];
1680
+ const int gid_originX = target.layout.x + target.computedStyle().padding[3];
1683
1681
  constexpr int kTextDirtyPadPx = 4; // AA / glyph-overhang guard
1684
1682
  const int x0 = gid_originX + gid_preW - kTextDirtyPadPx;
1685
1683
  const int x1 = gid_originX + gid_rightW + kTextDirtyPadPx;
@@ -1690,7 +1688,7 @@ void Tree::setText(int node, const char *text)
1690
1688
  }
1691
1689
  }
1692
1690
  if (target.render.text_layout_stable) {
1693
- perf.treeSetTextStable++;
1691
+ GEA_REFRESH_PERF(perf.treeSetTextStable++);
1694
1692
  // The pre-measure confirmed the box is unchanged: geometry can't move,
1695
1693
  // so this is paint-only dirt (unless something else already made the
1696
1694
  // node layout-dirty this frame).
@@ -1709,11 +1707,11 @@ bool TextRenderer::canFragmentInlineRuns(const Node &node)
1709
1707
  if (cached >= 0) return cached != 0;
1710
1708
  int w = 0;
1711
1709
  int h = 0;
1712
- const int fontId = node.style.font_id;
1713
- const int fontSize = node.style.font_size > 0 ? node.style.font_size : kBitmapFontHeight;
1710
+ const int fontId = node.computedStyle().font_id;
1711
+ const int fontSize = node.computedStyle().font_size > 0 ? node.computedStyle().font_size : kBitmapFontHeight;
1714
1712
  const bool hostMeasures =
1715
- gea_host_measure_text_with_style("Mg", 32767, fontId, fontSize, node.style.font_weight, node.style.line_height, &w, &h) ||
1716
- gea_host_measure_text_with_line_height("Mg", 32767, fontId, fontSize, node.style.line_height, &w, &h) ||
1713
+ gea_host_measure_text_with_style("Mg", 32767, fontId, fontSize, node.computedStyle().font_weight, node.computedStyle().line_height, &w, &h) ||
1714
+ gea_host_measure_text_with_line_height("Mg", 32767, fontId, fontSize, node.computedStyle().line_height, &w, &h) ||
1717
1715
  gea_host_measure_text("Mg", 32767, fontId, fontSize, &w, &h);
1718
1716
  cached = hostMeasures ? 0 : 1;
1719
1717
  return cached != 0;
@@ -1721,18 +1719,18 @@ bool TextRenderer::canFragmentInlineRuns(const Node &node)
1721
1719
 
1722
1720
  int TextRenderer::baselineOffset(const Node &node, bool last)
1723
1721
  {
1724
- const int fontSize = node.style.font_size > 0 ? node.style.font_size : 16;
1725
- const auto font = gea::framework::graphics::FontRegistry::rasterizedFamily(node.style.font_id, fontSize);
1726
- if (!font.valid()) return node.layout.height + node.style.margin[2];
1727
- const int lineAdvance = node.style.line_height > 0 ? node.style.line_height : font.lineHeight();
1728
- const int halfLeading = node.style.line_height > 0 ? (lineAdvance - font.lineHeight()) / 2 : 0;
1729
- int offset = boxInset(node.style, 0) + halfLeading + font.ascender();
1722
+ const int fontSize = node.computedStyle().font_size > 0 ? node.computedStyle().font_size : 16;
1723
+ const auto font = gea::framework::graphics::FontRegistry::rasterizedFamily(node.computedStyle().font_id, fontSize);
1724
+ if (!font.valid()) return node.layout.height + node.computedStyle().margin[2];
1725
+ const int lineAdvance = node.computedStyle().line_height > 0 ? node.computedStyle().line_height : font.lineHeight();
1726
+ const int halfLeading = node.computedStyle().line_height > 0 ? (lineAdvance - font.lineHeight()) / 2 : 0;
1727
+ int offset = boxInset(node.computedStyle(), 0) + halfLeading + font.ascender();
1730
1728
  if (last) {
1731
1729
  std::string storage;
1732
- const char *text = prepareText(node.text.c_str(), node.style.text_transform, node.style.white_space, storage);
1733
- const int width = node.style.white_space == 1 || node.style.white_space == 2
1734
- ? 32767 : std::max(1, node.layout.width - boxInsets(node.style, true));
1735
- const auto measured = TextMetrics::measure(text, width, node.style.font_id, fontSize, node.style.line_height, node.style.font_weight);
1730
+ const char *text = prepareText(node.text.c_str(), node.computedStyle().text_transform, node.computedStyle().white_space, storage);
1731
+ const int width = node.computedStyle().white_space == 1 || node.computedStyle().white_space == 2
1732
+ ? 32767 : std::max(1, node.layout.width - boxInsets(node.computedStyle(), true));
1733
+ const auto measured = TextMetrics::measure(text, width, node.computedStyle().font_id, fontSize, node.computedStyle().line_height, node.computedStyle().font_weight);
1736
1734
  offset += std::max(0, measured.height - lineAdvance);
1737
1735
  }
1738
1736
  return offset;
@@ -1745,20 +1743,20 @@ InlineFlowMeasure TextRenderer::measureInlineFlow(const Node &node, int firstAva
1745
1743
  if (!raw || !raw[0]) return out;
1746
1744
  // nowrap is a single line by definition, and an author-sized box wraps within
1747
1745
  // its own width — neither participates in the block's line boxes.
1748
- if (node.style.white_space == 1 || node.style.white_space == 2) return out;
1746
+ if (node.computedStyle().white_space == 1 || node.computedStyle().white_space == 2) return out;
1749
1747
  if (!canFragmentInlineRuns(node)) return out;
1750
1748
 
1751
1749
  const GlyphAdvanceSource advance = advanceSourceForNode(node);
1752
1750
  if (!advance.valid || advance.lineAdvance <= 0) return out;
1753
1751
 
1754
1752
  std::string transformed;
1755
- const char *text = textWithTransform(raw, node.style.text_transform, transformed, node.style.white_space);
1753
+ const char *text = textWithTransform(raw, node.computedStyle().text_transform, transformed, node.computedStyle().white_space);
1756
1754
  if (!text || !text[0]) return out;
1757
1755
 
1758
1756
  if (contentWidth < 1) contentWidth = 1;
1759
1757
  if (firstAvail < 0) firstAvail = 0;
1760
1758
 
1761
- if (atLineStart && (node.style.white_space == 0 || node.style.white_space == 4)) {
1759
+ if (atLineStart && (node.computedStyle().white_space == 0 || node.computedStyle().white_space == 4)) {
1762
1760
  const int lead = leadingCollapsibleBytes(text);
1763
1761
  if (lead > 0) {
1764
1762
  const char *p = text;
@@ -1778,7 +1776,7 @@ InlineFlowMeasure TextRenderer::measureInlineFlow(const Node &node, int firstAva
1778
1776
  const int visible = line.width + (lineIndex == 0 ? out.firstLineIndentAdjust : 0);
1779
1777
  if (lineIndex == 0) {
1780
1778
  out.firstLineWidth = visible;
1781
- if (node.style.white_space == 0 || node.style.white_space == 4) {
1779
+ if (node.computedStyle().white_space == 0 || node.computedStyle().white_space == 4) {
1782
1780
  const char *end = p + line.renderBytes;
1783
1781
  for (const char *glyph = p; glyph < end;) {
1784
1782
  const int cp = nextUtf8Codepoint(glyph);
@@ -1800,11 +1798,11 @@ InlineFlowMeasure TextRenderer::measureInlineFlow(const Node &node, int firstAva
1800
1798
  int TextRenderer::firstUnbreakableWidth(const Node &node)
1801
1799
  {
1802
1800
  std::string storage;
1803
- const char *text = prepareText(node.text.c_str(), node.style.text_transform, node.style.white_space, storage);
1801
+ const char *text = prepareText(node.text.c_str(), node.computedStyle().text_transform, node.computedStyle().white_space, storage);
1804
1802
  if (!text) return 0;
1805
- if (node.style.white_space == 0 || node.style.white_space == 1 || node.style.white_space == 4)
1803
+ if (node.computedStyle().white_space == 0 || node.computedStyle().white_space == 1 || node.computedStyle().white_space == 4)
1806
1804
  text += leadingCollapsibleBytes(text);
1807
- const bool wrapping = node.style.white_space != 1 && node.style.white_space != 2;
1805
+ const bool wrapping = node.computedStyle().white_space != 1 && node.computedStyle().white_space != 2;
1808
1806
  const char *end = text;
1809
1807
  while (*end) {
1810
1808
  const char *start = end;
@@ -1818,8 +1816,8 @@ int TextRenderer::firstUnbreakableWidth(const Node &node)
1818
1816
  int TextRenderer::minContentWidth(const Node &node, int *pendingWord)
1819
1817
  {
1820
1818
  std::string storage;
1821
- const char *text = prepareText(node.text.c_str(), node.style.text_transform, node.style.white_space, storage);
1822
- const bool wrapping = node.style.white_space != 1 && node.style.white_space != 2;
1819
+ const char *text = prepareText(node.text.c_str(), node.computedStyle().text_transform, node.computedStyle().white_space, storage);
1820
+ const bool wrapping = node.computedStyle().white_space != 1 && node.computedStyle().white_space != 2;
1823
1821
  const char *start = text;
1824
1822
  int width = 0, current = pendingWord ? *pendingWord : 0;
1825
1823
  for (const char *p = text;; ++p) {
@@ -1844,10 +1842,10 @@ void TextRenderer::layout(int id, int avail_w)
1844
1842
  {
1845
1843
  Node *n = &Tree::instance().nodes()[id];
1846
1844
 
1847
- int content_w = avail_w - boxInset(n->style, 1) - boxInset(n->style, 3)
1848
- - n->style.margin[1] - n->style.margin[3];
1849
- if (n->style.width != kUnset) content_w = contentSizeToBorderSize(n->style, n->style.width, true) - boxInset(n->style, 1) - boxInset(n->style, 3);
1850
- else if ((n->style.width_percent != kUnset || n->style.width_expression >= 0) && n->layout.width > 0) content_w = n->layout.width - boxInset(n->style, 1) - boxInset(n->style, 3);
1845
+ int content_w = avail_w - boxInset(n->computedStyle(), 1) - boxInset(n->computedStyle(), 3)
1846
+ - n->computedStyle().margin[1] - n->computedStyle().margin[3];
1847
+ if (n->computedStyle().width != kUnset) content_w = contentSizeToBorderSize(n->computedStyle(), n->computedStyle().width, true) - boxInset(n->computedStyle(), 1) - boxInset(n->computedStyle(), 3);
1848
+ else if ((n->computedStyle().width_percent != kUnset || n->computedStyle().width_expression >= 0) && n->layout.width > 0) content_w = n->layout.width - boxInset(n->computedStyle(), 1) - boxInset(n->computedStyle(), 3);
1851
1849
  if (content_w < 0) content_w = 0;
1852
1850
 
1853
1851
  const TextLayoutMeasure measured = measureTextLayoutForNode(*n, n->text.c_str(), content_w);
@@ -1872,9 +1870,9 @@ bool TextRenderer::remeasureContentBox(int id, bool keepBoxWidth)
1872
1870
  // explicit width re-wraps within the fixed box; natural-width text hugs the
1873
1871
  // new content (the 0x4000 bound matches setText's bbox predictor).
1874
1872
  int content_w = 0x4000;
1875
- if (keepBoxWidth) content_w = n.layout.width - boxInsets(n.style, true);
1876
- else if (n.style.width != kUnset) content_w = contentSizeToBorderSize(n.style, n.style.width, true) - boxInset(n.style, 1) - boxInset(n.style, 3);
1877
- else if ((n.style.width_percent != kUnset || n.style.width_expression >= 0) && n.layout.width > 0) content_w = n.layout.width - boxInset(n.style, 1) - boxInset(n.style, 3);
1873
+ if (keepBoxWidth) content_w = n.layout.width - boxInsets(n.computedStyle(), true);
1874
+ else if (n.computedStyle().width != kUnset) content_w = contentSizeToBorderSize(n.computedStyle(), n.computedStyle().width, true) - boxInset(n.computedStyle(), 1) - boxInset(n.computedStyle(), 3);
1875
+ else if ((n.computedStyle().width_percent != kUnset || n.computedStyle().width_expression >= 0) && n.layout.width > 0) content_w = n.layout.width - boxInset(n.computedStyle(), 1) - boxInset(n.computedStyle(), 3);
1878
1876
  if (content_w < 0) content_w = 0;
1879
1877
  const TextLayoutMeasure measured = measureTextLayoutForNode(n, n.text.c_str(), content_w);
1880
1878
  if (keepBoxWidth) {
@@ -2000,11 +1998,11 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2000
1998
  int y = n->layout.y;
2001
1999
  int w = n->layout.width;
2002
2000
  int h = n->layout.height;
2003
- int tx = x + boxInset(n->style, 3);
2004
- int ty = y + boxInset(n->style, 0);
2005
- int tw = w - boxInset(n->style, 1) - boxInset(n->style, 3);
2001
+ int tx = x + boxInset(n->computedStyle(), 3);
2002
+ int ty = y + boxInset(n->computedStyle(), 0);
2003
+ int tw = w - boxInset(n->computedStyle(), 1) - boxInset(n->computedStyle(), 3);
2006
2004
  if (tw < 0) tw = 0;
2007
- float textScale = n->style.font_size > 0 ? static_cast<float>(n->style.font_size) / kBitmapFontHeight : 1.0f;
2005
+ float textScale = n->computedStyle().font_size > 0 ? static_cast<float>(n->computedStyle().font_size) / kBitmapFontHeight : 1.0f;
2008
2006
 
2009
2007
  int bx = x;
2010
2008
  int by = y;
@@ -2014,7 +2012,7 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2014
2012
  int drawY = ty;
2015
2013
  int drawW = tw;
2016
2014
  int containerW = tw;
2017
- int commandLineHeight = n->style.line_height;
2015
+ int commandLineHeight = n->computedStyle().line_height;
2018
2016
  int transformedX0 = x;
2019
2017
  int transformedY0 = y;
2020
2018
  int transformedX1 = x + w - 1;
@@ -2041,14 +2039,14 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2041
2039
  }
2042
2040
  }
2043
2041
  std::string transformedText;
2044
- const char *measureText = textWithTransform(n->text.c_str(), n->style.text_transform, transformedText, n->style.white_space);
2042
+ const char *measureText = textWithTransform(n->text.c_str(), n->computedStyle().text_transform, transformedText, n->computedStyle().white_space);
2045
2043
  #ifdef GEA_EMBEDDED_HAS_GENERATED_FONTS
2046
2044
  if (transformed && recordProjectedRasterText(*n, measureText, parentAlpha, tx, ty, tw)) return;
2047
2045
  #endif
2048
2046
  if (transformed && transformedX1 >= transformedX0 && transformedY1 >= transformedY0) {
2049
2047
  const int projectedW = transformedX1 - transformedX0 + 1;
2050
2048
  const int projectedH = transformedY1 - transformedY0 + 1;
2051
- const int contentH = h - boxInset(n->style, 0) - boxInset(n->style, 2);
2049
+ const int contentH = h - boxInset(n->computedStyle(), 0) - boxInset(n->computedStyle(), 2);
2052
2050
  const int centerX = transformedX0 + projectedW / 2;
2053
2051
  const int centerY = transformedY0 + projectedH / 2;
2054
2052
  float projectedScaleX = tw > 0 ? static_cast<float>(projectedW) / static_cast<float>(tw) : 1.0f;
@@ -2060,12 +2058,12 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2060
2058
  projectedScale = clampFloat(projectedScale, 0.35f, 1.35f);
2061
2059
  textScale *= projectedScale;
2062
2060
  const int projectedFontSize = static_cast<int>(textScale * kBitmapFontHeight + 0.5f);
2063
- const int projectedLineHeight = n->style.line_height > 0
2064
- ? static_cast<int>(static_cast<float>(n->style.line_height) * projectedScale + 0.5f)
2061
+ const int projectedLineHeight = n->computedStyle().line_height > 0
2062
+ ? static_cast<int>(static_cast<float>(n->computedStyle().line_height) * projectedScale + 0.5f)
2065
2063
  : 0;
2066
2064
  commandLineHeight = projectedLineHeight;
2067
2065
  const TextMeasure projectedMeasure =
2068
- TextMetrics::measure(measureText, 32767, n->style.font_id, projectedFontSize, projectedLineHeight, n->style.font_weight);
2066
+ TextMetrics::measure(measureText, 32767, n->computedStyle().font_id, projectedFontSize, projectedLineHeight, n->computedStyle().font_weight);
2069
2067
  drawW = projectedMeasure.width > 0 ? projectedMeasure.width : projectedW;
2070
2068
  const int drawH = projectedMeasure.height > 0 ? projectedMeasure.height : (contentH > 0 ? contentH : projectedH);
2071
2069
  containerW = drawW;
@@ -2080,7 +2078,7 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2080
2078
  bw = drawX1 - drawX + 1 + pad * 2;
2081
2079
  bh = drawY1 - drawY + 1 + pad * 2;
2082
2080
  #ifdef GEA_EMBEDDED_HAS_GENERATED_FONTS
2083
- if (n->style.font_id >= 0) {
2081
+ if (n->computedStyle().font_id >= 0) {
2084
2082
  const int commandFontSize = static_cast<int>(textScale * kBitmapFontHeight + 0.5f);
2085
2083
  int ix0 = 0;
2086
2084
  int iy0 = 0;
@@ -2088,9 +2086,9 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2088
2086
  int iy1 = -1;
2089
2087
  if (rasterizedTextInkBounds(measureText,
2090
2088
  drawW,
2091
- n->style.text_align,
2089
+ n->computedStyle().text_align,
2092
2090
  containerW,
2093
- n->style.font_id,
2091
+ n->computedStyle().font_id,
2094
2092
  commandFontSize,
2095
2093
  commandLineHeight,
2096
2094
  &ix0,
@@ -2107,8 +2105,8 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2107
2105
  #endif
2108
2106
  }
2109
2107
 
2110
- const bool noWrap = n->style.white_space == 1;
2111
- const bool noSoftWrap = noWrap || n->style.white_space == 2;
2108
+ const bool noWrap = n->computedStyle().white_space == 1;
2109
+ const bool noSoftWrap = noWrap || n->computedStyle().white_space == 2;
2112
2110
  // Inline continuation (see LayoutBox::inline_indent): line 0 starts at
2113
2111
  // `drawX + inlineIndent`, every later line at `drawX`. The tight ink/paint
2114
2112
  // bounds below all assume one origin for the whole run, so an indented run
@@ -2124,7 +2122,7 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2124
2122
  if (!transformed && inlineIndent == 0) {
2125
2123
  const int commandFontSize = static_cast<int>(textScale * kBitmapFontHeight + 0.5f);
2126
2124
  const TextMeasure paintMeasure =
2127
- TextMetrics::measure(measureText, noSoftWrap ? 32767 : drawW, n->style.font_id, commandFontSize, commandLineHeight, n->style.font_weight);
2125
+ TextMetrics::measure(measureText, noSoftWrap ? 32767 : drawW, n->computedStyle().font_id, commandFontSize, commandLineHeight, n->computedStyle().font_weight);
2128
2126
  if (paintMeasure.width > 0 && paintMeasure.height > 0) {
2129
2127
  // CSS: a flex container's bare text becomes an anonymous flex item, so
2130
2128
  // align-items centers (or end-aligns) it on the cross axis. This node
@@ -2133,16 +2131,16 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2133
2131
  // had to fake it with line-height. Row-direction flex only (the cross
2134
2132
  // axis is vertical there); a child-bearing flex container aligns its
2135
2133
  // child BOXES through layout as before.
2136
- if (n->style.display == kDisplayFlex && n->first_child < 0 &&
2137
- usesRowLayout(n->style)) {
2138
- const int contentH = h - boxInset(n->style, 0) - boxInset(n->style, 2);
2134
+ if (n->computedStyle().display == kDisplayFlex && n->first_child < 0 &&
2135
+ usesRowLayout(n->computedStyle())) {
2136
+ const int contentH = h - boxInset(n->computedStyle(), 0) - boxInset(n->computedStyle(), 2);
2139
2137
  const int slack = contentH - paintMeasure.height;
2140
2138
  #if GEA_CSS_FLEX_WRAP
2141
- const bool reverseCrossAxis = (n->style.flex_wrap & 3) == 2;
2139
+ const bool reverseCrossAxis = (n->computedStyle().flex_wrap & 3) == 2;
2142
2140
  #else
2143
2141
  constexpr bool reverseCrossAxis = false;
2144
2142
  #endif
2145
- const int alignment = usedAlignment(n->style.align_items, slack, reverseCrossAxis);
2143
+ const int alignment = usedAlignment(n->computedStyle().align_items, slack, reverseCrossAxis);
2146
2144
  if (alignment == 1) drawY += slack / 2;
2147
2145
  else if (alignment == 2) drawY += slack;
2148
2146
  }
@@ -2151,9 +2149,9 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2151
2149
  int paintWidth = paintMeasure.width;
2152
2150
  if (noWrap && paintWidth > drawW) paintWidth = drawW;
2153
2151
  #ifdef GEA_EMBEDDED_HAS_GENERATED_FONTS
2154
- if (n->style.font_id >= 0) {
2152
+ if (n->computedStyle().font_id >= 0) {
2155
2153
  gea::framework::graphics::RasterizedFont font =
2156
- gea::framework::graphics::FontRegistry::rasterizedFamily(n->style.font_id, commandFontSize);
2154
+ gea::framework::graphics::FontRegistry::rasterizedFamily(n->computedStyle().font_id, commandFontSize);
2157
2155
  const int lineAdvance = commandLineHeight > 0 ? commandLineHeight : (font.valid() ? font.lineHeight() : 0);
2158
2156
  const bool singleLine = font.valid() &&
2159
2157
  std::strchr(measureText, '\n') == nullptr &&
@@ -2165,30 +2163,30 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2165
2163
  // RenderState::inline_baseline.
2166
2164
  if (singleLine && !n->render.inline_baseline) {
2167
2165
  drawY += rasterizedSingleLineInkCenterOffsetY(measureText,
2168
- n->style.text_align,
2166
+ n->computedStyle().text_align,
2169
2167
  containerW,
2170
- n->style.font_id,
2168
+ n->computedStyle().font_id,
2171
2169
  commandFontSize,
2172
2170
  commandLineHeight);
2173
2171
  }
2174
2172
  }
2175
2173
  #endif
2176
- const int xOffset = alignedOffset(n->style.text_align, containerW, paintWidth);
2174
+ const int xOffset = alignedOffset(n->computedStyle().text_align, containerW, paintWidth);
2177
2175
  int paintX0 = drawX + xOffset;
2178
2176
  int paintY0 = drawY;
2179
2177
  int paintX1 = paintX0 + paintWidth - 1;
2180
2178
  int paintY1 = paintY0 + paintMeasure.height - 1;
2181
2179
  #ifdef GEA_EMBEDDED_HAS_GENERATED_FONTS
2182
- if (n->style.font_id >= 0) {
2180
+ if (n->computedStyle().font_id >= 0) {
2183
2181
  int ix0 = 0;
2184
2182
  int iy0 = 0;
2185
2183
  int ix1 = -1;
2186
2184
  int iy1 = -1;
2187
2185
  if (rasterizedTextInkBounds(measureText,
2188
2186
  noSoftWrap ? 32767 : drawW,
2189
- n->style.text_align,
2187
+ n->computedStyle().text_align,
2190
2188
  containerW,
2191
- n->style.font_id,
2189
+ n->computedStyle().font_id,
2192
2190
  commandFontSize,
2193
2191
  commandLineHeight,
2194
2192
  &ix0,
@@ -2217,10 +2215,10 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2217
2215
  }
2218
2216
 
2219
2217
  // TEMPORARY BASELINE INSTRUMENTATION (env-gated) — remove before landing.
2220
- if (std::getenv("GEA_TEXT_BASELINE_DEBUG") && n->style.font_id >= 0) {
2218
+ if (std::getenv("GEA_TEXT_BASELINE_DEBUG") && n->computedStyle().font_id >= 0) {
2221
2219
  const int dbgFontSize = static_cast<int>(textScale * kBitmapFontHeight + 0.5f);
2222
2220
  gea::framework::graphics::RasterizedFont dbgFont =
2223
- gea::framework::graphics::FontRegistry::rasterizedFamily(n->style.font_id, dbgFontSize);
2221
+ gea::framework::graphics::FontRegistry::rasterizedFamily(n->computedStyle().font_id, dbgFontSize);
2224
2222
  const int fontLH = dbgFont.valid() ? dbgFont.lineHeight() : -1;
2225
2223
  const int asc = dbgFont.valid() ? dbgFont.ascender() : -1;
2226
2224
  const int lineAdv = commandLineHeight > 0 ? commandLineHeight : fontLH;
@@ -2228,8 +2226,8 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2228
2226
  int inkOff = 0;
2229
2227
  #ifdef GEA_EMBEDDED_HAS_GENERATED_FONTS
2230
2228
  const int genFonts = 1;
2231
- inkOff = rasterizedSingleLineInkCenterOffsetY(measureText, n->style.text_align, containerW,
2232
- n->style.font_id, dbgFontSize, commandLineHeight);
2229
+ inkOff = rasterizedSingleLineInkCenterOffsetY(measureText, n->computedStyle().text_align, containerW,
2230
+ n->computedStyle().font_id, dbgFontSize, commandLineHeight);
2233
2231
  #else
2234
2232
  const int genFonts = 0;
2235
2233
  #endif
@@ -2240,14 +2238,14 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2240
2238
  preview[pi] = '\0';
2241
2239
  std::printf("[baseline] gen=%d '%s' font=%d size=%d asc=%d fontLH=%d cssLH=%d "
2242
2240
  "box=(%d,%d,%dx%d) ty=%d drawY=%d inkOff=%d lineBoxOff=%d baselineY=%d\n",
2243
- genFonts, preview, n->style.font_id, dbgFontSize, asc, fontLH,
2244
- n->style.line_height, n->layout.x, n->layout.y, n->layout.width,
2241
+ genFonts, preview, n->computedStyle().font_id, dbgFontSize, asc, fontLH,
2242
+ n->computedStyle().line_height, n->layout.x, n->layout.y, n->layout.width,
2245
2243
  n->layout.height, ty, drawY, inkOff, lineBoxOff, drawY + lineBoxOff + asc);
2246
2244
  std::fflush(stdout);
2247
2245
  }
2248
2246
 
2249
2247
 
2250
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, n->style.text_alpha);
2248
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, n->computedStyle().text_alpha);
2251
2249
  if (effectiveAlpha != parentAlpha) appendAlphaCommand(effectiveAlpha, bx, by, bw, bh);
2252
2250
 
2253
2251
  DisplayCommand *cmd = DisplayList::instance().append();
@@ -2260,18 +2258,18 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2260
2258
  cmd->text.text = n->text.c_str();
2261
2259
  cmd->text.x = drawX; cmd->text.y = drawY;
2262
2260
  cmd->text.maxWidth = drawW;
2263
- cmd->text.color = n->style.text_color;
2261
+ cmd->text.color = n->computedStyle().text_color;
2264
2262
  cmd->text.scale = textScale;
2265
- cmd->text.align = n->style.text_align;
2266
- cmd->text.textTransform = n->style.text_transform;
2263
+ cmd->text.align = n->computedStyle().text_align;
2264
+ cmd->text.textTransform = n->computedStyle().text_transform;
2267
2265
  cmd->text.lineHeight = commandLineHeight;
2268
2266
  cmd->text.containerWidth = containerW;
2269
- cmd->text.fontId = n->style.font_id;
2270
- cmd->text.whiteSpace = n->style.white_space;
2271
- cmd->text.textOverflow = n->style.text_overflow;
2267
+ cmd->text.fontId = n->computedStyle().font_id;
2268
+ cmd->text.whiteSpace = n->computedStyle().white_space;
2269
+ cmd->text.textOverflow = n->computedStyle().text_overflow;
2272
2270
  cmd->text.firstLineIndent = static_cast<int16_t>(inlineIndent);
2273
2271
  {
2274
- const int contentH = h - boxInset(n->style, 0) - boxInset(n->style, 2);
2272
+ const int contentH = h - boxInset(n->computedStyle(), 0) - boxInset(n->computedStyle(), 2);
2275
2273
  cmd->text.maxHeight = static_cast<int16_t>(contentH > 0 ? (contentH > 32767 ? 32767 : contentH) : 0);
2276
2274
  }
2277
2275
 
@@ -2281,11 +2279,11 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2281
2279
  // underline sits near the baseline, and thickness scales with the text.
2282
2280
  // The width matches the measured text width so the line doesn't extend
2283
2281
  // past the actual glyphs.
2284
- if (n->style.text_decoration != 0 && !n->text.empty()) {
2285
- const int fontSize = n->style.font_size > 0 ? n->style.font_size : kBitmapFontHeight;
2286
- const int lineWidth = TextMetrics::measure(measureText, tw, n->style.font_id, n->style.font_size, 0, n->style.font_weight).width;
2282
+ if (n->computedStyle().text_decoration != 0 && !n->text.empty()) {
2283
+ const int fontSize = n->computedStyle().font_size > 0 ? n->computedStyle().font_size : kBitmapFontHeight;
2284
+ const int lineWidth = TextMetrics::measure(measureText, tw, n->computedStyle().font_id, n->computedStyle().font_size, 0, n->computedStyle().font_weight).width;
2287
2285
  const int lineHeight = textDecorationThickness(fontSize);
2288
- const int lineY = textDecorationY(ty, fontSize, lineHeight, n->style.text_decoration);
2286
+ const int lineY = textDecorationY(ty, fontSize, lineHeight, n->computedStyle().text_decoration);
2289
2287
  DisplayCommand *deco = DisplayList::instance().append();
2290
2288
  if (deco) {
2291
2289
  deco->type = DisplayCommandType::FillRect;
@@ -2295,7 +2293,7 @@ void GEA_TEXT_HOT_SRAM TextRenderer::record(const Node &node, uint8_t parentAlph
2295
2293
  deco->fill.y = lineY;
2296
2294
  deco->fill.w = lineWidth;
2297
2295
  deco->fill.h = lineHeight;
2298
- deco->fill.color = n->style.text_color;
2296
+ deco->fill.color = n->computedStyle().text_color;
2299
2297
  }
2300
2298
  }
2301
2299