#include "ui/display/display_layout.h"
#include <map>
#include <set>
#include <sstream>
#include <string_view>
#include <unordered_map>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/device_event_log/device_event_log.h"
#include "ui/display/display.h"
#include "ui/display/util/display_util.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
namespace display {
namespace {
const char kTop[] = …;
const char kRight[] = …;
const char kBottom[] = …;
const char kLeft[] = …;
const char kUnknown[] = …;
const int kMaxValidOffset = …;
bool ComparePlacements(const DisplayPlacement& d1, const DisplayPlacement& d2) { … }
DisplayIdList DisplayListToDisplayIdList(const Displays& displays) { … }
Display* FindDisplayById(Displays* display_list, int64_t id) { … }
int GetDisplayTreeDepth(
int64_t display_id,
int64_t primary_id,
const std::map<int64_t, int64_t>& display_to_parent_ids_map) { … }
bool AreDisplaysTouching(const Display& child_display,
const Display& parent_display,
DisplayPlacement::Position child_position) { … }
void UpdatePlacementList(Displays* display_list,
std::vector<DisplayPlacement>* placement_list) { … }
void MaybeReparentTargetDisplay(
int last_offset_x,
int last_offset_y,
const Display* last_intersecting_source_display,
const Display* target_display,
std::map<int64_t, int64_t>* display_to_parent_ids_map,
Displays* display_list,
std::vector<DisplayPlacement>* placement_list) { … }
void OffsetDisplay(Display* display, int x, int y) { … }
int CalculateOffsetX(const gfx::Rect& source_bounds,
const gfx::Rect& target_bounds) { … }
int CalculateOffsetY(const gfx::Rect& source_bounds,
const gfx::Rect& target_bounds) { … }
void DeIntersectDisplays(int64_t primary_id,
Displays* display_list,
std::vector<DisplayPlacement>* placement_list,
std::set<int64_t>* updated_displays) { … }
bool IsPointOverRadiusVector(const gfx::Point& point,
const gfx::Point& vector) { … }
}
DisplayPlacement::DisplayPlacement()
: … { … }
DisplayPlacement::DisplayPlacement(Position position, int offset)
: … { … }
DisplayPlacement::DisplayPlacement(Position position,
int offset,
OffsetReference offset_reference)
: … { … }
DisplayPlacement::DisplayPlacement(int64_t display_id,
int64_t parent_display_id,
Position position,
int offset,
OffsetReference offset_reference)
: … { … }
DisplayPlacement::DisplayPlacement(const DisplayPlacement&) = default;
DisplayPlacement& DisplayPlacement::operator=(const DisplayPlacement&) =
default;
bool DisplayPlacement::operator==(const DisplayPlacement& other) const { … }
bool DisplayPlacement::operator!=(const DisplayPlacement& other) const { … }
DisplayPlacement& DisplayPlacement::Swap() { … }
std::string DisplayPlacement::ToString() const { … }
std::string DisplayPlacement::PositionToString(Position position) { … }
bool DisplayPlacement::StringToPosition(std::string_view string,
Position* position) { … }
DisplayLayout::DisplayLayout()
: … { … }
DisplayLayout::~DisplayLayout() { … }
void DisplayLayout::ApplyToDisplayList(Displays* display_list,
std::vector<int64_t>* updated_ids,
int minimum_offset_overlap) { … }
bool DisplayLayout::Validate(const DisplayIdList& list,
const DisplayLayout& layout) { … }
std::unique_ptr<DisplayLayout> DisplayLayout::Copy() const { … }
void DisplayLayout::SwapPrimaryDisplay(int64_t new_primary_id) { … }
bool DisplayLayout::HasSamePlacementList(const DisplayLayout& layout) const { … }
void DisplayLayout::RemoveDisplayPlacements(const DisplayIdList& list) { … }
std::string DisplayLayout::ToString() const { … }
DisplayPlacement DisplayLayout::FindPlacementById(int64_t display_id) const { … }
DisplayPlacement DisplayLayout::CreatePlacementForRectangles(
const gfx::Rect& reference,
const gfx::Rect& rectangle) { … }
bool DisplayLayout::ApplyDisplayPlacement(const DisplayPlacement& placement,
Displays* display_list,
int minimum_offset_overlap) { … }
}