@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/view.cpp CHANGED
@@ -61,11 +61,11 @@ uint8_t combineAlpha(uint8_t parentAlpha, uint8_t localAlpha)
61
61
 
62
62
  bool borderIsSameOpaqueSolidBackground(const Node &node, uint8_t parentAlpha)
63
63
  {
64
- return !hasBorderRelief(node.style) && node.style.has_bg &&
65
- StyleValues::backgroundClip(node.style, rstyle(node.style).bg_image_layer_count - 1) == 0 &&
66
- !styleHasBackgroundImage(node.style) &&
67
- node.style.bg_color == borderPaintColor(node.style, 0) &&
68
- combineAlpha(parentAlpha, node.style.bg_alpha) == combineAlpha(parentAlpha, borderPaintAlpha(node.style, 0));
64
+ return !hasBorderRelief(node.computedStyle()) && node.computedStyle().has_bg &&
65
+ StyleValues::backgroundClip(node.computedStyle(), rstyle(node.computedStyle()).bg_image_layer_count - 1) == 0 &&
66
+ !styleHasBackgroundImage(node.computedStyle()) &&
67
+ node.computedStyle().bg_color == borderPaintColor(node.computedStyle(), 0) &&
68
+ combineAlpha(parentAlpha, node.computedStyle().bg_alpha) == combineAlpha(parentAlpha, borderPaintAlpha(node.computedStyle(), 0));
69
69
  }
70
70
 
71
71
  void appendAlphaCommand(uint8_t alpha, int bx, int by, int bw, int bh)
@@ -130,7 +130,7 @@ int clampPermille(int value)
130
130
 
131
131
  int gradientToStop(const Node &node)
132
132
  {
133
- const int toStop = rstyle(node.style).bg_gradient_to_stop > 0 ? rstyle(node.style).bg_gradient_to_stop : 1000;
133
+ const int toStop = rstyle(node.computedStyle()).bg_gradient_to_stop > 0 ? rstyle(node.computedStyle()).bg_gradient_to_stop : 1000;
134
134
  return std::max(1, toStop);
135
135
  }
136
136
 
@@ -147,24 +147,24 @@ uint16_t gradientColorAt(const Node &node, int permille)
147
147
  {
148
148
  permille = clampPermille(permille);
149
149
  const int toStop = gradientToStop(node);
150
- if (rstyle(node.style).bg_gradient_has_mid && rstyle(node.style).bg_gradient_mid_stop > 0 && rstyle(node.style).bg_gradient_mid_stop < toStop) {
151
- const int stop = rstyle(node.style).bg_gradient_mid_stop;
150
+ if (rstyle(node.computedStyle()).bg_gradient_has_mid && rstyle(node.computedStyle()).bg_gradient_mid_stop > 0 && rstyle(node.computedStyle()).bg_gradient_mid_stop < toStop) {
151
+ const int stop = rstyle(node.computedStyle()).bg_gradient_mid_stop;
152
152
  if (permille <= stop)
153
- return interpolatePremultipliedColor(rstyle(node.style).bg_gradient_from_color,
154
- rstyle(node.style).bg_gradient_from_alpha,
155
- rstyle(node.style).bg_gradient_mid_color,
156
- rstyle(node.style).bg_gradient_mid_alpha,
153
+ return interpolatePremultipliedColor(rstyle(node.computedStyle()).bg_gradient_from_color,
154
+ rstyle(node.computedStyle()).bg_gradient_from_alpha,
155
+ rstyle(node.computedStyle()).bg_gradient_mid_color,
156
+ rstyle(node.computedStyle()).bg_gradient_mid_alpha,
157
157
  stopRangePermille(permille, 0, stop));
158
- return interpolatePremultipliedColor(rstyle(node.style).bg_gradient_mid_color,
159
- rstyle(node.style).bg_gradient_mid_alpha,
160
- rstyle(node.style).bg_gradient_to_color,
161
- rstyle(node.style).bg_gradient_to_alpha,
158
+ return interpolatePremultipliedColor(rstyle(node.computedStyle()).bg_gradient_mid_color,
159
+ rstyle(node.computedStyle()).bg_gradient_mid_alpha,
160
+ rstyle(node.computedStyle()).bg_gradient_to_color,
161
+ rstyle(node.computedStyle()).bg_gradient_to_alpha,
162
162
  stopRangePermille(permille, stop, toStop));
163
163
  }
164
- return interpolatePremultipliedColor(rstyle(node.style).bg_gradient_from_color,
165
- rstyle(node.style).bg_gradient_from_alpha,
166
- rstyle(node.style).bg_gradient_to_color,
167
- rstyle(node.style).bg_gradient_to_alpha,
164
+ return interpolatePremultipliedColor(rstyle(node.computedStyle()).bg_gradient_from_color,
165
+ rstyle(node.computedStyle()).bg_gradient_from_alpha,
166
+ rstyle(node.computedStyle()).bg_gradient_to_color,
167
+ rstyle(node.computedStyle()).bg_gradient_to_alpha,
168
168
  stopRangePermille(permille, 0, toStop));
169
169
  }
170
170
 
@@ -172,17 +172,17 @@ uint8_t gradientAlphaAt(const Node &node, int permille)
172
172
  {
173
173
  permille = clampPermille(permille);
174
174
  const int toStop = gradientToStop(node);
175
- if (rstyle(node.style).bg_gradient_has_mid && rstyle(node.style).bg_gradient_mid_stop > 0 && rstyle(node.style).bg_gradient_mid_stop < toStop) {
176
- const int stop = rstyle(node.style).bg_gradient_mid_stop;
175
+ if (rstyle(node.computedStyle()).bg_gradient_has_mid && rstyle(node.computedStyle()).bg_gradient_mid_stop > 0 && rstyle(node.computedStyle()).bg_gradient_mid_stop < toStop) {
176
+ const int stop = rstyle(node.computedStyle()).bg_gradient_mid_stop;
177
177
  if (permille <= stop)
178
- return interpolateAlpha(rstyle(node.style).bg_gradient_from_alpha,
179
- rstyle(node.style).bg_gradient_mid_alpha,
178
+ return interpolateAlpha(rstyle(node.computedStyle()).bg_gradient_from_alpha,
179
+ rstyle(node.computedStyle()).bg_gradient_mid_alpha,
180
180
  stopRangePermille(permille, 0, stop));
181
- return interpolateAlpha(rstyle(node.style).bg_gradient_mid_alpha,
182
- rstyle(node.style).bg_gradient_to_alpha,
181
+ return interpolateAlpha(rstyle(node.computedStyle()).bg_gradient_mid_alpha,
182
+ rstyle(node.computedStyle()).bg_gradient_to_alpha,
183
183
  stopRangePermille(permille, stop, toStop));
184
184
  }
185
- return interpolateAlpha(rstyle(node.style).bg_gradient_from_alpha, rstyle(node.style).bg_gradient_to_alpha, stopRangePermille(permille, 0, toStop));
185
+ return interpolateAlpha(rstyle(node.computedStyle()).bg_gradient_from_alpha, rstyle(node.computedStyle()).bg_gradient_to_alpha, stopRangePermille(permille, 0, toStop));
186
186
  }
187
187
 
188
188
  void appendFillRectWithAlpha(int x, int y, int w, int h, uint16_t color, uint8_t alpha, uint8_t parentAlpha, int bx, int by, int bw, int bh)
@@ -300,10 +300,10 @@ DisplayCommand *appendLinearGradientRectRaw(const Node &node, int x, int y, int
300
300
  cmd->gradient.y = y;
301
301
  cmd->gradient.w = w;
302
302
  cmd->gradient.h = h;
303
- cmd->gradient.tl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)];
304
- cmd->gradient.tr = node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)];
305
- cmd->gradient.br = node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)];
306
- cmd->gradient.bl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)];
303
+ cmd->gradient.tl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)];
304
+ cmd->gradient.tr = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)];
305
+ cmd->gradient.br = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)];
306
+ cmd->gradient.bl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)];
307
307
  cmd->gradient.fromColor = fromColor;
308
308
  cmd->gradient.midColor = midColor;
309
309
  cmd->gradient.toColor = toColor;
@@ -324,16 +324,16 @@ DisplayCommand *appendLinearGradientRectRaw(const Node &node, int x, int y, int
324
324
  y,
325
325
  w,
326
326
  h,
327
- rstyle(node.style).bg_gradient_from_color,
328
- rstyle(node.style).bg_gradient_mid_color,
329
- rstyle(node.style).bg_gradient_to_color,
330
- rstyle(node.style).bg_gradient_mid_stop,
331
- rstyle(node.style).bg_gradient_to_stop,
332
- rstyle(node.style).bg_gradient_angle,
333
- rstyle(node.style).bg_gradient_from_alpha,
334
- rstyle(node.style).bg_gradient_mid_alpha,
335
- rstyle(node.style).bg_gradient_to_alpha,
336
- rstyle(node.style).bg_gradient_has_mid);
327
+ rstyle(node.computedStyle()).bg_gradient_from_color,
328
+ rstyle(node.computedStyle()).bg_gradient_mid_color,
329
+ rstyle(node.computedStyle()).bg_gradient_to_color,
330
+ rstyle(node.computedStyle()).bg_gradient_mid_stop,
331
+ rstyle(node.computedStyle()).bg_gradient_to_stop,
332
+ rstyle(node.computedStyle()).bg_gradient_angle,
333
+ rstyle(node.computedStyle()).bg_gradient_from_alpha,
334
+ rstyle(node.computedStyle()).bg_gradient_mid_alpha,
335
+ rstyle(node.computedStyle()).bg_gradient_to_alpha,
336
+ rstyle(node.computedStyle()).bg_gradient_has_mid);
337
337
  }
338
338
 
339
339
  DisplayCommand *appendRadialGradientRectRaw(const Node &node, int x, int y, int w, int h)
@@ -349,19 +349,19 @@ DisplayCommand *appendRadialGradientRectRaw(const Node &node, int x, int y, int
349
349
  cmd->radialGradient.y = y;
350
350
  cmd->radialGradient.w = w;
351
351
  cmd->radialGradient.h = h;
352
- cmd->radialGradient.tl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)];
353
- cmd->radialGradient.tr = node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)];
354
- cmd->radialGradient.br = node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)];
355
- cmd->radialGradient.bl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)];
356
- cmd->radialGradient.cxPermille = rstyle(node.style).bg_radial_gradient_cx;
357
- cmd->radialGradient.cyPermille = rstyle(node.style).bg_radial_gradient_cy;
358
- cmd->radialGradient.rxPermille = rstyle(node.style).bg_radial_gradient_rx;
359
- cmd->radialGradient.ryPermille = rstyle(node.style).bg_radial_gradient_ry;
360
- cmd->radialGradient.fromColor = rstyle(node.style).bg_radial_gradient_from_color;
361
- cmd->radialGradient.toColor = rstyle(node.style).bg_radial_gradient_to_color;
362
- cmd->radialGradient.stopPermille = rstyle(node.style).bg_radial_gradient_stop;
363
- cmd->radialGradient.fromAlpha = rstyle(node.style).bg_radial_gradient_from_alpha;
364
- cmd->radialGradient.toAlpha = rstyle(node.style).bg_radial_gradient_to_alpha;
352
+ cmd->radialGradient.tl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)];
353
+ cmd->radialGradient.tr = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)];
354
+ cmd->radialGradient.br = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)];
355
+ cmd->radialGradient.bl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)];
356
+ cmd->radialGradient.cxPermille = rstyle(node.computedStyle()).bg_radial_gradient_cx;
357
+ cmd->radialGradient.cyPermille = rstyle(node.computedStyle()).bg_radial_gradient_cy;
358
+ cmd->radialGradient.rxPermille = rstyle(node.computedStyle()).bg_radial_gradient_rx;
359
+ cmd->radialGradient.ryPermille = rstyle(node.computedStyle()).bg_radial_gradient_ry;
360
+ cmd->radialGradient.fromColor = rstyle(node.computedStyle()).bg_radial_gradient_from_color;
361
+ cmd->radialGradient.toColor = rstyle(node.computedStyle()).bg_radial_gradient_to_color;
362
+ cmd->radialGradient.stopPermille = rstyle(node.computedStyle()).bg_radial_gradient_stop;
363
+ cmd->radialGradient.fromAlpha = rstyle(node.computedStyle()).bg_radial_gradient_from_alpha;
364
+ cmd->radialGradient.toAlpha = rstyle(node.computedStyle()).bg_radial_gradient_to_alpha;
365
365
  return cmd;
366
366
  }
367
367
 
@@ -427,31 +427,31 @@ void appendStrokeSegmentBandRaw(float x0, float y0, float x1, float y1, float wi
427
427
 
428
428
  bool gradientAlphaNearlyConstant(const Node &node)
429
429
  {
430
- uint8_t minAlpha = std::min(rstyle(node.style).bg_gradient_from_alpha, rstyle(node.style).bg_gradient_to_alpha);
431
- uint8_t maxAlpha = std::max(rstyle(node.style).bg_gradient_from_alpha, rstyle(node.style).bg_gradient_to_alpha);
432
- if (rstyle(node.style).bg_gradient_has_mid) {
433
- minAlpha = std::min(minAlpha, rstyle(node.style).bg_gradient_mid_alpha);
434
- maxAlpha = std::max(maxAlpha, rstyle(node.style).bg_gradient_mid_alpha);
430
+ uint8_t minAlpha = std::min(rstyle(node.computedStyle()).bg_gradient_from_alpha, rstyle(node.computedStyle()).bg_gradient_to_alpha);
431
+ uint8_t maxAlpha = std::max(rstyle(node.computedStyle()).bg_gradient_from_alpha, rstyle(node.computedStyle()).bg_gradient_to_alpha);
432
+ if (rstyle(node.computedStyle()).bg_gradient_has_mid) {
433
+ minAlpha = std::min(minAlpha, rstyle(node.computedStyle()).bg_gradient_mid_alpha);
434
+ maxAlpha = std::max(maxAlpha, rstyle(node.computedStyle()).bg_gradient_mid_alpha);
435
435
  }
436
436
  return maxAlpha - minAlpha <= 8;
437
437
  }
438
438
 
439
439
  bool hasAnyRadius(const Node &node)
440
440
  {
441
- return node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)] || node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)] ||
442
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)] || node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)] ||
443
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != kUnset ||
444
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != kUnset ||
445
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != kUnset ||
446
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != kUnset;
441
+ return node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)] || node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)] ||
442
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)] || node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)] ||
443
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != kUnset ||
444
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != kUnset ||
445
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != kUnset ||
446
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != kUnset;
447
447
  }
448
448
 
449
449
  bool hasAnyPercentRadius(const Node &node)
450
450
  {
451
- return node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != kUnset ||
452
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != kUnset ||
453
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != kUnset ||
454
- node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != kUnset;
451
+ return node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != kUnset ||
452
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != kUnset ||
453
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != kUnset ||
454
+ node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != kUnset;
455
455
  }
456
456
 
457
457
  int integerSqrt(int n)
@@ -475,10 +475,10 @@ int normalizedRadius(int radius, int maxRadius)
475
475
  void roundedNodeRowSpan(const Node &node, int y, int *x0, int *x1)
476
476
  {
477
477
  const int maxRadius = std::min(node.layout.width / 2, node.layout.height / 2);
478
- const int tl = normalizedRadius(node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)], maxRadius);
479
- const int tr = normalizedRadius(node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)], maxRadius);
480
- const int br = normalizedRadius(node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)], maxRadius);
481
- const int bl = normalizedRadius(node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)], maxRadius);
478
+ const int tl = normalizedRadius(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)], maxRadius);
479
+ const int tr = normalizedRadius(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)], maxRadius);
480
+ const int br = normalizedRadius(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)], maxRadius);
481
+ const int bl = normalizedRadius(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)], maxRadius);
482
482
  if ((tl | tr | br | bl) == 0) return;
483
483
 
484
484
  const int left = node.layout.x;
@@ -520,10 +520,10 @@ bool isFullyRoundedShape(const Node &node)
520
520
  const int halfMin = std::min(node.layout.width, node.layout.height) / 2;
521
521
  if (halfMin <= 0) return false;
522
522
  const int minRadius = std::max(1, halfMin - 1);
523
- return node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)] >= minRadius &&
524
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)] >= minRadius &&
525
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)] >= minRadius &&
526
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)] >= minRadius;
523
+ return node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)] >= minRadius &&
524
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)] >= minRadius &&
525
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)] >= minRadius &&
526
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)] >= minRadius;
527
527
  }
528
528
 
529
529
  void resolvedBorderRadii8(const Node &node, int16_t rx8[4], int16_t ry8[4])
@@ -534,14 +534,14 @@ void resolvedBorderRadii8(const Node &node, int16_t rx8[4], int16_t ry8[4])
534
534
  double ry[4]{};
535
535
  for (int i = 0; i < 4; i++) {
536
536
  #if GEA_CSS_PERCENT_RADIUS
537
- if (node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] != kUnset) {
538
- const double p = static_cast<double>(node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(i)]) / 1000.0;
537
+ if (node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] != kUnset) {
538
+ const double p = static_cast<double>(node.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(i)]) / 1000.0;
539
539
  rx[i] = std::max(0.0, width * p);
540
540
  ry[i] = std::max(0.0, height * p);
541
541
  } else
542
542
  #endif
543
543
  {
544
- const double r = static_cast<double>(std::max(0, static_cast<int>(node.style.border_radius[GEA_CSS_RADIUS_INDEX(i)])));
544
+ const double r = static_cast<double>(std::max(0, static_cast<int>(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(i)])));
545
545
  rx[i] = r;
546
546
  ry[i] = r;
547
547
  }
@@ -578,15 +578,15 @@ bool resolvedCircularBorderRadii(const Node &node, int radii[4])
578
578
 
579
579
  void appendFillRoundedRectWithAlpha(const Node &node, uint8_t parentAlpha, const int *resolvedRadii = nullptr)
580
580
  {
581
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, node.style.bg_alpha);
581
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, node.computedStyle().bg_alpha);
582
582
  if (effectiveAlpha != parentAlpha)
583
583
  appendAlphaCommand(effectiveAlpha, node.layout.x, node.layout.y, node.layout.width, node.layout.height);
584
584
  DisplayCommand *cmd = DisplayList::instance().append();
585
585
  if (cmd) {
586
- const int tl = resolvedRadii ? resolvedRadii[0] : node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)];
587
- const int tr = resolvedRadii ? resolvedRadii[1] : node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)];
588
- const int br = resolvedRadii ? resolvedRadii[2] : node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)];
589
- const int bl = resolvedRadii ? resolvedRadii[3] : node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)];
586
+ const int tl = resolvedRadii ? resolvedRadii[0] : node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)];
587
+ const int tr = resolvedRadii ? resolvedRadii[1] : node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)];
588
+ const int br = resolvedRadii ? resolvedRadii[2] : node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)];
589
+ const int bl = resolvedRadii ? resolvedRadii[3] : node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)];
590
590
  cmd->type = DisplayCommandType::FillRoundedRect;
591
591
  cmd->bx = node.layout.x; cmd->by = node.layout.y; cmd->bw = node.layout.width; cmd->bh = node.layout.height;
592
592
  cmd->fillRoundedRect.x = node.layout.x; cmd->fillRoundedRect.y = node.layout.y;
@@ -595,7 +595,7 @@ void appendFillRoundedRectWithAlpha(const Node &node, uint8_t parentAlpha, const
595
595
  cmd->fillRoundedRect.tr = tr;
596
596
  cmd->fillRoundedRect.br = br;
597
597
  cmd->fillRoundedRect.bl = bl;
598
- cmd->fillRoundedRect.color = node.style.bg_color;
598
+ cmd->fillRoundedRect.color = node.computedStyle().bg_color;
599
599
  }
600
600
  if (effectiveAlpha != parentAlpha)
601
601
  appendAlphaCommand(parentAlpha, node.layout.x, node.layout.y, node.layout.width, node.layout.height);
@@ -679,7 +679,7 @@ void appendFillCircleWithAlpha(int cx, int cy, int r, gea::framework::graphics::
679
679
 
680
680
  void appendStrokeWithAlpha(const Node &node, uint8_t parentAlpha)
681
681
  {
682
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, borderPaintAlpha(node.style, 0));
682
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, borderPaintAlpha(node.computedStyle(), 0));
683
683
  if (effectiveAlpha != parentAlpha)
684
684
  appendAlphaCommand(effectiveAlpha, node.layout.x, node.layout.y, node.layout.width, node.layout.height);
685
685
 
@@ -688,30 +688,30 @@ void appendStrokeWithAlpha(const Node &node, uint8_t parentAlpha)
688
688
  // Canvas::strokeRect is deliberately the fast one-pixel primitive. Route
689
689
  // wider square CSS borders through the width-aware rounded-rect rasterizer
690
690
  // with zero radii instead of silently collapsing border-width to 1px.
691
- if (hasAnyRadius(node) || node.style.border_width > 1) {
691
+ if (hasAnyRadius(node) || node.computedStyle().border_width > 1) {
692
692
  cmd->type = DisplayCommandType::StrokeRoundedRect;
693
693
  cmd->strokeRoundedRect = {};
694
694
  cmd->bx = node.layout.x; cmd->by = node.layout.y; cmd->bw = node.layout.width; cmd->bh = node.layout.height;
695
695
  cmd->strokeRoundedRect.x = node.layout.x; cmd->strokeRoundedRect.y = node.layout.y;
696
696
  cmd->strokeRoundedRect.w = node.layout.width; cmd->strokeRoundedRect.h = node.layout.height;
697
- cmd->strokeRoundedRect.tl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)];
698
- cmd->strokeRoundedRect.tr = node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)];
699
- cmd->strokeRoundedRect.br = node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)];
700
- cmd->strokeRoundedRect.bl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)];
701
- cmd->strokeRoundedRect.lineWidth = node.style.border_width;
697
+ cmd->strokeRoundedRect.tl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)];
698
+ cmd->strokeRoundedRect.tr = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)];
699
+ cmd->strokeRoundedRect.br = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)];
700
+ cmd->strokeRoundedRect.bl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)];
701
+ cmd->strokeRoundedRect.lineWidth = node.computedStyle().border_width;
702
702
  resolvedBorderRadii8(node, cmd->strokeRoundedRect.rx8, cmd->strokeRoundedRect.ry8);
703
703
  cmd->strokeRoundedRect.cssRadii = hasAnyPercentRadius(node);
704
704
  for (int i = 0; i < 4; ++i)
705
705
  if (cmd->strokeRoundedRect.rx8[i] > std::min(node.layout.width, node.layout.height) * 4 ||
706
706
  cmd->strokeRoundedRect.ry8[i] > std::min(node.layout.width, node.layout.height) * 4)
707
707
  cmd->strokeRoundedRect.cssRadii = 1;
708
- cmd->strokeRoundedRect.color = borderPaintColor(node.style, 0);
708
+ cmd->strokeRoundedRect.color = borderPaintColor(node.computedStyle(), 0);
709
709
  } else {
710
710
  cmd->type = DisplayCommandType::StrokeRect;
711
711
  cmd->bx = node.layout.x; cmd->by = node.layout.y; cmd->bw = node.layout.width; cmd->bh = node.layout.height;
712
712
  cmd->stroke.x = node.layout.x; cmd->stroke.y = node.layout.y;
713
713
  cmd->stroke.w = node.layout.width; cmd->stroke.h = node.layout.height;
714
- cmd->stroke.color = borderPaintColor(node.style, 0);
714
+ cmd->stroke.color = borderPaintColor(node.computedStyle(), 0);
715
715
  }
716
716
  }
717
717
 
@@ -756,7 +756,7 @@ public:
756
756
  // wrappers and text nodes.
757
757
  static bool hasTransformableBox(const Node &node)
758
758
  {
759
- if (node.style.display == kDisplayNone) return false;
759
+ if (node.computedStyle().display == kDisplayNone) return false;
760
760
  if (node.type == NodeType::Text) return false;
761
761
  if (node.type == NodeType::Image) return true;
762
762
  return !LayoutEngine::isCssInlineLevelBox(node);
@@ -766,7 +766,7 @@ public:
766
766
  {
767
767
  if (!GEA_CSS_TRANSFORMS) return false;
768
768
  if (usePrevious ? !node.render.previous_transformable_box : !hasTransformableBox(node)) return false;
769
- const RareStyle &rs = rstyle(node.style); // one pool lookup, not 10
769
+ const RareStyle &rs = rstyle(node.computedStyle()); // one pool lookup, not 10
770
770
  const int rotate = usePrevious ? node.render.previous_transform_rotate : rs.transform_rotate;
771
771
  const int rotateX = usePrevious ? node.render.previous_transform_rotate_x : rs.transform_rotate_x;
772
772
  const int rotateY = usePrevious ? node.render.previous_transform_rotate_y : rs.transform_rotate_y;
@@ -815,7 +815,7 @@ public:
815
815
  for (int i = 0; i < state.nodeCount; i++) {
816
816
  const Node &n = state.nodes[i];
817
817
  if (nodeHasLocalTransform(n, false) || nodeHasLocalTransform(n, true) ||
818
- (hasTransformableBox(n) && rstyle(n.style).perspective > 0) ||
818
+ (hasTransformableBox(n) && rstyle(n.computedStyle()).perspective > 0) ||
819
819
  (n.render.previous_transformable_box && n.render.previous_perspective > 0)) {
820
820
  present = true;
821
821
  break;
@@ -837,7 +837,7 @@ public:
837
837
  for (int id = nodeIndex(node); id >= 0 && id < state.nodeCount; id = state.nodes[id].parent) {
838
838
  if (nodeHasLocalTransform(state.nodes[id], usePrevious)) return true;
839
839
  if (usePrevious ? !state.nodes[id].render.previous_transformable_box : !hasTransformableBox(state.nodes[id])) continue;
840
- const int perspective = usePrevious ? state.nodes[id].render.previous_perspective : rstyle(state.nodes[id].style).perspective;
840
+ const int perspective = usePrevious ? state.nodes[id].render.previous_perspective : rstyle(state.nodes[id].computedStyle()).perspective;
841
841
  if (perspective > 0) return true;
842
842
  }
843
843
  return false;
@@ -1010,7 +1010,7 @@ public:
1010
1010
 
1011
1011
  static void fillNodeTransform(NodeTransformCache &e, const Node &node, int id)
1012
1012
  {
1013
- const RareStyle &r = rstyle(node.style);
1013
+ const RareStyle &r = rstyle(node.computedStyle());
1014
1014
  e.x = node.layout.x; e.y = node.layout.y; e.w = node.layout.width; e.h = node.layout.height;
1015
1015
  e.ox = e.x + e.w * r.transform_origin_x * kInv1000f;
1016
1016
  e.oy = e.y + e.h * r.transform_origin_y * kInv1000f;
@@ -1166,13 +1166,13 @@ public:
1166
1166
  id = state.nodes[id].parent;
1167
1167
  if (id < 0 || id >= state.nodeCount) break;
1168
1168
  const auto &parent = state.nodes[id];
1169
- const auto &rare = rstyle(parent.style);
1169
+ const auto &rare = rstyle(parent.computedStyle());
1170
1170
  if (hasTransformableBox(parent) && rare.perspective > 0) {
1171
1171
  const float ox = parent.layout.x + parent.layout.width * rare.perspective_origin_x * 0.001f;
1172
1172
  const float oy = parent.layout.y + parent.layout.height * rare.perspective_origin_y * 0.001f;
1173
1173
  normal.z += (offset + normal.x * ox + normal.y * oy) / rare.perspective;
1174
1174
  }
1175
- if (!hasTransformableBox(parent) || !preserves3D(parent.style)) break;
1175
+ if (!hasTransformableBox(parent) || !preserves3D(parent.computedStyle())) break;
1176
1176
  }
1177
1177
  return normal.z < -0.00001f;
1178
1178
  #else
@@ -1253,7 +1253,7 @@ public:
1253
1253
  auto &state = treeState();
1254
1254
  for (int id = nodeIndex(node); id >= 0 && id < state.nodeCount; id = state.nodes[id].parent) {
1255
1255
  if (usePrevious ? !state.nodes[id].render.previous_transformable_box : !hasTransformableBox(state.nodes[id])) continue;
1256
- const int perspective = usePrevious ? state.nodes[id].render.previous_perspective : rstyle(state.nodes[id].style).perspective;
1256
+ const int perspective = usePrevious ? state.nodes[id].render.previous_perspective : rstyle(state.nodes[id].computedStyle()).perspective;
1257
1257
  if (perspective > 0) return id;
1258
1258
  }
1259
1259
  return -1;
@@ -1267,7 +1267,7 @@ public:
1267
1267
  const int y = usePrevious ? node.layout.previous_y : node.layout.y;
1268
1268
  const int w = usePrevious ? node.layout.previous_width : node.layout.width;
1269
1269
  const int h = usePrevious ? node.layout.previous_height : node.layout.height;
1270
- const RareStyle &rs = rstyle(node.style); // one pool lookup, not 3
1270
+ const RareStyle &rs = rstyle(node.computedStyle()); // one pool lookup, not 3
1271
1271
  const int perspective = usePrevious ? node.render.previous_perspective : rs.perspective;
1272
1272
  const int originX = usePrevious ? node.render.previous_perspective_origin_x : rs.perspective_origin_x;
1273
1273
  const int originY = usePrevious ? node.render.previous_perspective_origin_y : rs.perspective_origin_y;
@@ -1533,13 +1533,13 @@ void appendReliefBordersWithAlpha(const Node &node, uint8_t parentAlpha)
1533
1533
  if (w <= 0 || h <= 0) return;
1534
1534
  int widths[4];
1535
1535
  for (int side = 0; side < 4; ++side)
1536
- widths[side] = std::min(computedBorderWidth(node.style, side), side % 2 ? w / 2 : h / 2);
1536
+ widths[side] = std::min(computedBorderWidth(node.computedStyle(), side), side % 2 ? w / 2 : h / 2);
1537
1537
  const bool transformed = ViewGeometry::hasTransformChain(node, false);
1538
1538
  for (int side = 0; side < 4; ++side) {
1539
1539
  if (widths[side] <= 0) continue;
1540
- const int relief = rstyle(node.style).border_relief[side];
1540
+ const int relief = rstyle(node.computedStyle()).border_relief[side];
1541
1541
  const int bands = relief == 1 || relief == 2 ? 2 : 1;
1542
- const auto color = borderPaintColor(node.style, side);
1542
+ const auto color = borderPaintColor(node.computedStyle(), side);
1543
1543
  int r, g, b; pixel::unpackRgb565(color, &r, &g, &b);
1544
1544
  r = pixel::expand5To8(r); g = pixel::expand6To8(g); b = pixel::expand5To8(b);
1545
1545
  // CSS permits UA-defined relief shades. Mixing with white keeps even a
@@ -1566,7 +1566,7 @@ void appendReliefBordersWithAlpha(const Node &node, uint8_t parentAlpha)
1566
1566
  const bool shadedDark = (side == 0 || side == 3) == inset;
1567
1567
  int bx0, by0, bx1, by1; boundsFromCorners(xs, ys, &bx0, &by0, &bx1, &by1);
1568
1568
  appendFillQuadWithAlpha(xs, ys, relief == 0 ? color : shadedDark ? dark : light,
1569
- borderPaintAlpha(node.style, side), parentAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
1569
+ borderPaintAlpha(node.computedStyle(), side), parentAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
1570
1570
  }
1571
1571
  }
1572
1572
  }
@@ -1577,16 +1577,16 @@ void appendSideBordersWithAlpha(const Node &node, uint8_t parentAlpha)
1577
1577
  const int y = node.layout.y;
1578
1578
  const int w = node.layout.width;
1579
1579
  const int h = node.layout.height;
1580
- if (hasBorderRelief(node.style)) { appendReliefBordersWithAlpha(node, parentAlpha); return; }
1581
- const bool textClippedTransform = StyleValues::hasTextBackgroundClip(node.style) &&
1580
+ if (hasBorderRelief(node.computedStyle())) { appendReliefBordersWithAlpha(node, parentAlpha); return; }
1581
+ const bool textClippedTransform = StyleValues::hasTextBackgroundClip(node.computedStyle()) &&
1582
1582
  ViewGeometry::hasTransformChain(node, false) && !isFullyRoundedShape(node);
1583
- if (w <= 0 || h <= 0 || (!hasSideBorder(node.style) && !borderColorsDiffer(node.style) && !textClippedTransform)) return;
1583
+ if (w <= 0 || h <= 0 || (!hasSideBorder(node.computedStyle()) && !borderColorsDiffer(node.computedStyle()) && !textClippedTransform)) return;
1584
1584
 
1585
1585
  const bool transformed = ViewGeometry::hasTransformChain(node, false);
1586
1586
  for (int side = 0; side < 4; ++side) {
1587
- const int borderWidth = computedBorderWidth(node.style, side);
1588
- const auto color = borderPaintColor(node.style, side);
1589
- const auto alpha = borderPaintAlpha(node.style, side);
1587
+ const int borderWidth = computedBorderWidth(node.computedStyle(), side);
1588
+ const auto color = borderPaintColor(node.computedStyle(), side);
1589
+ const auto alpha = borderPaintAlpha(node.computedStyle(), side);
1590
1590
  if (borderWidth <= 0) continue;
1591
1591
  int sx = x;
1592
1592
  int sy = y;
@@ -1606,8 +1606,8 @@ void appendSideBordersWithAlpha(const Node &node, uint8_t parentAlpha)
1606
1606
  // Horizontal edges own the corners. Avoid compositing a translucent
1607
1607
  // asymmetric border twice where two side rectangles would overlap.
1608
1608
  if (side == 1 || side == 3) {
1609
- const int top = std::min<int>(computedBorderWidth(node.style, 0), h);
1610
- const int bottom = std::min<int>(computedBorderWidth(node.style, 2), h - top);
1609
+ const int top = std::min<int>(computedBorderWidth(node.computedStyle(), 0), h);
1610
+ const int bottom = std::min<int>(computedBorderWidth(node.computedStyle(), 2), h - top);
1611
1611
  sy += top;
1612
1612
  sh -= top + bottom;
1613
1613
  }
@@ -1689,26 +1689,26 @@ void recordLinearGradientBackground(const Node &node, uint8_t parentAlpha)
1689
1689
  g.ly = static_cast<int16_t>(y);
1690
1690
  g.lw = static_cast<int16_t>(w);
1691
1691
  g.lh = static_cast<int16_t>(h);
1692
- g.fromColor = rstyle(node.style).bg_gradient_from_color;
1693
- g.midColor = rstyle(node.style).bg_gradient_mid_color;
1694
- g.toColor = rstyle(node.style).bg_gradient_to_color;
1695
- g.midStop = static_cast<uint16_t>(rstyle(node.style).bg_gradient_mid_stop);
1692
+ g.fromColor = rstyle(node.computedStyle()).bg_gradient_from_color;
1693
+ g.midColor = rstyle(node.computedStyle()).bg_gradient_mid_color;
1694
+ g.toColor = rstyle(node.computedStyle()).bg_gradient_to_color;
1695
+ g.midStop = static_cast<uint16_t>(rstyle(node.computedStyle()).bg_gradient_mid_stop);
1696
1696
  g.toStop = static_cast<uint16_t>(gradientToStop(node));
1697
- g.angle = static_cast<int16_t>(rstyle(node.style).bg_gradient_angle);
1698
- g.fromAlpha = rstyle(node.style).bg_gradient_from_alpha;
1699
- g.midAlpha = rstyle(node.style).bg_gradient_mid_alpha;
1700
- g.toAlpha = rstyle(node.style).bg_gradient_to_alpha;
1701
- g.hasMid = rstyle(node.style).bg_gradient_has_mid ? 1 : 0;
1702
- g.backfaceHidden = node.style.backface_hidden ? 1 : 0;
1697
+ g.angle = static_cast<int16_t>(rstyle(node.computedStyle()).bg_gradient_angle);
1698
+ g.fromAlpha = rstyle(node.computedStyle()).bg_gradient_from_alpha;
1699
+ g.midAlpha = rstyle(node.computedStyle()).bg_gradient_mid_alpha;
1700
+ g.toAlpha = rstyle(node.computedStyle()).bg_gradient_to_alpha;
1701
+ g.hasMid = rstyle(node.computedStyle()).bg_gradient_has_mid ? 1 : 0;
1702
+ g.backfaceHidden = node.computedStyle().backface_hidden ? 1 : 0;
1703
1703
  // Transformed rectangular borders ride this command as an edge frame (the
1704
1704
  // span rasterizer paints the first/last edgeWidth px of every span, tracing
1705
1705
  // the quad outline). Emitting projected stroke quads instead would disarm
1706
1706
  // the transform-reproject fast path every frame.
1707
- if (!StyleValues::hasTextBackgroundClip(node.style) && node.style.border_width > 0 && !hasBorderRelief(node.style) && !hasSideBorder(node.style) && !borderColorsDiffer(node.style) && borderPaintAlpha(node.style, 0) > 0 &&
1707
+ if (!StyleValues::hasTextBackgroundClip(node.computedStyle()) && node.computedStyle().border_width > 0 && !hasBorderRelief(node.computedStyle()) && !hasSideBorder(node.computedStyle()) && !borderColorsDiffer(node.computedStyle()) && borderPaintAlpha(node.computedStyle(), 0) > 0 &&
1708
1708
  !isFullyRoundedShape(node)) {
1709
- g.edgeColor = borderPaintColor(node.style, 0);
1710
- g.edgeAlpha = borderPaintAlpha(node.style, 0);
1711
- const int ew = node.style.border_width < 1 ? 1 : node.style.border_width;
1709
+ g.edgeColor = borderPaintColor(node.computedStyle(), 0);
1710
+ g.edgeAlpha = borderPaintAlpha(node.computedStyle(), 0);
1711
+ const int ew = node.computedStyle().border_width < 1 ? 1 : node.computedStyle().border_width;
1712
1712
  g.edgeWidth = static_cast<uint8_t>(ew > 8 ? 8 : ew);
1713
1713
  } else {
1714
1714
  g.edgeColor = 0;
@@ -1719,7 +1719,7 @@ void recordLinearGradientBackground(const Node &node, uint8_t parentAlpha)
1719
1719
 
1720
1720
  void recordRadialGradientBackground(const Node &node)
1721
1721
  {
1722
- if (!rstyle(node.style).bg_radial_gradient) return;
1722
+ if (!rstyle(node.computedStyle()).bg_radial_gradient) return;
1723
1723
  const int x = node.layout.x;
1724
1724
  const int y = node.layout.y;
1725
1725
  const int w = node.layout.width;
@@ -1731,7 +1731,7 @@ void recordRadialGradientBackground(const Node &node)
1731
1731
 
1732
1732
  void recordOverlayLinearGradientBackground(const Node &node)
1733
1733
  {
1734
- if (!rstyle(node.style).bg_overlay_gradient) return;
1734
+ if (!rstyle(node.computedStyle()).bg_overlay_gradient) return;
1735
1735
  const int x = node.layout.x;
1736
1736
  const int y = node.layout.y;
1737
1737
  const int w = node.layout.width;
@@ -1743,44 +1743,44 @@ void recordOverlayLinearGradientBackground(const Node &node)
1743
1743
  y,
1744
1744
  w,
1745
1745
  h,
1746
- rstyle(node.style).bg_overlay_gradient_from_color,
1747
- rstyle(node.style).bg_overlay_gradient_mid_color,
1748
- rstyle(node.style).bg_overlay_gradient_to_color,
1749
- rstyle(node.style).bg_overlay_gradient_mid_stop,
1750
- rstyle(node.style).bg_overlay_gradient_to_stop,
1751
- rstyle(node.style).bg_overlay_gradient_angle,
1752
- rstyle(node.style).bg_overlay_gradient_from_alpha,
1753
- rstyle(node.style).bg_overlay_gradient_mid_alpha,
1754
- rstyle(node.style).bg_overlay_gradient_to_alpha,
1755
- rstyle(node.style).bg_overlay_gradient_has_mid);
1746
+ rstyle(node.computedStyle()).bg_overlay_gradient_from_color,
1747
+ rstyle(node.computedStyle()).bg_overlay_gradient_mid_color,
1748
+ rstyle(node.computedStyle()).bg_overlay_gradient_to_color,
1749
+ rstyle(node.computedStyle()).bg_overlay_gradient_mid_stop,
1750
+ rstyle(node.computedStyle()).bg_overlay_gradient_to_stop,
1751
+ rstyle(node.computedStyle()).bg_overlay_gradient_angle,
1752
+ rstyle(node.computedStyle()).bg_overlay_gradient_from_alpha,
1753
+ rstyle(node.computedStyle()).bg_overlay_gradient_mid_alpha,
1754
+ rstyle(node.computedStyle()).bg_overlay_gradient_to_alpha,
1755
+ rstyle(node.computedStyle()).bg_overlay_gradient_has_mid);
1756
1756
  }
1757
1757
 
1758
1758
  // Background positioning and painting areas are distinct. In particular, the
1759
1759
  // document canvas paints beyond the root box without stretching its images.
1760
1760
  bool recordPlacedBackgrounds(const Node &geometry, const Node &source, bool canvas)
1761
1761
  {
1762
- const auto &r = rstyle(source.style);
1762
+ const auto &r = rstyle(source.computedStyle());
1763
1763
  if (!canvas && r.bg_size_list < 0 && r.bg_position_list < 0 && r.bg_repeat_list < 0 &&
1764
1764
  r.bg_attachment_list < 0 && r.bg_origin_list < 0) return false;
1765
1765
  if (ViewGeometry::hasTransformChain(geometry, false)) return false;
1766
1766
  const int nodeId = ViewGeometry::nodeIndex(geometry);
1767
1767
  for (int layer = r.bg_image_layer_count-1; layer >= 0; --layer) {
1768
- const bool linear = source.style.bg_fill == 1 && layer == r.bg_gradient_layer;
1768
+ const bool linear = source.computedStyle().bg_fill == 1 && layer == r.bg_gradient_layer;
1769
1769
  const bool overlay = r.bg_overlay_gradient && layer == r.bg_overlay_gradient_layer;
1770
1770
  const bool radial = r.bg_radial_gradient && layer == r.bg_radial_gradient_layer;
1771
1771
  if (!linear && !overlay && !radial) continue;
1772
- const auto p = StyleValues::backgroundPlacement(source.style, nodeId, layer,
1772
+ const auto p = StyleValues::backgroundPlacement(source.computedStyle(), nodeId, layer,
1773
1773
  geometry.layout.x, geometry.layout.y, geometry.layout.width, geometry.layout.height);
1774
1774
  if (p.width <= 0 || p.height <= 0) continue;
1775
1775
  int x = canvas ? 0 : geometry.layout.x, y = canvas ? 0 : geometry.layout.y;
1776
1776
  int w = canvas ? treeState().mountedWidth : geometry.layout.width;
1777
1777
  int h = canvas ? treeState().mountedHeight : geometry.layout.height;
1778
- const int clip = canvas ? 0 : StyleValues::backgroundClip(source.style, layer);
1778
+ const int clip = canvas ? 0 : StyleValues::backgroundClip(source.computedStyle(), layer);
1779
1779
  TextBackgroundClipScope textClip(source, clip);
1780
1780
  if (clip == 1 || clip == 2) {
1781
1781
  int inset[4];
1782
- for (int i = 0; i < 4; ++i) inset[i] = computedBorderWidth(geometry.style, i) +
1783
- (clip == 2 ? std::max<int>(0, geometry.style.padding[i]) : 0);
1782
+ for (int i = 0; i < 4; ++i) inset[i] = computedBorderWidth(geometry.computedStyle(), i) +
1783
+ (clip == 2 ? std::max<int>(0, geometry.computedStyle().padding[i]) : 0);
1784
1784
  x += inset[3]; y += inset[0]; w -= inset[1]+inset[3]; h -= inset[0]+inset[2];
1785
1785
  }
1786
1786
  if (w <= 0 || h <= 0) continue;
@@ -1836,7 +1836,7 @@ void recordTransformedEllipseFill(const Node &node, uint8_t parentAlpha)
1836
1836
 
1837
1837
  int bx0, by0, bx1, by1;
1838
1838
  ViewRenderer::transformedBounds(node, false, &bx0, &by0, &bx1, &by1);
1839
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, node.style.bg_alpha);
1839
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, node.computedStyle().bg_alpha);
1840
1840
  if (effectiveAlpha != parentAlpha) appendAlphaCommand(effectiveAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
1841
1841
 
1842
1842
  const double cx = static_cast<double>(x) + static_cast<double>(w) * 0.5;
@@ -1862,7 +1862,7 @@ void recordTransformedEllipseFill(const Node &node, uint8_t parentAlpha)
1862
1862
  ViewGeometry::transformRectCorners(node, false, sx, sy, sw, sh, xs, ys);
1863
1863
  int qx0, qy0, qx1, qy1;
1864
1864
  boundsFromCorners(xs, ys, &qx0, &qy0, &qx1, &qy1);
1865
- appendFillQuadRaw(xs, ys, node.style.bg_color, qx0, qy0, qx1 - qx0 + 1, qy1 - qy0 + 1,
1865
+ appendFillQuadRaw(xs, ys, node.computedStyle().bg_color, qx0, qy0, qx1 - qx0 + 1, qy1 - qy0 + 1,
1866
1866
  sx, sy, sw, sh, true);
1867
1867
  }
1868
1868
 
@@ -1874,8 +1874,8 @@ void recordTransformedRoundedRectFill(const Node &node, uint8_t parentAlpha, int
1874
1874
  int inset[4]{};
1875
1875
  if (backgroundClip > 0)
1876
1876
  for (int i = 0; i < 4; ++i)
1877
- inset[i] = computedBorderWidth(node.style, i) +
1878
- (backgroundClip == 2 ? std::max<int>(0, node.style.padding[i]) : 0);
1877
+ inset[i] = computedBorderWidth(node.computedStyle(), i) +
1878
+ (backgroundClip == 2 ? std::max<int>(0, node.computedStyle().padding[i]) : 0);
1879
1879
  const int x = node.layout.x + inset[3];
1880
1880
  const int y = node.layout.y + inset[0];
1881
1881
  const int w = node.layout.width - inset[3] - inset[1];
@@ -1886,7 +1886,7 @@ void recordTransformedRoundedRectFill(const Node &node, uint8_t parentAlpha, int
1886
1886
  ViewGeometry::transformRectCorners(node, false, x, y, w, h, xs, ys);
1887
1887
  int bx0, by0, bx1, by1;
1888
1888
  boundsFromCorners(xs, ys, &bx0, &by0, &bx1, &by1);
1889
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, node.style.bg_alpha);
1889
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, node.computedStyle().bg_alpha);
1890
1890
  if (effectiveAlpha != parentAlpha) appendAlphaCommand(effectiveAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
1891
1891
  int16_t rx8[4]{};
1892
1892
  int16_t ry8[4]{};
@@ -1915,8 +1915,8 @@ void recordTransformedRoundedRectFill(const Node &node, uint8_t parentAlpha, int
1915
1915
  r.trRx8 = rx8[1]; r.trRy8 = ry8[1];
1916
1916
  r.brRx8 = rx8[2]; r.brRy8 = ry8[2];
1917
1917
  r.blRx8 = rx8[3]; r.blRy8 = ry8[3];
1918
- r.color = node.style.bg_color;
1919
- r.backfaceHidden = node.style.backface_hidden ? 1 : 0;
1918
+ r.color = node.computedStyle().bg_color;
1919
+ r.backfaceHidden = node.computedStyle().backface_hidden ? 1 : 0;
1920
1920
  }
1921
1921
 
1922
1922
  if (effectiveAlpha != parentAlpha) appendAlphaCommand(parentAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
@@ -1928,16 +1928,16 @@ void recordTransformedEllipseStroke(const Node &node, uint8_t parentAlpha)
1928
1928
  const int y = node.layout.y;
1929
1929
  const int w = node.layout.width;
1930
1930
  const int h = node.layout.height;
1931
- if (w <= 0 || h <= 0 || node.style.border_width <= 0) return;
1931
+ if (w <= 0 || h <= 0 || node.computedStyle().border_width <= 0) return;
1932
1932
 
1933
1933
  int bx0, by0, bx1, by1;
1934
1934
  ViewRenderer::transformedBounds(node, false, &bx0, &by0, &bx1, &by1);
1935
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, borderPaintAlpha(node.style, 0));
1935
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, borderPaintAlpha(node.computedStyle(), 0));
1936
1936
  if (effectiveAlpha != parentAlpha) appendAlphaCommand(effectiveAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
1937
1937
 
1938
1938
  const float cx = static_cast<float>(x) + static_cast<float>(w) * 0.5f;
1939
1939
  const float cy = static_cast<float>(y) + static_cast<float>(h) * 0.5f;
1940
- const float stroke = static_cast<float>(node.style.border_width < 1 ? 1 : node.style.border_width);
1940
+ const float stroke = static_cast<float>(node.computedStyle().border_width < 1 ? 1 : node.computedStyle().border_width);
1941
1941
  const float screenStroke = std::max(1.6f, stroke * 1.2f);
1942
1942
  const float rx = std::max(0.0f, static_cast<float>(w) * 0.5f - stroke * 0.5f);
1943
1943
  const float ry = std::max(0.0f, static_cast<float>(h) * 0.5f - stroke * 0.5f);
@@ -1960,7 +1960,7 @@ void recordTransformedEllipseStroke(const Node &node, uint8_t parentAlpha)
1960
1960
  int16_t px, py;
1961
1961
  ViewGeometry::projectPoint(projector, localX, localY, 0.0f, &px, &py);
1962
1962
  if (i > 0)
1963
- appendStrokeSegmentBandRaw(prevX, prevY, px, py, screenStroke, borderPaintColor(node.style, 0),
1963
+ appendStrokeSegmentBandRaw(prevX, prevY, px, py, screenStroke, borderPaintColor(node.computedStyle(), 0),
1964
1964
  prevLocalX, prevLocalY, localX, localY, true);
1965
1965
  prevX = px;
1966
1966
  prevY = py;
@@ -1987,11 +1987,11 @@ void appendBackgroundGridRectRaw(const Node &node, int x, int y, int w, int h)
1987
1987
  if (xs[2] - xs[3] < 1) xs[2] = xs[3] + 1; // bottom edge width (BR right of BL)
1988
1988
  int bx0, by0, bx1, by1;
1989
1989
  boundsFromCorners(xs, ys, &bx0, &by0, &bx1, &by1);
1990
- appendFillQuadRaw(xs, ys, rstyle(node.style).bg_grid_color, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1,
1990
+ appendFillQuadRaw(xs, ys, rstyle(node.computedStyle()).bg_grid_color, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1,
1991
1991
  x, y, w, h, 3);
1992
1992
  } else {
1993
1993
  if (!hasAnyRadius(node)) {
1994
- appendFillRectRaw(x, y, w, h, rstyle(node.style).bg_grid_color, x, y, w, h);
1994
+ appendFillRectRaw(x, y, w, h, rstyle(node.computedStyle()).bg_grid_color, x, y, w, h);
1995
1995
  return;
1996
1996
  }
1997
1997
  int runX0 = 0;
@@ -2000,7 +2000,7 @@ void appendBackgroundGridRectRaw(const Node &node, int x, int y, int w, int h)
2000
2000
  int runH = 0;
2001
2001
  auto flushRun = [&]() {
2002
2002
  if (runH > 0 && runX0 <= runX1)
2003
- appendFillRectRaw(runX0, runY, runX1 - runX0 + 1, runH, rstyle(node.style).bg_grid_color, runX0, runY, runX1 - runX0 + 1, runH);
2003
+ appendFillRectRaw(runX0, runY, runX1 - runX0 + 1, runH, rstyle(node.computedStyle()).bg_grid_color, runX0, runY, runX1 - runX0 + 1, runH);
2004
2004
  runH = 0;
2005
2005
  };
2006
2006
  for (int py = y; py < y + h; ++py) {
@@ -2027,8 +2027,8 @@ void appendBackgroundGridRectRaw(const Node &node, int x, int y, int w, int h)
2027
2027
 
2028
2028
  void recordBackgroundGrid(const Node &node, uint8_t parentAlpha)
2029
2029
  {
2030
- if (rstyle(node.style).bg_grid_axes == 0) return;
2031
- const auto placement = StyleValues::backgroundPlacement(node.style, ViewGeometry::nodeIndex(node), 0, node.layout.x, node.layout.y, node.layout.width, node.layout.height);
2030
+ if (rstyle(node.computedStyle()).bg_grid_axes == 0) return;
2031
+ const auto placement = StyleValues::backgroundPlacement(node.computedStyle(), ViewGeometry::nodeIndex(node), 0, node.layout.x, node.layout.y, node.layout.width, node.layout.height);
2032
2032
  const int x0 = node.layout.x;
2033
2033
  const int y0 = node.layout.y;
2034
2034
  const int x1 = node.layout.x + node.layout.width;
@@ -2038,23 +2038,23 @@ void recordBackgroundGrid(const Node &node, uint8_t parentAlpha)
2038
2038
  int bx0 = x0, by0 = y0, bx1 = x1 - 1, by1 = y1 - 1;
2039
2039
  if (ViewGeometry::hasTransformChain(node, false))
2040
2040
  ViewRenderer::transformedBounds(node, false, &bx0, &by0, &bx1, &by1);
2041
- const uint8_t effectiveAlpha = combineAlpha(parentAlpha, rstyle(node.style).bg_grid_alpha);
2041
+ const uint8_t effectiveAlpha = combineAlpha(parentAlpha, rstyle(node.computedStyle()).bg_grid_alpha);
2042
2042
  if (effectiveAlpha != parentAlpha) appendAlphaCommand(effectiveAlpha, bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1);
2043
2043
 
2044
- if ((rstyle(node.style).bg_grid_axes & 1) != 0 && rstyle(node.style).bg_grid_line_x > 0) {
2045
- const int step = rstyle(node.style).bg_size_list >= 0 ? placement.width : rstyle(node.style).bg_grid_step_x > 0 ? rstyle(node.style).bg_grid_step_x : rstyle(node.style).bg_grid_line_x;
2044
+ if ((rstyle(node.computedStyle()).bg_grid_axes & 1) != 0 && rstyle(node.computedStyle()).bg_grid_line_x > 0) {
2045
+ const int step = rstyle(node.computedStyle()).bg_size_list >= 0 ? placement.width : rstyle(node.computedStyle()).bg_grid_step_x > 0 ? rstyle(node.computedStyle()).bg_grid_step_x : rstyle(node.computedStyle()).bg_grid_line_x;
2046
2046
  if (step > 0) {
2047
2047
  for (int x = x0; x < x1; x += step) {
2048
- const int w = std::min<int>(rstyle(node.style).bg_grid_line_x, x1 - x);
2048
+ const int w = std::min<int>(rstyle(node.computedStyle()).bg_grid_line_x, x1 - x);
2049
2049
  appendBackgroundGridRectRaw(node, x, y0, w, y1 - y0);
2050
2050
  }
2051
2051
  }
2052
2052
  }
2053
- if ((rstyle(node.style).bg_grid_axes & 2) != 0 && rstyle(node.style).bg_grid_line_y > 0) {
2054
- const int step = rstyle(node.style).bg_size_list >= 0 ? placement.height : rstyle(node.style).bg_grid_step_y > 0 ? rstyle(node.style).bg_grid_step_y : rstyle(node.style).bg_grid_line_y;
2053
+ if ((rstyle(node.computedStyle()).bg_grid_axes & 2) != 0 && rstyle(node.computedStyle()).bg_grid_line_y > 0) {
2054
+ const int step = rstyle(node.computedStyle()).bg_size_list >= 0 ? placement.height : rstyle(node.computedStyle()).bg_grid_step_y > 0 ? rstyle(node.computedStyle()).bg_grid_step_y : rstyle(node.computedStyle()).bg_grid_line_y;
2055
2055
  if (step > 0) {
2056
2056
  for (int y = y0; y < y1; y += step) {
2057
- const int h = std::min<int>(rstyle(node.style).bg_grid_line_y, y1 - y);
2057
+ const int h = std::min<int>(rstyle(node.computedStyle()).bg_grid_line_y, y1 - y);
2058
2058
  appendBackgroundGridRectRaw(node, x0, y, x1 - x0, h);
2059
2059
  }
2060
2060
  }
@@ -2088,7 +2088,7 @@ void appendInsetShadowBand(const Node &node, uint8_t parentAlpha, int x, int y,
2088
2088
  boundsFromCorners(xs, ys, &bx0, &by0, &bx1, &by1);
2089
2089
  appendFillQuadWithAlpha(xs,
2090
2090
  ys,
2091
- (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_color : 0),
2091
+ (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_color : 0),
2092
2092
  alpha,
2093
2093
  parentAlpha,
2094
2094
  bx0,
@@ -2103,7 +2103,7 @@ void appendInsetShadowBand(const Node &node, uint8_t parentAlpha, int x, int y,
2103
2103
  return;
2104
2104
  }
2105
2105
  if (!hasAnyRadius(node)) {
2106
- appendFillRectWithAlpha(x, y, w, h, (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_color : 0), alpha, parentAlpha, x, y, w, h);
2106
+ appendFillRectWithAlpha(x, y, w, h, (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_color : 0), alpha, parentAlpha, x, y, w, h);
2107
2107
  return;
2108
2108
  }
2109
2109
  int runX0 = 0;
@@ -2116,7 +2116,7 @@ void appendInsetShadowBand(const Node &node, uint8_t parentAlpha, int x, int y,
2116
2116
  runY,
2117
2117
  runX1 - runX0 + 1,
2118
2118
  runH,
2119
- (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_color : 0),
2119
+ (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_color : 0),
2120
2120
  alpha,
2121
2121
  parentAlpha,
2122
2122
  runX0,
@@ -2170,7 +2170,7 @@ void constrainShadowRadii(ShadowContour &shape)
2170
2170
  ShadowContour insetShadowClip(const Node &node)
2171
2171
  {
2172
2172
  int border[4];
2173
- for (int i = 0; i < 4; ++i) border[i] = computedBorderWidth(node.style, i);
2173
+ for (int i = 0; i < 4; ++i) border[i] = computedBorderWidth(node.computedStyle(), i);
2174
2174
  ShadowContour shape{float(node.layout.x + border[3]), float(node.layout.y + border[0]),
2175
2175
  float(std::max(0, node.layout.width - border[3] - border[1])),
2176
2176
  float(std::max(0, node.layout.height - border[0] - border[2]))};
@@ -2228,8 +2228,8 @@ bool shadowContourRow(const ShadowContour &shape, int y, int &left, int &right)
2228
2228
  void appendShadowRect(const Node &node, uint8_t parentAlpha, int x, int y, int w, int h)
2229
2229
  {
2230
2230
  if (w <= 0 || h <= 0) return;
2231
- const auto color = (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_color : 0);
2232
- const auto alpha = (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0);
2231
+ const auto color = (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_color : 0);
2232
+ const auto alpha = (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0);
2233
2233
  if (!ViewGeometry::hasTransformChain(node, false)) {
2234
2234
  appendFillRectWithAlpha(x, y, w, h, color, alpha, parentAlpha, x, y, w, h);
2235
2235
  return;
@@ -2250,7 +2250,7 @@ void recordSharpInsetShadow(const Node &node, uint8_t parentAlpha, const ShadowC
2250
2250
  bool circular = true;
2251
2251
  for (int i = 0; i < 4; ++i) circular &= clip.rx[i] == clip.ry[i] && clip.rx[i] == std::floor(clip.rx[i]) && clip.rx[i] <= std::min(clip.w, clip.h) * 0.5f;
2252
2252
  if (ox == 0 && oy == 0 && spread > 0 && hole.w > 0 && hole.h > 0 && circular &&
2253
- combineAlpha(parentAlpha, (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0)) == 255 &&
2253
+ combineAlpha(parentAlpha, (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0)) == 255 &&
2254
2254
  !ViewGeometry::hasTransformChain(node, false)) {
2255
2255
  DisplayCommand *cmd = DisplayList::instance().append();
2256
2256
  if (cmd) {
@@ -2265,7 +2265,7 @@ void recordSharpInsetShadow(const Node &node, uint8_t parentAlpha, const ShadowC
2265
2265
  cmd->strokeRoundedRect.br = static_cast<int16_t>(clip.rx[2]);
2266
2266
  cmd->strokeRoundedRect.bl = static_cast<int16_t>(clip.rx[3]);
2267
2267
  cmd->strokeRoundedRect.lineWidth = spread;
2268
- cmd->strokeRoundedRect.color = (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_color : 0);
2268
+ cmd->strokeRoundedRect.color = (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_color : 0);
2269
2269
  }
2270
2270
  return;
2271
2271
  }
@@ -2298,23 +2298,23 @@ void recordSharpInsetShadow(const Node &node, uint8_t parentAlpha, const ShadowC
2298
2298
 
2299
2299
  void recordInsetBoxShadow(const Node &node, uint8_t parentAlpha)
2300
2300
  {
2301
- if (!(GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_inset : 0) || (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0) == 0) return;
2301
+ if (!(GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_inset : 0) || (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0) == 0) return;
2302
2302
  const int x = node.layout.x;
2303
2303
  const int y = node.layout.y;
2304
2304
  const int w = node.layout.width;
2305
2305
  const int h = node.layout.height;
2306
2306
  if (w <= 0 || h <= 0) return;
2307
2307
 
2308
- const int blur = std::max<int>(0, (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_blur_radius : 0));
2308
+ const int blur = std::max<int>(0, (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_blur_radius : 0));
2309
2309
  if (blur == 0) {
2310
- recordSharpInsetShadow(node, parentAlpha, insetShadowClip(node), (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_spread : 0),
2311
- (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_offset_x : 0), (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_offset_y : 0));
2310
+ recordSharpInsetShadow(node, parentAlpha, insetShadowClip(node), (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_spread : 0),
2311
+ (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_offset_x : 0), (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_offset_y : 0));
2312
2312
  return;
2313
2313
  }
2314
- const int spread = std::max<int>(0, (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_spread : 0));
2315
- const int ox = (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_offset_x : 0);
2316
- const int oy = (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_offset_y : 0);
2317
- const uint8_t baseAlpha = (GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0);
2314
+ const int spread = std::max<int>(0, (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_spread : 0));
2315
+ const int ox = (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_offset_x : 0);
2316
+ const int oy = (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_offset_y : 0);
2317
+ const uint8_t baseAlpha = (GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0);
2318
2318
 
2319
2319
  const int leftSolid = spread + std::max(0, ox);
2320
2320
  const int rightSolid = spread + std::max(0, -ox);
@@ -2355,7 +2355,7 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_transformed_bounds") ViewRenderer:
2355
2355
  // exactly the layout box. In a transformed tree we must still walk ancestors:
2356
2356
  // otherwise plain children (for example a face label <span>) ignore their
2357
2357
  // transformed parent plane and paint as axis-aligned overlay text.
2358
- if (!use_prev && n->style.rare_style < 0 && !ViewGeometry::anyTransformPresent()) {
2358
+ if (!use_prev && n->computedStyle().rare_style < 0 && !ViewGeometry::anyTransformPresent()) {
2359
2359
  *x0 = x;
2360
2360
  *y0 = y;
2361
2361
  *x1 = x + w - 1;
@@ -2363,10 +2363,10 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_transformed_bounds") ViewRenderer:
2363
2363
  return;
2364
2364
  }
2365
2365
 
2366
- int rotate = use_prev ? n->render.previous_transform_rotate : rstyle(n->style).transform_rotate;
2366
+ int rotate = use_prev ? n->render.previous_transform_rotate : rstyle(n->computedStyle()).transform_rotate;
2367
2367
 
2368
2368
  auto expandForBlur = [&]() {
2369
- const int radius = use_prev ? n->render.previous_filter_blur_radius : (GEA_CSS_FILTERS ? rstyle(n->style).filter_blur_radius : 0);
2369
+ const int radius = use_prev ? n->render.previous_filter_blur_radius : (GEA_CSS_FILTERS ? rstyle(n->computedStyle()).filter_blur_radius : 0);
2370
2370
  if (radius <= 0) return;
2371
2371
  const int extentX = std::max(1, radius) * 5;
2372
2372
  const int extentY = std::max(1, radius) * 5;
@@ -2413,8 +2413,8 @@ bool ViewRenderer::backfaceSubtreeHidden(const Node &node)
2413
2413
  const auto &state = treeState();
2414
2414
  for (int id = ViewGeometry::nodeIndex(node); id >= 0 && id < state.nodeCount; id = state.nodes[id].parent) {
2415
2415
  const auto &ancestor = state.nodes[id];
2416
- if (ViewGeometry::hasTransformableBox(ancestor) && ancestor.style.backface_hidden &&
2417
- !preserves3D(ancestor.style) && ViewGeometry::backFacing(ancestor))
2416
+ if (ViewGeometry::hasTransformableBox(ancestor) && ancestor.computedStyle().backface_hidden &&
2417
+ !preserves3D(ancestor.computedStyle()) && ViewGeometry::backFacing(ancestor))
2418
2418
  return true;
2419
2419
  }
2420
2420
  return false;
@@ -2445,7 +2445,7 @@ bool ViewRenderer::recordClipBegin(const Node &node)
2445
2445
  {
2446
2446
  const Node *n = &node;
2447
2447
  if (ViewGeometry::hasTransformChain(*n, false)) return 0;
2448
- if (!isViewLikeNodeType(n->type) || n->style.overflow == 0) return 0;
2448
+ if (!isViewLikeNodeType(n->type) || n->computedStyle().overflow == 0) return 0;
2449
2449
  if (n->first_child < 0) return 0;
2450
2450
 
2451
2451
  int x, y, w, h;
@@ -2508,10 +2508,10 @@ int ViewRenderer::canvasBackgroundSource()
2508
2508
  const Node &html = state.nodes[root];
2509
2509
  // CSS Backgrounds: a transparent root with no images takes the first
2510
2510
  // direct body's background. Its used background is then transparent.
2511
- if (!(GEA_CSS_CONTAINMENT ? rstyle(html.style).containment : 0) && (!html.style.has_bg || html.style.bg_alpha == 0) && !styleHasBackgroundImage(html.style)) {
2511
+ if (!(GEA_CSS_CONTAINMENT ? rstyle(html.computedStyle()).containment : 0) && (!html.computedStyle().has_bg || html.computedStyle().bg_alpha == 0) && !styleHasBackgroundImage(html.computedStyle())) {
2512
2512
  for (int child = html.first_child; child >= 0; child = state.nodes[child].next_sibling)
2513
2513
  if (std::string_view(tagFromId(state.nodes[child].tag_id)) == "body")
2514
- return (GEA_CSS_CONTAINMENT ? rstyle(state.nodes[child].style).containment : 0) ? root : child;
2514
+ return (GEA_CSS_CONTAINMENT ? rstyle(state.nodes[child].computedStyle()).containment : 0) ? root : child;
2515
2515
  }
2516
2516
  return root;
2517
2517
  }
@@ -2527,7 +2527,7 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_record_box") ViewRenderer::recordB
2527
2527
  const bool canvasRoot = isDocumentCanvasRoot(node);
2528
2528
  if (canvasRoot && canvasSource >= 0) {
2529
2529
  const auto &state = treeState();
2530
- const auto &source = state.nodes[canvasSource].style;
2530
+ const auto &source = state.nodes[canvasSource].computedStyle();
2531
2531
  if (source.display != 1 && source.has_bg && source.bg_alpha > 0)
2532
2532
  appendFillRectWithAlpha(0, 0, state.mountedWidth, state.mountedHeight,
2533
2533
  source.bg_color, source.bg_alpha, parentAlpha, 0, 0, state.mountedWidth, state.mountedHeight);
@@ -2542,11 +2542,11 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_record_box") ViewRenderer::recordB
2542
2542
  }
2543
2543
  if (w <= 0 || h <= 0) return;
2544
2544
 
2545
- if (n->style.has_bg) {
2545
+ if (n->computedStyle().has_bg) {
2546
2546
  // The color is the bottom layer; image longhands never replace it.
2547
- if (n->style.bg_alpha > 0 && !canvasRoot &&
2547
+ if (n->computedStyle().bg_alpha > 0 && !canvasRoot &&
2548
2548
  (canvasSource < 0 || &treeState().nodes[canvasSource] != n)) {
2549
- const int clip = StyleValues::backgroundClip(n->style, rstyle(n->style).bg_image_layer_count - 1);
2549
+ const int clip = StyleValues::backgroundClip(n->computedStyle(), rstyle(n->computedStyle()).bg_image_layer_count - 1);
2550
2550
  TextBackgroundClipScope textClip(*n, clip);
2551
2551
  if (clip == 1 || clip == 2) {
2552
2552
  recordTransformedRoundedRectFill(*n, parentAlpha, clip);
@@ -2558,7 +2558,7 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_record_box") ViewRenderer::recordB
2558
2558
  recordTransformedRoundedRectFill(*n, parentAlpha);
2559
2559
  } else {
2560
2560
  ViewGeometry::transformCorners(*n, false, xs, ys);
2561
- appendFillQuadWithAlpha(xs, ys, n->style.bg_color, n->style.bg_alpha, parentAlpha,
2561
+ appendFillQuadWithAlpha(xs, ys, n->computedStyle().bg_color, n->computedStyle().bg_alpha, parentAlpha,
2562
2562
  bx0, by0, bx1 - bx0 + 1, by1 - by0 + 1,
2563
2563
  x, y, w, h, true);
2564
2564
  }
@@ -2567,22 +2567,22 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_record_box") ViewRenderer::recordB
2567
2567
  if (!appendResolvedCircularRoundedRectWithAlpha(*n, parentAlpha))
2568
2568
  recordTransformedRoundedRectFill(*n, parentAlpha);
2569
2569
  } else {
2570
- appendFillRectWithAlpha(x, y, w, h, n->style.bg_color, n->style.bg_alpha, parentAlpha, x, y, w, h);
2570
+ appendFillRectWithAlpha(x, y, w, h, n->computedStyle().bg_color, n->computedStyle().bg_alpha, parentAlpha, x, y, w, h);
2571
2571
  }
2572
2572
  }
2573
2573
  }
2574
2574
  if (!canvasRoot && (canvasSource < 0 || &treeState().nodes[canvasSource] != n)) {
2575
2575
  if (!recordPlacedBackgrounds(*n, *n, false)) {
2576
- if (n->style.bg_fill == 1) {
2577
- TextBackgroundClipScope textClip(*n, StyleValues::backgroundClip(n->style, rstyle(n->style).bg_gradient_layer));
2576
+ if (n->computedStyle().bg_fill == 1) {
2577
+ TextBackgroundClipScope textClip(*n, StyleValues::backgroundClip(n->computedStyle(), rstyle(n->computedStyle()).bg_gradient_layer));
2578
2578
  recordLinearGradientBackground(*n, parentAlpha);
2579
2579
  }
2580
2580
  {
2581
- TextBackgroundClipScope textClip(*n, StyleValues::backgroundClip(n->style, rstyle(n->style).bg_radial_gradient_layer));
2581
+ TextBackgroundClipScope textClip(*n, StyleValues::backgroundClip(n->computedStyle(), rstyle(n->computedStyle()).bg_radial_gradient_layer));
2582
2582
  recordRadialGradientBackground(*n);
2583
2583
  }
2584
2584
  {
2585
- TextBackgroundClipScope textClip(*n, StyleValues::backgroundClip(n->style, rstyle(n->style).bg_overlay_gradient_layer));
2585
+ TextBackgroundClipScope textClip(*n, StyleValues::backgroundClip(n->computedStyle(), rstyle(n->computedStyle()).bg_overlay_gradient_layer));
2586
2586
  recordOverlayLinearGradientBackground(*n);
2587
2587
  }
2588
2588
  }
@@ -2594,7 +2594,7 @@ void GEA_VIEW_HOT_SRAM_SECTION("view_renderer_record_box") ViewRenderer::recordB
2594
2594
  recordInsetBoxShadow(*n, parentAlpha);
2595
2595
  #endif
2596
2596
 
2597
- if (n->style.border_width > 0 && !hasBorderRelief(n->style) && !hasSideBorder(n->style) && !borderColorsDiffer(n->style) && !borderIsSameOpaqueSolidBackground(*n, parentAlpha)) {
2597
+ if (n->computedStyle().border_width > 0 && !hasBorderRelief(n->computedStyle()) && !hasSideBorder(n->computedStyle()) && !borderColorsDiffer(n->computedStyle()) && !borderIsSameOpaqueSolidBackground(*n, parentAlpha)) {
2598
2598
  if (ViewGeometry::hasTransformChain(*n, false)) {
2599
2599
  if (isFullyRoundedShape(*n)) recordTransformedEllipseStroke(*n, parentAlpha);
2600
2600
  } else {
@@ -2608,7 +2608,7 @@ void ViewRenderer::recordScrollbar(const Node &node)
2608
2608
  {
2609
2609
  #if GEA_CSS_SCROLLING
2610
2610
  const Node *n = &node;
2611
- if (!isViewLikeNodeType(n->type) || (n->type != NodeType::VirtualList && !scrollsOverflowY(n->style))) return;
2611
+ if (!isViewLikeNodeType(n->type) || (n->type != NodeType::VirtualList && !scrollsOverflowY(n->computedStyle()))) return;
2612
2612
  if (n->layout.height <= 0 || n->layout.scroll_content_height <= n->layout.height) return;
2613
2613
 
2614
2614
  int track_h = n->layout.height - 12;