Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: Source/core/inspector/InspectorLayerTreeAgent.cpp

Issue 166273018: Added showing slow scroll rectangles in Layers panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed test. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorLayerTreeAgent.cpp
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.cpp b/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 70914c8120cdcea3c583f6f1564e57e447e3e857..4cb298db915db77ca98f88b539e6952f2d308a36 100644
--- a/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -77,6 +77,36 @@ inline String idForLayer(const GraphicsLayer* graphicsLayer)
return String::number(graphicsLayer->platformLayer()->id());
}
+static PassRefPtr<TypeBuilder::LayerTree::ScrollRect> buildScrollRect(const blink::WebRect& rect, const TypeBuilder::LayerTree::ScrollRect::Type::Enum& type)
+{
+ RefPtr<TypeBuilder::DOM::Rect> rectObject = TypeBuilder::DOM::Rect::create()
+ .setX(rect.x)
+ .setY(rect.y)
+ .setHeight(rect.height)
+ .setWidth(rect.width);
+ RefPtr<TypeBuilder::LayerTree::ScrollRect> scrollRectObject = TypeBuilder::LayerTree::ScrollRect::create()
+ .setRect(rectObject.release())
+ .setType(type);
+ return scrollRectObject.release();
+}
+
+static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > buildScrollRectsForLayer(GraphicsLayer* graphicsLayer)
+{
+ RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create();
+ blink::WebLayer* webLayer = graphicsLayer->platformLayer();
+ for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) {
+ scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll));
+ }
+ for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) {
+ scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler));
+ }
+ if (webLayer->haveWheelEventHandlers()) {
+ blink::WebRect webRect(webLayer->position().x, webLayer->position().y, webLayer->bounds().width, webLayer->bounds().height);
+ scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::ScrollRect::Type::WheelEventHandler));
+ }
+ return scrollRects->length() ? scrollRects.release() : nullptr;
+}
+
static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLayer* graphicsLayer, BackendNodeId nodeId)
{
blink::WebLayer* webLayer = graphicsLayer->platformLayer();
@@ -111,6 +141,9 @@ static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLay
layerObject->setAnchorY(anchor.y());
layerObject->setAnchorZ(anchor.z());
}
+ RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer);
+ if (scrollRects)
+ layerObject->setScrollRects(scrollRects.release());
return layerObject;
}
@@ -185,8 +218,8 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
ASSERT(!compositor->compositingLayersNeedRebuild());
LayerIdToNodeIdMap layerIdToNodeIdMap;
- buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), nodeGroup, layerIdToNodeIdMap);
RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuilder::Array<TypeBuilder::LayerTree::Layer>::create();
+ buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), nodeGroup, layerIdToNodeIdMap);
gatherGraphicsLayers(compositor->rootGraphicsLayer(), layerIdToNodeIdMap, layers);
return layers.release();
}
« no previous file with comments | « LayoutTests/inspector/layers/layer-scroll-rects-update-expected.txt ('k') | Source/devtools/front_end/LayerTreeModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698