#include "components/ui_devtools/views/overlay_agent_views.h"
#include <memory>
#include <utility>
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/ui_devtools/ui_element.h"
#include "components/ui_devtools/views/view_element.h"
#include "components/ui_devtools/views/widget_element.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/compositor/paint_recorder.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/render_text.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#if defined(USE_AURA)
#include "ui/aura/window.h"
#include "ui/wm/core/window_util.h"
#endif
namespace ui_devtools {
namespace {
void DrawRulerText(const std::u16string& utf16_text,
const gfx::Point& p,
gfx::Canvas* canvas,
gfx::RenderText* render_text_) { … }
void DrawRulers(const gfx::Rect& screen_bounds,
gfx::Canvas* canvas,
gfx::RenderText* render_text_) { … }
void DrawSizeOfRectangle(const gfx::Rect& hovered_rect,
const RectSide drawing_side,
gfx::Canvas* canvas,
gfx::RenderText* render_text_) { … }
void DrawRectGuideLinesOnCanvas(const gfx::Rect& screen_bounds,
const gfx::RectF& rect_f,
cc::PaintFlags flags,
gfx::Canvas* canvas) { … }
void DrawSizeWithAnyBounds(float x1,
float y1,
float x2,
float y2,
RectSide side,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
void DrawR1ContainsR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
void DrawR1HorizontalFullLeftR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
void DrawR1TopFullLeftR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas_,
gfx::RenderText* render_text) { … }
void DrawR1BottomFullLeftR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
void DrawR1TopPartialLeftR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
void DrawR1BottomPartialLeftR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
void DrawR1IntersectsR2(const gfx::RectF& pinned_rect_f,
const gfx::RectF& hovered_rect_f,
const cc::PaintFlags& flags,
gfx::Canvas* canvas,
gfx::RenderText* render_text) { … }
}
OverlayAgentViews::OverlayAgentViews(DOMAgent* dom_agent)
: … { … }
OverlayAgentViews::~OverlayAgentViews() { … }
void OverlayAgentViews::SetPinnedNodeId(int node_id) { … }
protocol::Response OverlayAgentViews::setInspectMode(
const protocol::String& in_mode,
protocol::Maybe<protocol::Overlay::HighlightConfig> in_highlightConfig) { … }
protocol::Response OverlayAgentViews::highlightNode(
std::unique_ptr<protocol::Overlay::HighlightConfig> highlight_config,
protocol::Maybe<int> node_id) { … }
protocol::Response OverlayAgentViews::hideHighlight() { … }
void OverlayAgentViews::ShowDistancesInHighlightOverlay(int pinned_id,
int element_id) { … }
protocol::Response OverlayAgentViews::HighlightNode(int node_id,
bool show_size) { … }
void OverlayAgentViews::OnMouseEvent(ui::MouseEvent* event) { … }
void OverlayAgentViews::OnKeyEvent(ui::KeyEvent* event) { … }
void OverlayAgentViews::OnPaintLayer(const ui::PaintContext& context) { … }
bool OverlayAgentViews::UpdateHighlight(
const std::pair<gfx::NativeWindow, gfx::Rect>& window_and_bounds) { … }
}