| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 if (a.x() != b.x()) | 527 if (a.x() != b.x()) |
| 528 return a.x() > b.x(); | 528 return a.x() > b.x(); |
| 529 if (a.y() != b.y()) | 529 if (a.y() != b.y()) |
| 530 return a.y() > b.y(); | 530 return a.y() > b.y(); |
| 531 if (a.width() != b.width()) | 531 if (a.width() != b.width()) |
| 532 return a.width() > b.width(); | 532 return a.width() > b.width(); |
| 533 return a.height() > b.height(); | 533 return a.height() > b.height(); |
| 534 } | 534 } |
| 535 | 535 |
| 536 template <typename T> | 536 template <typename T> |
| 537 static PassRefPtrWillBeRawPtr<JSONArray> pointAsJSONArray(const T& point) | 537 static PassRefPtr<JSONArray> pointAsJSONArray(const T& point) |
| 538 { | 538 { |
| 539 RefPtrWillBeRawPtr<JSONArray> array = adoptRefWillBeNoop(new JSONArray); | 539 RefPtr<JSONArray> array = adoptRef(new JSONArray); |
| 540 array->pushNumber(point.x()); | 540 array->pushNumber(point.x()); |
| 541 array->pushNumber(point.y()); | 541 array->pushNumber(point.y()); |
| 542 return array; | 542 return array; |
| 543 } | 543 } |
| 544 | 544 |
| 545 template <typename T> | 545 template <typename T> |
| 546 static PassRefPtrWillBeRawPtr<JSONArray> sizeAsJSONArray(const T& size) | 546 static PassRefPtr<JSONArray> sizeAsJSONArray(const T& size) |
| 547 { | 547 { |
| 548 RefPtrWillBeRawPtr<JSONArray> array = adoptRefWillBeNoop(new JSONArray); | 548 RefPtr<JSONArray> array = adoptRef(new JSONArray); |
| 549 array->pushNumber(size.width()); | 549 array->pushNumber(size.width()); |
| 550 array->pushNumber(size.height()); | 550 array->pushNumber(size.height()); |
| 551 return array; | 551 return array; |
| 552 } | 552 } |
| 553 | 553 |
| 554 template <typename T> | 554 template <typename T> |
| 555 static PassRefPtrWillBeRawPtr<JSONArray> rectAsJSONArray(const T& rect) | 555 static PassRefPtr<JSONArray> rectAsJSONArray(const T& rect) |
| 556 { | 556 { |
| 557 RefPtrWillBeRawPtr<JSONArray> array = adoptRefWillBeNoop(new JSONArray); | 557 RefPtr<JSONArray> array = adoptRef(new JSONArray); |
| 558 array->pushNumber(rect.x()); | 558 array->pushNumber(rect.x()); |
| 559 array->pushNumber(rect.y()); | 559 array->pushNumber(rect.y()); |
| 560 array->pushNumber(rect.width()); | 560 array->pushNumber(rect.width()); |
| 561 array->pushNumber(rect.height()); | 561 array->pushNumber(rect.height()); |
| 562 return array; | 562 return array; |
| 563 } | 563 } |
| 564 | 564 |
| 565 static PassRefPtrWillBeRawPtr<JSONArray> transformAsJSONArray(const Transformati
onMatrix& t) | 565 static PassRefPtr<JSONArray> transformAsJSONArray(const TransformationMatrix& t) |
| 566 { | 566 { |
| 567 RefPtrWillBeRawPtr<JSONArray> array = adoptRefWillBeNoop(new JSONArray); | 567 RefPtr<JSONArray> array = adoptRef(new JSONArray); |
| 568 { | 568 { |
| 569 RefPtrWillBeRawPtr<JSONArray> row = adoptRefWillBeNoop(new JSONArray); | 569 RefPtr<JSONArray> row = adoptRef(new JSONArray); |
| 570 row->pushNumber(t.m11()); | 570 row->pushNumber(t.m11()); |
| 571 row->pushNumber(t.m12()); | 571 row->pushNumber(t.m12()); |
| 572 row->pushNumber(t.m13()); | 572 row->pushNumber(t.m13()); |
| 573 row->pushNumber(t.m14()); | 573 row->pushNumber(t.m14()); |
| 574 array->pushArray(row); | 574 array->pushArray(row); |
| 575 } | 575 } |
| 576 { | 576 { |
| 577 RefPtrWillBeRawPtr<JSONArray> row = adoptRefWillBeNoop(new JSONArray); | 577 RefPtr<JSONArray> row = adoptRef(new JSONArray); |
| 578 row->pushNumber(t.m21()); | 578 row->pushNumber(t.m21()); |
| 579 row->pushNumber(t.m22()); | 579 row->pushNumber(t.m22()); |
| 580 row->pushNumber(t.m23()); | 580 row->pushNumber(t.m23()); |
| 581 row->pushNumber(t.m24()); | 581 row->pushNumber(t.m24()); |
| 582 array->pushArray(row); | 582 array->pushArray(row); |
| 583 } | 583 } |
| 584 { | 584 { |
| 585 RefPtrWillBeRawPtr<JSONArray> row = adoptRefWillBeNoop(new JSONArray); | 585 RefPtr<JSONArray> row = adoptRef(new JSONArray); |
| 586 row->pushNumber(t.m31()); | 586 row->pushNumber(t.m31()); |
| 587 row->pushNumber(t.m32()); | 587 row->pushNumber(t.m32()); |
| 588 row->pushNumber(t.m33()); | 588 row->pushNumber(t.m33()); |
| 589 row->pushNumber(t.m34()); | 589 row->pushNumber(t.m34()); |
| 590 array->pushArray(row); | 590 array->pushArray(row); |
| 591 } | 591 } |
| 592 { | 592 { |
| 593 RefPtrWillBeRawPtr<JSONArray> row = adoptRefWillBeNoop(new JSONArray); | 593 RefPtr<JSONArray> row = adoptRef(new JSONArray); |
| 594 row->pushNumber(t.m41()); | 594 row->pushNumber(t.m41()); |
| 595 row->pushNumber(t.m42()); | 595 row->pushNumber(t.m42()); |
| 596 row->pushNumber(t.m43()); | 596 row->pushNumber(t.m43()); |
| 597 row->pushNumber(t.m44()); | 597 row->pushNumber(t.m44()); |
| 598 array->pushArray(row); | 598 array->pushArray(row); |
| 599 } | 599 } |
| 600 return array; | 600 return array; |
| 601 } | 601 } |
| 602 | 602 |
| 603 static String pointerAsString(const void* ptr) | 603 static String pointerAsString(const void* ptr) |
| 604 { | 604 { |
| 605 TextStream ts; | 605 TextStream ts; |
| 606 ts << ptr; | 606 ts << ptr; |
| 607 return ts.release(); | 607 return ts.release(); |
| 608 } | 608 } |
| 609 | 609 |
| 610 PassRefPtrWillBeRawPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags
flags, RenderingContextMap& renderingContextMap) const | 610 PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, Rend
eringContextMap& renderingContextMap) const |
| 611 { | 611 { |
| 612 RefPtrWillBeRawPtr<JSONObject> json = adoptRefWillBeNoop(new JSONObject); | 612 RefPtr<JSONObject> json = adoptRef(new JSONObject); |
| 613 | 613 |
| 614 if (flags & LayerTreeIncludesDebugInfo) { | 614 if (flags & LayerTreeIncludesDebugInfo) { |
| 615 json->setString("this", pointerAsString(this)); | 615 json->setString("this", pointerAsString(this)); |
| 616 json->setString("debugName", m_client->debugName(this)); | 616 json->setString("debugName", m_client->debugName(this)); |
| 617 } | 617 } |
| 618 | 618 |
| 619 if (m_position != FloatPoint()) | 619 if (m_position != FloatPoint()) |
| 620 json->setArray("position", pointAsJSONArray(m_position)); | 620 json->setArray("position", pointAsJSONArray(m_position)); |
| 621 | 621 |
| 622 if (m_boundsOrigin != FloatPoint()) | 622 if (m_boundsOrigin != FloatPoint()) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 | 674 |
| 675 if (m_replicaLayer) | 675 if (m_replicaLayer) |
| 676 json->setObject("replicaLayer", m_replicaLayer->layerTreeAsJSON(flags, r
enderingContextMap)); | 676 json->setObject("replicaLayer", m_replicaLayer->layerTreeAsJSON(flags, r
enderingContextMap)); |
| 677 | 677 |
| 678 if (m_replicatedLayer) | 678 if (m_replicatedLayer) |
| 679 json->setString("replicatedLayer", flags & LayerTreeIncludesDebugInfo ?
pointerAsString(m_replicatedLayer) : ""); | 679 json->setString("replicatedLayer", flags & LayerTreeIncludesDebugInfo ?
pointerAsString(m_replicatedLayer) : ""); |
| 680 | 680 |
| 681 if ((flags & LayerTreeIncludesRepaintRects) && repaintRectMap().contains(thi
s) && !repaintRectMap().get(this).isEmpty()) { | 681 if ((flags & LayerTreeIncludesRepaintRects) && repaintRectMap().contains(thi
s) && !repaintRectMap().get(this).isEmpty()) { |
| 682 Vector<FloatRect> repaintRectsCopy = repaintRectMap().get(this); | 682 Vector<FloatRect> repaintRectsCopy = repaintRectMap().get(this); |
| 683 std::sort(repaintRectsCopy.begin(), repaintRectsCopy.end(), &compareFloa
tRects); | 683 std::sort(repaintRectsCopy.begin(), repaintRectsCopy.end(), &compareFloa
tRects); |
| 684 RefPtrWillBeRawPtr<JSONArray> repaintRectsJSON = adoptRefWillBeNoop(new
JSONArray); | 684 RefPtr<JSONArray> repaintRectsJSON = adoptRef(new JSONArray); |
| 685 for (size_t i = 0; i < repaintRectsCopy.size(); ++i) { | 685 for (size_t i = 0; i < repaintRectsCopy.size(); ++i) { |
| 686 if (repaintRectsCopy[i].isEmpty()) | 686 if (repaintRectsCopy[i].isEmpty()) |
| 687 continue; | 687 continue; |
| 688 repaintRectsJSON->pushArray(rectAsJSONArray(repaintRectsCopy[i])); | 688 repaintRectsJSON->pushArray(rectAsJSONArray(repaintRectsCopy[i])); |
| 689 } | 689 } |
| 690 json->setArray("repaintRects", repaintRectsJSON); | 690 json->setArray("repaintRects", repaintRectsJSON); |
| 691 } | 691 } |
| 692 | 692 |
| 693 if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) { | 693 if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) { |
| 694 RefPtrWillBeRawPtr<JSONArray> paintingPhasesJSON = adoptRefWillBeNoop(ne
w JSONArray); | 694 RefPtr<JSONArray> paintingPhasesJSON = adoptRef(new JSONArray); |
| 695 if (m_paintingPhase & GraphicsLayerPaintBackground) | 695 if (m_paintingPhase & GraphicsLayerPaintBackground) |
| 696 paintingPhasesJSON->pushString("GraphicsLayerPaintBackground"); | 696 paintingPhasesJSON->pushString("GraphicsLayerPaintBackground"); |
| 697 if (m_paintingPhase & GraphicsLayerPaintForeground) | 697 if (m_paintingPhase & GraphicsLayerPaintForeground) |
| 698 paintingPhasesJSON->pushString("GraphicsLayerPaintForeground"); | 698 paintingPhasesJSON->pushString("GraphicsLayerPaintForeground"); |
| 699 if (m_paintingPhase & GraphicsLayerPaintMask) | 699 if (m_paintingPhase & GraphicsLayerPaintMask) |
| 700 paintingPhasesJSON->pushString("GraphicsLayerPaintMask"); | 700 paintingPhasesJSON->pushString("GraphicsLayerPaintMask"); |
| 701 if (m_paintingPhase & GraphicsLayerPaintChildClippingMask) | 701 if (m_paintingPhase & GraphicsLayerPaintChildClippingMask) |
| 702 paintingPhasesJSON->pushString("GraphicsLayerPaintChildClippingMask"
); | 702 paintingPhasesJSON->pushString("GraphicsLayerPaintChildClippingMask"
); |
| 703 if (m_paintingPhase & GraphicsLayerPaintOverflowContents) | 703 if (m_paintingPhase & GraphicsLayerPaintOverflowContents) |
| 704 paintingPhasesJSON->pushString("GraphicsLayerPaintOverflowContents")
; | 704 paintingPhasesJSON->pushString("GraphicsLayerPaintOverflowContents")
; |
| 705 if (m_paintingPhase & GraphicsLayerPaintCompositedScroll) | 705 if (m_paintingPhase & GraphicsLayerPaintCompositedScroll) |
| 706 paintingPhasesJSON->pushString("GraphicsLayerPaintCompositedScroll")
; | 706 paintingPhasesJSON->pushString("GraphicsLayerPaintCompositedScroll")
; |
| 707 json->setArray("paintingPhases", paintingPhasesJSON); | 707 json->setArray("paintingPhases", paintingPhasesJSON); |
| 708 } | 708 } |
| 709 | 709 |
| 710 if (flags & LayerTreeIncludesClipAndScrollParents) { | 710 if (flags & LayerTreeIncludesClipAndScrollParents) { |
| 711 if (m_hasScrollParent) | 711 if (m_hasScrollParent) |
| 712 json->setBoolean("hasScrollParent", true); | 712 json->setBoolean("hasScrollParent", true); |
| 713 if (m_hasClipParent) | 713 if (m_hasClipParent) |
| 714 json->setBoolean("hasClipParent", true); | 714 json->setBoolean("hasClipParent", true); |
| 715 } | 715 } |
| 716 | 716 |
| 717 if (flags & LayerTreeIncludesDebugInfo) { | 717 if (flags & LayerTreeIncludesDebugInfo) { |
| 718 RefPtrWillBeRawPtr<JSONArray> compositingReasonsJSON = adoptRefWillBeNoo
p(new JSONArray); | 718 RefPtr<JSONArray> compositingReasonsJSON = adoptRef(new JSONArray); |
| 719 for (size_t i = 0; i < WTF_ARRAY_LENGTH(compositingReasonStringMap); ++i
) { | 719 for (size_t i = 0; i < WTF_ARRAY_LENGTH(compositingReasonStringMap); ++i
) { |
| 720 if (m_debugInfo.compositingReasons() & compositingReasonStringMap[i]
.reason) | 720 if (m_debugInfo.compositingReasons() & compositingReasonStringMap[i]
.reason) |
| 721 compositingReasonsJSON->pushString(compositingReasonStringMap[i]
.description); | 721 compositingReasonsJSON->pushString(compositingReasonStringMap[i]
.description); |
| 722 } | 722 } |
| 723 json->setArray("compositingReasons", compositingReasonsJSON); | 723 json->setArray("compositingReasons", compositingReasonsJSON); |
| 724 } | 724 } |
| 725 | 725 |
| 726 if (m_children.size()) { | 726 if (m_children.size()) { |
| 727 RefPtrWillBeRawPtr<JSONArray> childrenJSON = adoptRefWillBeNoop(new JSON
Array); | 727 RefPtr<JSONArray> childrenJSON = adoptRef(new JSONArray); |
| 728 for (size_t i = 0; i < m_children.size(); i++) | 728 for (size_t i = 0; i < m_children.size(); i++) |
| 729 childrenJSON->pushObject(m_children[i]->layerTreeAsJSON(flags, rende
ringContextMap)); | 729 childrenJSON->pushObject(m_children[i]->layerTreeAsJSON(flags, rende
ringContextMap)); |
| 730 json->setArray("children", childrenJSON); | 730 json->setArray("children", childrenJSON); |
| 731 } | 731 } |
| 732 | 732 |
| 733 return json; | 733 return json; |
| 734 } | 734 } |
| 735 | 735 |
| 736 String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const | 736 String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const |
| 737 { | 737 { |
| 738 RenderingContextMap renderingContextMap; | 738 RenderingContextMap renderingContextMap; |
| 739 RefPtrWillBeRawPtr<JSONObject> json = layerTreeAsJSON(flags, renderingContex
tMap); | 739 RefPtr<JSONObject> json = layerTreeAsJSON(flags, renderingContextMap); |
| 740 return json->toPrettyJSONString(); | 740 return json->toPrettyJSONString(); |
| 741 } | 741 } |
| 742 | 742 |
| 743 String GraphicsLayer::debugName(blink::WebLayer* webLayer) const | 743 String GraphicsLayer::debugName(blink::WebLayer* webLayer) const |
| 744 { | 744 { |
| 745 String name; | 745 String name; |
| 746 if (!m_client) | 746 if (!m_client) |
| 747 return name; | 747 return name; |
| 748 | 748 |
| 749 String highlightDebugName; | 749 String highlightDebugName; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 #ifndef NDEBUG | 1209 #ifndef NDEBUG |
| 1210 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 1210 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |
| 1211 { | 1211 { |
| 1212 if (!layer) | 1212 if (!layer) |
| 1213 return; | 1213 return; |
| 1214 | 1214 |
| 1215 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 1215 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |
| 1216 fprintf(stderr, "%s\n", output.utf8().data()); | 1216 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1217 } | 1217 } |
| 1218 #endif | 1218 #endif |
| OLD | NEW |