InspectorLayerTreeAgent.h [plain text]
#ifndef InspectorLayerTreeAgent_h
#define InspectorLayerTreeAgent_h
#if ENABLE(INSPECTOR)
#include "InspectorWebAgentBase.h"
#include "InspectorWebBackendDispatchers.h"
#include "InspectorWebFrontendDispatchers.h"
#include "InspectorWebTypeBuilders.h"
#include "RenderLayer.h"
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class InstrumentingAgents;
typedef String ErrorString;
class InspectorLayerTreeAgent : public InspectorAgentBase, public Inspector::InspectorLayerTreeBackendDispatcherHandler {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit InspectorLayerTreeAgent(InstrumentingAgents*);
~InspectorLayerTreeAgent();
virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
void reset();
void layerTreeDidChange();
void renderLayerDestroyed(const RenderLayer*);
void pseudoElementDestroyed(PseudoElement*);
virtual void enable(ErrorString*) override;
virtual void disable(ErrorString*) override;
virtual void layersForNode(ErrorString*, int nodeId, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::LayerTree::Layer>>&) override;
virtual void reasonsForCompositingLayer(ErrorString*, const String& layerId, RefPtr<Inspector::TypeBuilder::LayerTree::CompositingReasons>&) override;
private:
String bind(const RenderLayer*);
void unbind(const RenderLayer*);
void gatherLayersUsingRenderObjectHierarchy(ErrorString*, RenderObject*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::LayerTree::Layer>>&);
void gatherLayersUsingRenderLayerHierarchy(ErrorString*, RenderLayer*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::LayerTree::Layer>>&);
PassRefPtr<Inspector::TypeBuilder::LayerTree::Layer> buildObjectForLayer(ErrorString*, RenderLayer*);
PassRefPtr<Inspector::TypeBuilder::LayerTree::IntRect> buildObjectForIntRect(const IntRect&);
int idForNode(ErrorString*, Node*);
String bindPseudoElement(PseudoElement*);
void unbindPseudoElement(PseudoElement*);
std::unique_ptr<Inspector::InspectorLayerTreeFrontendDispatcher> m_frontendDispatcher;
RefPtr<Inspector::InspectorLayerTreeBackendDispatcher> m_backendDispatcher;
HashMap<const RenderLayer*, String> m_documentLayerToIdMap;
HashMap<String, const RenderLayer*> m_idToLayer;
HashMap<PseudoElement*, String> m_pseudoElementToIdMap;
HashMap<String, PseudoElement*> m_idToPseudoElement;
};
}
#endif // ENABLE(INSPECTOR)
#endif // !defined(InspectorLayerTreeAgent_h)