Repository: flutter
Issue: [Web][html]: `getBoxesForSelection` on RenderParagraph gives different Boxes
Labels: engine,platform-web,e: web_html,has reproducible steps,P2,found in release: 2.10,found in release: 2.13,team-web,triaged-web

I calculate the Boxes for a complete Text and color the boxes.
As you can see below there are two outcomes.
Linux/Android/"Web on desktop" are working like expected.
But Chrome on Android displaying the Webversion does unexpected thing.
I use Chrome Verion 99.0.4844.73 on Android 10


## Steps to Reproduce

Use this Example-Widget and its SimpleSelectionPainter

```

class Example extends StatefulWidget {
  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  final _textKey = GlobalKey();

  final _textBoxRects = <Rect>[];

  final String text = "abcdefg hijklmnopqrstuvw xyzabcde\nfghij klmnopqrstuvwxy\nzabcdefghijklmnopq rstuvw\nxyzabcdefg hijklmnopqrstuvwxyz";

  @override
  void initState() {
    super.initState();
    _scheduleTextLayoutUpdate();
  }

  RenderParagraph? get _renderParagraph => _textKey.currentContext!.findRenderObject() as RenderParagraph;

  void _scheduleTextLayoutUpdate() {
    WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
      setState(() {
        _textBoxRects
          ..clear()
          ..addAll(_computeAllTextBoxRects());
      });
    });
  }

  List<Rect> _computeAllTextBoxRects() {
    if (_textKey.currentContext == null) {
      return const [];
    }

    if (_renderParagraph == null) {
      return const [];
    }
    TextSelection selection = TextSelection(
      baseOffset: 0,
      extentOffset: text.length,
    );
    final textBoxes = _renderParagraph!.getBoxesForSelection(selection);
    return textBoxes.map((box) => box.toRect()).toList();
  }

  @override
  Widget build(BuildContext context) {

    return NotificationListener<SizeChangedLayoutNotification>(
      onNotification: (notification) {
        _scheduleTextLayoutUpdate();
        return true;
      },
      child: SizeChangedLayoutNotifier(
        child: Stack(
          children: [
            CustomPaint(
              painter: SimpleSelectionPainter(
                rects: _textBoxRects,
              ),
            ),
            Text(
              text,
              key: _textKey,
              style: TextStyle(height: 3),
            ),
          ],
        ),
      ),
    );
  }
}

class SimpleSelectionPainter extends CustomPainter {
  SimpleSelectionPainter({
    required List<Rect> rects
  })  : _rects = rects;

  static final List<Color> colors = [
    const Color.fromRGBO(253, 215, 120, 1.0), // Safrangelb
    const Color.fromRGBO(240, 230, 140, 1.0), // Khaki
    const Color.fromRGBO(255, 216, 209, 1.0), // Zartrosa
    const Color.fromRGBO(243, 182, 177, 1.0), // Kirschblüte
    const Color.fromRGBO(206, 232, 229, 1.0), // Himmelblau
    const Color.fromRGBO(189, 183, 107, 1.0), // darkkhaki
    const Color.fromRGBO(222, 184, 135, 1.0), //burlywood
    const Color.fromRGBO(188, 143, 143, 1.0), //rosybrown
    const Color.fromRGBO(244, 164, 96, 1.0), //sandybrown
    const Color.fromRGBO(255, 0, 255, 1.0), //fuchsia

  ];

  final List<Rect> _rects;

  @override
  void paint(Canvas canvas, Size size) {
    for (var i = 0; i < _rects.length; ++i) {
      Paint paint = Paint();
      paint.style = PaintingStyle.fill;
      paint.color = colors[i%10];
      canvas.drawRect(_rects[i], paint);
    }
  }

  @override
  bool shouldRepaint(SimpleSelectionPainter other) {
    return true;
  }
}

```


**Expected results:**
![grafik](https://user-images.githubusercontent.com/10772789/159528715-fe7b7c62-e77b-458d-a1c7-77c11a04b3ea.png)



**Actual results:** 
![grafik](https://user-images.githubusercontent.com/10772789/159528833-0cba3677-a9f8-4b50-b963-0c2711250936.png)