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

Side by Side Diff: chrome_linux/resources/inspector/LayersPanel.js

Issue 85333005: Update reference builds to Chrome 32.0.1700.19 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 WebInspector.LayerTreeModel=function() 1 WebInspector.LayerTreeModel=function()
2 {WebInspector.Object.call(this);this._layersById={};InspectorBackend.registerLay erTreeDispatcher(new WebInspector.LayerTreeDispatcher(this));LayerTreeAgent.enab le();this._needsRefresh=true;} 2 {WebInspector.Object.call(this);this._layersById={};this._lastPaintRectByLayerId ={};InspectorBackend.registerLayerTreeDispatcher(new WebInspector.LayerTreeDispa tcher(this));WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events .DocumentUpdated,this._onDocumentUpdated,this);}
3 WebInspector.LayerTreeModel.Events={LayerTreeChanged:"LayerTreeChanged",} 3 WebInspector.LayerTreeModel.Events={LayerTreeChanged:"LayerTreeChanged",LayerPai nted:"LayerPainted",}
4 WebInspector.LayerTreeModel.prototype={dispose:function() 4 WebInspector.LayerTreeModel.prototype={disable:function()
5 {LayerTreeAgent.disable();},root:function() 5 {if(!this._enabled)
6 return;this._enabled=false;LayerTreeAgent.disable();},enable:function(callback)
7 {if(this._enabled)
8 return;this._enabled=true;WebInspector.domAgent.requestDocument(onDocumentAvaila ble.bind(this));function onDocumentAvailable()
9 {if(!this._enabled)
10 return;LayerTreeAgent.enable();}},root:function()
6 {return this._root;},contentRoot:function() 11 {return this._root;},contentRoot:function()
7 {return this._contentRoot;},forEachLayer:function(callback,root) 12 {return this._contentRoot;},forEachLayer:function(callback,root)
8 {if(!root){root=this.root();if(!root) 13 {if(!root){root=this.root();if(!root)
9 return false;} 14 return false;}
10 return callback(root)||root.children().some(this.forEachLayer.bind(this,callback ));},requestLayers:function(callback) 15 return callback(root)||root.children().some(this.forEachLayer.bind(this,callback ));},layerById:function(id)
11 {delete this._delayedRequestLayersTimer;if(!callback)
12 callback=function(){}
13 if(!this._needsRefresh){callback();return;}
14 if(this._pendingRequestLayersCallbacks){this._pendingRequestLayersCallbacks.push (callback);return;}
15 this._pendingRequestLayersCallbacks=[];this._pendingRequestLayersCallbacks.push( callback);function onGetLayers(error,layers)
16 {this._root=null;this._contentRoot=null;if(error){console.error("LayerTreeAgent. getLayers(): "+error);layers=[];}
17 this._repopulate(layers);for(var i=0;i<this._pendingRequestLayersCallbacks.lengt h;++i)
18 this._pendingRequestLayersCallbacks[i]();delete this._pendingRequestLayersCallba cks;}
19 function onDocumentAvailable()
20 {LayerTreeAgent.getLayers(undefined,onGetLayers.bind(this))}
21 WebInspector.domAgent.requestDocument(onDocumentAvailable.bind(this));},layerByI d:function(id)
22 {return this._layersById[id];},_repopulate:function(payload) 16 {return this._layersById[id];},_repopulate:function(payload)
23 {var oldLayersById=this._layersById;this._layersById={};for(var i=0;i<payload.le ngth;++i){var layer=oldLayersById[payload[i].layerId];if(layer) 17 {var oldLayersById=this._layersById;this._layersById={};for(var i=0;i<payload.le ngth;++i){var layerId=payload[i].layerId;var layer=oldLayersById[layerId];if(lay er)
24 layer._reset(payload[i]);else 18 layer._reset(payload[i]);else
25 layer=new WebInspector.Layer(payload[i]);this._layersById[layer.id()]=layer;var parentId=layer.parentId();if(!this._contentRoot&&layer.nodeId()) 19 layer=new WebInspector.Layer(payload[i]);this._layersById[layerId]=layer;var par entId=layer.parentId();if(!this._contentRoot&&layer.nodeId())
26 this._contentRoot=layer;if(parentId){var parent=this._layersById[parentId];if(!p arent) 20 this._contentRoot=layer;var lastPaintRect=this._lastPaintRectByLayerId[layerId]; if(lastPaintRect)
27 console.assert(parent,"missing parent "+parentId+" for layer "+layer.id());paren t.addChild(layer);}else{if(this._root) 21 layer._lastPaintRect=lastPaintRect;if(parentId){var parent=this._layersById[pare ntId];if(!parent)
22 console.assert(parent,"missing parent "+parentId+" for layer "+layerId);parent.a ddChild(layer);}else{if(this._root)
28 console.assert(false,"Multiple root layers");this._root=layer;}} 23 console.assert(false,"Multiple root layers");this._root=layer;}}
29 this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTreeChange d);},_layerTreeChanged:function() 24 this._lastPaintRectByLayerId={};},_layerTreeChanged:function(payload)
30 {if(this._delayedRequestLayersTimer) 25 {this._root=null;this._contentRoot=null;if(payload)
31 return;this._needsRefresh=true;this._delayedRequestLayersTimer=setTimeout(this.r equestLayers.bind(this),100);},__proto__:WebInspector.Object.prototype} 26 this._repopulate(payload);this.dispatchEventToListeners(WebInspector.LayerTreeMo del.Events.LayerTreeChanged);},_layerPainted:function(layerId,clipRect)
27 {var layer=this._layersById[layerId];if(!layer){this._lastPaintRectByLayerId[lay erId]=clipRect;return;}
28 layer._didPaint(clipRect);this.dispatchEventToListeners(WebInspector.LayerTreeMo del.Events.LayerPainted,layer);},_onDocumentUpdated:function()
29 {this.disable();this.enable();},__proto__:WebInspector.Object.prototype}
32 WebInspector.Layer=function(layerPayload) 30 WebInspector.Layer=function(layerPayload)
33 {this._reset(layerPayload);} 31 {this._reset(layerPayload);}
34 WebInspector.Layer.prototype={id:function() 32 WebInspector.Layer.prototype={id:function()
35 {return this._layerPayload.layerId;},parentId:function() 33 {return this._layerPayload.layerId;},parentId:function()
36 {return this._layerPayload.parentLayerId;},parent:function() 34 {return this._layerPayload.parentLayerId;},parent:function()
37 {return this._parent;},isRoot:function() 35 {return this._parent;},isRoot:function()
38 {return!this.parentId();},children:function() 36 {return!this.parentId();},children:function()
39 {return this._children;},addChild:function(child) 37 {return this._children;},addChild:function(child)
40 {if(child._parent) 38 {if(child._parent)
41 console.assert(false,"Child already has a parent");this._children.push(child);ch ild._parent=this;},nodeId:function() 39 console.assert(false,"Child already has a parent");this._children.push(child);ch ild._parent=this;},nodeId:function()
42 {return this._layerPayload.nodeId;},nodeIdForSelfOrAncestor:function() 40 {return this._layerPayload.nodeId;},nodeIdForSelfOrAncestor:function()
43 {for(var layer=this;layer;layer=layer._parent){var nodeId=layer._layerPayload.no deId;if(nodeId) 41 {for(var layer=this;layer;layer=layer._parent){var nodeId=layer._layerPayload.no deId;if(nodeId)
44 return nodeId;} 42 return nodeId;}
45 return null;},offsetX:function() 43 return null;},offsetX:function()
46 {return this._layerPayload.offsetX;},offsetY:function() 44 {return this._layerPayload.offsetX;},offsetY:function()
47 {return this._layerPayload.offsetY;},width:function() 45 {return this._layerPayload.offsetY;},width:function()
48 {return this._layerPayload.width;},height:function() 46 {return this._layerPayload.width;},height:function()
49 {return this._layerPayload.height;},transform:function() 47 {return this._layerPayload.height;},transform:function()
50 {return this._layerPayload.transform;},anchorPoint:function() 48 {return this._layerPayload.transform;},anchorPoint:function()
51 {return[this._layerPayload.anchorX||0,this._layerPayload.anchorY||0,this._layerP ayload.anchorZ||0,];},invisible:function() 49 {return[this._layerPayload.anchorX||0,this._layerPayload.anchorY||0,this._layerP ayload.anchorZ||0,];},invisible:function()
52 {return this._layerPayload.invisible;},paintCount:function() 50 {return this._layerPayload.invisible;},paintCount:function()
53 {return this._layerPayload.paintCount;},requestCompositingReasons:function(callb ack) 51 {return this._paintCount||this._layerPayload.paintCount;},lastPaintRect:function ()
52 {return this._lastPaintRect;},requestCompositingReasons:function(callback)
54 {function callbackWrapper(error,compositingReasons) 53 {function callbackWrapper(error,compositingReasons)
55 {if(error){console.error("LayerTreeAgent.reasonsForCompositingLayer(): "+error); callback(null);return;} 54 {if(error){console.error("LayerTreeAgent.reasonsForCompositingLayer(): "+error); callback(null);return;}
56 callback(compositingReasons);} 55 callback(compositingReasons);}
57 LayerTreeAgent.compositingReasons(this.id(),callbackWrapper.bind(this));},_reset :function(layerPayload) 56 LayerTreeAgent.compositingReasons(this.id(),callbackWrapper.bind(this));},_didPa int:function(rect)
58 {this._children=[];this._parent=null;this._layerPayload=layerPayload;}} 57 {this._lastPaintRect=rect;this._paintCount=this.paintCount()+1;},_reset:function (layerPayload)
58 {this._children=[];this._parent=null;this._paintCount=0;this._layerPayload=layer Payload;}}
59 WebInspector.LayerTreeDispatcher=function(layerTreeModel) 59 WebInspector.LayerTreeDispatcher=function(layerTreeModel)
60 {this._layerTreeModel=layerTreeModel;} 60 {this._layerTreeModel=layerTreeModel;}
61 WebInspector.LayerTreeDispatcher.prototype={layerTreeDidChange:function() 61 WebInspector.LayerTreeDispatcher.prototype={layerTreeDidChange:function(payload)
62 {this._layerTreeModel._layerTreeChanged();}};WebInspector.LayerTree=function(mod el,treeOutline) 62 {this._layerTreeModel._layerTreeChanged(payload);},layerPainted:function(layerId ,clipRect)
63 {WebInspector.Object.call(this);this._model=model;this._treeOutline=treeOutline; this._treeOutline.childrenListElement.addEventListener("mousemove",this._onMouse Move.bind(this),false);this._treeOutline.childrenListElement.addEventListener("m ouseout",this._onMouseMove.bind(this),false);this._treeOutline.childrenListEleme nt.addEventListener("contextmenu",this._onContextMenu.bind(this),true);this._mod el.addEventListener(WebInspector.LayerTreeModel.Events.LayerTreeChanged,this._up date.bind(this));this._lastHoveredNode=null;this._needsUpdate=true;} 63 {this._layerTreeModel._layerPainted(layerId,clipRect);}};WebInspector.LayerTree= function(model,treeOutline)
64 {WebInspector.Object.call(this);this._model=model;this._treeOutline=treeOutline; this._treeOutline.childrenListElement.addEventListener("mousemove",this._onMouse Move.bind(this),false);this._treeOutline.childrenListElement.addEventListener("m ouseout",this._onMouseMove.bind(this),false);this._treeOutline.childrenListEleme nt.addEventListener("contextmenu",this._onContextMenu.bind(this),true);this._mod el.addEventListener(WebInspector.LayerTreeModel.Events.LayerTreeChanged,this._up date.bind(this));this._lastHoveredNode=null;}
64 WebInspector.LayerTree.Events={LayerHovered:"LayerHovered",LayerSelected:"LayerS elected"} 65 WebInspector.LayerTree.Events={LayerHovered:"LayerHovered",LayerSelected:"LayerS elected"}
65 WebInspector.LayerTree.prototype={setVisible:function(visible) 66 WebInspector.LayerTree.prototype={selectLayer:function(layer)
66 {if(this._isVisible===visible)
67 return;this._isVisible=visible;if(visible&&this._needsUpdate)
68 this._update();},selectLayer:function(layer)
69 {this.hoverLayer(null);var node=layer&&this._treeOutline.getCachedTreeElement(la yer);if(node) 67 {this.hoverLayer(null);var node=layer&&this._treeOutline.getCachedTreeElement(la yer);if(node)
70 node.revealAndSelect(true);else if(this._treeOutline.selectedTreeElement) 68 node.revealAndSelect(true);else if(this._treeOutline.selectedTreeElement)
71 this._treeOutline.selectedTreeElement.deselect();},hoverLayer:function(layer) 69 this._treeOutline.selectedTreeElement.deselect();},hoverLayer:function(layer)
72 {var node=layer&&this._treeOutline.getCachedTreeElement(layer);if(node===this._l astHoveredNode) 70 {var node=layer&&this._treeOutline.getCachedTreeElement(layer);if(node===this._l astHoveredNode)
73 return;if(this._lastHoveredNode) 71 return;if(this._lastHoveredNode)
74 this._lastHoveredNode.setHovered(false);if(node) 72 this._lastHoveredNode.setHovered(false);if(node)
75 node.setHovered(true);this._lastHoveredNode=node;},_update:function() 73 node.setHovered(true);this._lastHoveredNode=node;},_update:function()
76 {if(!this._isVisible){this._needsUpdate=true;return;} 74 {var seenLayers={};function updateLayer(layer)
77 this._needsUpdate=false;var seenLayers={};function updateLayer(layer)
78 {var id=layer.id();if(seenLayers[id]) 75 {var id=layer.id();if(seenLayers[id])
79 console.assert(false,"Duplicate layer id: "+id);seenLayers[id]=true;var node=thi s._treeOutline.getCachedTreeElement(layer);var parent=layer===this._model.conten tRoot()?this._treeOutline:this._treeOutline.getCachedTreeElement(layer.parent()) ;if(!parent) 76 console.assert(false,"Duplicate layer id: "+id);seenLayers[id]=true;var node=thi s._treeOutline.getCachedTreeElement(layer);var parent=layer===this._model.conten tRoot()?this._treeOutline:this._treeOutline.getCachedTreeElement(layer.parent()) ;if(!parent)
80 console.assert(false,"Parent is not in the tree");if(!node){node=new WebInspecto r.LayerTreeElement(this,layer);parent.appendChild(node);}else{var oldParentId=no de.parent.representedObject&&node.parent.representedObject.id();if(oldParentId!= =layer.parentId()){(node.parent||this._treeOutline).removeChild(node);parent.app endChild(node);} 77 console.assert(false,"Parent is not in the tree");if(!node){node=new WebInspecto r.LayerTreeElement(this,layer);parent.appendChild(node);}else{var oldParentId=no de.parent.representedObject&&node.parent.representedObject.id();if(oldParentId!= =layer.parentId()){(node.parent||this._treeOutline).removeChild(node);parent.app endChild(node);}
81 node._update();}} 78 node._update();}}
79 if(this._model.contentRoot())
82 this._model.forEachLayer(updateLayer.bind(this),this._model.contentRoot());for(v ar node=(this._treeOutline.children[0]);node&&!node.root;){if(seenLayers[node.re presentedObject.id()]){node=node.traverseNextTreeElement(false);}else{var nextNo de=node.nextSibling||node.parent;node.parent.removeChild(node);if(node===this._l astHoveredNode) 80 this._model.forEachLayer(updateLayer.bind(this),this._model.contentRoot());for(v ar node=(this._treeOutline.children[0]);node&&!node.root;){if(seenLayers[node.re presentedObject.id()]){node=node.traverseNextTreeElement(false);}else{var nextNo de=node.nextSibling||node.parent;node.parent.removeChild(node);if(node===this._l astHoveredNode)
83 this._lastHoveredNode=null;node=nextNode;}}},_onMouseMove:function(event) 81 this._lastHoveredNode=null;node=nextNode;}}},_onMouseMove:function(event)
84 {var node=this._treeOutline.treeElementFromPoint(event.pageX,event.pageY);if(nod e===this._lastHoveredNode) 82 {var node=this._treeOutline.treeElementFromPoint(event.pageX,event.pageY);if(nod e===this._lastHoveredNode)
85 return;this.dispatchEventToListeners(WebInspector.LayerTree.Events.LayerHovered, node&&node.representedObject);},_selectedNodeChanged:function(node) 83 return;this.dispatchEventToListeners(WebInspector.LayerTree.Events.LayerHovered, node&&node.representedObject);},_selectedNodeChanged:function(node)
86 {var layer=(node.representedObject);this.dispatchEventToListeners(WebInspector.L ayerTree.Events.LayerSelected,layer);},_onContextMenu:function(event) 84 {var layer=(node.representedObject);this.dispatchEventToListeners(WebInspector.L ayerTree.Events.LayerSelected,layer);},_onContextMenu:function(event)
87 {var node=this._treeOutline.treeElementFromPoint(event.pageX,event.pageY);if(!no de||!node.representedObject) 85 {var node=this._treeOutline.treeElementFromPoint(event.pageX,event.pageY);if(!no de||!node.representedObject)
88 return;var layer=(node.representedObject);if(!layer) 86 return;var layer=(node.representedObject);if(!layer)
89 return;var nodeId=layer.nodeId();if(!nodeId) 87 return;var nodeId=layer.nodeId();if(!nodeId)
90 return;var domNode=WebInspector.domAgent.nodeForId(nodeId);if(!domNode) 88 return;var domNode=WebInspector.domAgent.nodeForId(nodeId);if(!domNode)
91 return;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApp licableItems(domNode);contextMenu.show();},__proto__:WebInspector.Object.prototy pe} 89 return;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApp licableItems(domNode);contextMenu.show();},__proto__:WebInspector.Object.prototy pe}
92 WebInspector.LayerTreeElement=function(tree,layer) 90 WebInspector.LayerTreeElement=function(tree,layer)
93 {TreeElement.call(this,"",layer);this._layerTree=tree;this._update();} 91 {TreeElement.call(this,"",layer);this._layerTree=tree;this._update();}
94 WebInspector.LayerTreeElement.prototype={onattach:function() 92 WebInspector.LayerTreeElement.prototype={onattach:function()
95 {var selection=document.createElement("div");selection.className="selection";thi s.listItemElement.insertBefore(selection,this.listItemElement.firstChild);},_upd ate:function() 93 {var selection=document.createElement("div");selection.className="selection";thi s.listItemElement.insertBefore(selection,this.listItemElement.firstChild);},_upd ate:function()
96 {var layer=(this.representedObject);var nodeId=layer.nodeIdForSelfOrAncestor();v ar node=nodeId&&WebInspector.domAgent.nodeForId(nodeId);var title=document.creat eDocumentFragment();title.createChild("div","selection");title.appendChild(docum ent.createTextNode(node?node.appropriateSelectorFor(false):"#"+layer.id()));var details=title.createChild("span","dimmed");details.textContent=WebInspector.UISt ring(" (%d × %d)",layer.width(),layer.height());this.title=title;},onselect:func tion() 94 {var layer=(this.representedObject);var nodeId=layer.nodeIdForSelfOrAncestor();v ar node=nodeId&&WebInspector.domAgent.nodeForId(nodeId);var title=document.creat eDocumentFragment();title.createChild("div","selection");title.appendChild(docum ent.createTextNode(node?node.appropriateSelectorFor(false):"#"+layer.id()));var details=title.createChild("span","dimmed");details.textContent=WebInspector.UISt ring(" (%d × %d)",layer.width(),layer.height());this.title=title;},onselect:func tion()
97 {this._layerTree._selectedNodeChanged(this);},setHovered:function(hovered) 95 {this._layerTree._selectedNodeChanged(this);},setHovered:function(hovered)
98 {this.listItemElement.enableStyleClass("hovered",hovered);},__proto__:TreeElemen t.prototype};WebInspector.Layers3DView=function(model) 96 {this.listItemElement.enableStyleClass("hovered",hovered);},__proto__:TreeElemen t.prototype};WebInspector.Layers3DView=function(model)
99 {WebInspector.View.call(this);this.element.classList.add("fill");this.element.cl assList.add("layers-3d-view");this._emptyView=new WebInspector.EmptyView(WebInsp ector.UIString("Not in the composited mode.\nConsider forcing composited mode in Settings."));this._model=model;this._model.addEventListener(WebInspector.LayerT reeModel.Events.LayerTreeChanged,this._update,this);this._rotatingContainerEleme nt=this.element.createChild("div","fill rotating-container");this.element.addEve ntListener("mousemove",this._onMouseMove.bind(this),false);this.element.addEvent Listener("mouseout",this._onMouseMove.bind(this),false);this.element.addEventLis tener("mousedown",this._onMouseDown.bind(this),false);this.element.addEventListe ner("mouseup",this._onMouseUp.bind(this),false);this.element.addEventListener("c ontextmenu",this._onContextMenu.bind(this),false);this.element.addEventListener( "click",this._onClick.bind(this),false);this._elementsByLayerId={};this._rotateX =0;this._rotateY=0;this._scaleAdjustmentStylesheet=this.element.ownerDocument.he ad.createChild("style");this._scaleAdjustmentStylesheet.disabled=true;this._last OutlinedElement={};} 97 {WebInspector.View.call(this);this.element.classList.add("fill");this.element.cl assList.add("layers-3d-view");this._emptyView=new WebInspector.EmptyView(WebInsp ector.UIString("Not in the composited mode.\nConsider forcing composited mode in Settings."));this._model=model;this._model.addEventListener(WebInspector.LayerT reeModel.Events.LayerTreeChanged,this._update,this);this._model.addEventListener (WebInspector.LayerTreeModel.Events.LayerPainted,this._onLayerPainted,this);this ._rotatingContainerElement=this.element.createChild("div","fill rotating-contain er");this.element.addEventListener("mousemove",this._onMouseMove.bind(this),fals e);this.element.addEventListener("mouseout",this._onMouseMove.bind(this),false); this.element.addEventListener("mousedown",this._onMouseDown.bind(this),false);th is.element.addEventListener("mouseup",this._onMouseUp.bind(this),false);this.ele ment.addEventListener("contextmenu",this._onContextMenu.bind(this),false);this.e lement.addEventListener("click",this._onClick.bind(this),false);this._elementsBy LayerId={};this._rotateX=0;this._rotateY=0;this._scaleAdjustmentStylesheet=this. element.ownerDocument.head.createChild("style");this._scaleAdjustmentStylesheet. disabled=true;this._lastOutlinedElement={};WebInspector.settings.showPaintRects. addChangeListener(this._update,this);}
100 WebInspector.Layers3DView.OutlineType={Hovered:"hovered",Selected:"selected"} 98 WebInspector.Layers3DView.OutlineType={Hovered:"hovered",Selected:"selected"}
101 WebInspector.Layers3DView.Events={LayerHovered:"LayerHovered",LayerSelected:"Lay erSelected"} 99 WebInspector.Layers3DView.Events={LayerHovered:"LayerHovered",LayerSelected:"Lay erSelected"}
100 WebInspector.Layers3DView.PaintRectColors=[WebInspector.Color.fromRGBA([0xFF,0,0 ]),WebInspector.Color.fromRGBA([0xFF,0,0xFF]),WebInspector.Color.fromRGBA([0,0,0 xFF])]
102 WebInspector.Layers3DView.prototype={onResize:function() 101 WebInspector.Layers3DView.prototype={onResize:function()
103 {this._update();},willHide:function() 102 {this._update();},willHide:function()
104 {this._scaleAdjustmentStylesheet.disabled=true;},wasShown:function() 103 {this._scaleAdjustmentStylesheet.disabled=true;},wasShown:function()
105 {this._scaleAdjustmentStylesheet.disabled=false;if(this._needsUpdate) 104 {this._scaleAdjustmentStylesheet.disabled=false;if(this._needsUpdate)
106 this._update();},_setOutline:function(type,layer) 105 this._update();},_setOutline:function(type,layer)
107 {var element=layer?this._elementForLayer(layer):null;var previousElement=this._l astOutlinedElement[type];if(previousElement===element) 106 {var element=layer?this._elementForLayer(layer):null;var previousElement=this._l astOutlinedElement[type];if(previousElement===element)
108 return;this._lastOutlinedElement[type]=element;if(previousElement){previousEleme nt.removeStyleClass(type);this._updateElementColor(previousElement);} 107 return;this._lastOutlinedElement[type]=element;if(previousElement){previousEleme nt.removeStyleClass(type);this._updateElementColor(previousElement);}
109 if(element){element.addStyleClass(type);this._updateElementColor(element);}},hov erLayer:function(layer) 108 if(element){element.addStyleClass(type);this._updateElementColor(element);}},hov erLayer:function(layer)
110 {this._setOutline(WebInspector.Layers3DView.OutlineType.Hovered,layer);},selectL ayer:function(layer) 109 {this._setOutline(WebInspector.Layers3DView.OutlineType.Hovered,layer);},selectL ayer:function(layer)
111 {this._setOutline(WebInspector.Layers3DView.OutlineType.Hovered,null);this._setO utline(WebInspector.Layers3DView.OutlineType.Selected,layer);},_scaleToFit:funct ion() 110 {this._setOutline(WebInspector.Layers3DView.OutlineType.Hovered,null);this._setO utline(WebInspector.Layers3DView.OutlineType.Selected,layer);},_scaleToFit:funct ion()
112 {var root=this._model.contentRoot();if(!root) 111 {var root=this._model.contentRoot();if(!root)
113 return;const padding=40;var scaleX=this._clientWidth/(root.width()+2*padding);va r scaleY=this._clientHeight/(root.height()+2*padding);this._scale=Math.min(scale X,scaleY);const screenLayerSpacing=20;this._layerSpacing=Math.ceil(screenLayerSp acing/this._scale)+"px";const screenLayerThickness=4;var layerThickness=Math.cei l(screenLayerThickness/this._scale)+"px";var stylesheetContent=".layer-container .side-wall { height: "+layerThickness+"; width: "+layerThickness+"; } "+".layer -container .back-wall { -webkit-transform: translateZ(-"+layerThickness+"); } "+ ".layer-container { -webkit-transform: translateZ("+this._layerSpacing+"); }";va r stylesheetTextNode=this._scaleAdjustmentStylesheet.firstChild;if(!stylesheetTe xtNode||stylesheetTextNode.nodeType!==Node.TEXT_NODE||stylesheetTextNode.nextSib ling) 112 return;const padding=40;var scaleX=this._clientWidth/(root.width()+2*padding);va r scaleY=this._clientHeight/(root.height()+2*padding);this._scale=Math.min(scale X,scaleY);const screenLayerSpacing=20;this._layerSpacing=Math.ceil(screenLayerSp acing/this._scale)+"px";const screenLayerThickness=4;var layerThickness=Math.cei l(screenLayerThickness/this._scale)+"px";var stylesheetContent=".layer-container .side-wall { height: "+layerThickness+"; width: "+layerThickness+"; } "+".layer -container .back-wall { -webkit-transform: translateZ(-"+layerThickness+"); } "+ ".layer-container { -webkit-transform: translateZ("+this._layerSpacing+"); }";va r stylesheetTextNode=this._scaleAdjustmentStylesheet.firstChild;if(!stylesheetTe xtNode||stylesheetTextNode.nodeType!==Node.TEXT_NODE||stylesheetTextNode.nextSib ling)
114 this._scaleAdjustmentStylesheet.textContent=stylesheetContent;else 113 this._scaleAdjustmentStylesheet.textContent=stylesheetContent;else
115 stylesheetTextNode.nodeValue=stylesheetContent;var element=this._elementForLayer (root);element.style.webkitTransform="scale3d("+this._scale+","+this._scale+","+ this._scale+")";element.style.left=((this._clientWidth-root.width()*this._scale) >>1)+"px";element.style.top=((this._clientHeight-root.height()*this._scale)>>1)+ "px";},_update:function() 114 stylesheetTextNode.nodeValue=stylesheetContent;var element=this._elementForLayer (root);element.style.webkitTransform="scale3d("+this._scale+","+this._scale+","+ this._scale+")";element.style.webkitTransformOrigin="";element.style.left=((this ._clientWidth-root.width()*this._scale)>>1)+"px";element.style.top=((this._clien tHeight-root.height()*this._scale)>>1)+"px";},_update:function()
116 {if(!this.isShowing()){this._needsUpdate=true;return;} 115 {if(!this.isShowing()){this._needsUpdate=true;return;}
117 if(!this._model.contentRoot()){this._emptyView.show(this.element);this._rotating ContainerElement.removeChildren();return;} 116 if(!this._model.contentRoot()){this._emptyView.show(this.element);this._rotating ContainerElement.removeChildren();return;}
118 this._emptyView.detach();function updateLayer(layer) 117 this._emptyView.detach();function updateLayer(layer)
119 {this._updateLayerElement(this._elementForLayer(layer));} 118 {this._updateLayerElement(this._elementForLayer(layer));}
120 this._clientWidth=this.element.clientWidth;this._clientHeight=this.element.clien tHeight;for(var layerId in this._elementsByLayerId){if(this._model.layerById(lay erId)) 119 this._clientWidth=this.element.clientWidth;this._clientHeight=this.element.clien tHeight;for(var layerId in this._elementsByLayerId){if(this._model.layerById(lay erId))
121 continue;this._elementsByLayerId[layerId].remove();delete this._elementsByLayerI d[layerId];} 120 continue;this._elementsByLayerId[layerId].remove();delete this._elementsByLayerI d[layerId];}
122 this._scaleToFit();this._model.forEachLayer(updateLayer.bind(this),this._model.c ontentRoot());this._needsUpdate=false;},_elementForLayer:function(layer) 121 this._scaleToFit();this._model.forEachLayer(updateLayer.bind(this),this._model.c ontentRoot());this._needsUpdate=false;},_onLayerPainted:function(event)
123 {var element=this._elementsByLayerId[layer.id()];if(element){element.__layer=lay er;return element;} 122 {var layer=(event.data);this._updatePaintRect(this._elementForLayer(layer));},_e lementForLayer:function(layer)
124 element=document.createElement("div");element.className="layer-container";elemen t.__layer=layer;["fill back-wall","side-wall top","side-wall right","side-wall b ottom","side-wall left"].forEach(element.createChild.bind(element,"div"));this._ elementsByLayerId[layer.id()]=element;return element;},_updateLayerElement:funct ion(element) 123 {var element=this._elementsByLayerId[layer.id()];if(element){element.__layerDeta ils.layer=layer;return element;}
125 {var layer=element.__layer;var style=element.style;var isContentRoot=layer===thi s._model.contentRoot();var parentElement=isContentRoot?this._rotatingContainerEl ement:this._elementForLayer(layer.parent());element.__depth=(parentElement.__dep th||0)+1;element.enableStyleClass("invisible",layer.invisible());this._updateEle mentColor(element);if(parentElement!==element.parentElement) 124 element=document.createElement("div");element.className="layer-container";["fill back-wall","side-wall top","side-wall right","side-wall bottom","side-wall left "].forEach(element.createChild.bind(element,"div"));element.__layerDetails=new W ebInspector.LayerDetails(layer,element.createChild("div","paint-rect"));this._el ementsByLayerId[layer.id()]=element;return element;},_updateLayerElement:functio n(element)
126 parentElement.appendChild(element);style.width=layer.width()+"px";style.height=l ayer.height()+"px";if(isContentRoot) 125 {var layer=element.__layerDetails.layer;var style=element.style;var isContentRoo t=layer===this._model.contentRoot();var parentElement=isContentRoot?this._rotati ngContainerElement:this._elementForLayer(layer.parent());element.__layerDetails. depth=parentElement.__layerDetails?parentElement.__layerDetails.depth+1:0;elemen t.enableStyleClass("invisible",layer.invisible());this._updateElementColor(eleme nt);if(parentElement!==element.parentElement)
126 parentElement.appendChild(element);style.width=layer.width()+"px";style.height=l ayer.height()+"px";this._updatePaintRect(element);if(isContentRoot)
127 return;style.left=layer.offsetX()+"px";style.top=layer.offsetY()+"px";var transf orm=layer.transform();if(transform){function toFixed5(x) 127 return;style.left=layer.offsetX()+"px";style.top=layer.offsetY()+"px";var transf orm=layer.transform();if(transform){function toFixed5(x)
128 {return x.toFixed(5);} 128 {return x.toFixed(5);}
129 style.webkitTransform="matrix3d("+transform.map(toFixed5).join(",")+") translate Z("+this._layerSpacing+")";var anchor=layer.anchorPoint();style.webkitTransformO rigin=Math.round(anchor[0]*100)+"% "+Math.round(anchor[1]*100)+"% "+anchor[2];}e lse{style.webkitTransform="";style.webkitTransformOrigin="";}},_updateElementCol or:function(element) 129 style.webkitTransform="matrix3d("+transform.map(toFixed5).join(",")+") translate Z("+this._layerSpacing+")";var anchor=layer.anchorPoint();style.webkitTransformO rigin=Math.round(anchor[0]*100)+"% "+Math.round(anchor[1]*100)+"% "+anchor[2];}e lse{style.webkitTransform="";style.webkitTransformOrigin="";}},_updatePaintRect: function(element)
130 {var details=element.__layerDetails;var paintRect=details.layer.lastPaintRect(); var paintRectElement=details.paintRectElement;if(!paintRect||!WebInspector.setti ngs.showPaintRects.get()){paintRectElement.addStyleClass("hidden");return;}
131 paintRectElement.removeStyleClass("hidden");if(details.paintCount===details.laye r.paintCount())
132 return;details.paintCount=details.layer.paintCount();var style=paintRectElement. style;style.left=paintRect.x+"px";style.top=paintRect.y+"px";style.width=paintRe ct.width+"px";style.height=paintRect.height+"px";var color=WebInspector.Layers3D View.PaintRectColors[details.paintCount%WebInspector.Layers3DView.PaintRectColor s.length];style.borderWidth=Math.ceil(1/this._scale)+"px";style.borderColor=colo r.toString(WebInspector.Color.Format.RGBA);},_updateElementColor:function(elemen t)
130 {var color;if(element===this._lastOutlinedElement[WebInspector.Layers3DView.Outl ineType.Selected]) 133 {var color;if(element===this._lastOutlinedElement[WebInspector.Layers3DView.Outl ineType.Selected])
131 color=WebInspector.Color.PageHighlight.Content.toString(WebInspector.Color.Forma t.RGBA)||"";else{const base=144;var component=base+20*((element.__depth-1)%5);co lor="rgba("+component+","+component+","+component+", 0.8)";} 134 color=WebInspector.Color.PageHighlight.Content.toString(WebInspector.Color.Forma t.RGBA)||"";else{const base=144;var component=base+20*((element.__layerDetails.d epth-1)%5);color="rgba("+component+","+component+","+component+", 0.8)";}
132 element.style.backgroundColor=color;},_onMouseDown:function(event) 135 element.style.backgroundColor=color;},_onMouseDown:function(event)
133 {if(event.which!==1) 136 {if(event.which!==1)
134 return;this._setReferencePoint(event);},_setReferencePoint:function(event) 137 return;this._setReferencePoint(event);},_setReferencePoint:function(event)
135 {this._originX=event.clientX;this._originY=event.clientY;this._oldRotateX=this._ rotateX;this._oldRotateY=this._rotateY;},_resetReferencePoint:function() 138 {this._originX=event.clientX;this._originY=event.clientY;this._oldRotateX=this._ rotateX;this._oldRotateY=this._rotateY;},_resetReferencePoint:function()
136 {delete this._originX;delete this._originY;delete this._oldRotateX;delete this._ oldRotateY;},_onMouseUp:function(event) 139 {delete this._originX;delete this._originY;delete this._oldRotateX;delete this._ oldRotateY;},_onMouseUp:function(event)
137 {if(event.which!==1) 140 {if(event.which!==1)
138 return;this._resetReferencePoint();},_layerFromEventPoint:function(event) 141 return;this._resetReferencePoint();},_layerFromEventPoint:function(event)
139 {var element=this.element.ownerDocument.elementFromPoint(event.pageX,event.pageY );if(!element) 142 {var element=this.element.ownerDocument.elementFromPoint(event.pageX,event.pageY );if(!element)
140 return null;element=element.enclosingNodeOrSelfWithClass("layer-container");retu rn element&&element.__layer;},_onMouseMove:function(event) 143 return null;element=element.enclosingNodeOrSelfWithClass("layer-container");retu rn element&&element.__layerDetails&&element.__layerDetails.layer;},_onMouseMove: function(event)
141 {if(!event.which){this.dispatchEventToListeners(WebInspector.Layers3DView.Events .LayerHovered,this._layerFromEventPoint(event));return;} 144 {if(!event.which){this.dispatchEventToListeners(WebInspector.Layers3DView.Events .LayerHovered,this._layerFromEventPoint(event));return;}
142 if(event.which===1){if(typeof this._originX!=="number") 145 if(event.which===1){if(typeof this._originX!=="number")
143 this._setReferencePoint(event);this._rotateX=this._oldRotateX+(this._originY-eve nt.clientY)/2;this._rotateY=this._oldRotateY-(this._originX-event.clientX)/4;thi s._rotatingContainerElement.style.webkitTransform="translateZ(10000px) rotateX(" +this._rotateX+"deg) rotateY("+this._rotateY+"deg)";}},_onContextMenu:function(e vent) 146 this._setReferencePoint(event);this._rotateX=this._oldRotateX+(this._originY-eve nt.clientY)/2;this._rotateY=this._oldRotateY-(this._originX-event.clientX)/4;thi s._rotatingContainerElement.style.webkitTransform="translateZ(10000px) rotateX(" +this._rotateX+"deg) rotateY("+this._rotateY+"deg)";}},_onContextMenu:function(e vent)
144 {var layer=this._layerFromEventPoint(event);var nodeId=layer&&layer.nodeId();if( !nodeId) 147 {var layer=this._layerFromEventPoint(event);var nodeId=layer&&layer.nodeId();if( !nodeId)
145 return;var domNode=WebInspector.domAgent.nodeForId(nodeId);if(!domNode) 148 return;var domNode=WebInspector.domAgent.nodeForId(nodeId);if(!domNode)
146 return;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApp licableItems(domNode);contextMenu.show();},_onClick:function(event) 149 return;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApp licableItems(domNode);contextMenu.show();},_onClick:function(event)
147 {this.dispatchEventToListeners(WebInspector.Layers3DView.Events.LayerSelected,th is._layerFromEventPoint(event));},__proto__:WebInspector.View.prototype};WebInsp ector.LayerDetailsView=function() 150 {this.dispatchEventToListeners(WebInspector.Layers3DView.Events.LayerSelected,th is._layerFromEventPoint(event));},__proto__:WebInspector.View.prototype}
151 WebInspector.LayerDetails=function(layer,paintRectElement)
152 {this.layer=layer;this.depth=0;this.paintRectElement=paintRectElement;this.paint Count=0;};WebInspector.LayerDetailsView=function()
148 {WebInspector.View.call(this);this.element.classList.add("fill");this.element.cl assList.add("layer-details-view");this._emptyView=new WebInspector.EmptyView(Web Inspector.UIString("Select a layer to see its details"));this._createTable();thi s.showLayer(null);} 153 {WebInspector.View.call(this);this.element.classList.add("fill");this.element.cl assList.add("layer-details-view");this._emptyView=new WebInspector.EmptyView(Web Inspector.UIString("Select a layer to see its details"));this._createTable();thi s.showLayer(null);}
149 WebInspector.LayerDetailsView.CompositingReasonDetail={"transform3D":WebInspecto r.UIString("Composition due to association with an element with a CSS 3D transfo rm."),"video":WebInspector.UIString("Composition due to association with a <vide o> element."),"canvas":WebInspector.UIString("Composition due to the element bei ng a <canvas> element."),"plugin":WebInspector.UIString("Composition due to asso ciation with a plugin."),"iFrame":WebInspector.UIString("Composition due to asso ciation with an <iframe> element."),"backfaceVisibilityHidden":WebInspector.UISt ring("Composition due to association with an element with a \"backface-visibilit y: hidden\" style."),"animation":WebInspector.UIString("Composition due to assoc iation with an animated element."),"filters":WebInspector.UIString("Composition due to association with an element with CSS filters applied."),"positionFixed":W ebInspector.UIString("Composition due to association with an element with a \"po sition: fixed\" style."),"positionSticky":WebInspector.UIString("Composition due to association with an element with a \"position: sticky\" style."),"overflowSc rollingTouch":WebInspector.UIString("Composition due to association with an elem ent with a \"overflow-scrolling: touch\" style."),"blending":WebInspector.UIStri ng("Composition due to association with an element that has blend mode other tha n \"normal\"."),"assumedOverlap":WebInspector.UIString("Composition due to assoc iation with an element that may overlap other composited elements."),"overlap":W ebInspector.UIString("Composition due to association with an element overlapping other composited elements."),"negativeZIndexChildren":WebInspector.UIString("Co mposition due to association with an element with descendants that have a negati ve z-index."),"transformWithCompositedDescendants":WebInspector.UIString("Compos ition due to association with an element with composited descendants."),"opacity WithCompositedDescendants":WebInspector.UIString("Composition due to association with an element with opacity applied and composited descendants."),"maskWithCom positedDescendants":WebInspector.UIString("Composition due to association with a masked element and composited descendants."),"reflectionWithCompositedDescendan ts":WebInspector.UIString("Composition due to association with an element with a reflection and composited descendants."),"filterWithCompositedDescendants":WebI nspector.UIString("Composition due to association with an element with CSS filte rs applied and composited descendants."),"blendingWithCompositedDescendants":Web Inspector.UIString("Composition due to association with an element with CSS blen ding applied and composited descendants."),"clipsCompositingDescendants":WebInsp ector.UIString("Composition due to association with an element clipping composit ing descendants."),"perspective":WebInspector.UIString("Composition due to assoc iation with an element with perspective applied."),"preserve3D":WebInspector.UIS tring("Composition due to association with an element with a \"transform-style: preserve-3d\" style."),"root":WebInspector.UIString("Root layer."),"layerForClip ":WebInspector.UIString("Layer for clip."),"layerForScrollbar":WebInspector.UISt ring("Layer for scrollbar."),"layerForScrollingContainer":WebInspector.UIString( "Layer for scrolling container."),"layerForForeground":WebInspector.UIString("La yer for foreground."),"layerForBackground":WebInspector.UIString("Layer for back ground."),"layerForMask":WebInspector.UIString("Layer for mask."),"layerForVideo Overlay":WebInspector.UIString("Layer for video overlay.")};WebInspector.LayerDe tailsView.prototype={showLayer:function(layer) 154 WebInspector.LayerDetailsView.CompositingReasonDetail={"transform3D":WebInspecto r.UIString("Composition due to association with an element with a CSS 3D transfo rm."),"video":WebInspector.UIString("Composition due to association with a <vide o> element."),"canvas":WebInspector.UIString("Composition due to the element bei ng a <canvas> element."),"plugin":WebInspector.UIString("Composition due to asso ciation with a plugin."),"iFrame":WebInspector.UIString("Composition due to asso ciation with an <iframe> element."),"backfaceVisibilityHidden":WebInspector.UISt ring("Composition due to association with an element with a \"backface-visibilit y: hidden\" style."),"animation":WebInspector.UIString("Composition due to assoc iation with an animated element."),"filters":WebInspector.UIString("Composition due to association with an element with CSS filters applied."),"positionFixed":W ebInspector.UIString("Composition due to association with an element with a \"po sition: fixed\" style."),"positionSticky":WebInspector.UIString("Composition due to association with an element with a \"position: sticky\" style."),"overflowSc rollingTouch":WebInspector.UIString("Composition due to association with an elem ent with a \"overflow-scrolling: touch\" style."),"blending":WebInspector.UIStri ng("Composition due to association with an element that has blend mode other tha n \"normal\"."),"assumedOverlap":WebInspector.UIString("Composition due to assoc iation with an element that may overlap other composited elements."),"overlap":W ebInspector.UIString("Composition due to association with an element overlapping other composited elements."),"negativeZIndexChildren":WebInspector.UIString("Co mposition due to association with an element with descendants that have a negati ve z-index."),"transformWithCompositedDescendants":WebInspector.UIString("Compos ition due to association with an element with composited descendants."),"opacity WithCompositedDescendants":WebInspector.UIString("Composition due to association with an element with opacity applied and composited descendants."),"maskWithCom positedDescendants":WebInspector.UIString("Composition due to association with a masked element and composited descendants."),"reflectionWithCompositedDescendan ts":WebInspector.UIString("Composition due to association with an element with a reflection and composited descendants."),"filterWithCompositedDescendants":WebI nspector.UIString("Composition due to association with an element with CSS filte rs applied and composited descendants."),"blendingWithCompositedDescendants":Web Inspector.UIString("Composition due to association with an element with CSS blen ding applied and composited descendants."),"clipsCompositingDescendants":WebInsp ector.UIString("Composition due to association with an element clipping composit ing descendants."),"perspective":WebInspector.UIString("Composition due to assoc iation with an element with perspective applied."),"preserve3D":WebInspector.UIS tring("Composition due to association with an element with a \"transform-style: preserve-3d\" style."),"root":WebInspector.UIString("Root layer."),"layerForClip ":WebInspector.UIString("Layer for clip."),"layerForScrollbar":WebInspector.UISt ring("Layer for scrollbar."),"layerForScrollingContainer":WebInspector.UIString( "Layer for scrolling container."),"layerForForeground":WebInspector.UIString("La yer for foreground."),"layerForBackground":WebInspector.UIString("Layer for back ground."),"layerForMask":WebInspector.UIString("Layer for mask."),"layerForVideo Overlay":WebInspector.UIString("Layer for video overlay.")};WebInspector.LayerDe tailsView.prototype={showLayer:function(layer)
150 {if(!layer){this._tableElement.remove();this._emptyView.show(this.element);retur n;} 155 {if(!layer){this._tableElement.remove();this._emptyView.show(this.element);retur n;}
151 this._emptyView.detach();this.element.appendChild(this._tableElement);this._posi tionCell.textContent=WebInspector.UIString("%d,%d",layer.offsetX(),layer.offsetY ());this._sizeCell.textContent=WebInspector.UIString("%d × %d",layer.width(),lay er.height());this._paintCountCell.textContent=layer.paintCount();const bytesPerP ixel=4;this._memoryEstimateCell.textContent=Number.bytesToString(layer.invisible ()?0:layer.width()*layer.height()*bytesPerPixel);layer.requestCompositingReasons (this._updateCompositingReasons.bind(this));},_createTable:function() 156 this._emptyView.detach();this.element.appendChild(this._tableElement);this._posi tionCell.textContent=WebInspector.UIString("%d,%d",layer.offsetX(),layer.offsetY ());this._sizeCell.textContent=WebInspector.UIString("%d × %d",layer.width(),lay er.height());this._paintCountCell.textContent=layer.paintCount();const bytesPerP ixel=4;this._memoryEstimateCell.textContent=Number.bytesToString(layer.invisible ()?0:layer.width()*layer.height()*bytesPerPixel);layer.requestCompositingReasons (this._updateCompositingReasons.bind(this));},_createTable:function()
152 {this._tableElement=this.element.createChild("table");this._tbodyElement=this._t ableElement.createChild("tbody");this._positionCell=this._createRow(WebInspector .UIString("Position in parent:"));this._sizeCell=this._createRow(WebInspector.UI String("Size:"));this._compositingReasonsCell=this._createRow(WebInspector.UIStr ing("Compositing Reasons:"));this._memoryEstimateCell=this._createRow(WebInspect or.UIString("Memory estimate:"));this._paintCountCell=this._createRow(WebInspect or.UIString("Paint count:"));},_createRow:function(title) 157 {this._tableElement=this.element.createChild("table");this._tbodyElement=this._t ableElement.createChild("tbody");this._positionCell=this._createRow(WebInspector .UIString("Position in parent:"));this._sizeCell=this._createRow(WebInspector.UI String("Size:"));this._compositingReasonsCell=this._createRow(WebInspector.UIStr ing("Compositing Reasons:"));this._memoryEstimateCell=this._createRow(WebInspect or.UIString("Memory estimate:"));this._paintCountCell=this._createRow(WebInspect or.UIString("Paint count:"));},_createRow:function(title)
153 {var tr=this._tbodyElement.createChild("tr");var titleCell=tr.createChild("td"); titleCell.textContent=title;return tr.createChild("td");},_updateCompositingReas ons:function(compositingReasons) 158 {var tr=this._tbodyElement.createChild("tr");var titleCell=tr.createChild("td"); titleCell.textContent=title;return tr.createChild("td");},_updateCompositingReas ons:function(compositingReasons)
154 {if(!compositingReasons||!compositingReasons.length){this._compositingReasonsCel l.textContent="n/a";return;} 159 {if(!compositingReasons||!compositingReasons.length){this._compositingReasonsCel l.textContent="n/a";return;}
155 var fragment=document.createDocumentFragment();for(var i=0;i<compositingReasons. length;++i){if(i) 160 var fragment=document.createDocumentFragment();for(var i=0;i<compositingReasons. length;++i){if(i)
156 fragment.appendChild(document.createTextNode(","));var span=document.createEleme nt("span");span.title=WebInspector.LayerDetailsView.CompositingReasonDetail[comp ositingReasons[i]]||"";span.textContent=compositingReasons[i];fragment.appendChi ld(span);} 161 fragment.appendChild(document.createTextNode(","));var span=document.createEleme nt("span");span.title=WebInspector.LayerDetailsView.CompositingReasonDetail[comp ositingReasons[i]]||"";span.textContent=compositingReasons[i];fragment.appendChi ld(span);}
157 this._compositingReasonsCell.removeChildren();this._compositingReasonsCell.appen dChild(fragment);},__proto__:WebInspector.View.prototype};WebInspector.LayersPan el=function() 162 this._compositingReasonsCell.removeChildren();this._compositingReasonsCell.appen dChild(fragment);},updatePaintCount:function(paintCount)
158 {WebInspector.Panel.call(this,"layers");this.registerRequiredCSS("layersPanel.cs s");const initialLayerTreeSidebarWidth=225;const minimumMainWidthPercent=0.5;thi s.createSidebarViewWithTree();this.sidebarElement.addStyleClass("outline-disclos ure");this.sidebarTreeElement.removeStyleClass("sidebar-tree");this._model=new W ebInspector.LayerTreeModel();this._model.addEventListener(WebInspector.LayerTree Model.Events.LayerTreeChanged,this._onLayerTreeUpdated,this);this._currentlySele ctedLayer=null;this._currentlyHoveredLayer=null;this._layerTree=new WebInspector .LayerTree(this._model,this.sidebarTree);this._layerTree.addEventListener(WebIns pector.LayerTree.Events.LayerSelected,this._onLayerSelected,this);this._layerTre e.addEventListener(WebInspector.LayerTree.Events.LayerHovered,this._onLayerHover ed,this);this._layerDetailsSplitView=new WebInspector.SplitView(false,"layerDeta ilsSplitView");this._layerDetailsSplitView.show(this.splitView.mainElement);this ._layers3DView=new WebInspector.Layers3DView(this._model);this._layers3DView.sho w(this._layerDetailsSplitView.firstElement());this._layers3DView.addEventListene r(WebInspector.Layers3DView.Events.LayerSelected,this._onLayerSelected,this);thi s._layers3DView.addEventListener(WebInspector.Layers3DView.Events.LayerHovered,t his._onLayerHovered,this);this._layerDetailsView=new WebInspector.LayerDetailsVi ew();this._layerDetailsView.show(this._layerDetailsSplitView.secondElement());th is._model.requestLayers();} 163 {this._paintCountCell.textContent=paintCount;},__proto__:WebInspector.View.proto type};WebInspector.LayersPanel=function()
164 {WebInspector.Panel.call(this,"layers");this.registerRequiredCSS("layersPanel.cs s");const initialLayerTreeSidebarWidth=225;const minimumMainWidthPercent=0.5;thi s.createSidebarViewWithTree();this.sidebarElement.addStyleClass("outline-disclos ure");this.sidebarTreeElement.removeStyleClass("sidebar-tree");this._model=new W ebInspector.LayerTreeModel();this._model.addEventListener(WebInspector.LayerTree Model.Events.LayerTreeChanged,this._onLayerTreeUpdated,this);this._model.addEven tListener(WebInspector.LayerTreeModel.Events.LayerPainted,this._onLayerPainted,t his);this._currentlySelectedLayer=null;this._currentlyHoveredLayer=null;this._la yerTree=new WebInspector.LayerTree(this._model,this.sidebarTree);this._layerTree .addEventListener(WebInspector.LayerTree.Events.LayerSelected,this._onLayerSelec ted,this);this._layerTree.addEventListener(WebInspector.LayerTree.Events.LayerHo vered,this._onLayerHovered,this);this._layerDetailsSplitView=new WebInspector.Sp litView(false,"layerDetailsSplitView");this._layerDetailsSplitView.show(this.spl itView.mainElement);this._layers3DView=new WebInspector.Layers3DView(this._model );this._layers3DView.show(this._layerDetailsSplitView.firstElement());this._laye rs3DView.addEventListener(WebInspector.Layers3DView.Events.LayerSelected,this._o nLayerSelected,this);this._layers3DView.addEventListener(WebInspector.Layers3DVi ew.Events.LayerHovered,this._onLayerHovered,this);this._layerDetailsView=new Web Inspector.LayerDetailsView();this._layerDetailsView.show(this._layerDetailsSplit View.secondElement());}
159 WebInspector.LayersPanel.prototype={wasShown:function() 165 WebInspector.LayersPanel.prototype={wasShown:function()
160 {WebInspector.Panel.prototype.wasShown.call(this);this._layerTree.setVisible(tru e);this.sidebarTreeElement.focus();},willHide:function() 166 {WebInspector.Panel.prototype.wasShown.call(this);this.sidebarTreeElement.focus( );this._model.enable();},willHide:function()
161 {this._layerTree.setVisible(false);WebInspector.Panel.prototype.willHide.call(th is);},_onLayerTreeUpdated:function() 167 {this._model.disable();WebInspector.Panel.prototype.willHide.call(this);},_onLay erTreeUpdated:function()
162 {if(this._currentlySelectedLayer&&!this._model.layerById(this._currentlySelected Layer.id())) 168 {if(this._currentlySelectedLayer&&!this._model.layerById(this._currentlySelected Layer.id()))
163 this._selectLayer(null);if(this._currentlyHoveredLayer&&!this._model.layerById(t his._currentlyHoveredLayer.id())) 169 this._selectLayer(null);if(this._currentlyHoveredLayer&&!this._model.layerById(t his._currentlyHoveredLayer.id()))
164 this._hoverLayer(null);if(this._currentlySelectedLayer) 170 this._hoverLayer(null);if(this._currentlySelectedLayer)
165 this._layerDetailsView.showLayer(this._currentlySelectedLayer);},_onLayerSelecte d:function(event) 171 this._layerDetailsView.showLayer(this._currentlySelectedLayer);},_onLayerPainted :function(event)
172 {var layer=(event.data);if(this._currentlySelectedLayer===layer)
173 this._layerDetailsView.updatePaintCount(this._currentlySelectedLayer.paintCount( ));},_onLayerSelected:function(event)
166 {var layer=(event.data);this._selectLayer(layer);},_onLayerHovered:function(even t) 174 {var layer=(event.data);this._selectLayer(layer);},_onLayerHovered:function(even t)
167 {var layer=(event.data);this._hoverLayer(layer);},_selectLayer:function(layer) 175 {var layer=(event.data);this._hoverLayer(layer);},_selectLayer:function(layer)
168 {if(this._currentlySelectedLayer===layer) 176 {if(this._currentlySelectedLayer===layer)
169 return;this._currentlySelectedLayer=layer;var nodeId=layer&&layer.nodeIdForSelfO rAncestor();if(nodeId) 177 return;this._currentlySelectedLayer=layer;var nodeId=layer&&layer.nodeIdForSelfO rAncestor();if(nodeId)
170 WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId);else 178 WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId);else
171 WebInspector.domAgent.hideDOMNodeHighlight();this._layerTree.selectLayer(layer); this._layers3DView.selectLayer(layer);this._layerDetailsView.showLayer(layer);}, _hoverLayer:function(layer) 179 WebInspector.domAgent.hideDOMNodeHighlight();this._layerTree.selectLayer(layer); this._layers3DView.selectLayer(layer);this._layerDetailsView.showLayer(layer);}, _hoverLayer:function(layer)
172 {if(this._currentlyHoveredLayer===layer) 180 {if(this._currentlyHoveredLayer===layer)
173 return;this._currentlyHoveredLayer=layer;var nodeId=layer&&layer.nodeIdForSelfOr Ancestor();if(nodeId) 181 return;this._currentlyHoveredLayer=layer;var nodeId=layer&&layer.nodeIdForSelfOr Ancestor();if(nodeId)
174 WebInspector.domAgent.highlightDOMNode(nodeId);else 182 WebInspector.domAgent.highlightDOMNode(nodeId);else
175 WebInspector.domAgent.hideDOMNodeHighlight();this._layerTree.hoverLayer(layer);t his._layers3DView.hoverLayer(layer);},__proto__:WebInspector.Panel.prototype} 183 WebInspector.domAgent.hideDOMNodeHighlight();this._layerTree.hoverLayer(layer);t his._layers3DView.hoverLayer(layer);},__proto__:WebInspector.Panel.prototype}
OLDNEW
« no previous file with comments | « chrome_linux/resources/inspector/Images/statusbarButtonGlyphs2x.png ('k') | chrome_linux/resources/inspector/NetworkPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698