diff --git a/bin/internal/engine.version b/bin/internal/engine.version
index 62e6786..84001e4 100644
--- a/bin/internal/engine.version
+++ b/bin/internal/engine.version
@@ -1 +1 @@
-07584c64bb7ba8d9e79214c3667cdb16cfa67923
+74ac1de5d4f70d6db6cc7f99f6f259a7d073c3ab
diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart
index 73648a2..cee3c63 100644
--- a/packages/flutter/lib/src/rendering/object.dart
+++ b/packages/flutter/lib/src/rendering/object.dart
@@ -2295,12 +2295,6 @@
         return;
       }
     }
-    assert(() {
-      final AbstractNode? parent = this.parent;
-      if (parent is RenderObject)
-        return parent._needsCompositing;
-      return true;
-    }());
     // parent is fine (or there isn't one), but we are dirty
     if (owner != null)
       owner!._nodesNeedingCompositingBitsUpdate.add(this);
diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart
index 28b5990..e593f59 100644
--- a/packages/flutter/lib/src/rendering/proxy_box.dart
+++ b/packages/flutter/lib/src/rendering/proxy_box.dart
@@ -843,7 +843,7 @@
        super(child);
 
   @override
-  bool get isRepaintBoundary => child != null && (_alpha > 0);
+  bool get alwaysNeedsCompositing => child != null && (_alpha > 0);
 
   @override
   OffsetLayer updateCompositedLayer({required covariant OpacityLayer? oldLayer}) {
@@ -871,13 +871,13 @@
     assert(value >= 0.0 && value <= 1.0);
     if (_opacity == value)
       return;
-    final bool wasRepaintBoundary = isRepaintBoundary;
+    final bool didNeedCompositing = alwaysNeedsCompositing;
     final bool wasVisible = _alpha != 0;
     _opacity = value;
     _alpha = ui.Color.getAlphaFromOpacity(_opacity);
-    if (wasRepaintBoundary != isRepaintBoundary)
+    if (didNeedCompositing != alwaysNeedsCompositing)
       markNeedsCompositingBitsUpdate();
-    markNeedsCompositedLayerUpdate();
+    markNeedsPaint();
     if (wasVisible != (_alpha != 0) && !alwaysIncludeSemantics)
       markNeedsSemanticsUpdate();
   }
@@ -898,10 +898,19 @@
 
   @override
   void paint(PaintingContext context, Offset offset) {
-    if (_alpha == 0) {
-      return;
+    if (child != null) {
+      if (_alpha == 0) {
+        // No need to keep the layer. We'll create a new one if necessary.
+        layer = null;
+        return;
+      }
+      assert(needsCompositing);
+      layer = context.pushOpacity(offset, _alpha, super.paint, oldLayer: layer as OpacityLayer?);
+      assert(() {
+        layer!.debugCreator = debugCreator;
+        return true;
+      }());
     }
-    super.paint(context, offset);
   }
 
   @override
diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart
index be622d5..8e477b4 100644
--- a/packages/flutter/lib/src/widgets/editable_text.dart
+++ b/packages/flutter/lib/src/widgets/editable_text.dart
@@ -2514,11 +2514,6 @@
     _showCaretOnScreenScheduled = true;
     SchedulerBinding.instance.addPostFrameCallback((Duration _) {
       _showCaretOnScreenScheduled = false;
-
-      // if cursor is inactive, e.g. while selecting text, do not jump away
-      if (!_cursorActive) {
-        return;
-      }
       if (_currentCaretRect == null || !_scrollController.hasClients) {
         return;
       }
diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart
index 4b0226e..c13aecb 100644
--- a/packages/flutter/test/widgets/editable_text_test.dart
+++ b/packages/flutter/test/widgets/editable_text_test.dart
@@ -5183,53 +5183,6 @@
     // toolbar. Until we change that, this test should remain skipped.
   }, skip: kIsWeb); // [intended]
 
-
-  testWidgets('text selection handle visibility for long text', (WidgetTester tester) async {
-    // long text which is scrollable based on given box size
-    const String testText =
-        'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.';
-    final TextEditingController controller =
-        TextEditingController(text: testText);
-    final ScrollController scrollController = ScrollController();
-
-    await tester.pumpWidget(MaterialApp(
-      home: Align(
-        alignment: Alignment.topLeft,
-        child: SizedBox(
-          width: 100,
-          height: 100,
-          child: SingleChildScrollView(
-            controller: scrollController,
-            child: EditableText(
-              controller: controller,
-              showSelectionHandles: true,
-              focusNode: FocusNode(),
-              style: Typography.material2018().black.subtitle1!,
-              cursorColor: Colors.blue,
-              backgroundCursorColor: Colors.grey,
-              selectionControls: materialTextSelectionControls,
-              keyboardType: TextInputType.multiline,
-              maxLines: null,
-            ),
-          ),
-        ),
-      ),
-    ));
-
-    // scroll to a text that is outside of the inital visible rect
-    scrollController.jumpTo(151);
-    await tester.pump();
-
-    // long press on a word to trigger a select
-    await tester.longPressAt(const Offset(20, 15));
-    // wait for adjustments of scroll area
-    await tester.pump();
-    await tester.pumpAndSettle();
-
-    // assert not jumped to top
-    expect(scrollController.offset, equals(151));
-  });
-
   const String testText = 'Now is the time for\n' // 20
       'all good people\n'                         // 20 + 16 => 36
       'to come to the aid\n'                      // 36 + 19 => 55
diff --git a/packages/flutter/test/widgets/opacity_repaint_test.dart b/packages/flutter/test/widgets/opacity_repaint_test.dart
deleted file mode 100644
index 00ca296..0000000
--- a/packages/flutter/test/widgets/opacity_repaint_test.dart
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright 2014 The Flutter Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-void main() {
-  testWidgets('RenderOpacity acts as a repaint boundary for changes above the widget when partially opaque', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity acts as a repaint boundary for changes above the widget when fully opaque', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 1,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 1,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity can update its opacity without repainting its child - partially opaque to partially opaque', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 0.9,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity can update its opacity without repainting its child - partially opaque to fully opaque', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 1,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity can update its opacity without repainting its child - fully opaque to partially opaque', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 1,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity can update its opacity without repainting its child - fully opaque to fully transparent', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 1,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 0,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity must paint child - fully transparent to partially opaque', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 0,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 0);
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity allows child to update without updating parent', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      TestWidget(
-        child: Opacity(
-          opacity: 0.5,
-          child: Container(
-            color: Colors.red,
-          ),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-
-    await tester.pumpWidget(
-      TestWidget(
-        child: Opacity(
-          opacity: 0.5,
-          child: Container(
-            color: Colors.blue,
-          ),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-  });
-
-  testWidgets('RenderOpacity disposes of opacity layer when opacity is updated to 0', (WidgetTester tester) async {
-    RenderTestObject.paintCount = 0;
-    await tester.pumpWidget(
-      Container(
-        color: Colors.red,
-        child: const Opacity(
-          opacity: 0.5,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-    expect(tester.layers, contains(isA<OpacityLayer>()));
-
-    await tester.pumpWidget(
-      Container(
-        color: Colors.blue,
-        child: const Opacity(
-          opacity: 0,
-          child: TestWidget(),
-        ),
-      )
-    );
-
-    expect(RenderTestObject.paintCount, 1);
-    expect(tester.layers, isNot(contains(isA<OpacityLayer>())));
-  });
-}
-
-class TestWidget extends SingleChildRenderObjectWidget {
-  const TestWidget({super.key, super.child});
-
-  @override
-  RenderObject createRenderObject(BuildContext context) {
-    return RenderTestObject();
-  }
-}
-
-class RenderTestObject extends RenderProxyBox {
-  static int paintCount = 0;
-
-  @override
-  void paint(PaintingContext context, Offset offset) {
-    paintCount += 1;
-    super.paint(context, offset);
-  }
-}
