chromium/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.h"

#include "base/containers/adapters.h"
#include "base/logging.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/numerics/safe_conversions.h"
#include "cc/input/layer_selection_bound.h"
#include "cc/layers/layer.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/paint_op_buffer.h"
#include "cc/paint/render_surface_filters.h"
#include "third_party/blink/renderer/platform/graphics/compositing/chunk_to_layer_mapper.h"
#include "third_party/blink/renderer/platform/graphics/compositing/property_tree_manager.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/paint/display_item_list.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h"
#include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_chunk.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h"
#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h"
#include "third_party/blink/renderer/platform/graphics/paint/raster_invalidation_tracking.h"
#include "third_party/blink/renderer/platform/graphics/paint/scroll_paint_property_node.h"
#include "third_party/blink/renderer/platform/graphics/paint/scrollbar_display_item.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/rect_conversions.h"

namespace blink {

namespace {

// Adapts cc::PaintOpBuffer to provide cc::DisplayItemList API with empty
// implementations.
class PaintOpBufferExt : public cc::PaintOpBuffer {};

// In a ConversionContext's property state switching function (e.g.
// SwitchToClip), if a scroll translation switch is needed to finish the switch,
// the function returns this struct with kStart or kEnd type, and
// ConversionContext::Convert() will start a new DrawScrollingContentsOp in a
// new ConversionContext, or end the current DrawScrollingContentsOp and return
// to the outer ConversionContext. Then the switch will continue in the new
// context.
struct ScrollTranslationAction {};

// State stack of ConversionContext.
// The size of the stack is the number of nested paired items that are
// currently nested. Note that this is a "restore stack", i.e. the top element
// does not represent the current state, but the state prior to applying the
// last paired begin.
struct StateEntry {};

// This structure accumulates bounds of all chunks under an effect. When an
// effect starts, we emit a SaveLayer[Alpha]Op with null bounds, and push a
// new |EffectBoundsInfo| onto |effect_bounds_stack_|. When the effect ends,
// we update the bounds of the op.
struct EffectBoundsInfo {};

template <typename Result>
class ConversionContext {};

template <typename Result>
ConversionContext<Result>::~ConversionContext() {}

template <typename Result>
void ConversionContext<Result>::TranslateForLayerOffsetOnce() {}

// Tries to combine a clip node's clip rect into |combined_clip_rect|.
// Returns whether the clip has been combined.
static bool CombineClip(const ClipPaintPropertyNode& clip,
                        FloatRoundedRect& combined_clip_rect) {}

template <typename Result>
ScrollTranslationAction ConversionContext<Result>::SwitchToClip(
    const ClipPaintPropertyNode& target_clip) {}

template <typename Result>
ScrollTranslationAction ConversionContext<Result>::StartClip(
    const FloatRoundedRect& combined_clip_rect,
    const ClipPaintPropertyNode& lowest_combined_clip_node) {}

bool HasRealEffects(const EffectPaintPropertyNode& current,
                    const EffectPaintPropertyNode& ancestor) {}

template <typename Result>
ScrollTranslationAction ConversionContext<Result>::SwitchToEffect(
    const EffectPaintPropertyNode& target_effect) {}

template <typename Result>
ScrollTranslationAction ConversionContext<Result>::StartEffect(
    const EffectPaintPropertyNode& effect) {}

template <typename Result>
void ConversionContext<Result>::UpdateEffectBounds(
    const gfx::RectF& bounds,
    const TransformPaintPropertyNode& transform) {}

template <typename Result>
void ConversionContext<Result>::EndEffect() {}

template <typename Result>
ScrollTranslationAction ConversionContext<Result>::EndClips() {}

template <typename Result>
void ConversionContext<Result>::EndClip() {}

template <typename Result>
void ConversionContext<Result>::PushState(
    typename StateEntry::PairedType type) {}

template <typename Result>
void ConversionContext<Result>::PopState() {}

template <typename Result>
ScrollTranslationAction ConversionContext<Result>::SwitchToTransform(
    const TransformPaintPropertyNode& target_transform) {}

template <typename Result>
void ConversionContext<Result>::EndTransform() {}

template <>
void ConversionContext<cc::DisplayItemList>::EmitDrawScrollingContentsOp(
    PaintChunkIterator& chunk_it,
    PaintChunkIterator end_chunk,
    const TransformPaintPropertyNode& scroll_translation) {}

template <>
ScrollTranslationAction
ConversionContext<cc::DisplayItemList>::ComputeScrollTranslationAction(
    const TransformPaintPropertyNode& target_transform) const {}

template <typename Result>
bool ConversionContext<Result>::HasDrawing(
    PaintChunkIterator chunk_it,
    const PropertyTreeState& chunk_state) const {}

template <typename Result>
void ConversionContext<Result>::Convert(PaintChunkIterator& chunk_it,
                                        PaintChunkIterator end_chunk,
                                        const gfx::Rect* additional_cull_rect) {}

}  // unnamed namespace

void PaintChunksToCcLayer::ConvertInto(
    const PaintChunkSubset& chunks,
    const PropertyTreeState& layer_state,
    const gfx::Vector2dF& layer_offset,
    RasterUnderInvalidationCheckingParams* under_invalidation_checking_params,
    cc::DisplayItemList& cc_list) {}

PaintRecord PaintChunksToCcLayer::Convert(const PaintChunkSubset& chunks,
                                          const PropertyTreeState& layer_state,
                                          const gfx::Rect* cull_rect) {}

namespace {

struct NonCompositedScroll {};

class LayerPropertiesUpdater {};

TouchAction LayerPropertiesUpdater::ShouldDisableCursorControl() {}

void LayerPropertiesUpdater::UpdateTouchActionRegion(
    const HitTestData& hit_test_data) {}

void LayerPropertiesUpdater::UpdateWheelEventRegion(
    const HitTestData& hit_test_data) {}

void LayerPropertiesUpdater::UpdateScrollHitTestData(const PaintChunk& chunk) {}

const TransformPaintPropertyNode&
LayerPropertiesUpdater::TopNonCompositedScroll(
    const TransformPaintPropertyNode& scroll_translation) const {}

void LayerPropertiesUpdater::AddNonCompositedScroll(const PaintChunk& chunk) {}

// Updates hit_test_opaqueness on previous non-composited scrollers to be
// HitTestOpaqueness::kMixed if the chunk is hit testable and overlaps.
// Hit tests in these cases cannot be handled on the compositor thread.
void LayerPropertiesUpdater::UpdatePreviousNonCompositedScrolls(
    const PaintChunk& chunk) {}

const ScrollbarDisplayItem* NonCompositedScrollbarDisplayItem(
    PaintChunkIterator chunk_it,
    const cc::Layer& layer) {}

void LayerPropertiesUpdater::UpdateForNonCompositedScrollbar(
    const ScrollbarDisplayItem& scrollbar) {}

void LayerPropertiesUpdater::UpdateRegionCaptureData(
    const RegionCaptureData& region_capture_data) {}

gfx::Point LayerPropertiesUpdater::MapSelectionBoundPoint(
    const gfx::Point& point) const {}

cc::LayerSelectionBound
LayerPropertiesUpdater::PaintedSelectionBoundToLayerSelectionBound(
    const PaintedSelectionBound& bound) const {}

void LayerPropertiesUpdater::UpdateLayerSelection(
    const LayerSelectionData& layer_selection_data) {}

void LayerPropertiesUpdater::Update() {}

}  // namespace

void PaintChunksToCcLayer::UpdateLayerProperties(
    cc::Layer& layer,
    const PropertyTreeState& layer_state,
    const PaintChunkSubset& chunks,
    cc::LayerSelection& layer_selection,
    bool selection_only) {}

}  // namespace blink

WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS()
WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS()
WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS()