| Index: sky/engine/platform/graphics/GraphicsLayer.cpp
|
| diff --git a/sky/engine/platform/graphics/GraphicsLayer.cpp b/sky/engine/platform/graphics/GraphicsLayer.cpp
|
| index 9ddb8224a0b25f72d7b544d58c9c049b4a5e7d9a..42ed3b6304bef95a0e5a8757db2885be02a943d8 100644
|
| --- a/sky/engine/platform/graphics/GraphicsLayer.cpp
|
| +++ b/sky/engine/platform/graphics/GraphicsLayer.cpp
|
| @@ -426,215 +426,6 @@ void GraphicsLayer::addRepaintRect(const FloatRect& repaintRect)
|
| }
|
| }
|
|
|
| -static bool compareFloatRects(const FloatRect& a, const FloatRect& b)
|
| -{
|
| - if (a.x() != b.x())
|
| - return a.x() > b.x();
|
| - if (a.y() != b.y())
|
| - return a.y() > b.y();
|
| - if (a.width() != b.width())
|
| - return a.width() > b.width();
|
| - return a.height() > b.height();
|
| -}
|
| -
|
| -template <typename T>
|
| -static PassRefPtr<JSONArray> pointAsJSONArray(const T& point)
|
| -{
|
| - RefPtr<JSONArray> array = adoptRef(new JSONArray);
|
| - array->pushNumber(point.x());
|
| - array->pushNumber(point.y());
|
| - return array;
|
| -}
|
| -
|
| -template <typename T>
|
| -static PassRefPtr<JSONArray> sizeAsJSONArray(const T& size)
|
| -{
|
| - RefPtr<JSONArray> array = adoptRef(new JSONArray);
|
| - array->pushNumber(size.width());
|
| - array->pushNumber(size.height());
|
| - return array;
|
| -}
|
| -
|
| -template <typename T>
|
| -static PassRefPtr<JSONArray> rectAsJSONArray(const T& rect)
|
| -{
|
| - RefPtr<JSONArray> array = adoptRef(new JSONArray);
|
| - array->pushNumber(rect.x());
|
| - array->pushNumber(rect.y());
|
| - array->pushNumber(rect.width());
|
| - array->pushNumber(rect.height());
|
| - return array;
|
| -}
|
| -
|
| -static double roundCloseToZero(double number)
|
| -{
|
| - return std::abs(number) < 1e-7 ? 0 : number;
|
| -}
|
| -
|
| -static PassRefPtr<JSONArray> transformAsJSONArray(const TransformationMatrix& t)
|
| -{
|
| - RefPtr<JSONArray> array = adoptRef(new JSONArray);
|
| - {
|
| - RefPtr<JSONArray> row = adoptRef(new JSONArray);
|
| - row->pushNumber(roundCloseToZero(t.m11()));
|
| - row->pushNumber(roundCloseToZero(t.m12()));
|
| - row->pushNumber(roundCloseToZero(t.m13()));
|
| - row->pushNumber(roundCloseToZero(t.m14()));
|
| - array->pushArray(row);
|
| - }
|
| - {
|
| - RefPtr<JSONArray> row = adoptRef(new JSONArray);
|
| - row->pushNumber(roundCloseToZero(t.m21()));
|
| - row->pushNumber(roundCloseToZero(t.m22()));
|
| - row->pushNumber(roundCloseToZero(t.m23()));
|
| - row->pushNumber(roundCloseToZero(t.m24()));
|
| - array->pushArray(row);
|
| - }
|
| - {
|
| - RefPtr<JSONArray> row = adoptRef(new JSONArray);
|
| - row->pushNumber(roundCloseToZero(t.m31()));
|
| - row->pushNumber(roundCloseToZero(t.m32()));
|
| - row->pushNumber(roundCloseToZero(t.m33()));
|
| - row->pushNumber(roundCloseToZero(t.m34()));
|
| - array->pushArray(row);
|
| - }
|
| - {
|
| - RefPtr<JSONArray> row = adoptRef(new JSONArray);
|
| - row->pushNumber(roundCloseToZero(t.m41()));
|
| - row->pushNumber(roundCloseToZero(t.m42()));
|
| - row->pushNumber(roundCloseToZero(t.m43()));
|
| - row->pushNumber(roundCloseToZero(t.m44()));
|
| - array->pushArray(row);
|
| - }
|
| - return array;
|
| -}
|
| -
|
| -static String pointerAsString(const void* ptr)
|
| -{
|
| - TextStream ts;
|
| - ts << ptr;
|
| - return ts.release();
|
| -}
|
| -
|
| -PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, RenderingContextMap& renderingContextMap) const
|
| -{
|
| - RefPtr<JSONObject> json = adoptRef(new JSONObject);
|
| -
|
| - if (flags & LayerTreeIncludesDebugInfo) {
|
| - json->setString("this", pointerAsString(this));
|
| - json->setString("debugName", m_client->debugName(this));
|
| - }
|
| -
|
| - if (m_position != FloatPoint())
|
| - json->setArray("position", pointAsJSONArray(m_position));
|
| -
|
| - if (m_hasTransformOrigin && m_transformOrigin != FloatPoint3D(m_size.width() * 0.5f, m_size.height() * 0.5f, 0))
|
| - json->setArray("transformOrigin", pointAsJSONArray(m_transformOrigin));
|
| -
|
| - if (m_size != IntSize())
|
| - json->setArray("bounds", sizeAsJSONArray(m_size));
|
| -
|
| - if (m_opacity != 1)
|
| - json->setNumber("opacity", m_opacity);
|
| -
|
| - if (m_blendMode != WebBlendModeNormal)
|
| - json->setString("blendMode", compositeOperatorName(CompositeSourceOver, m_blendMode));
|
| -
|
| - if (m_contentsOpaque)
|
| - json->setBoolean("contentsOpaque", m_contentsOpaque);
|
| -
|
| - if (!m_shouldFlattenTransform)
|
| - json->setBoolean("shouldFlattenTransform", m_shouldFlattenTransform);
|
| -
|
| - if (m_3dRenderingContext) {
|
| - RenderingContextMap::const_iterator it = renderingContextMap.find(m_3dRenderingContext);
|
| - int contextId = renderingContextMap.size() + 1;
|
| - if (it == renderingContextMap.end())
|
| - renderingContextMap.set(m_3dRenderingContext, contextId);
|
| - else
|
| - contextId = it->value;
|
| -
|
| - json->setNumber("3dRenderingContext", contextId);
|
| - }
|
| -
|
| - if (m_drawsContent)
|
| - json->setBoolean("drawsContent", m_drawsContent);
|
| -
|
| - if (!m_contentsVisible)
|
| - json->setBoolean("contentsVisible", m_contentsVisible);
|
| -
|
| - if (!m_backfaceVisibility)
|
| - json->setString("backfaceVisibility", m_backfaceVisibility ? "visible" : "hidden");
|
| -
|
| - if (flags & LayerTreeIncludesDebugInfo)
|
| - json->setString("client", pointerAsString(m_client));
|
| -
|
| - if (m_backgroundColor.alpha())
|
| - json->setString("backgroundColor", m_backgroundColor.nameForRenderTreeAsText());
|
| -
|
| - if (!m_transform.isIdentity())
|
| - json->setArray("transform", transformAsJSONArray(m_transform));
|
| -
|
| - if ((flags & LayerTreeIncludesPaintInvalidationRects) && repaintRectMap().contains(this) && !repaintRectMap().get(this).isEmpty()) {
|
| - Vector<FloatRect> repaintRectsCopy = repaintRectMap().get(this);
|
| - std::sort(repaintRectsCopy.begin(), repaintRectsCopy.end(), &compareFloatRects);
|
| - RefPtr<JSONArray> repaintRectsJSON = adoptRef(new JSONArray);
|
| - for (size_t i = 0; i < repaintRectsCopy.size(); ++i) {
|
| - if (repaintRectsCopy[i].isEmpty())
|
| - continue;
|
| - repaintRectsJSON->pushArray(rectAsJSONArray(repaintRectsCopy[i]));
|
| - }
|
| - json->setArray("repaintRects", repaintRectsJSON);
|
| - }
|
| -
|
| - if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) {
|
| - RefPtr<JSONArray> paintingPhasesJSON = adoptRef(new JSONArray);
|
| - if (m_paintingPhase & GraphicsLayerPaintBackground)
|
| - paintingPhasesJSON->pushString("GraphicsLayerPaintBackground");
|
| - if (m_paintingPhase & GraphicsLayerPaintForeground)
|
| - paintingPhasesJSON->pushString("GraphicsLayerPaintForeground");
|
| - if (m_paintingPhase & GraphicsLayerPaintMask)
|
| - paintingPhasesJSON->pushString("GraphicsLayerPaintMask");
|
| - if (m_paintingPhase & GraphicsLayerPaintChildClippingMask)
|
| - paintingPhasesJSON->pushString("GraphicsLayerPaintChildClippingMask");
|
| - if (m_paintingPhase & GraphicsLayerPaintOverflowContents)
|
| - paintingPhasesJSON->pushString("GraphicsLayerPaintOverflowContents");
|
| - json->setArray("paintingPhases", paintingPhasesJSON);
|
| - }
|
| -
|
| - if (flags & LayerTreeIncludesClipAndScrollParents) {
|
| - if (m_hasScrollParent)
|
| - json->setBoolean("hasScrollParent", true);
|
| - if (m_hasClipParent)
|
| - json->setBoolean("hasClipParent", true);
|
| - }
|
| -
|
| - if (flags & LayerTreeIncludesDebugInfo) {
|
| - RefPtr<JSONArray> compositingReasonsJSON = adoptRef(new JSONArray);
|
| - for (size_t i = 0; i < kNumberOfCompositingReasons; ++i) {
|
| - if (m_debugInfo.compositingReasons() & kCompositingReasonStringMap[i].reason)
|
| - compositingReasonsJSON->pushString(kCompositingReasonStringMap[i].description);
|
| - }
|
| - json->setArray("compositingReasons", compositingReasonsJSON);
|
| - }
|
| -
|
| - if (m_children.size()) {
|
| - RefPtr<JSONArray> childrenJSON = adoptRef(new JSONArray);
|
| - for (size_t i = 0; i < m_children.size(); i++)
|
| - childrenJSON->pushObject(m_children[i]->layerTreeAsJSON(flags, renderingContextMap));
|
| - json->setArray("children", childrenJSON);
|
| - }
|
| -
|
| - return json;
|
| -}
|
| -
|
| -String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const
|
| -{
|
| - RenderingContextMap renderingContextMap;
|
| - RefPtr<JSONObject> json = layerTreeAsJSON(flags, renderingContextMap);
|
| - return json->toPrettyJSONString();
|
| -}
|
| -
|
| String GraphicsLayer::debugName(WebLayer* webLayer) const
|
| {
|
| String name;
|
| @@ -988,14 +779,3 @@ void GraphicsLayer::didScroll()
|
| }
|
|
|
| } // namespace blink
|
| -
|
| -#ifndef NDEBUG
|
| -void showGraphicsLayerTree(const blink::GraphicsLayer* layer)
|
| -{
|
| - if (!layer)
|
| - return;
|
| -
|
| - String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
|
| - fprintf(stderr, "%s\n", output.utf8().data());
|
| -}
|
| -#endif
|
|
|