OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/layer_impl.h" | 5 #include "cc/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/values.h" |
9 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
10 #include "cc/debug_colors.h" | 11 #include "cc/debug_colors.h" |
11 #include "cc/layer_tree_host_impl.h" | 12 #include "cc/layer_tree_host_impl.h" |
12 #include "cc/math_util.h" | 13 #include "cc/math_util.h" |
13 #include "cc/proxy.h" | 14 #include "cc/proxy.h" |
14 #include "cc/quad_sink.h" | 15 #include "cc/quad_sink.h" |
15 #include "cc/scrollbar_animation_controller.h" | 16 #include "cc/scrollbar_animation_controller.h" |
16 #include "ui/gfx/point_conversions.h" | 17 #include "ui/gfx/point_conversions.h" |
17 #include "ui/gfx/rect_conversions.h" | 18 #include "ui/gfx/rect_conversions.h" |
18 | 19 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 341 } |
341 if (m_maskLayer) { | 342 if (m_maskLayer) { |
342 str->append(indentString(indent+2)); | 343 str->append(indentString(indent+2)); |
343 str->append("Mask:\n"); | 344 str->append("Mask:\n"); |
344 m_maskLayer->dumpLayer(str, indent+3); | 345 m_maskLayer->dumpLayer(str, indent+3); |
345 } | 346 } |
346 for (size_t i = 0; i < m_children.size(); ++i) | 347 for (size_t i = 0; i < m_children.size(); ++i) |
347 m_children[i]->dumpLayer(str, indent+1); | 348 m_children[i]->dumpLayer(str, indent+1); |
348 } | 349 } |
349 | 350 |
| 351 base::DictionaryValue* LayerImpl::layerTreeAsJson() const |
| 352 { |
| 353 base::ListValue* list; |
| 354 base::DictionaryValue* result = new base::DictionaryValue; |
| 355 result->SetString("LayerType", layerTypeAsString()); |
| 356 |
| 357 list = new base::ListValue; |
| 358 list->AppendInteger(bounds().width()); |
| 359 list->AppendInteger(bounds().height()); |
| 360 result->Set("Bounds", list); |
| 361 |
| 362 list = new base::ListValue; |
| 363 list->AppendDouble(m_position.x()); |
| 364 list->AppendDouble(m_position.y()); |
| 365 result->Set("Position", list); |
| 366 |
| 367 const gfx::Transform& gfxTransform = m_drawProperties.target_space_transform
; |
| 368 double transform[16]; |
| 369 gfxTransform.matrix().asColMajord(transform); |
| 370 list = new base::ListValue; |
| 371 for (int i = 0; i < 16; ++i) |
| 372 list->AppendDouble(transform[i]); |
| 373 result->Set("DrawTransform", list); |
| 374 |
| 375 result->SetBoolean("DrawsContent", m_drawsContent); |
| 376 result->SetDouble("Opacity", opacity()); |
| 377 |
| 378 list = new base::ListValue; |
| 379 for (size_t i = 0; i < m_children.size(); ++i) |
| 380 list->Append(m_children[i]->layerTreeAsJson()); |
| 381 result->Set("Children", list); |
| 382 |
| 383 return result; |
| 384 } |
| 385 |
350 void LayerImpl::setStackingOrderChanged(bool stackingOrderChanged) | 386 void LayerImpl::setStackingOrderChanged(bool stackingOrderChanged) |
351 { | 387 { |
352 // We don't need to store this flag; we only need to track that the change o
ccurred. | 388 // We don't need to store this flag; we only need to track that the change o
ccurred. |
353 if (stackingOrderChanged) | 389 if (stackingOrderChanged) |
354 noteLayerPropertyChangedForSubtree(); | 390 noteLayerPropertyChangedForSubtree(); |
355 } | 391 } |
356 | 392 |
357 bool LayerImpl::layerSurfacePropertyChanged() const | 393 bool LayerImpl::layerSurfacePropertyChanged() const |
358 { | 394 { |
359 if (m_layerSurfacePropertyChanged) | 395 if (m_layerSurfacePropertyChanged) |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 744 |
709 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) | 745 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
710 { | 746 { |
711 if (!m_scrollbarAnimationController) | 747 if (!m_scrollbarAnimationController) |
712 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); | 748 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); |
713 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 749 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
714 m_scrollbarAnimationController->updateScrollOffset(this); | 750 m_scrollbarAnimationController->updateScrollOffset(this); |
715 } | 751 } |
716 | 752 |
717 } // namespace cc | 753 } // namespace cc |
OLD | NEW |