diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.cc index 9933400a699..d3007145eb7 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.cc @@ -257,27 +257,37 @@ void FakeFlatland::SetClipBounds( transform->clip_bounds = clip_bounds; } -void FakeFlatland::SetOpacity( - fuchsia::ui::composition::TransformId transform_id, - float opacity) { - if (transform_id.value == 0) { - // TODO(fxb/85619): Raise a FlatlandError here - FML_CHECK(false) << "FakeFlatland::SetOpacity: TransformId 0 is invalid."; - return; - } +// TODO(fxbug.dev/89111): Re-enable once SDK rolls. +// void FakeFlatland::SetImageOpacity( +// fuchsia::ui::composition::ContentId content_id, +// float opacity) { +// if (content_id.value == 0) { +// // TODO(fxb/85619): Raise a FlatlandError here +// FML_CHECK(false) +// << "FakeFlatland::SetImageOpacity: ContentId 0 is invalid."; +// return; +// } - auto found_transform = pending_graph_.transform_map.find(transform_id.value); - if (found_transform == pending_graph_.transform_map.end()) { - // TODO(fxb/85619): Raise a FlatlandError here - FML_CHECK(false) << "FakeFlatland::SetOpacity: TransformId " - << transform_id.value << " does not exist."; - return; - } +// auto found_content = pending_graph_.content_map.find(image_id.value); +// if (found_content == pending_graph_.content_map.end()) { +// // TODO(fxb/85619): Raise a FlatlandError here +// FML_CHECK(false) << "FakeFlatland::SetImageOpacity: ContentId " +// << image_id.value << " does not exist."; +// return; +// } - auto& transform = found_transform->second; - FML_CHECK(transform); - transform->opacity = opacity; -} +// auto& content = found_content->second; +// FML_CHECK(content); +// FakeImage* image = std::get_if(content.get()); +// if (image == nullptr) { +// // TODO(fxb/85619): Raise a FlatlandError here +// FML_CHECK(false) << "FakeFlatland::SetImageOpacity: ContentId " +// << image_id.value << " is not an Image."; +// return; +// } + +// image->opacity = opacity; +// } void FakeFlatland::AddChild( fuchsia::ui::composition::TransformId parent_transform_id, diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.h b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.h index 48c4db6210c..1f219198dc4 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland.h @@ -230,9 +230,10 @@ class FakeFlatland void SetClipBounds(fuchsia::ui::composition::TransformId transform_id, fuchsia::math::Rect clip_bounds) override; - // |fuchsia::ui::composition::Flatland| - void SetOpacity(fuchsia::ui::composition::TransformId transform_id, - float opacity) override; + // TODO(fxbug.dev/89111): Re-enable once SDK rolls. + // // |fuchsia::ui::composition::Flatland| + // void SetImageOpacity(fuchsia::ui::composition::ContentId image_id, + // float opacity) override; // |fuchsia::ui::composition::Flatland| void AddChild( diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc index ae6bde4855b..a79e702af94 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.cc @@ -39,6 +39,7 @@ std::shared_ptr CloneFakeContent( .image_properties = fidl::Clone(image->image_properties), .sample_region = image->sample_region, .destination_size = image->destination_size, + .opacity = image->opacity, .import_token = image->import_token, .vmo_index = image->vmo_index, }); @@ -65,7 +66,6 @@ std::shared_ptr CloneFakeTransform( .translation = transform->translation, .clip_bounds = transform->clip_bounds, .orientation = transform->orientation, - .opacity = transform->opacity, .children = CloneFakeTransformVector( transform->children, transform_cache), .content = CloneFakeContent(transform->content), @@ -124,14 +124,14 @@ bool FakeImage::operator==(const FakeImage& other) const { return id == other.id && image_properties == other.image_properties && sample_region == other.sample_region && destination_size == other.destination_size && - import_token == other.import_token && vmo_index == other.vmo_index; + opacity == other.opacity && import_token == other.import_token && + vmo_index == other.vmo_index; } bool FakeTransform::operator==(const FakeTransform& other) const { return id == other.id && translation == other.translation && clip_bounds == other.clip_bounds && orientation == other.orientation && - opacity == other.opacity && children == other.children && - content == other.content; + children == other.children && content == other.content; } bool FakeGraph::operator==(const FakeGraph& other) const { diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h index 8d1af253f4a..4a76a00171c 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/fakes/scenic/fake_flatland_types.h @@ -143,12 +143,14 @@ struct FakeImage { constexpr static fuchsia::math::SizeU kDefaultImageSize{}; constexpr static fuchsia::math::RectF kDefaultSampleRegion{}; constexpr static fuchsia::math::SizeU kDefaultDestinationSize{}; + constexpr static float kDefaultOpacity{1.f}; fuchsia::ui::composition::ContentId id{kInvalidContentId}; fuchsia::ui::composition::ImageProperties image_properties{}; fuchsia::math::RectF sample_region{kDefaultSampleRegion}; fuchsia::math::SizeU destination_size{kDefaultDestinationSize}; + float opacity{kDefaultOpacity}; zx_koid_t import_token{}; uint32_t vmo_index{0}; @@ -166,14 +168,12 @@ struct FakeTransform { .height = 0}; constexpr static fuchsia::ui::composition::Orientation kDefaultOrientation{ fuchsia::ui::composition::Orientation::CCW_0_DEGREES}; - constexpr static float kDefaultOpacity{1.f}; fuchsia::ui::composition::TransformId id{kInvalidTransformId}; fuchsia::math::Vec translation{kDefaultTranslation}; fuchsia::math::Rect clip_bounds{kDefaultClipBounds}; fuchsia::ui::composition::Orientation orientation{kDefaultOrientation}; - float opacity{kDefaultOpacity}; std::vector> children; std::shared_ptr content; diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/flatland_external_view_embedder_unittests.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/flatland_external_view_embedder_unittests.cc index 20983bd49fb..efa5ef54f8b 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/tests/flatland_external_view_embedder_unittests.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/tests/flatland_external_view_embedder_unittests.cc @@ -200,7 +200,7 @@ Matcher IsFlutterGraph( Pointee(FieldsAre( /*id*/ _, FakeTransform::kDefaultTranslation, FakeTransform::kDefaultClipBounds, FakeTransform::kDefaultOrientation, - FakeTransform::kDefaultOpacity, ElementsAreArray(layer_matchers), + /*children*/ ElementsAreArray(layer_matchers), /*content*/ Eq(nullptr))), Eq(FakeView{ .view_token = viewport_token_koids.second, @@ -219,10 +219,12 @@ Matcher> IsImageLayer( return Pointee(FieldsAre( /*id*/ _, FakeTransform::kDefaultTranslation, FakeTransform::kDefaultClipBounds, FakeTransform::kDefaultOrientation, - FakeTransform::kDefaultOpacity, IsEmpty(), + /*children*/ IsEmpty(), + /*content*/ Pointee(VariantWith(FieldsAre( /*id*/ _, IsImageProperties(layer_size), FakeImage::kDefaultSampleRegion, layer_size, + FakeImage::kDefaultOpacity, /*buffer_import_token*/ _, /*vmo_index*/ 0))))); } @@ -233,7 +235,8 @@ Matcher> IsViewportLayer( return Pointee( FieldsAre(_ /* id */, view_transform, FakeTransform::kDefaultClipBounds, FakeTransform::kDefaultOrientation, - FakeTransform::kDefaultOpacity, IsEmpty(), + /*children*/ IsEmpty(), + /*content*/ Pointee(VariantWith(FieldsAre( /* id */ _, IsViewportProperties(view_logical_size), /* viewport_token */ GetKoids(view_token).second,