Repository navigation
Description
Steps to reproduce
- Create a Flutter project with the standard
flutter_testSDK dev dependency. - Save the code below as
test/path_combine_test.dart. - Run
flutter test test/path_combine_test.dart: it passes. - Run
flutter test --platform chrome test/path_combine_test.dart: it fails.
The reproduction uses the default CanvasKit web renderer. No third-party packages or custom shapes are needed.
Expected results
Subtracting a 196×196 rectangle from a surrounding 200×200 rectangle produces a 2-pixel ring. The result contains (1, 1), but does not contain (100, 100). Both native and web should agree.
Actual results
Native returns center=false and passes. Chrome returns center=true and fails. Drawing the result with a fill paints the entire outer rectangle, including the supposed hole.
This also affects custom ShapeBorder painters that draw an outer-minus-inner path: when the border is painted over a child, any positive border width can cover the whole child rather than just its outline.
Code sample
import 'dart:ui';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('difference of nested rectangles preserves the hole', () {
final outer = Path()..addRect(const Rect.fromLTWH(0, 0, 200, 200));
final inner = Path()..addRect(const Rect.fromLTWH(2, 2, 196, 196));
final ring = Path.combine(PathOperation.difference, outer, inner);
print('fillType=${ring.fillType}, '
'center=${ring.contains(const Offset(100, 100))}, '
'border=${ring.contains(const Offset(1, 1))}');
expect(ring.contains(const Offset(1, 1)), isTrue);
expect(ring.contains(const Offset(100, 100)), isFalse);
});
}Screenshots or Video
The minimal example uses Path.contains so that the incorrect geometry is reproducible without relying on a screenshot.
Logs
Native:
fillType=PathFillType.evenOdd, center=false, border=true
All tests passed!
Chrome:
fillType=PathFillType.nonZero, center=true, border=true
Expected: false
Actual: <true>
Some tests failed.
Suspected cause
In CkPathBuilder.combine on Flutter 3.47.8, CanvasKit computes the operation, but the result is then wrapped using the first input's fill type:
final combined = CkPathBuilder.fromSkPath(combinedSkPath, path1.fillType);The fromSkPath factory explicitly applies that fill type to the copied SkPathBuilder:
skPathBuilder.setFillType(toSkFillType(fillType));As an additional isolation check, calling CanvasKit.Path.MakeFromOp(outer, inner, Difference) directly with nested rectangles produces an even-odd path with contains(100, 100) == false. Copying that result into a PathBuilder and setting its fill type to Winding, as the wrapper does, changes contains(100, 100) to true.
The result's own fill rule appears to need preservation instead of replacement with the first operand's rule. The same two lines are present in the current default-branch source inspected for this report; the runtime reproduction concerns the 3.47.8 implementation. This has not been bisected, and an engine patch has not been built or tested.
Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.47.4, on macOS 27.2 26B123 darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 27.0)
[✓] Chrome - develop for the web
Activity
suryaKommana2662 commentedon Nov 4, 2026
@jamesblasco Thanks for the detailed report. I was able to reproduce the issue locally using the provided test case. The results match the reported behavior. Routing to
team-webfor further investigation.Logs:
Flutter Doctor Output
flutter-triage-bot commentedon Nov 4, 2026
This issue is missing a priority label. Please set a priority label when adding the
triaged-weblabel.[web] Preserve fill rules from path operations (flutter#195971)