Repository: flutter/flutter
File: engine/src/flutter/lib/web_ui/lib/src/engine/pointer_binding.dart (Dart)

Code before:
  /// Full-page apps have `flt-embedding="full-page"` attribute on the body.
  /// Custom element apps have `flt-embedding="custom-element"` on their host.
  ///
  /// This distinction is important for scroll handling in iframes:
  /// - Full-page in iframe: always preventDefault, scroll parent window when at boundary
  /// - Custom element in iframe: let browser handle normal scroll flow (iframe first, then parent)
  bool _isFullPageApp() {
    if (_cachedIsFullPageApp != null) {
      return _cachedIsFullPageApp!;
    }

    try {
      final DomElement? body = domDocument.body;
      if (body != null) {
        final String? embedding = body.getAttribute('flt-embedding');
        _cachedIsFullPageApp = embedding == 'full-page';
        return _cachedIsFullPageApp!;
      }
    } catch (e) {
      // If we can't determine embedding type, default to full-page.
      // This is the conservative choice: it applies the iframe scroll fix,
      // which is the expected behavior for most Flutter web apps.
    }
    _cachedIsFullPageApp = true;
    return true;
  }

  bool _isAcceleratedMouseWheelDelta(num delta, num? wheelDelta) {
    // On macOS, scrolling using a mouse wheel by default uses an acceleration
    // curve, so delta values ramp up and are not at fixed multiples of 120.
    // But in this case, the wheelDelta properties of the event still keep
    // their original values.
    // For all events without this acceleration curve applied, the wheelDelta
    // values are by convention three times greater than the delta values and with
    // the opposite sign.
    if (wheelDelta == null) {
      return false;
    }
    // Account for observed issues with integer truncation by allowing +-1px error.
    return (wheelDelta - (-3 * delta)).abs() > 1;
  }

  bool _isTrackpadEvent(DomWheelEvent event) {
    // This function relies on deprecated and non-standard implementation
    // details. Useful reference material can be found below.
    //
    // https://source.chromium.org/chromium/chromium/src/+/main:ui/events/event.cc
    // https://source.chromium.org/chromium/chromium/src/+/main:ui/events/cocoa/events_mac.mm
    // https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
    // https://searchfox.org/mozilla-central/source/dom/events/WheelEvent.h
    // https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel

Review comment (suggestion):
There's no need to check the DOM for this. We already have this information. You can do something like:

```suggestion
  bool get _isFullPageApp => _view.embeddingStrategy is FullPageEmbeddingStrategy;
```

Code after:
  ///
  /// This distinction is important for scroll handling in iframes:
  /// - Full-page in iframe: conditionally preventDefault, let browser bubble to parent at boundary
  /// - Custom element in iframe: let browser handle normal scroll flow
  bool get _isFullPageApp {
    // Test override takes precedence
    if (_debugIsFullPageApp != null) {
      return _debugIsFullPageApp!;
    }
    return _view.embeddingStrategy is FullPageEmbeddingStrategy;
  }

  bool _isAcceleratedMouseWheelDelta(num delta, num? wheelDelta) {
    // On macOS, scrolling using a mouse wheel by default uses an acceleration
    // curve, so delta values ramp up and are not at fixed multiples of 120.
    // But in this case, the wheelDelta properties of the event still keep
    // their original values.
    // For all events without this acceleration curve applied, the wheelDelta
    // values are by convention three times greater than the delta values and with
    // the opposite sign.
    if (wheelDelta == null) {
      return false;
    }
    // Account for observed issues with integer truncation by allowing +-1px error.
    return (wheelDelta - (-3 * delta)).abs() > 1;
  }

  bool _isTrackpadEvent(DomWheelEvent event) {
    // This function relies on deprecated and non-standard implementation
    // details. Useful reference material can be found below.
    //
    // https://source.chromium.org/chromium/chromium/src/+/main:ui/events/event.cc
    // https://source.chromium.org/chromium/chromium/src/+/main:ui/events/cocoa/events_mac.mm
    // https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
    // https://searchfox.org/mozilla-central/source/dom/events/WheelEvent.h
    // https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
    if (ui_web.browser.browserEngine == ui_web.BrowserEngine.firefox) {
      // Firefox has restricted the wheelDelta properties, they do not provide
      // enough information to accurately disambiguate trackpad events from mouse
      // wheel events.
      return false;
    }
    if (_isAcceleratedMouseWheelDelta(event.deltaX, event.wheelDeltaX) ||
        _isAcceleratedMouseWheelDelta(event.deltaY, event.wheelDeltaY)) {
      return false;
    }
    if (((event.deltaX % 120 == 0) && (event.deltaY % 120 == 0)) ||
        (((event.wheelDeltaX ?? 1) % 120 == 0) && ((event.wheelDeltaY ?? 1) % 120) == 0)) {
      // While not in any formal web standard, `blink` and `webkit` browsers use
      // a delta of 120 to represent one mouse wheel turn. If both dimensions of
      // the delta are divisible by 120, this event is probably from a mouse.