| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 namespace blink { | 61 namespace blink { |
| 62 | 62 |
| 63 unsigned InspectorLayerTreeAgent::s_lastSnapshotId; | 63 unsigned InspectorLayerTreeAgent::s_lastSnapshotId; |
| 64 | 64 |
| 65 inline String idForLayer(const GraphicsLayer* graphicsLayer) | 65 inline String idForLayer(const GraphicsLayer* graphicsLayer) |
| 66 { | 66 { |
| 67 return String::number(graphicsLayer->platformLayer()->id()); | 67 return String::number(graphicsLayer->platformLayer()->id()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static PassRefPtr<TypeBuilder::LayerTree::ScrollRect> buildScrollRect(const blin
k::WebRect& rect, const TypeBuilder::LayerTree::ScrollRect::Type::Enum& type) | 70 static PassRefPtr<TypeBuilder::LayerTree::ScrollRect> buildScrollRect(const WebR
ect& rect, const TypeBuilder::LayerTree::ScrollRect::Type::Enum& type) |
| 71 { | 71 { |
| 72 RefPtr<TypeBuilder::DOM::Rect> rectObject = TypeBuilder::DOM::Rect::create() | 72 RefPtr<TypeBuilder::DOM::Rect> rectObject = TypeBuilder::DOM::Rect::create() |
| 73 .setX(rect.x) | 73 .setX(rect.x) |
| 74 .setY(rect.y) | 74 .setY(rect.y) |
| 75 .setHeight(rect.height) | 75 .setHeight(rect.height) |
| 76 .setWidth(rect.width); | 76 .setWidth(rect.width); |
| 77 RefPtr<TypeBuilder::LayerTree::ScrollRect> scrollRectObject = TypeBuilder::L
ayerTree::ScrollRect::create() | 77 RefPtr<TypeBuilder::LayerTree::ScrollRect> scrollRectObject = TypeBuilder::L
ayerTree::ScrollRect::create() |
| 78 .setRect(rectObject.release()) | 78 .setRect(rectObject.release()) |
| 79 .setType(type); | 79 .setType(type); |
| 80 return scrollRectObject.release(); | 80 return scrollRectObject.release(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > build
ScrollRectsForLayer(GraphicsLayer* graphicsLayer) | 83 static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > build
ScrollRectsForLayer(GraphicsLayer* graphicsLayer) |
| 84 { | 84 { |
| 85 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects
= TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create(); | 85 RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects
= TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create(); |
| 86 blink::WebLayer* webLayer = graphicsLayer->platformLayer(); | 86 WebLayer* webLayer = graphicsLayer->platformLayer(); |
| 87 for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) { | 87 for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) { |
| 88 scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll)); | 88 scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll)); |
| 89 } | 89 } |
| 90 for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) { | 90 for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) { |
| 91 scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler)); | 91 scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()
[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler)); |
| 92 } | 92 } |
| 93 if (webLayer->haveWheelEventHandlers()) { | 93 if (webLayer->haveWheelEventHandlers()) { |
| 94 blink::WebRect webRect(webLayer->position().x, webLayer->position().y, w
ebLayer->bounds().width, webLayer->bounds().height); | 94 WebRect webRect(webLayer->position().x, webLayer->position().y, webLayer
->bounds().width, webLayer->bounds().height); |
| 95 scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::Sc
rollRect::Type::WheelEventHandler)); | 95 scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::Sc
rollRect::Type::WheelEventHandler)); |
| 96 } | 96 } |
| 97 return scrollRects->length() ? scrollRects.release() : nullptr; | 97 return scrollRects->length() ? scrollRects.release() : nullptr; |
| 98 } | 98 } |
| 99 | 99 |
| 100 static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLay
er* graphicsLayer, int nodeId) | 100 static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLay
er* graphicsLayer, int nodeId) |
| 101 { | 101 { |
| 102 blink::WebLayer* webLayer = graphicsLayer->platformLayer(); | 102 WebLayer* webLayer = graphicsLayer->platformLayer(); |
| 103 RefPtr<TypeBuilder::LayerTree::Layer> layerObject = TypeBuilder::LayerTree::
Layer::create() | 103 RefPtr<TypeBuilder::LayerTree::Layer> layerObject = TypeBuilder::LayerTree::
Layer::create() |
| 104 .setLayerId(idForLayer(graphicsLayer)) | 104 .setLayerId(idForLayer(graphicsLayer)) |
| 105 .setOffsetX(webLayer->position().x) | 105 .setOffsetX(webLayer->position().x) |
| 106 .setOffsetY(webLayer->position().y) | 106 .setOffsetY(webLayer->position().y) |
| 107 .setWidth(webLayer->bounds().width) | 107 .setWidth(webLayer->bounds().width) |
| 108 .setHeight(webLayer->bounds().height) | 108 .setHeight(webLayer->bounds().height) |
| 109 .setPaintCount(graphicsLayer->paintCount()) | 109 .setPaintCount(graphicsLayer->paintCount()) |
| 110 .setDrawsContent(webLayer->drawsContent()); | 110 .setDrawsContent(webLayer->drawsContent()); |
| 111 | 111 |
| 112 if (nodeId) | 112 if (nodeId) |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) | 461 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) |
| 462 { | 462 { |
| 463 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); | 463 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); |
| 464 if (index == WTF::kNotFound) | 464 if (index == WTF::kNotFound) |
| 465 return; | 465 return; |
| 466 m_pageOverlayLayerIds.remove(index); | 466 m_pageOverlayLayerIds.remove(index); |
| 467 } | 467 } |
| 468 | 468 |
| 469 | 469 |
| 470 } // namespace blink | 470 } // namespace blink |
| OLD | NEW |