| Index: ash/devtools/ash_devtools_css_agent.cc
|
| diff --git a/ash/devtools/ash_devtools_css_agent.cc b/ash/devtools/ash_devtools_css_agent.cc
|
| index 90c2ed2d37a1a38a95f69655c94e7f45ceff8d74..84c65d7d1e0c1a31cab815248c286cc98878964e 100644
|
| --- a/ash/devtools/ash_devtools_css_agent.cc
|
| +++ b/ash/devtools/ash_devtools_css_agent.cc
|
| @@ -4,15 +4,14 @@
|
|
|
| #include "ash/devtools/ash_devtools_css_agent.h"
|
|
|
| -#include "ash/devtools/ui_element.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| #include "ui/aura/window.h"
|
|
|
| namespace ash {
|
| namespace devtools {
|
| +
|
| namespace {
|
| -
|
| using namespace ui::devtools::protocol;
|
|
|
| const char kHeight[] = "height";
|
| @@ -164,8 +163,16 @@
|
| return ui::devtools::protocol::Response::OK();
|
| }
|
|
|
| -void AshDevToolsCSSAgent::OnNodeBoundsChanged(int node_id) {
|
| - InvalidateStyleSheet(node_id);
|
| +void AshDevToolsCSSAgent::OnWindowBoundsChanged(aura::Window* 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));
|
| }
|
|
|
| std::unique_ptr<ui::devtools::protocol::CSS::CSSStyle>
|
| @@ -185,10 +192,22 @@
|
| bool AshDevToolsCSSAgent::GetPropertiesForNodeId(int node_id,
|
| gfx::Rect* bounds,
|
| bool* visible) {
|
| - UIElement* ui_element = dom_agent_->GetElementFromNodeId(node_id);
|
| - if (ui_element) {
|
| - ui_element->GetBounds(bounds);
|
| - ui_element->GetVisible(visible);
|
| + aura::Window* window = dom_agent_->GetWindowFromNodeId(node_id);
|
| + if (window) {
|
| + *bounds = window->bounds();
|
| + *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();
|
| return true;
|
| }
|
| return false;
|
| @@ -197,10 +216,33 @@
|
| bool AshDevToolsCSSAgent::SetPropertiesForNodeId(int node_id,
|
| const gfx::Rect& bounds,
|
| bool visible) {
|
| - UIElement* ui_element = dom_agent_->GetElementFromNodeId(node_id);
|
| - if (ui_element) {
|
| - ui_element->SetBounds(bounds);
|
| - ui_element->SetVisible(visible);
|
| + aura::Window* 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();
|
| + }
|
| + 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;
|
|
|