From 9622acd9730cff9ad3cc463a268951f3141c7b09 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth <15619084+vashworth@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:31:25 -0600 Subject: [PATCH] Fix css changes with macOS 13 and Safari (flutter/engine#48807) Safari on macOS 13 outputs different styling than before. Adjust tests to accept new changes. Fixes https://github.com/flutter/flutter/issues/136274. Fixes https://github.com/flutter/flutter/issues/136279. Example passing on macOS 12: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20linux_web_engine/16401/overview Example passing on macOS 13: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20linux_web_engine/16396/overview [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../test/engine/semantics/semantics_test.dart | 7 ++++++- .../lib/web_ui/test/engine/text_editing_test.dart | 13 ++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart b/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart index 2ace112a3e..882c37760e 100644 --- a/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart +++ b/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart @@ -799,7 +799,12 @@ void _testContainer() { owner().semanticsHost.querySelector('flt-semantics-container')!; expect(parentElement.style.transform, 'matrix(1, 0, 0, 1, 10, 10)'); - expect(parentElement.style.transformOrigin, '0px 0px 0px'); + if (isSafari) { + // macOS 13 returns different values than macOS 12. + expect(parentElement.style.transformOrigin, anyOf(contains('0px 0px 0px'), contains('0px 0px'))); + } else { + expect(parentElement.style.transformOrigin, '0px 0px 0px'); + } expect(container.style.top, '-10px'); expect(container.style.left, '-10px'); semantics().semanticsEnabled = false; diff --git a/engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart b/engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart index 7379a7fee4..408d4dabea 100644 --- a/engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart +++ b/engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart @@ -3075,11 +3075,18 @@ Future testMain() async { final DomHTMLElement input = editingStrategy!.activeDomElement; expect(input.style.color, contains('transparent')); - expect(input.style.background, contains('transparent')); + if (isSafari) { + // macOS 13 returns different values than macOS 12. + expect(input.style.background, anyOf(contains('transparent'), contains('none'))); + expect(input.style.outline, anyOf(contains('none'), contains('currentcolor'))); + expect(input.style.border, anyOf(contains('none'), contains('medium'))); + } else { + expect(input.style.background, contains('transparent')); + expect(input.style.outline, contains('none')); + expect(input.style.border, contains('none')); + } expect(input.style.backgroundColor, contains('transparent')); expect(input.style.caretColor, contains('transparent')); - expect(input.style.outline, contains('none')); - expect(input.style.border, contains('none')); expect(input.style.textShadow, contains('none')); });