chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc

// Copyright 2020 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/core/paint/selection_bounds_recorder.h"

#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/layout/selection_state.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"

namespace blink {

namespace {

// This represents a directional edge of a rect, starting at one corner and
// ending on another. Note that the 'left' and 'right' edges only have one
// variant because the edge always ends on the bottom. However in vertical
// writing modes, the edge end should follow the block direction, which can
// be flipped.
enum class RectEdge {};

struct BoundEdges {};

// Based on the given WritingMode and direction, return the pair of start and
// end edges that should be used to determe the PaintedSelectionBound start
// and end edges given a selection rectangle. For the simplest cases (i.e.
// LTR horizontal writing mode), the left edge is the start and the right edge
// would be the end. However, this flips for RTL, and vertical writing modes
// additionally complicated matters.
BoundEdges GetBoundEdges(WritingMode writing_mode, bool is_ltr) {}

// Set the given bound's edge_start and edge_end, based on the provided
// selection rect and edge.
void SetBoundEdge(gfx::Rect selection_rect,
                  RectEdge edge,
                  PaintedSelectionBound& bound) {}

PhysicalOffset GetSamplePointForVisibility(const PhysicalOffset& edge_start,
                                           const PhysicalOffset& edge_end,
                                           float zoom_factor) {}

}  // namespace

SelectionBoundsRecorder::SelectionBoundsRecorder(
    SelectionState state,
    PhysicalRect selection_rect,
    PaintController& paint_controller,
    TextDirection text_direction,
    WritingMode writing_mode,
    const LayoutObject& layout_object)
    :{}

SelectionBoundsRecorder::~SelectionBoundsRecorder() {}

bool SelectionBoundsRecorder::ShouldRecordSelection(
    const FrameSelection& frame_selection,
    SelectionState state) {}

// Returns whether this position is not visible on the screen (because
// clipped out).
bool SelectionBoundsRecorder::IsVisible(const LayoutObject& rect_layout_object,
                                        const PhysicalOffset& edge_start,
                                        const PhysicalOffset& edge_end) {}

}  // namespace blink