| Index: ash/common/devtools/ash_devtools_css_agent.cc
|
| diff --git a/ash/common/devtools/ash_devtools_css_agent.cc b/ash/common/devtools/ash_devtools_css_agent.cc
|
| index 966ff83d4f7a411245ac46f664f7cfa55eeff69a..27b04a6ceaa996e739bb403cd37f518eb6154523 100644
|
| --- a/ash/common/devtools/ash_devtools_css_agent.cc
|
| +++ b/ash/common/devtools/ash_devtools_css_agent.cc
|
| @@ -163,16 +163,8 @@ ui::devtools::protocol::Response AshDevToolsCSSAgent::setStyleTexts(
|
| return ui::devtools::protocol::Response::OK();
|
| }
|
|
|
| -void AshDevToolsCSSAgent::OnWindowBoundsChanged(WmWindow* window) {
|
| - InvalidateStyleSheet(dom_agent_->GetNodeIdFromWindow(window));
|
| -}
|
| -
|
| -void AshDevToolsCSSAgent::OnWidgetBoundsChanged(views::Widget* widget) {
|
| - InvalidateStyleSheet(dom_agent_->GetNodeIdFromWidget(widget));
|
| -}
|
| -
|
| -void AshDevToolsCSSAgent::OnViewBoundsChanged(views::View* view) {
|
| - InvalidateStyleSheet(dom_agent_->GetNodeIdFromView(view));
|
| +void AshDevToolsCSSAgent::OnUIElementBoundsChanged(UIElement* ui_element) {
|
| + InvalidateStyleSheet(ui_element->GetNodeId());
|
| }
|
|
|
| std::unique_ptr<ui::devtools::protocol::CSS::CSSStyle>
|
| @@ -192,59 +184,18 @@ void AshDevToolsCSSAgent::InvalidateStyleSheet(int node_id) {
|
| bool AshDevToolsCSSAgent::GetPropertiesForNodeId(int node_id,
|
| gfx::Rect* bounds,
|
| bool* visible) {
|
| - WmWindow* window = dom_agent_->GetWindowFromNodeId(node_id);
|
| - if (window) {
|
| - *bounds = window->GetBounds();
|
| - *visible = window->IsVisible();
|
| - return true;
|
| - }
|
| - views::Widget* widget = dom_agent_->GetWidgetFromNodeId(node_id);
|
| - if (widget) {
|
| - *bounds = widget->GetRestoredBounds();
|
| - *visible = widget->IsVisible();
|
| - return true;
|
| - }
|
| - views::View* view = dom_agent_->GetViewFromNodeId(node_id);
|
| - if (view) {
|
| - *bounds = view->bounds();
|
| - *visible = view->visible();
|
| + UIElement* ui_element = UIElement::GetUIElementByNodeId(node_id);
|
| + if (ui_element->GetBounds(bounds) && ui_element->GetVisible(visible))
|
| return true;
|
| - }
|
| return false;
|
| }
|
|
|
| bool AshDevToolsCSSAgent::SetPropertiesForNodeId(int node_id,
|
| const gfx::Rect& bounds,
|
| bool visible) {
|
| - WmWindow* window = dom_agent_->GetWindowFromNodeId(node_id);
|
| - if (window) {
|
| - window->SetBounds(bounds);
|
| - if (visible != window->IsVisible()) {
|
| - if (visible)
|
| - window->Show();
|
| - else
|
| - window->Hide();
|
| - }
|
| - return true;
|
| - }
|
| - views::Widget* widget = dom_agent_->GetWidgetFromNodeId(node_id);
|
| - if (widget) {
|
| - widget->SetBounds(bounds);
|
| - if (visible != widget->IsVisible()) {
|
| - if (visible)
|
| - widget->Show();
|
| - else
|
| - widget->Hide();
|
| - }
|
| + UIElement* ui_element = UIElement::GetUIElementByNodeId(node_id);
|
| + if (ui_element->SetBounds(bounds) && ui_element->SetVisible(visible))
|
| return true;
|
| - }
|
| - views::View* view = dom_agent_->GetViewFromNodeId(node_id);
|
| - if (view) {
|
| - view->SetBoundsRect(bounds);
|
| - if (visible != view->visible())
|
| - view->SetVisible(visible);
|
| - return true;
|
| - }
|
| return false;
|
| }
|
|
|
|
|