1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/compositor/compositor_property_tree_delegate.h"
#include "base/check.h"
#include "base/trace_event/trace_event.h"
#include "cc/input/scroll_snap_data.h"
#include "cc/paint/element_id.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/mutator_host_client.h"
#include "cc/trees/property_tree_builder.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_export.h"
#include "ui/gfx/geometry/vector2d_f.h"
namespace ui {
void CompositorPropertyTreeDelegate::UpdatePropertyTreesIfNeeded() {
// Note that this code is identical to the base method, except that
// we update the method names in the trace events to be more accurate.
// TODO(crbug.com/389771428): Implement this w/ layer lists.
// Note: this leaves the _BuiltPropertyTrees trace event guarded by
// cc.debug to be consistent with the default implementations in cc and
// so we don't need to set two different logging options to get the output.
TRACE_EVENT0("ui",
"CompositorPropertyTreeDelegate::UpdatePropertyTreesIfNeeded");
cc::PropertyTreeBuilder::BuildPropertyTrees(host());
DCHECK(compositor_);
compositor_->CheckPropertyTrees();
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
"CompositorPropertyTreeDelegate::"
"UpdatePropertyTreesIfNeeded_BuiltPropertyTrees",
TRACE_EVENT_SCOPE_THREAD, "property_trees",
host()->property_trees()->AsTracedValue());
if (observer_) {
observer_->OnUpdateCalled(host());
}
}
void CompositorPropertyTreeDelegate::UpdateScrollOffsetFromImpl(
const cc::ElementId& id,
const gfx::Vector2dF& delta,
const std::optional<cc::TargetSnapAreaElementIds>& snap_target_ids) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::UpdateScrollOffsetFromImpl(
id, delta, snap_target_ids);
}
void CompositorPropertyTreeDelegate::OnAnimateLayers() {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::OnAnimateLayers();
}
void CompositorPropertyTreeDelegate::RegisterViewportPropertyIds(
const cc::ViewportPropertyIds& ids) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now, just
// call the base class implementation to ensure that we don't get out of date.
cc::PropertyTreeLayerTreeDelegate::RegisterViewportPropertyIds(ids);
}
void CompositorPropertyTreeDelegate::OnUnregisterElement(
cc::ElementId element_id) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::OnUnregisterElement(element_id);
}
bool CompositorPropertyTreeDelegate::IsElementInPropertyTrees(
cc::ElementId element_id,
cc::ElementListType list_type) const {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
return cc::PropertyTreeLayerTreeDelegate::IsElementInPropertyTrees(element_id,
list_type);
}
void CompositorPropertyTreeDelegate::OnElementFilterMutated(
cc::ElementId element_id,
cc::ElementListType list_type,
const cc::FilterOperations& filters) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::OnElementFilterMutated(element_id,
list_type, filters);
}
void CompositorPropertyTreeDelegate::OnElementBackdropFilterMutated(
cc::ElementId element_id,
cc::ElementListType list_type,
const cc::FilterOperations& backdrop_filters) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::OnElementBackdropFilterMutated(
element_id, list_type, backdrop_filters);
}
void CompositorPropertyTreeDelegate::OnElementOpacityMutated(
cc::ElementId element_id,
cc::ElementListType list_type,
float opacity) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::OnElementOpacityMutated(
element_id, list_type, opacity);
}
void CompositorPropertyTreeDelegate::OnElementTransformMutated(
cc::ElementId element_id,
cc::ElementListType list_type,
const gfx::Transform& transform) {
// TODO(crbug.com/389771428): Implement this w/ layer lists. For now,
// just call the base class implementation to ensure that we don't get
// out of date.
cc::PropertyTreeLayerTreeDelegate::OnElementTransformMutated(
element_id, list_type, transform);
}
void CompositorPropertyTreeDelegate::SetObserverForTesting(Observer* observer) {
observer_ = observer;
}
} // namespace ui
|