@@ -104,9 +104,7 @@ ViewHolder::ViewHolder(fuchsia::ui::views::ViewHolderToken view_holder_token,
104104void ViewHolder::UpdateScene (scenic::Session* session,
105105 scenic::ContainerNode& container_node,
106106 const SkPoint& offset,
107- const SkSize& size,
108- SkAlpha opacity,
109- bool hit_testable) {
107+ SkAlpha opacity) {
110108 if (pending_view_holder_token_.value ) {
111109 entity_node_ = std::make_unique<scenic::EntityNode>(session);
112110 opacity_node_ = std::make_unique<scenic::OpacityNodeHACK>(session);
@@ -131,17 +129,8 @@ void ViewHolder::UpdateScene(scenic::Session* session,
131129 container_node.AddChild (*opacity_node_);
132130 opacity_node_->SetOpacity (opacity / 255 .0f );
133131 entity_node_->SetTranslation (offset.x (), offset.y (), -0 .1f );
134- entity_node_->SetHitTestBehavior (
135- hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault
136- : fuchsia::ui::gfx::HitTestBehavior::kSuppress );
137- if (has_pending_properties_) {
138- // TODO(dworsham): This should be derived from size and elevation. We
139- // should be able to Z-limit the view's box but otherwise it uses all of the
140- // available airspace.
141- view_holder_->SetViewProperties (std::move (pending_properties_));
142-
143- has_pending_properties_ = false ;
144- }
132+ entity_node_->SetHitTestBehavior (hit_test_behavior_);
133+ view_holder_->SetViewProperties (view_properties_);
145134}
146135
147136void ViewHolder::SetProperties (double width,
@@ -151,9 +140,32 @@ void ViewHolder::SetProperties(double width,
151140 double insetBottom,
152141 double insetLeft,
153142 bool focusable) {
154- pending_properties_ = ToViewProperties (width, height, insetTop, insetRight,
155- insetBottom, insetLeft, focusable);
156- has_pending_properties_ = true ;
143+ view_properties_ = ToViewProperties (width, height, insetTop, insetRight,
144+ insetBottom, insetLeft, focusable);
145+ }
146+
147+ void ViewHolder::set_hit_testable (bool value) {
148+ hit_test_behavior_ = value ? fuchsia::ui::gfx::HitTestBehavior::kDefault
149+ : fuchsia::ui::gfx::HitTestBehavior::kSuppress ;
150+ }
151+
152+ void ViewHolder::set_focusable (bool value) {
153+ view_properties_.focus_change = value;
154+ }
155+
156+ void ViewHolder::set_size (const SkSize& size) {
157+ // TODO(dworsham): The Z-bound should be derived from elevation. We should be
158+ // able to Z-limit the view's box but otherwise it uses all of the available
159+ // airspace.
160+ view_properties_.bounding_box .max .x = size.width ();
161+ view_properties_.bounding_box .max .y = size.height ();
162+ }
163+
164+ void ViewHolder::set_occlusion_hint (const SkRect& occlusion_hint) {
165+ view_properties_.inset_from_min .x = occlusion_hint.fLeft ;
166+ view_properties_.inset_from_min .y = occlusion_hint.fTop ;
167+ view_properties_.inset_from_max .x = occlusion_hint.fRight ;
168+ view_properties_.inset_from_max .y = occlusion_hint.fBottom ;
157169}
158170
159171} // namespace flutter
0 commit comments