#include "third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/css/css_computed_style_declaration.h"
#include "third_party/blink/renderer/core/css/parser/css_property_parser.h"
#include "third_party/blink/renderer/core/dom/attribute.h"
#include "third_party/blink/renderer/core/dom/attribute_collection.h"
#include "third_party/blink/renderer/core/dom/character_data.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/document_type.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/core/dom/qualified_name.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.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/html_option_element.h"
#include "third_party/blink/renderer/core/html/forms/html_text_area_element.h"
#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/html/html_link_element.h"
#include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/inspector/inspected_frames.h"
#include "third_party/blink/renderer/core/inspector/inspector_contrast.h"
#include "third_party/blink/renderer/core/inspector/inspector_dom_agent.h"
#include "third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h"
#include "third_party/blink/renderer/core/inspector/legacy_dom_snapshot_agent.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_paint_order_iterator.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/platform/bindings/thread_debugger.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "v8/include/v8-inspector.h"
namespace blink {
FormControlType;
Maybe;
namespace {
std::unique_ptr<protocol::Array<double>> BuildRectForPhysicalRect(
const PhysicalRect& rect) { … }
std::unique_ptr<protocol::Array<double>> BuildRectForLayout(const int x,
const int y,
const int width,
const int height) { … }
Document* GetEmbeddedDocument(PaintLayer* layer) { … }
std::unique_ptr<protocol::DOMSnapshot::RareStringData> StringData() { … }
std::unique_ptr<protocol::DOMSnapshot::RareIntegerData> IntegerData() { … }
std::unique_ptr<protocol::DOMSnapshot::RareBooleanData> BooleanData() { … }
String GetOriginUrl(const Node* node) { … }
class DOMTreeIterator { … };
}
PhysicalRect InspectorDOMSnapshotAgent::RectInDocument(
const LayoutObject* layout_object) { … }
PhysicalRect InspectorDOMSnapshotAgent::TextFragmentRectInDocument(
const LayoutObject* layout_object,
const LayoutText::TextBoxInfo& text_box) { … }
InspectorDOMSnapshotAgent::InspectorDOMSnapshotAgent(
InspectedFrames* inspected_frames,
InspectorDOMDebuggerAgent* dom_debugger_agent)
: … { … }
InspectorDOMSnapshotAgent::~InspectorDOMSnapshotAgent() = default;
void InspectorDOMSnapshotAgent::CharacterDataModified(
CharacterData* character_data) { … }
void InspectorDOMSnapshotAgent::DidInsertDOMNode(Node* node) { … }
void InspectorDOMSnapshotAgent::EnableAndReset() { … }
void InspectorDOMSnapshotAgent::Restore() { … }
protocol::Response InspectorDOMSnapshotAgent::enable() { … }
protocol::Response InspectorDOMSnapshotAgent::disable() { … }
protocol::Response InspectorDOMSnapshotAgent::getSnapshot(
std::unique_ptr<protocol::Array<String>> style_filter,
protocol::Maybe<bool> include_event_listeners,
protocol::Maybe<bool> include_paint_order,
protocol::Maybe<bool> include_user_agent_shadow_tree,
std::unique_ptr<protocol::Array<protocol::DOMSnapshot::DOMNode>>* dom_nodes,
std::unique_ptr<protocol::Array<protocol::DOMSnapshot::LayoutTreeNode>>*
layout_tree_nodes,
std::unique_ptr<protocol::Array<protocol::DOMSnapshot::ComputedStyle>>*
computed_styles) { … }
protocol::Response InspectorDOMSnapshotAgent::captureSnapshot(
std::unique_ptr<protocol::Array<String>> computed_styles,
protocol::Maybe<bool> include_paint_order,
protocol::Maybe<bool> include_dom_rects,
protocol::Maybe<bool> include_blended_background_colors,
protocol::Maybe<bool> include_text_color_opacities,
std::unique_ptr<protocol::Array<protocol::DOMSnapshot::DocumentSnapshot>>*
documents,
std::unique_ptr<protocol::Array<String>>* strings) { … }
int InspectorDOMSnapshotAgent::AddString(const String& string) { … }
void InspectorDOMSnapshotAgent::SetRare(
protocol::DOMSnapshot::RareIntegerData* data,
int index,
int value) { … }
void InspectorDOMSnapshotAgent::SetRare(
protocol::DOMSnapshot::RareStringData* data,
int index,
const String& value) { … }
void InspectorDOMSnapshotAgent::SetRare(
protocol::DOMSnapshot::RareBooleanData* data,
int index) { … }
void InspectorDOMSnapshotAgent::VisitDocument(Document* document) { … }
void InspectorDOMSnapshotAgent::VisitNode(Node* node,
int parent_index,
InspectorContrast& contrast) { … }
void InspectorDOMSnapshotAgent::VisitPseudoElements(
Element* parent,
int parent_index,
InspectorContrast& contrast) { … }
std::unique_ptr<protocol::Array<int>>
InspectorDOMSnapshotAgent::BuildArrayForElementAttributes(Node* node) { … }
int InspectorDOMSnapshotAgent::BuildLayoutTreeNode(
LayoutObject* layout_object,
Node* node,
int node_index,
InspectorContrast& contrast) { … }
std::unique_ptr<protocol::Array<int>>
InspectorDOMSnapshotAgent::BuildStylesForNode(Node* node) { … }
InspectorDOMSnapshotAgent::PaintOrderMap*
InspectorDOMSnapshotAgent::BuildPaintLayerTree(Document* document) { … }
void InspectorDOMSnapshotAgent::TraversePaintLayerTree(
Document* document,
PaintOrderMap* paint_order_map) { … }
void InspectorDOMSnapshotAgent::VisitPaintLayer(
PaintLayer* layer,
PaintOrderMap* paint_order_map) { … }
void InspectorDOMSnapshotAgent::Trace(Visitor* visitor) const { … }
}