Use placeholder dimensions that reflect the final text layout (#42558)

The _computeChildren[Width/Height]With[Min/Max]Intrinsics methods in
RenderParagraph overwrite the text painter's placeholder dimensions
in order to compute potential widths and heights for the paragraph.

The placeholder dimensions should be restored to the values computed by
_layoutChildren before painting the text.
diff --git a/bin/internal/goldens.version b/bin/internal/goldens.version
index db957bd..278ccf4 100644
--- a/bin/internal/goldens.version
+++ b/bin/internal/goldens.version
@@ -1 +1 @@
-fa13c1b039e693123888e434e4ee1f9ff79d3b6e
+65bd07204149c4f7612bbf179cf088a2d69ca549
diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart
index e01b7c2..d17b0d4 100644
--- a/packages/flutter/lib/src/rendering/paragraph.dart
+++ b/packages/flutter/lib/src/rendering/paragraph.dart
@@ -488,7 +488,15 @@
     _textPainter.markNeedsLayout();
   }
 
+  // Placeholder dimensions representing the sizes of child inline widgets.
+  //
+  // These need to be cached because the text painter's placeholder dimensions
+  // will be overwritten during intrinsic width/height calculations and must be
+  // restored to the original values before final layout and painting.
+  List<PlaceholderDimensions> _placeholderDimensions;
+
   void _layoutTextWithConstraints(BoxConstraints constraints) {
+    _textPainter.setPlaceholderDimensions(_placeholderDimensions);
     _layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
   }
 
@@ -501,7 +509,7 @@
       return;
     }
     RenderBox child = firstChild;
-    final List<PlaceholderDimensions> placeholderDimensions = List<PlaceholderDimensions>(childCount);
+    _placeholderDimensions = List<PlaceholderDimensions>(childCount);
     int childIndex = 0;
     while (child != null) {
       // Only constrain the width to the maximum width of the paragraph.
@@ -525,7 +533,7 @@
           break;
         }
       }
-      placeholderDimensions[childIndex] = PlaceholderDimensions(
+      _placeholderDimensions[childIndex] = PlaceholderDimensions(
         size: child.size,
         alignment: _placeholderSpans[childIndex].alignment,
         baseline: _placeholderSpans[childIndex].baseline,
@@ -534,7 +542,6 @@
       child = childAfter(child);
       childIndex += 1;
     }
-    _textPainter.setPlaceholderDimensions(placeholderDimensions);
   }
 
   // Iterate through the laid-out children and set the parentData offsets based
diff --git a/packages/flutter/test/widgets/text_golden_test.dart b/packages/flutter/test/widgets/text_golden_test.dart
index 5bf078c..f4a464b 100644
--- a/packages/flutter/test/widgets/text_golden_test.dart
+++ b/packages/flutter/test/widgets/text_golden_test.dart
@@ -831,7 +831,7 @@
       find.byType(Container),
       matchesGoldenFile(
         'text_golden.TextInlineWidgetNest.1.png',
-        version: 2,
+        version: 3,
       ),
     );
   });