additionalPositiveXOverflowFromAtomicPlaceholders method
double
additionalPositiveXOverflowFromAtomicPlaceholders(
)
Implementation
double additionalPositiveXOverflowFromAtomicPlaceholders() {
if (_paragraph == null || _placeholderBoxes.isEmpty || _allPlaceholders.isEmpty) return 0.0;
// Base paragraph right edge is the visual max line width.
final double baseRight = (_paraLines.isEmpty)
? (_paragraph?.maxIntrinsicWidth ?? _paragraph?.width ?? 0.0)
: _paraLines.fold<double>(0.0, (maxR, lm) => math.max(maxR, lm.left + lm.width));
double maxRight = baseRight;
final int n = math.min(_placeholderBoxes.length, _allPlaceholders.length);
for (int i = 0; i < n; i++) {
final ph = _allPlaceholders[i];
if (ph.kind != _PHKind.atomic) continue;
final tb = _placeholderBoxes[i];
final RenderBox? rb = ph.atomic;
if (rb == null) continue;
final RenderBoxModel? styleBox = _resolveStyleBoxForPlaceholder(rb);
if (styleBox == null || !styleBox.hasSize) continue;
final rs = styleBox.renderStyle;
final bool childScrolls =
rs.effectiveOverflowX != CSSOverflowType.visible || rs.effectiveOverflowY != CSSOverflowType.visible;
final Size childExtent = childScrolls ? (styleBox.boxSize ?? styleBox.size) : styleBox.scrollableSize;
double candidateRight = tb.left + (childExtent.width.isFinite ? childExtent.width : 0.0);
final Offset? rel = CSSPositionedLayout.getRelativeOffset(rs);
if (rel != null && rel.dx > 0) candidateRight += rel.dx;
final Offset? tr = rs.effectiveTransformOffset;
if (tr != null && tr.dx > 0) candidateRight += tr.dx;
// Include right margin since line layout accounts for margins horizontally
// when distributing inline-level boxes.
candidateRight += rs.marginRight.computedValue;
if (candidateRight > maxRight) maxRight = candidateRight;
}
final double extra = maxRight - baseRight;
return extra > 0 ? extra : 0.0;
}