#include "components/ui_devtools/css_agent.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "components/ui_devtools/agent_util.h"
#include "components/ui_devtools/ui_element.h"
namespace ui_devtools {
CSS;
Array;
Response;
namespace {
const char kHeight[] = …;
const char kWidth[] = …;
const char kX[] = …;
const char kY[] = …;
const char kVisibility[] = …;
std::unique_ptr<CSS::SourceRange> BuildDefaultPropertySourceRange() { … }
std::unique_ptr<CSS::SourceRange> BuildDefaultSelectorSourceRange() { … }
std::unique_ptr<Array<int>> BuildDefaultMatchingSelectors() { … }
std::unique_ptr<CSS::CSSProperty> BuildCSSProperty(const std::string& name,
const std::string& value) { … }
std::unique_ptr<Array<CSS::CSSProperty>> BuildCSSProperties(
const std::vector<UIElement::UIProperty>& properties_vector) { … }
std::unique_ptr<CSS::CSSStyle> BuildCSSStyle(
std::string stylesheet_uid,
const std::vector<UIElement::UIProperty>& properties) { … }
std::unique_ptr<Array<CSS::Value>> BuildSelectors(const std::string& name) { … }
std::unique_ptr<CSS::SelectorList> BuildSelectorList(const std::string& name) { … }
std::unique_ptr<CSS::CSSRule> BuildCSSRule(
std::string stylesheet_uid,
const UIElement::ClassProperties& class_properties) { … }
std::vector<UIElement::ClassProperties> GetClassPropertiesWithBounds(
UIElement* ui_element) { … }
std::string BuildStylesheetUId(int node_id, int stylesheet_id) { … }
Response NodeNotFoundError(int node_id) { … }
Response ParseProperties(const std::string& style_text,
gfx::Rect* bounds,
bool* visible) { … }
std::unique_ptr<CSS::CSSStyleSheetHeader> BuildObjectForStyleSheetInfo(
std::string stylesheet_uid,
std::string url_path,
int line) { … }
}
CSSAgent::CSSAgent(DOMAgent* dom_agent) : … { … }
CSSAgent::~CSSAgent() { … }
Response CSSAgent::enable() { … }
Response CSSAgent::disable() { … }
Response CSSAgent::getMatchedStylesForNode(
int node_id,
protocol::Maybe<Array<CSS::RuleMatch>>* matched_css_rules) { … }
Response CSSAgent::getStyleSheetText(const protocol::String& style_sheet_id,
protocol::String* result) { … }
Response CSSAgent::setStyleTexts(
std::unique_ptr<Array<CSS::StyleDeclarationEdit>> edits,
std::unique_ptr<Array<CSS::CSSStyle>>* result) { … }
void CSSAgent::OnElementBoundsChanged(UIElement* ui_element) { … }
void CSSAgent::InvalidateStyleSheet(UIElement* ui_element) { … }
bool CSSAgent::GetPropertiesForUIElement(UIElement* ui_element,
gfx::Rect* bounds,
bool* visible) { … }
bool CSSAgent::SetPropertiesForUIElement(UIElement* ui_element,
const gfx::Rect& bounds,
bool visible) { … }
std::unique_ptr<Array<CSS::RuleMatch>> CSSAgent::BuildMatchedStyles(
UIElement* ui_element) { … }
void CSSAgent::InitStylesheetHeaders(UIElement* ui_element) { … }
}