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

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

Issue 310483004: Roll reference builds to 35.0.1916.114. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 WebInspector.CSSNamedFlowCollectionsView=function() 1 WebInspector.DOMSyntaxHighlighter=function(mimeType,stripExtraWhitespace)
2 {WebInspector.SidebarView.call(this,WebInspector.SidebarView.SidebarPosition.Sta rt);this.registerRequiredCSS("cssNamedFlows.css");this._namedFlows={};this._cont entNodes={};this._regionNodes={};this.element.classList.add("css-named-flow-coll ections-view");this.element.classList.add("fill");this._statusElement=document.c reateElement("span");this._statusElement.textContent=WebInspector.UIString("CSS Named Flows");var sidebarHeader=this.firstElement().createChild("div","tabbed-pa ne-header selected sidebar-header");var tab=sidebarHeader.createChild("div","tab bed-pane-header-tab");tab.createChild("span","tabbed-pane-header-tab-title").tex tContent=WebInspector.UIString("CSS Named Flows");this._sidebarContentElement=th is.firstElement().createChild("div","sidebar-content outline-disclosure");this._ flowListElement=this._sidebarContentElement.createChild("ol");this._flowTree=new TreeOutline(this._flowListElement);this._emptyElement=document.createElement("d iv");this._emptyElement.classList.add("info");this._emptyElement.textContent=Web Inspector.UIString("No CSS Named Flows");this._tabbedPane=new WebInspector.Tabbe dPane();this._tabbedPane.closeableTabs=true;this._tabbedPane.show(this.secondEle ment());} 2 {this._mimeType=mimeType;this._stripExtraWhitespace=stripExtraWhitespace;}
3 WebInspector.CSSNamedFlowCollectionsView.prototype={showInDrawer:function() 3 WebInspector.DOMSyntaxHighlighter.prototype={createSpan:function(content,classNa me)
4 {WebInspector.inspectorView.showCloseableViewInDrawer("css-flows",WebInspector.U IString("CSS Flows"),this);},reset:function() 4 {var span=document.createElement("span");span.className="cm-"+className;if(this. _stripExtraWhitespace&&className!=="whitespace")
5 {if(!this._document) 5 content=content.replace(/^[\n\r]*/,"").replace(/\s*$/,"");span.appendChild(docum ent.createTextNode(content));return span;},syntaxHighlightNode:function(node)
6 return;WebInspector.cssModel.getNamedFlowCollectionAsync(this._document.id,this. _resetNamedFlows.bind(this));},_setDocument:function(document) 6 {var lines=node.textContent.split("\n");node.removeChildren();function processTo ken(token,tokenType,column,newColumn)
7 {this._document=document;this.reset();},_documentUpdated:function(event) 7 {if(!tokenType)
8 {var document=(event.data);this._setDocument(document);},_setSidebarHasContent:f unction(hasContent) 8 return;if(column>plainTextStart){var plainText=line.substring(plainTextStart,col umn);node.appendChild(document.createTextNode(plainText));}
9 {if(hasContent){if(!this._emptyElement.parentNode) 9 node.appendChild(this.createSpan(token,tokenType));plainTextStart=newColumn;}
10 return;this._sidebarContentElement.removeChild(this._emptyElement);this._sidebar ContentElement.appendChild(this._flowListElement);}else{if(!this._flowListElemen t.parentNode) 10 var tokenize=WebInspector.moduleManager.instance(WebInspector.TokenizerFactory). createTokenizer(this._mimeType);for(var i=lines[0].length?0:1;i<lines.length;++i ){var line=lines[i];var plainTextStart=0;tokenize(line,processToken.bind(this)); if(plainTextStart<line.length){var plainText=line.substring(plainTextStart,line. length);node.appendChild(document.createTextNode(plainText));}
11 return;this._sidebarContentElement.removeChild(this._flowListElement);this._side barContentElement.appendChild(this._emptyElement);}},_appendNamedFlow:function(f low) 11 if(i<lines.length-1)
12 {var flowHash=this._hashNamedFlow(flow.documentNodeId,flow.name);var flowContain er={flow:flow,flowHash:flowHash};for(var i=0;i<flow.content.length;++i) 12 node.appendChild(document.createElement("br"));}}};WebInspector.ElementsTreeOutl ine=function(omitRootDOMNode,selectEnabled,contextMenuCallback,setPseudoClassCal lback)
13 this._contentNodes[flow.content[i]]=flowHash;for(var i=0;i<flow.regions.length;+ +i) 13 {this.element=document.createElement("ol");this.element.className="elements-tree -outline";this.element.addEventListener("mousedown",this._onmousedown.bind(this) ,false);this.element.addEventListener("mousemove",this._onmousemove.bind(this),f alse);this.element.addEventListener("mouseout",this._onmouseout.bind(this),false );this.element.addEventListener("dragstart",this._ondragstart.bind(this),false); this.element.addEventListener("dragover",this._ondragover.bind(this),false);this .element.addEventListener("dragleave",this._ondragleave.bind(this),false);this.e lement.addEventListener("drop",this._ondrop.bind(this),false);this.element.addEv entListener("dragend",this._ondragend.bind(this),false);this.element.addEventLis tener("keydown",this._onkeydown.bind(this),false);TreeOutline.call(this,this.ele ment);this._includeRootDOMNode=!omitRootDOMNode;this._selectEnabled=selectEnable d;this._rootDOMNode=null;this._selectedDOMNode=null;this._eventSupport=new WebIn spector.Object();this._visible=false;this.element.addEventListener("contextmenu" ,this._contextMenuEventFired.bind(this),true);this._contextMenuCallback=contextM enuCallback;this._setPseudoClassCallback=setPseudoClassCallback;this._createNode Decorators();}
14 this._regionNodes[flow.regions[i].nodeId]=flowHash;var flowTreeItem=new WebInspe ctor.FlowTreeElement(flowContainer);flowTreeItem.onselect=this._selectNamedFlowT ab.bind(this,flowHash);flowContainer.flowTreeItem=flowTreeItem;this._namedFlows[ flowHash]=flowContainer;if(!this._flowTree.children.length) 14 WebInspector.ElementsTreeOutline.Events={SelectedNodeChanged:"SelectedNodeChange d",ElementsTreeUpdated:"ElementsTreeUpdated"}
15 this._setSidebarHasContent(true);this._flowTree.appendChild(flowTreeItem);},_rem oveNamedFlow:function(flowHash) 15 WebInspector.ElementsTreeOutline.MappedCharToEntity={"\u00a0":"nbsp","\u2002":"e nsp","\u2003":"emsp","\u2009":"thinsp","\u200a":"#8202","\u200b":"#8203","\u200c ":"zwnj","\u200d":"zwj","\u200e":"lrm","\u200f":"rlm","\u202a":"#8234","\u202b": "#8235","\u202c":"#8236","\u202d":"#8237","\u202e":"#8238"}
16 {var flowContainer=this._namedFlows[flowHash];if(this._tabbedPane._tabsById[flow Hash]) 16 WebInspector.ElementsTreeOutline.prototype={setVisibleWidth:function(width)
17 this._tabbedPane.closeTab(flowHash);this._flowTree.removeChild(flowContainer.flo wTreeItem);var flow=flowContainer.flow;for(var i=0;i<flow.content.length;++i) 17 {this._visibleWidth=width;if(this._multilineEditing)
18 delete this._contentNodes[flow.content[i]];for(var i=0;i<flow.regions.length;++i ) 18 this._multilineEditing.setWidth(this._visibleWidth);},_createNodeDecorators:func tion()
19 delete this._regionNodes[flow.regions[i].nodeId];delete this._namedFlows[flowHas h];if(!this._flowTree.children.length) 19 {this._nodeDecorators=[];this._nodeDecorators.push(new WebInspector.ElementsTree Outline.PseudoStateDecorator());},wireToDomAgent:function()
20 this._setSidebarHasContent(false);},_updateNamedFlow:function(flow) 20 {this._elementsTreeUpdater=new WebInspector.ElementsTreeUpdater(this);},setVisib le:function(visible)
21 {var flowHash=this._hashNamedFlow(flow.documentNodeId,flow.name);var flowContain er=this._namedFlows[flowHash];if(!flowContainer) 21 {this._visible=visible;if(!this._visible)
22 return;var oldFlow=flowContainer.flow;flowContainer.flow=flow;for(var i=0;i<oldF low.content.length;++i) 22 return;this._updateModifiedNodes();if(this._selectedDOMNode)
23 delete this._contentNodes[oldFlow.content[i]];for(var i=0;i<oldFlow.regions.leng th;++i) 23 this._revealAndSelectNode(this._selectedDOMNode,false);},addEventListener:functi on(eventType,listener,thisObject)
24 delete this._regionNodes[oldFlow.regions[i].nodeId];for(var i=0;i<flow.content.l ength;++i) 24 {this._eventSupport.addEventListener(eventType,listener,thisObject);},removeEven tListener:function(eventType,listener,thisObject)
25 this._contentNodes[flow.content[i]]=flowHash;for(var i=0;i<flow.regions.length;+ +i) 25 {this._eventSupport.removeEventListener(eventType,listener,thisObject);},get roo tDOMNode()
26 this._regionNodes[flow.regions[i].nodeId]=flowHash;flowContainer.flowTreeItem.se tOverset(flow.overset);if(flowContainer.flowView) 26 {return this._rootDOMNode;},set rootDOMNode(x)
27 flowContainer.flowView.flow=flow;},_resetNamedFlows:function(namedFlowCollection ) 27 {if(this._rootDOMNode===x)
28 {for(var flowHash in this._namedFlows) 28 return;this._rootDOMNode=x;this._isXMLMimeType=x&&x.isXMLNode();this.update();}, get isXMLMimeType()
29 this._removeNamedFlow(flowHash);var namedFlows=namedFlowCollection?namedFlowColl ection.namedFlowMap:{};for(var flowName in namedFlows) 29 {return this._isXMLMimeType;},selectedDOMNode:function()
30 this._appendNamedFlow(namedFlows[flowName]);if(!this._flowTree.children.length) 30 {return this._selectedDOMNode;},selectDOMNode:function(node,focus)
31 this._setSidebarHasContent(false);else 31 {if(this._selectedDOMNode===node){this._revealAndSelectNode(node,!focus);return; }
32 this._showNamedFlowForNode(WebInspector.panel("elements").treeOutline.selectedDO MNode());},_namedFlowCreated:function(event) 32 this._selectedDOMNode=node;this._revealAndSelectNode(node,!focus);if(this._selec tedDOMNode===node)
33 {if(event.data.documentNodeId!==this._document.id) 33 this._selectedNodeChanged();},editing:function()
34 return;var flow=(event.data);this._appendNamedFlow(flow);},_namedFlowRemoved:fun ction(event) 34 {var node=this.selectedDOMNode();if(!node)
35 {if(event.data.documentNodeId!==this._document.id) 35 return false;var treeElement=this.findTreeElement(node);if(!treeElement)
36 return;this._removeNamedFlow(this._hashNamedFlow(event.data.documentNodeId,event .data.flowName));},_regionLayoutUpdated:function(event) 36 return false;return treeElement._editing||false;},update:function()
37 {if(event.data.documentNodeId!==this._document.id) 37 {var selectedNode=this.selectedTreeElement?this.selectedTreeElement._node:null;t his.removeChildren();if(!this.rootDOMNode)
38 return;var flow=(event.data);this._updateNamedFlow(flow);},_regionOversetChanged :function(event) 38 return;var treeElement;if(this._includeRootDOMNode){treeElement=new WebInspector .ElementsTreeElement(this.rootDOMNode);treeElement.selectable=this._selectEnable d;this.appendChild(treeElement);}else{var node=this.rootDOMNode.firstChild;while (node){treeElement=new WebInspector.ElementsTreeElement(node);treeElement.select able=this._selectEnabled;this.appendChild(treeElement);node=node.nextSibling;}}
39 {if(event.data.documentNodeId!==this._document.id) 39 if(selectedNode)
40 return;var flow=(event.data);this._updateNamedFlow(flow);},_hashNamedFlow:functi on(documentNodeId,flowName) 40 this._revealAndSelectNode(selectedNode,true);},updateSelection:function()
41 {return documentNodeId+"|"+flowName;},_showNamedFlow:function(flowHash) 41 {if(!this.selectedTreeElement)
42 {this._selectNamedFlowInSidebar(flowHash);this._selectNamedFlowTab(flowHash);},_ selectNamedFlowInSidebar:function(flowHash) 42 return;var element=this.treeOutline.selectedTreeElement;element.updateSelection( );},updateOpenCloseTags:function(node)
43 {this._namedFlows[flowHash].flowTreeItem.select(true);},_selectNamedFlowTab:func tion(flowHash) 43 {var treeElement=this.findTreeElement(node);if(treeElement)
44 {var flowContainer=this._namedFlows[flowHash];if(this._tabbedPane.selectedTabId= ==flowHash) 44 treeElement.updateTitle();var children=treeElement.children;var closingTagElemen t=children[children.length-1];if(closingTagElement&&closingTagElement._elementCl oseTag)
45 return false;if(!this._tabbedPane.selectTab(flowHash)){if(!flowContainer.flowVie w) 45 closingTagElement.updateTitle();},_selectedNodeChanged:function()
46 flowContainer.flowView=new WebInspector.CSSNamedFlowView(flowContainer.flow);thi s._tabbedPane.appendTab(flowHash,flowContainer.flow.name,flowContainer.flowView) ;this._tabbedPane.selectTab(flowHash);} 46 {this._eventSupport.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Ev ents.SelectedNodeChanged,this._selectedDOMNode);},_fireElementsTreeUpdated:funct ion(nodes)
47 return false;},_selectedNodeChanged:function(event) 47 {this._eventSupport.dispatchEventToListeners(WebInspector.ElementsTreeOutline.Ev ents.ElementsTreeUpdated,nodes);},findTreeElement:function(node)
48 {var node=(event.data);this._showNamedFlowForNode(node);},_tabSelected:function( event) 48 {function isAncestorNode(ancestor,node)
49 {this._selectNamedFlowInSidebar(event.data.tabId);},_tabClosed:function(event) 49 {return ancestor.isAncestor(node);}
50 {this._namedFlows[event.data.tabId].flowTreeItem.deselect();},_showNamedFlowForN ode:function(node) 50 function parentNode(node)
51 {if(!node) 51 {return node.parentNode;}
52 return;if(this._regionNodes[node.id]){this._showNamedFlow(this._regionNodes[node .id]);return;} 52 var treeElement=TreeOutline.prototype.findTreeElement.call(this,node,isAncestorN ode,parentNode);if(!treeElement&&node.nodeType()===Node.TEXT_NODE){treeElement=T reeOutline.prototype.findTreeElement.call(this,node.parentNode,isAncestorNode,pa rentNode);}
53 while(node){if(this._contentNodes[node.id]){this._showNamedFlow(this._contentNod es[node.id]);return;} 53 return treeElement;},createTreeElementFor:function(node)
54 node=node.parentNode;}},wasShown:function() 54 {var treeElement=this.findTreeElement(node);if(treeElement)
55 {WebInspector.SidebarView.prototype.wasShown.call(this);WebInspector.domAgent.re questDocument(this._setDocument.bind(this));WebInspector.domAgent.addEventListen er(WebInspector.DOMAgent.Events.DocumentUpdated,this._documentUpdated,this);WebI nspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCr eated,this._namedFlowCreated,this);WebInspector.cssModel.addEventListener(WebIns pector.CSSStyleModel.Events.NamedFlowRemoved,this._namedFlowRemoved,this);WebIns pector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutU pdated,this._regionLayoutUpdated,this);WebInspector.cssModel.addEventListener(We bInspector.CSSStyleModel.Events.RegionOversetChanged,this._regionOversetChanged, this);WebInspector.panel("elements").treeOutline.addEventListener(WebInspector.E lementsTreeOutline.Events.SelectedNodeChanged,this._selectedNodeChanged,this);th is._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,t his._tabSelected,this);this._tabbedPane.addEventListener(WebInspector.TabbedPane .EventTypes.TabClosed,this._tabClosed,this);},willHide:function() 55 return treeElement;if(!node.parentNode)
56 {WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.Document Updated,this._documentUpdated,this);WebInspector.cssModel.removeEventListener(We bInspector.CSSStyleModel.Events.NamedFlowCreated,this._namedFlowCreated,this);We bInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedF lowRemoved,this._namedFlowRemoved,this);WebInspector.cssModel.removeEventListene r(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated,this._regionLayoutUpdate d,this);WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.RegionOversetChanged,this._regionOversetChanged,this);WebInspector.panel("el ements").treeOutline.removeEventListener(WebInspector.ElementsTreeOutline.Events .SelectedNodeChanged,this._selectedNodeChanged,this);this._tabbedPane.removeEven tListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this) ;this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabClos ed,this._tabClosed,this);},__proto__:WebInspector.SidebarView.prototype} 56 return null;treeElement=this.createTreeElementFor(node.parentNode);return treeEl ement?treeElement._showChild(node):null;},set suppressRevealAndSelect(x)
57 WebInspector.FlowTreeElement=function(flowContainer) 57 {if(this._suppressRevealAndSelect===x)
58 {var container=document.createElement("div");container.createChild("div","select ion");container.createChild("span","title").createChild("span").textContent=flow Container.flow.name;TreeElement.call(this,container,flowContainer,false);this._o verset=false;this.setOverset(flowContainer.flow.overset);} 58 return;this._suppressRevealAndSelect=x;},_revealAndSelectNode:function(node,omit Focus)
59 WebInspector.FlowTreeElement.prototype={setOverset:function(newOverset) 59 {if(this._suppressRevealAndSelect)
60 {if(this._overset===newOverset) 60 return;if(!this._includeRootDOMNode&&node===this.rootDOMNode&&this.rootDOMNode)
61 return;if(newOverset){this.title.classList.add("named-flow-overflow");this.toolt ip=WebInspector.UIString("Overflows.");}else{this.title.classList.remove("named- flow-overflow");this.tooltip="";} 61 node=this.rootDOMNode.firstChild;if(!node)
62 this._overset=newOverset;},__proto__:TreeElement.prototype};WebInspector.CSSName dFlowView=function(flow) 62 return;var treeElement=this.createTreeElementFor(node);if(!treeElement)
63 {WebInspector.View.call(this);this.element.classList.add("css-named-flow");this. element.classList.add("outline-disclosure");this._treeOutline=new TreeOutline(th is.element.createChild("ol"),true);this._contentTreeItem=new TreeElement(WebInsp ector.UIString("content"),null,true);this._treeOutline.appendChild(this._content TreeItem);this._regionsTreeItem=new TreeElement(WebInspector.UIString("region ch ain"),null,true);this._regionsTreeItem.expand();this._treeOutline.appendChild(th is._regionsTreeItem);this._flow=flow;var content=flow.content;for(var i=0;i<cont ent.length;++i) 63 return;treeElement.revealAndSelect(omitFocus);},_treeElementFromEvent:function(e vent)
64 this._insertContentNode(content[i]);var regions=flow.regions;for(var i=0;i<regio ns.length;++i) 64 {var scrollContainer=this.element.parentElement;var x=scrollContainer.totalOffse tLeft()+scrollContainer.offsetWidth-36;var y=event.pageY;var elementUnderMouse=t his.treeElementFromPoint(x,y);var elementAboveMouse=this.treeElementFromPoint(x, y-2);var element;if(elementUnderMouse===elementAboveMouse)
65 this._insertRegion(regions[i]);} 65 element=elementUnderMouse;else
66 WebInspector.CSSNamedFlowView.OversetTypeMessageMap={empty:"empty",fit:"fit",ove rset:"overset"} 66 element=this.treeElementFromPoint(x,y+2);return element;},_onmousedown:function( event)
67 WebInspector.CSSNamedFlowView.prototype={_createFlowTreeOutline:function(rootDOM Node) 67 {var element=this._treeElementFromEvent(event);if(!element||element.isEventWithi nDisclosureTriangle(event))
68 {if(!rootDOMNode) 68 return;element.select();},_onmousemove:function(event)
69 return null;var treeOutline=new WebInspector.ElementsTreeOutline(false,false);tr eeOutline.element.classList.add("named-flow-element");treeOutline.setVisible(tru e);treeOutline.rootDOMNode=rootDOMNode;treeOutline.wireToDomAgent();WebInspector .domAgent.removeEventListener(WebInspector.DOMAgent.Events.DocumentUpdated,treeO utline._elementsTreeUpdater._documentUpdated,treeOutline._elementsTreeUpdater);r eturn treeOutline;},_insertContentNode:function(contentNodeId,index) 69 {var element=this._treeElementFromEvent(event);if(element&&this._previousHovered Element===element)
70 {var treeOutline=this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(con tentNodeId));var treeItem=new TreeElement(treeOutline.element,treeOutline);if(in dex===undefined){this._contentTreeItem.appendChild(treeItem);return;} 70 return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=fal se;delete this._previousHoveredElement;}
71 this._contentTreeItem.insertChild(treeItem,index);},_insertRegion:function(regio n,index) 71 if(element){element.hovered=true;this._previousHoveredElement=element;}
72 {var treeOutline=this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(reg ion.nodeId));treeOutline.element.classList.add("region-"+region.regionOverset);v ar treeItem=new TreeElement(treeOutline.element,treeOutline);var oversetText=Web Inspector.UIString(WebInspector.CSSNamedFlowView.OversetTypeMessageMap[region.re gionOverset]);treeItem.tooltip=WebInspector.UIString("Region is %s.",oversetText );if(index===undefined){this._regionsTreeItem.appendChild(treeItem);return;} 72 WebInspector.domModel.highlightDOMNode(element&&element._node?element._node.id:0 );},_onmouseout:function(event)
73 this._regionsTreeItem.insertChild(treeItem,index);},get flow() 73 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUn derMouse&&nodeUnderMouse.isDescendant(this.element))
74 {return this._flow;},set flow(newFlow) 74 return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=fal se;delete this._previousHoveredElement;}
75 {this._update(newFlow);},_updateRegionOverset:function(regionTreeItem,newRegionO verset,oldRegionOverset) 75 WebInspector.domModel.hideDOMNodeHighlight();},_ondragstart:function(event)
76 {var element=regionTreeItem.representedObject.element;element.classList.remove(" region-"+oldRegionOverset);element.classList.add("region-"+newRegionOverset);var oversetText=WebInspector.UIString(WebInspector.CSSNamedFlowView.OversetTypeMess ageMap[newRegionOverset]);regionTreeItem.tooltip=WebInspector.UIString("Region i s %s.",oversetText);},_mergeContentNodes:function(oldContent,newContent) 76 {if(!window.getSelection().isCollapsed)
77 {var nodeIdSet={};for(var i=0;i<newContent.length;++i) 77 return false;if(event.target.nodeName==="A")
78 nodeIdSet[newContent[i]]=true;var oldContentIndex=0;var newContentIndex=0;var co ntentTreeChildIndex=0;while(oldContentIndex<oldContent.length||newContentIndex<n ewContent.length){if(oldContentIndex===oldContent.length){this._insertContentNod e(newContent[newContentIndex]);++newContentIndex;continue;} 78 return false;var treeElement=this._treeElementFromEvent(event);if(!treeElement)
79 if(newContentIndex===newContent.length){this._contentTreeItem.removeChildAtIndex (contentTreeChildIndex);++oldContentIndex;continue;} 79 return false;if(!this._isValidDragSourceOrTarget(treeElement))
80 if(oldContent[oldContentIndex]===newContent[newContentIndex]){++oldContentIndex; ++newContentIndex;++contentTreeChildIndex;continue;} 80 return false;if(treeElement._node.nodeName()==="BODY"||treeElement._node.nodeNam e()==="HEAD")
81 if(nodeIdSet[oldContent[oldContentIndex]]){this._insertContentNode(newContent[ne wContentIndex],contentTreeChildIndex);++newContentIndex;++contentTreeChildIndex; continue;} 81 return false;event.dataTransfer.setData("text/plain",treeElement.listItemElement .textContent);event.dataTransfer.effectAllowed="copyMove";this._treeElementBeing Dragged=treeElement;WebInspector.domModel.hideDOMNodeHighlight();return true;},_ ondragover:function(event)
82 this._contentTreeItem.removeChildAtIndex(contentTreeChildIndex);++oldContentInde x;}},_mergeRegions:function(oldRegions,newRegions) 82 {if(!this._treeElementBeingDragged)
83 {var nodeIdSet={};for(var i=0;i<newRegions.length;++i) 83 return false;var treeElement=this._treeElementFromEvent(event);if(!this._isValid DragSourceOrTarget(treeElement))
84 nodeIdSet[newRegions[i].nodeId]=true;var oldRegionsIndex=0;var newRegionsIndex=0 ;var regionsTreeChildIndex=0;while(oldRegionsIndex<oldRegions.length||newRegions Index<newRegions.length){if(oldRegionsIndex===oldRegions.length){this._insertReg ion(newRegions[newRegionsIndex]);++newRegionsIndex;continue;} 84 return false;var node=treeElement._node;while(node){if(node===this._treeElementB eingDragged._node)
85 if(newRegionsIndex===newRegions.length){this._regionsTreeItem.removeChildAtIndex (regionsTreeChildIndex);++oldRegionsIndex;continue;} 85 return false;node=node.parentNode;}
86 if(oldRegions[oldRegionsIndex].nodeId===newRegions[newRegionsIndex].nodeId){if(o ldRegions[oldRegionsIndex].regionOverset!==newRegions[newRegionsIndex].regionOve rset) 86 treeElement.updateSelection();treeElement.listItemElement.classList.add("element s-drag-over");this._dragOverTreeElement=treeElement;event.preventDefault();event .dataTransfer.dropEffect='move';return false;},_ondragleave:function(event)
87 this._updateRegionOverset(this._regionsTreeItem.children[regionsTreeChildIndex], newRegions[newRegionsIndex].regionOverset,oldRegions[oldRegionsIndex].regionOver set);++oldRegionsIndex;++newRegionsIndex;++regionsTreeChildIndex;continue;} 87 {this._clearDragOverTreeElementMarker();event.preventDefault();return false;},_i sValidDragSourceOrTarget:function(treeElement)
88 if(nodeIdSet[oldRegions[oldRegionsIndex].nodeId]){this._insertRegion(newRegions[ newRegionsIndex],regionsTreeChildIndex);++newRegionsIndex;++regionsTreeChildInde x;continue;} 88 {if(!treeElement)
89 this._regionsTreeItem.removeChildAtIndex(regionsTreeChildIndex);++oldRegionsInde x;}},_update:function(newFlow) 89 return false;var node=treeElement.representedObject;if(!(node instanceof WebInsp ector.DOMNode))
90 {this._mergeContentNodes(this._flow.content,newFlow.content);this._mergeRegions( this._flow.regions,newFlow.regions);this._flow=newFlow;},__proto__:WebInspector. View.prototype};WebInspector.EventListenersSidebarPane=function() 90 return false;if(!node.parentNode||node.parentNode.nodeType()!==Node.ELEMENT_NODE )
91 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Event Listeners"));th is.bodyElement.classList.add("events-pane");this.sections=[];this.settingsSelect Element=document.createElement("select");this.settingsSelectElement.className="s elect-filter";var option=document.createElement("option");option.value="all";opt ion.label=WebInspector.UIString("All Nodes");this.settingsSelectElement.appendCh ild(option);option=document.createElement("option");option.value="selected";opti on.label=WebInspector.UIString("Selected Node Only");this.settingsSelectElement. appendChild(option);var filter=WebInspector.settings.eventListenersFilter.get(); if(filter==="all") 91 return false;return true;},_ondrop:function(event)
92 {event.preventDefault();var treeElement=this._treeElementFromEvent(event);if(tre eElement)
93 this._doMove(treeElement);},_doMove:function(treeElement)
94 {if(!this._treeElementBeingDragged)
95 return;var parentNode;var anchorNode;if(treeElement._elementCloseTag){parentNode =treeElement._node;}else{var dragTargetNode=treeElement._node;parentNode=dragTar getNode.parentNode;anchorNode=dragTargetNode;}
96 var wasExpanded=this._treeElementBeingDragged.expanded;this._treeElementBeingDra gged._node.moveTo(parentNode,anchorNode,this._selectNodeAfterEdit.bind(this,wasE xpanded));delete this._treeElementBeingDragged;},_ondragend:function(event)
97 {event.preventDefault();this._clearDragOverTreeElementMarker();delete this._tree ElementBeingDragged;},_clearDragOverTreeElementMarker:function()
98 {if(this._dragOverTreeElement){this._dragOverTreeElement.updateSelection();this. _dragOverTreeElement.listItemElement.classList.remove("elements-drag-over");dele te this._dragOverTreeElement;}},_onkeydown:function(event)
99 {var keyboardEvent=(event);var node=(this.selectedDOMNode());console.assert(node );var treeElement=this.getCachedTreeElement(node);if(!treeElement)
100 return;if(!treeElement._editing&&WebInspector.KeyboardShortcut.hasNoModifiers(ke yboardEvent)&&keyboardEvent.keyCode===WebInspector.KeyboardShortcut.Keys.H.code) {this._toggleHideShortcut(node);event.consume(true);return;}},_contextMenuEventF ired:function(event)
101 {var treeElement=this._treeElementFromEvent(event);if(!treeElement)
102 return;var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApp licableItems(treeElement._node);contextMenu.show();},populateContextMenu:functio n(contextMenu,event)
103 {var treeElement=this._treeElementFromEvent(event);if(!treeElement)
104 return;var isPseudoElement=!!treeElement._node.pseudoType();var isTag=treeElemen t._node.nodeType()===Node.ELEMENT_NODE&&!isPseudoElement;var textNode=event.targ et.enclosingNodeOrSelfWithClass("webkit-html-text-node");if(textNode&&textNode.c lassList.contains("bogus"))
105 textNode=null;var commentNode=event.target.enclosingNodeOrSelfWithClass("webkit- html-comment");contextMenu.appendApplicableItems(event.target);if(textNode){cont extMenu.appendSeparator();treeElement._populateTextContextMenu(contextMenu,textN ode);}else if(isTag){contextMenu.appendSeparator();treeElement._populateTagConte xtMenu(contextMenu,event);}else if(commentNode){contextMenu.appendSeparator();tr eeElement._populateNodeContextMenu(contextMenu,textNode);}else if(isPseudoElemen t){treeElement._populateScrollIntoView(contextMenu);}else if(treeElement._node.i sShadowRoot()){this.treeOutline._populateContextMenu(contextMenu,treeElement._no de);}},_updateModifiedNodes:function()
106 {if(this._elementsTreeUpdater)
107 this._elementsTreeUpdater._updateModifiedNodes();},_populateContextMenu:function (contextMenu,node)
108 {if(this._contextMenuCallback)
109 this._contextMenuCallback(contextMenu,node);},handleShortcut:function(event)
110 {var node=this.selectedDOMNode();var treeElement=this.getCachedTreeElement(node) ;if(!node||!treeElement)
111 return;if(event.keyIdentifier==="F2"&&treeElement.hasEditableNode()){this._toggl eEditAsHTML(node);event.handled=true;return;}
112 if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&node.parentNode){if( event.keyIdentifier==="Up"&&node.previousSibling){node.moveTo(node.parentNode,no de.previousSibling,this._selectNodeAfterEdit.bind(this,treeElement.expanded));ev ent.handled=true;return;}
113 if(event.keyIdentifier==="Down"&&node.nextSibling){node.moveTo(node.parentNode,n ode.nextSibling.nextSibling,this._selectNodeAfterEdit.bind(this,treeElement.expa nded));event.handled=true;return;}}},_toggleEditAsHTML:function(node)
114 {var treeElement=this.getCachedTreeElement(node);if(!treeElement)
115 return;if(treeElement._editing&&treeElement._htmlEditElement&&WebInspector.isBei ngEdited(treeElement._htmlEditElement))
116 treeElement._editing.commit();else
117 treeElement._editAsHTML();},_selectNodeAfterEdit:function(wasExpanded,error,node Id)
118 {if(error)
119 return;this._updateModifiedNodes();var newNode=nodeId?WebInspector.domModel.node ForId(nodeId):null;if(!newNode)
120 return;this.selectDOMNode(newNode,true);var newTreeItem=this.findTreeElement(new Node);if(wasExpanded){if(newTreeItem)
121 newTreeItem.expand();}
122 return newTreeItem;},_toggleHideShortcut:function(node,userCallback)
123 {var pseudoType=node.pseudoType();var effectiveNode=pseudoType?node.parentNode:n ode;if(!effectiveNode)
124 return;function resolvedNode(object)
125 {if(!object)
126 return;function toggleClassAndInjectStyleRule(pseudoType)
127 {const classNamePrefix="__web-inspector-hide";const classNameSuffix="-shortcut__ ";const styleTagId="__web-inspector-hide-shortcut-style__";const styleRules=".__ web-inspector-hide-shortcut__, .__web-inspector-hide-shortcut__ * { visibility: hidden !important; } .__web-inspector-hidebefore-shortcut__::before { visibility : hidden !important; } .__web-inspector-hideafter-shortcut__::after { visibility : hidden !important; }";var className=classNamePrefix+(pseudoType||"")+className Suffix;this.classList.toggle(className);var style=document.head.querySelector("s tyle#"+styleTagId);if(style)
128 return;style=document.createElement("style");style.id=styleTagId;style.type="tex t/css";style.textContent=styleRules;document.head.appendChild(style);}
129 object.callFunction(toggleClassAndInjectStyleRule,[{value:pseudoType}],userCallb ack);object.release();}
130 WebInspector.RemoteObject.resolveNode(effectiveNode,"",resolvedNode);},__proto__ :TreeOutline.prototype}
131 WebInspector.ElementsTreeOutline.ElementDecorator=function()
132 {}
133 WebInspector.ElementsTreeOutline.ElementDecorator.prototype={decorate:function(n ode)
134 {},decorateAncestor:function(node)
135 {}}
136 WebInspector.ElementsTreeOutline.PseudoStateDecorator=function()
137 {WebInspector.ElementsTreeOutline.ElementDecorator.call(this);}
138 WebInspector.ElementsTreeOutline.PseudoStateDecorator.PropertyName="pseudoState" ;WebInspector.ElementsTreeOutline.PseudoStateDecorator.prototype={decorate:funct ion(node)
139 {if(node.nodeType()!==Node.ELEMENT_NODE)
140 return null;var propertyValue=node.getUserProperty(WebInspector.ElementsTreeOutl ine.PseudoStateDecorator.PropertyName);if(!propertyValue)
141 return null;return WebInspector.UIString("Element state: %s",":"+propertyValue.j oin(", :"));},decorateAncestor:function(node)
142 {if(node.nodeType()!==Node.ELEMENT_NODE)
143 return null;var descendantCount=node.descendantUserPropertyCount(WebInspector.El ementsTreeOutline.PseudoStateDecorator.PropertyName);if(!descendantCount)
144 return null;if(descendantCount===1)
145 return WebInspector.UIString("%d descendant with forced state",descendantCount); return WebInspector.UIString("%d descendants with forced state",descendantCount) ;}}
146 WebInspector.ElementsTreeElement=function(node,elementCloseTag)
147 {TreeElement.call(this,"",node);this._node=node;this._elementCloseTag=elementClo seTag;this._updateHasChildren();if(this._node.nodeType()==Node.ELEMENT_NODE&&!el ementCloseTag)
148 this._canAddAttributes=true;this._searchQuery=null;this._expandedChildrenLimit=W ebInspector.ElementsTreeElement.InitialChildrenLimit;}
149 WebInspector.ElementsTreeElement.InitialChildrenLimit=500;WebInspector.ElementsT reeElement.ForbiddenClosingTagElements=["area","base","basefont","br","canvas"," col","command","embed","frame","hr","img","input","keygen","link","meta","param" ,"source"].keySet();WebInspector.ElementsTreeElement.EditTagBlacklist=["html","h ead","body"].keySet();WebInspector.ElementsTreeElement.prototype={highlightSearc hResults:function(searchQuery)
150 {if(this._searchQuery!==searchQuery){this._updateSearchHighlight(false);delete t his._highlightResult;}
151 this._searchQuery=searchQuery;this._searchHighlightsVisible=true;this.updateTitl e(true);},hideSearchHighlights:function()
152 {delete this._searchHighlightsVisible;this._updateSearchHighlight(false);},_upda teSearchHighlight:function(show)
153 {if(!this._highlightResult)
154 return;function updateEntryShow(entry)
155 {switch(entry.type){case"added":entry.parent.insertBefore(entry.node,entry.nextS ibling);break;case"changed":entry.node.textContent=entry.newText;break;}}
156 function updateEntryHide(entry)
157 {switch(entry.type){case"added":entry.node.remove();break;case"changed":entry.no de.textContent=entry.oldText;break;}}
158 if(show){for(var i=0,size=this._highlightResult.length;i<size;++i)
159 updateEntryShow(this._highlightResult[i]);}else{for(var i=(this._highlightResult .length-1);i>=0;--i)
160 updateEntryHide(this._highlightResult[i]);}},get hovered()
161 {return this._hovered;},set hovered(x)
162 {if(this._hovered===x)
163 return;this._hovered=x;if(this.listItemElement){if(x){this.updateSelection();thi s.listItemElement.classList.add("hovered");}else{this.listItemElement.classList. remove("hovered");}}},get expandedChildrenLimit()
164 {return this._expandedChildrenLimit;},set expandedChildrenLimit(x)
165 {if(this._expandedChildrenLimit===x)
166 return;this._expandedChildrenLimit=x;if(this.treeOutline&&!this._updateChildrenI nProgress)
167 this._updateChildren(true);},get expandedChildCount()
168 {var count=this.children.length;if(count&&this.children[count-1]._elementCloseTa g)
169 count--;if(count&&this.children[count-1].expandAllButton)
170 count--;return count;},_showChild:function(child)
171 {if(this._elementCloseTag)
172 return null;var index=this._visibleChildren().indexOf(child);if(index===-1)
173 return null;if(index>=this.expandedChildrenLimit){this._expandedChildrenLimit=in dex+1;this._updateChildren(true);}
174 return this.expandedChildCount>index?this.children[index]:null;},updateSelection :function()
175 {var listItemElement=this.listItemElement;if(!listItemElement)
176 return;if(!this._readyToUpdateSelection){if(document.body.offsetWidth>0)
177 this._readyToUpdateSelection=true;else{return;}}
178 if(!this.selectionElement){this.selectionElement=document.createElement("div");t his.selectionElement.className="selection selected";listItemElement.insertBefore (this.selectionElement,listItemElement.firstChild);}
179 this.selectionElement.style.height=listItemElement.offsetHeight+"px";},onattach: function()
180 {if(this._hovered){this.updateSelection();this.listItemElement.classList.add("ho vered");}
181 this.updateTitle();this._preventFollowingLinksOnDoubleClick();this.listItemEleme nt.draggable=true;},_preventFollowingLinksOnDoubleClick:function()
182 {var links=this.listItemElement.querySelectorAll("li .webkit-html-tag > .webkit- html-attribute > .webkit-html-external-link, li .webkit-html-tag > .webkit-html- attribute > .webkit-html-resource-link");if(!links)
183 return;for(var i=0;i<links.length;++i)
184 links[i].preventFollowOnDoubleClick=true;},onpopulate:function()
185 {if(this.children.length||this._showInlineText()||this._elementCloseTag)
186 return;this.updateChildren();},updateChildren:function(fullRefresh)
187 {if(this._elementCloseTag)
188 return;this._node.getChildNodes(this._updateChildren.bind(this,fullRefresh));},i nsertChildElement:function(child,index,closingTag)
189 {var newElement=new WebInspector.ElementsTreeElement(child,closingTag);newElemen t.selectable=this.treeOutline._selectEnabled;this.insertChild(newElement,index); return newElement;},moveChild:function(child,targetIndex)
190 {var wasSelected=child.selected;this.removeChild(child);this.insertChild(child,t argetIndex);if(wasSelected)
191 child.select();},_updateChildren:function(fullRefresh)
192 {if(this._updateChildrenInProgress||!this.treeOutline._visible)
193 return;this._updateChildrenInProgress=true;var selectedNode=this.treeOutline.sel ectedDOMNode();var originalScrollTop=0;if(fullRefresh){var treeOutlineContainerE lement=this.treeOutline.element.parentNode;originalScrollTop=treeOutlineContaine rElement.scrollTop;var selectedTreeElement=this.treeOutline.selectedTreeElement; if(selectedTreeElement&&selectedTreeElement.hasAncestor(this))
194 this.select();this.removeChildren();}
195 function updateChildrenOfNode()
196 {var treeOutline=this.treeOutline;var visibleChildren=this._visibleChildren();va r treeChildIndex=0;var elementToSelect=null;for(var i=0;i<visibleChildren.length ;++i){var child=visibleChildren[i];var currentTreeElement=this.children[treeChil dIndex];if(!currentTreeElement||currentTreeElement._node!==child){var existingTr eeElement=null;for(var j=(treeChildIndex+1),size=this.expandedChildCount;j<size; ++j){if(this.children[j]._node===child){existingTreeElement=this.children[j];bre ak;}}
197 if(existingTreeElement&&existingTreeElement.parent===this){this.moveChild(existi ngTreeElement,treeChildIndex);}else{if(treeChildIndex<this.expandedChildrenLimit ){var newElement=this.insertChildElement(child,treeChildIndex);if(child===select edNode)
198 elementToSelect=newElement;if(this.expandedChildCount>this.expandedChildrenLimit )
199 this.expandedChildrenLimit++;}}}
200 ++treeChildIndex;}
201 return elementToSelect;}
202 for(var i=(this.children.length-1);i>=0;--i){var currentChild=this.children[i];v ar currentNode=currentChild._node;if(!currentNode)
203 continue;var currentParentNode=currentNode.parentNode;if(currentParentNode===thi s._node)
204 continue;var selectedTreeElement=this.treeOutline.selectedTreeElement;if(selecte dTreeElement&&(selectedTreeElement===currentChild||selectedTreeElement.hasAncest or(currentChild)))
205 this.select();this.removeChildAtIndex(i);}
206 var elementToSelect=updateChildrenOfNode.call(this);this.updateTitle();this._adj ustCollapsedRange();var lastChild=this.children[this.children.length-1];if(this. _node.nodeType()==Node.ELEMENT_NODE&&(!lastChild||!lastChild._elementCloseTag))
207 this.insertChildElement(this._node,this.children.length,true);if(fullRefresh&&el ementToSelect){elementToSelect.select();if(treeOutlineContainerElement&&original ScrollTop<=treeOutlineContainerElement.scrollHeight)
208 treeOutlineContainerElement.scrollTop=originalScrollTop;}
209 delete this._updateChildrenInProgress;},_adjustCollapsedRange:function()
210 {var visibleChildren=this._visibleChildren();if(this.expandAllButtonElement&&thi s.expandAllButtonElement.__treeElement.parent)
211 this.removeChild(this.expandAllButtonElement.__treeElement);const childNodeCount =visibleChildren.length;for(var i=this.expandedChildCount,limit=Math.min(this.ex pandedChildrenLimit,childNodeCount);i<limit;++i)
212 this.insertChildElement(visibleChildren[i],i);const expandedChildCount=this.expa ndedChildCount;if(childNodeCount>this.expandedChildCount){var targetButtonIndex= expandedChildCount;if(!this.expandAllButtonElement){var button=document.createEl ement("button");button.className="show-all-nodes";button.value="";var item=new T reeElement(button,null,false);item.selectable=false;item.expandAllButton=true;th is.insertChild(item,targetButtonIndex);this.expandAllButtonElement=item.listItem Element.firstChild;this.expandAllButtonElement.__treeElement=item;this.expandAll ButtonElement.addEventListener("click",this.handleLoadAllChildren.bind(this),fal se);}else if(!this.expandAllButtonElement.__treeElement.parent)
213 this.insertChild(this.expandAllButtonElement.__treeElement,targetButtonIndex);th is.expandAllButtonElement.textContent=WebInspector.UIString("Show All Nodes (%d More)",childNodeCount-expandedChildCount);}else if(this.expandAllButtonElement)
214 delete this.expandAllButtonElement;},handleLoadAllChildren:function()
215 {this.expandedChildrenLimit=Math.max(this._visibleChildCount(),this.expandedChil drenLimit+WebInspector.ElementsTreeElement.InitialChildrenLimit);},expandRecursi vely:function()
216 {function callback()
217 {TreeElement.prototype.expandRecursively.call(this,Number.MAX_VALUE);}
218 this._node.getSubtree(-1,callback.bind(this));},onexpand:function()
219 {if(this._elementCloseTag)
220 return;this.updateTitle();this.treeOutline.updateSelection();},oncollapse:functi on()
221 {if(this._elementCloseTag)
222 return;this.updateTitle();this.treeOutline.updateSelection();},onreveal:function ()
223 {if(this.listItemElement){var tagSpans=this.listItemElement.getElementsByClassNa me("webkit-html-tag-name");if(tagSpans.length)
224 tagSpans[0].scrollIntoViewIfNeeded(true);else
225 this.listItemElement.scrollIntoViewIfNeeded(true);}},onselect:function(selectedB yUser)
226 {this.treeOutline.suppressRevealAndSelect=true;this.treeOutline.selectDOMNode(th is._node,selectedByUser);if(selectedByUser)
227 WebInspector.domModel.highlightDOMNode(this._node.id);this.updateSelection();thi s.treeOutline.suppressRevealAndSelect=false;return true;},ondelete:function()
228 {var startTagTreeElement=this.treeOutline.findTreeElement(this._node);startTagTr eeElement?startTagTreeElement.remove():this.remove();return true;},onenter:funct ion()
229 {if(this._editing)
230 return false;this._startEditing();return true;},selectOnMouseDown:function(event )
231 {TreeElement.prototype.selectOnMouseDown.call(this,event);if(this._editing)
232 return;if(this.treeOutline._showInElementsPanelEnabled){WebInspector.inspectorVi ew.showPanel("elements");this.treeOutline.selectDOMNode(this._node,true);}
233 if(event.detail>=2)
234 event.preventDefault();},ondblclick:function(event)
235 {if(this._editing||this._elementCloseTag)
236 return false;if(this._startEditingTarget(event.target))
237 return false;if(this.hasChildren&&!this.expanded)
238 this.expand();return false;},hasEditableNode:function()
239 {return!this.representedObject.isShadowRoot()&&!this.representedObject.ancestorU serAgentShadowRoot();},_insertInLastAttributePosition:function(tag,node)
240 {if(tag.getElementsByClassName("webkit-html-attribute").length>0)
241 tag.insertBefore(node,tag.lastChild);else{var nodeName=tag.textContent.match(/^< (.*?)>$/)[1];tag.textContent='';tag.appendChild(document.createTextNode('<'+node Name));tag.appendChild(node);tag.appendChild(document.createTextNode('>'));}
242 this.updateSelection();},_startEditingTarget:function(eventTarget)
243 {if(this.treeOutline.selectedDOMNode()!=this._node)
244 return;if(this._node.nodeType()!=Node.ELEMENT_NODE&&this._node.nodeType()!=Node. TEXT_NODE)
245 return false;var textNode=eventTarget.enclosingNodeOrSelfWithClass("webkit-html- text-node");if(textNode)
246 return this._startEditingTextNode(textNode);var attribute=eventTarget.enclosingN odeOrSelfWithClass("webkit-html-attribute");if(attribute)
247 return this._startEditingAttribute(attribute,eventTarget);var tagName=eventTarge t.enclosingNodeOrSelfWithClass("webkit-html-tag-name");if(tagName)
248 return this._startEditingTagName(tagName);var newAttribute=eventTarget.enclosing NodeOrSelfWithClass("add-attribute");if(newAttribute)
249 return this._addNewAttribute();return false;},_populateTagContextMenu:function(c ontextMenu,event)
250 {var treeElement=this._elementCloseTag?this.treeOutline.findTreeElement(this._no de):this;contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseM enuTitles()?"Add attribute":"Add Attribute"),treeElement._addNewAttribute.bind(t reeElement));var attribute=event.target.enclosingNodeOrSelfWithClass("webkit-htm l-attribute");var newAttribute=event.target.enclosingNodeOrSelfWithClass("add-at tribute");if(attribute&&!newAttribute)
251 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Edit attribute":"Edit Attribute"),this._startEditingAttribute.bind(this,attr ibute,event.target));contextMenu.appendSeparator();if(this.treeOutline._setPseud oClassCallback){var pseudoSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIS tring(WebInspector.useLowerCaseMenuTitles()?"Force element state":"Force Element State"));this._populateForcedPseudoStateItems(pseudoSubMenu);contextMenu.append Separator();}
252 this._populateNodeContextMenu(contextMenu);this.treeOutline._populateContextMenu (contextMenu,this._node);this._populateScrollIntoView(contextMenu);},_populateSc rollIntoView:function(contextMenu)
253 {contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString(WebI nspector.useLowerCaseMenuTitles()?"Scroll into view":"Scroll into View"),this._s crollIntoView.bind(this));},_populateForcedPseudoStateItems:function(subMenu)
254 {const pseudoClasses=["active","hover","focus","visited"];var node=this._node;va r forcedPseudoState=(node?node.getUserProperty("pseudoState"):null)||[];for(var i=0;i<pseudoClasses.length;++i){var pseudoClassForced=forcedPseudoState.indexOf( pseudoClasses[i])>=0;subMenu.appendCheckboxItem(":"+pseudoClasses[i],this.treeOu tline._setPseudoClassCallback.bind(null,node.id,pseudoClasses[i],!pseudoClassFor ced),pseudoClassForced,false);}},_populateTextContextMenu:function(contextMenu,t extNode)
255 {contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitle s()?"Edit text":"Edit Text"),this._startEditingTextNode.bind(this,textNode));thi s._populateNodeContextMenu(contextMenu);},_populateNodeContextMenu:function(cont extMenu)
256 {var openTagElement=this.treeOutline.getCachedTreeElement(this.representedObject )||this;var isEditable=this.hasEditableNode();if(isEditable)
257 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"),openTagElement._edi tAsHTML.bind(openTagElement));var isShadowRoot=this.representedObject.isShadowRo ot();if(!isShadowRoot)
258 contextMenu.appendItem(WebInspector.UIString("Copy as HTML"),this._copyHTML.bind (this));if(this.representedObject.nodeType()===Node.ELEMENT_NODE)
259 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Copy CSS path":"Copy CSS Path"),this._copyCSSPath.bind(this));if(!isShadowRo ot)
260 contextMenu.appendItem(WebInspector.UIString("Copy XPath"),this._copyXPath.bind( this));if(isEditable)
261 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Delete node":"Delete Node"),this.remove.bind(this));},_startEditing:function ()
262 {if(this.treeOutline.selectedDOMNode()!==this._node)
263 return;var listItem=this._listItemNode;if(this._canAddAttributes){var attribute= listItem.getElementsByClassName("webkit-html-attribute")[0];if(attribute)
264 return this._startEditingAttribute(attribute,attribute.getElementsByClassName("w ebkit-html-attribute-value")[0]);return this._addNewAttribute();}
265 if(this._node.nodeType()===Node.TEXT_NODE){var textNode=listItem.getElementsByCl assName("webkit-html-text-node")[0];if(textNode)
266 return this._startEditingTextNode(textNode);return;}},_addNewAttribute:function( )
267 {var container=document.createElement("span");this._buildAttributeDOM(container, " ","");var attr=container.firstElementChild;attr.style.marginLeft="2px";attr.st yle.marginRight="2px";var tag=this.listItemElement.getElementsByClassName("webki t-html-tag")[0];this._insertInLastAttributePosition(tag,attr);attr.scrollIntoVie wIfNeeded(true);return this._startEditingAttribute(attr,attr);},_triggerEditAttr ibute:function(attributeName)
268 {var attributeElements=this.listItemElement.getElementsByClassName("webkit-html- attribute-name");for(var i=0,len=attributeElements.length;i<len;++i){if(attribut eElements[i].textContent===attributeName){for(var elem=attributeElements[i].next Sibling;elem;elem=elem.nextSibling){if(elem.nodeType!==Node.ELEMENT_NODE)
269 continue;if(elem.classList.contains("webkit-html-attribute-value"))
270 return this._startEditingAttribute(elem.parentNode,elem);}}}},_startEditingAttri bute:function(attribute,elementForSelection)
271 {if(WebInspector.isBeingEdited(attribute))
272 return true;var attributeNameElement=attribute.getElementsByClassName("webkit-ht ml-attribute-name")[0];if(!attributeNameElement)
273 return false;var attributeName=attributeNameElement.textContent;var attributeVal ueElement=attribute.getElementsByClassName("webkit-html-attribute-value")[0];fun ction removeZeroWidthSpaceRecursive(node)
274 {if(node.nodeType===Node.TEXT_NODE){node.nodeValue=node.nodeValue.replace(/\u200 B/g,"");return;}
275 if(node.nodeType!==Node.ELEMENT_NODE)
276 return;for(var child=node.firstChild;child;child=child.nextSibling)
277 removeZeroWidthSpaceRecursive(child);}
278 var domNode;var listItemElement=attribute.enclosingNodeOrSelfWithNodeName("li"); if(attributeName&&attributeValueElement&&listItemElement&&listItemElement.treeEl ement)
279 domNode=listItemElement.treeElement.representedObject;var attributeValue=domNode ?domNode.getAttribute(attributeName):undefined;if(typeof attributeValue!=="undef ined")
280 attributeValueElement.textContent=attributeValue;removeZeroWidthSpaceRecursive(a ttribute);var config=new WebInspector.InplaceEditor.Config(this._attributeEditin gCommitted.bind(this),this._editingCancelled.bind(this),attributeName);function handleKeyDownEvents(event)
281 {var isMetaOrCtrl=WebInspector.isMac()?event.metaKey&&!event.shiftKey&&!event.ct rlKey&&!event.altKey:event.ctrlKey&&!event.shiftKey&&!event.metaKey&&!event.altK ey;if(isEnterKey(event)&&(event.isMetaOrCtrlForTest||!config.multiline||isMetaOr Ctrl))
282 return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.co de||event.keyIdentifier==="U+001B")
283 return"cancel";else if(event.keyIdentifier==="U+0009")
284 return"move-"+(event.shiftKey?"backward":"forward");else{WebInspector.handleElem entValueModifications(event,attribute);return"";}}
285 config.customFinishHandler=handleKeyDownEvents;this._editing=WebInspector.Inplac eEditor.startEditing(attribute,config);window.getSelection().setBaseAndExtent(el ementForSelection,0,elementForSelection,1);return true;},_startEditingTextNode:f unction(textNodeElement)
286 {if(WebInspector.isBeingEdited(textNodeElement))
287 return true;var textNode=this._node;if(textNode.nodeType()===Node.ELEMENT_NODE&& textNode.firstChild)
288 textNode=textNode.firstChild;var container=textNodeElement.enclosingNodeOrSelfWi thClass("webkit-html-text-node");if(container)
289 container.textContent=textNode.nodeValue();var config=new WebInspector.InplaceEd itor.Config(this._textNodeEditingCommitted.bind(this,textNode),this._editingCanc elled.bind(this));this._editing=WebInspector.InplaceEditor.startEditing(textNode Element,config);window.getSelection().setBaseAndExtent(textNodeElement,0,textNod eElement,1);return true;},_startEditingTagName:function(tagNameElement)
290 {if(!tagNameElement){tagNameElement=this.listItemElement.getElementsByClassName( "webkit-html-tag-name")[0];if(!tagNameElement)
291 return false;}
292 var tagName=tagNameElement.textContent;if(WebInspector.ElementsTreeElement.EditT agBlacklist[tagName.toLowerCase()])
293 return false;if(WebInspector.isBeingEdited(tagNameElement))
294 return true;var closingTagElement=this._distinctClosingTagElement();function key upListener(event)
295 {if(closingTagElement)
296 closingTagElement.textContent="</"+tagNameElement.textContent+">";}
297 function editingComitted(element,newTagName)
298 {tagNameElement.removeEventListener('keyup',keyupListener,false);this._tagNameEd itingCommitted.apply(this,arguments);}
299 function editingCancelled()
300 {tagNameElement.removeEventListener('keyup',keyupListener,false);this._editingCa ncelled.apply(this,arguments);}
301 tagNameElement.addEventListener('keyup',keyupListener,false);var config=new WebI nspector.InplaceEditor.Config(editingComitted.bind(this),editingCancelled.bind(t his),tagName);this._editing=WebInspector.InplaceEditor.startEditing(tagNameEleme nt,config);window.getSelection().setBaseAndExtent(tagNameElement,0,tagNameElemen t,1);return true;},_startEditingAsHTML:function(commitCallback,error,initialValu e)
302 {if(error)
303 return;if(this._editing)
304 return;function consume(event)
305 {if(event.eventPhase===Event.AT_TARGET)
306 event.consume(true);}
307 initialValue=this._convertWhitespaceToEntities(initialValue).text;this._htmlEdit Element=document.createElement("div");this._htmlEditElement.className="source-co de elements-tree-editor";var child=this.listItemElement.firstChild;while(child){ child.style.display="none";child=child.nextSibling;}
308 if(this._childrenListNode)
309 this._childrenListNode.style.display="none";this.listItemElement.appendChild(thi s._htmlEditElement);this.treeOutline.childrenListElement.parentElement.addEventL istener("mousedown",consume,false);this.updateSelection();function commit(elemen t,newValue)
310 {commitCallback(initialValue,newValue);dispose.call(this);}
311 function dispose()
312 {delete this._editing;delete this.treeOutline._multilineEditing;this.listItemEle ment.removeChild(this._htmlEditElement);delete this._htmlEditElement;if(this._ch ildrenListNode)
313 this._childrenListNode.style.removeProperty("display");var child=this.listItemEl ement.firstChild;while(child){child.style.removeProperty("display");child=child. nextSibling;}
314 this.treeOutline.childrenListElement.parentElement.removeEventListener("mousedow n",consume,false);this.updateSelection();this.treeOutline.element.focus();}
315 var config=new WebInspector.InplaceEditor.Config(commit.bind(this),dispose.bind( this));config.setMultilineOptions(initialValue,{name:"xml",htmlMode:true},"web-i nspector-html",WebInspector.settings.domWordWrap.get(),true);this._editing=WebIn spector.InplaceEditor.startEditing(this._htmlEditElement,config);this._editing.s etWidth(this.treeOutline._visibleWidth);this.treeOutline._multilineEditing=this. _editing;},_attributeEditingCommitted:function(element,newText,oldText,attribute Name,moveDirection)
316 {delete this._editing;var treeOutline=this.treeOutline;function moveToNextAttrib uteIfNeeded(error)
317 {if(error)
318 this._editingCancelled(element,attributeName);if(!moveDirection)
319 return;treeOutline._updateModifiedNodes();var attributes=this._node.attributes() ;for(var i=0;i<attributes.length;++i){if(attributes[i].name!==attributeName)
320 continue;if(moveDirection==="backward"){if(i===0)
321 this._startEditingTagName();else
322 this._triggerEditAttribute(attributes[i-1].name);}else{if(i===attributes.length- 1)
323 this._addNewAttribute();else
324 this._triggerEditAttribute(attributes[i+1].name);}
325 return;}
326 if(moveDirection==="backward"){if(newText===" "){if(attributes.length>0)
327 this._triggerEditAttribute(attributes[attributes.length-1].name);}else{if(attrib utes.length>1)
328 this._triggerEditAttribute(attributes[attributes.length-2].name);}}else if(moveD irection==="forward"){if(!/^\s*$/.test(newText))
329 this._addNewAttribute();else
330 this._startEditingTagName();}}
331 if(!attributeName.trim()&&!newText.trim()){element.remove();moveToNextAttributeI fNeeded.call(this);return;}
332 if(oldText!==newText){this._node.setAttribute(attributeName,newText,moveToNextAt tributeIfNeeded.bind(this));return;}
333 this.updateTitle();moveToNextAttributeIfNeeded.call(this);},_tagNameEditingCommi tted:function(element,newText,oldText,tagName,moveDirection)
334 {delete this._editing;var self=this;function cancel()
335 {var closingTagElement=self._distinctClosingTagElement();if(closingTagElement)
336 closingTagElement.textContent="</"+tagName+">";self._editingCancelled(element,ta gName);moveToNextAttributeIfNeeded.call(self);}
337 function moveToNextAttributeIfNeeded()
338 {if(moveDirection!=="forward"){this._addNewAttribute();return;}
339 var attributes=this._node.attributes();if(attributes.length>0)
340 this._triggerEditAttribute(attributes[0].name);else
341 this._addNewAttribute();}
342 newText=newText.trim();if(newText===oldText){cancel();return;}
343 var treeOutline=this.treeOutline;var wasExpanded=this.expanded;function changeTa gNameCallback(error,nodeId)
344 {if(error||!nodeId){cancel();return;}
345 var newTreeItem=treeOutline._selectNodeAfterEdit(wasExpanded,error,nodeId);moveT oNextAttributeIfNeeded.call(newTreeItem);}
346 this._node.setNodeName(newText,changeTagNameCallback);},_textNodeEditingCommitte d:function(textNode,element,newText)
347 {delete this._editing;function callback()
348 {this.updateTitle();}
349 textNode.setNodeValue(newText,callback.bind(this));},_editingCancelled:function( element,context)
350 {delete this._editing;this.updateTitle();},_distinctClosingTagElement:function()
351 {if(this.expanded){var closers=this._childrenListNode.querySelectorAll(".close") ;return closers[closers.length-1];}
352 var tags=this.listItemElement.getElementsByClassName("webkit-html-tag");return(t ags.length===1?null:tags[tags.length-1]);},updateTitle:function(onlySearchQueryC hanged)
353 {if(this._editing)
354 return;if(onlySearchQueryChanged){if(this._highlightResult)
355 this._updateSearchHighlight(false);}else{var nodeInfo=this._nodeTitleInfo(WebIns pector.linkifyURLAsNode);if(nodeInfo.shadowRoot)
356 this.listItemElement.classList.add("shadow-root");var highlightElement=document. createElement("span");highlightElement.className="highlight";highlightElement.ap pendChild(nodeInfo.titleDOM);this.title=highlightElement;this._updateDecorations ();delete this._highlightResult;}
357 delete this.selectionElement;if(this.selected)
358 this.updateSelection();this._preventFollowingLinksOnDoubleClick();this._highligh tSearchResults();},_createDecoratorElement:function()
359 {var node=this._node;var decoratorMessages=[];var parentDecoratorMessages=[];for (var i=0;i<this.treeOutline._nodeDecorators.length;++i){var decorator=this.treeO utline._nodeDecorators[i];var message=decorator.decorate(node);if(message){decor atorMessages.push(message);continue;}
360 if(this.expanded||this._elementCloseTag)
361 continue;message=decorator.decorateAncestor(node);if(message)
362 parentDecoratorMessages.push(message)}
363 if(!decoratorMessages.length&&!parentDecoratorMessages.length)
364 return null;var decoratorElement=document.createElement("div");decoratorElement. classList.add("elements-gutter-decoration");if(!decoratorMessages.length)
365 decoratorElement.classList.add("elements-has-decorated-children");decoratorEleme nt.title=decoratorMessages.concat(parentDecoratorMessages).join("\n");return dec oratorElement;},_updateDecorations:function()
366 {if(this._decoratorElement)
367 this._decoratorElement.remove();this._decoratorElement=this._createDecoratorElem ent();if(this._decoratorElement&&this.listItemElement)
368 this.listItemElement.insertBefore(this._decoratorElement,this.listItemElement.fi rstChild);},_buildAttributeDOM:function(parentElement,name,value,forceValue,node ,linkify)
369 {var closingPunctuationRegex=/[\/;:\)\]\}]/g;var highlightIndex=0;var highlightC ount;var additionalHighlightOffset=0;var result;function replacer(match,replaceO ffset){while(highlightIndex<highlightCount&&result.entityRanges[highlightIndex]. offset<replaceOffset){result.entityRanges[highlightIndex].offset+=additionalHigh lightOffset;++highlightIndex;}
370 additionalHighlightOffset+=1;return match+"\u200B";}
371 function setValueWithEntities(element,value)
372 {var attrValueElement=element.createChild("span","webkit-html-attribute-value"); result=this._convertWhitespaceToEntities(value);highlightCount=result.entityRang es.length;value=result.text.replace(closingPunctuationRegex,replacer);while(high lightIndex<highlightCount){result.entityRanges[highlightIndex].offset+=additiona lHighlightOffset;++highlightIndex;}
373 attrValueElement.textContent=value;WebInspector.highlightRangesWithStyleClass(at trValueElement,result.entityRanges,"webkit-html-entity-value");}
374 var hasText=(forceValue||value.length>0);var attrSpanElement=parentElement.creat eChild("span","webkit-html-attribute");var attrNameElement=attrSpanElement.creat eChild("span","webkit-html-attribute-name");attrNameElement.textContent=name;if( hasText)
375 attrSpanElement.appendChild(document.createTextNode("=\u200B\""));if(linkify&&(n ame==="src"||name==="href")){var rewrittenHref=node.resolveURL(value);if(rewritt enHref===null){setValueWithEntities.call(this,attrSpanElement,value);}else{value =value.replace(closingPunctuationRegex,"$&\u200B");if(value.startsWith("data:"))
376 value=value.trimMiddle(60);attrSpanElement.appendChild(linkify(rewrittenHref,val ue,"webkit-html-attribute-value",node.nodeName().toLowerCase()==="a"));}}else{se tValueWithEntities.call(this,attrSpanElement,value);}
377 if(hasText)
378 attrSpanElement.appendChild(document.createTextNode("\""));},_buildPseudoElement DOM:function(parentElement,pseudoElementName)
379 {var pseudoElement=parentElement.createChild("span","webkit-html-pseudo-element" );pseudoElement.textContent="::"+pseudoElementName;parentElement.appendChild(doc ument.createTextNode("\u200B"));},_buildTagDOM:function(parentElement,tagName,is ClosingTag,isDistinctTreeElement,linkify)
380 {var node=this._node;var classes=["webkit-html-tag"];if(isClosingTag&&isDistinct TreeElement)
381 classes.push("close");var tagElement=parentElement.createChild("span",classes.jo in(" "));tagElement.appendChild(document.createTextNode("<"));var tagNameElement =tagElement.createChild("span",isClosingTag?"":"webkit-html-tag-name");tagNameEl ement.textContent=(isClosingTag?"/":"")+tagName;if(!isClosingTag&&node.hasAttrib utes()){var attributes=node.attributes();for(var i=0;i<attributes.length;++i){va r attr=attributes[i];tagElement.appendChild(document.createTextNode(" "));this._ buildAttributeDOM(tagElement,attr.name,attr.value,false,node,linkify);}}
382 tagElement.appendChild(document.createTextNode(">"));parentElement.appendChild(d ocument.createTextNode("\u200B"));},_convertWhitespaceToEntities:function(text)
383 {var result="";var resultLength=0;var lastIndexAfterEntity=0;var entityRanges=[] ;var charToEntity=WebInspector.ElementsTreeOutline.MappedCharToEntity;for(var i= 0,size=text.length;i<size;++i){var char=text.charAt(i);if(charToEntity[char]){re sult+=text.substring(lastIndexAfterEntity,i);var entityValue="&"+charToEntity[ch ar]+";";entityRanges.push({offset:result.length,length:entityValue.length});resu lt+=entityValue;lastIndexAfterEntity=i+1;}}
384 if(result)
385 result+=text.substring(lastIndexAfterEntity);return{text:result||text,entityRang es:entityRanges};},_nodeTitleInfo:function(linkify)
386 {var node=this._node;var info={titleDOM:document.createDocumentFragment(),hasChi ldren:this.hasChildren};switch(node.nodeType()){case Node.ATTRIBUTE_NODE:this._b uildAttributeDOM(info.titleDOM,node.name,node.value,true);break;case Node.ELEMEN T_NODE:if(node.pseudoType()){this._buildPseudoElementDOM(info.titleDOM,node.pseu doType());info.hasChildren=false;break;}
387 var tagName=node.nodeNameInCorrectCase();if(this._elementCloseTag){this._buildTa gDOM(info.titleDOM,tagName,true,true);info.hasChildren=false;break;}
388 this._buildTagDOM(info.titleDOM,tagName,false,false,linkify);var showInlineText= this._showInlineText()&&!this.hasChildren;if(!this.expanded&&!showInlineText&&(t his.treeOutline.isXMLMimeType||!WebInspector.ElementsTreeElement.ForbiddenClosin gTagElements[tagName])){if(this.hasChildren){var textNodeElement=info.titleDOM.c reateChild("span","webkit-html-text-node bogus");textNodeElement.textContent="\u 2026";info.titleDOM.appendChild(document.createTextNode("\u200B"));}
389 this._buildTagDOM(info.titleDOM,tagName,true,false);}
390 if(showInlineText){var textNodeElement=info.titleDOM.createChild("span","webkit- html-text-node");var result=this._convertWhitespaceToEntities(node.firstChild.no deValue());textNodeElement.textContent=result.text;WebInspector.highlightRangesW ithStyleClass(textNodeElement,result.entityRanges,"webkit-html-entity-value");in fo.titleDOM.appendChild(document.createTextNode("\u200B"));this._buildTagDOM(inf o.titleDOM,tagName,true,false);info.hasChildren=false;}
391 break;case Node.TEXT_NODE:if(node.parentNode&&node.parentNode.nodeName().toLower Case()==="script"){var newNode=info.titleDOM.createChild("span","webkit-html-tex t-node webkit-html-js-node");newNode.textContent=node.nodeValue();var javascript SyntaxHighlighter=new WebInspector.DOMSyntaxHighlighter("text/javascript",true); javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);}else if(node.parentNod e&&node.parentNode.nodeName().toLowerCase()==="style"){var newNode=info.titleDOM .createChild("span","webkit-html-text-node webkit-html-css-node");newNode.textCo ntent=node.nodeValue();var cssSyntaxHighlighter=new WebInspector.DOMSyntaxHighli ghter("text/css",true);cssSyntaxHighlighter.syntaxHighlightNode(newNode);}else{i nfo.titleDOM.appendChild(document.createTextNode("\""));var textNodeElement=info .titleDOM.createChild("span","webkit-html-text-node");var result=this._convertWh itespaceToEntities(node.nodeValue());textNodeElement.textContent=result.text;Web Inspector.highlightRangesWithStyleClass(textNodeElement,result.entityRanges,"web kit-html-entity-value");info.titleDOM.appendChild(document.createTextNode("\"")) ;}
392 break;case Node.COMMENT_NODE:var commentElement=info.titleDOM.createChild("span" ,"webkit-html-comment");commentElement.appendChild(document.createTextNode("<!-- "+node.nodeValue()+"-->"));break;case Node.DOCUMENT_TYPE_NODE:var docTypeElement =info.titleDOM.createChild("span","webkit-html-doctype");docTypeElement.appendCh ild(document.createTextNode("<!DOCTYPE "+node.nodeName()));if(node.publicId){doc TypeElement.appendChild(document.createTextNode(" PUBLIC \""+node.publicId+"\"") );if(node.systemId)
393 docTypeElement.appendChild(document.createTextNode(" \""+node.systemId+"\""));}e lse if(node.systemId)
394 docTypeElement.appendChild(document.createTextNode(" SYSTEM \""+node.systemId+"\ ""));if(node.internalSubset)
395 docTypeElement.appendChild(document.createTextNode(" ["+node.internalSubset+"]") );docTypeElement.appendChild(document.createTextNode(">"));break;case Node.CDATA _SECTION_NODE:var cdataElement=info.titleDOM.createChild("span","webkit-html-tex t-node");cdataElement.appendChild(document.createTextNode("<![CDATA["+node.nodeV alue()+"]]>"));break;case Node.DOCUMENT_FRAGMENT_NODE:var fragmentElement=info.t itleDOM.createChild("span","webkit-html-fragment");if(node.isInShadowTree()){var shadowRootType=node.shadowRootType();if(shadowRootType){info.shadowRoot=true;fr agmentElement.classList.add("shadow-root");}}
396 fragmentElement.textContent=node.nodeNameInCorrectCase().collapseWhitespace();br eak;default:info.titleDOM.appendChild(document.createTextNode(node.nodeNameInCor rectCase().collapseWhitespace()));}
397 return info;},_showInlineText:function()
398 {if(this._node.importedDocument()||this._node.templateContent()||this._visibleSh adowRoots().length>0||this._node.hasPseudoElements())
399 return false;if(this._node.nodeType()!==Node.ELEMENT_NODE)
400 return false;if(!this._node.firstChild||this._node.firstChild!==this._node.lastC hild||this._node.firstChild.nodeType()!==Node.TEXT_NODE)
401 return false;var textChild=this._node.firstChild;if(textChild.nodeValue().length <Preferences.maxInlineTextChildLength)
402 return true;return false;},remove:function()
403 {if(this._node.pseudoType())
404 return;var parentElement=this.parent;if(!parentElement)
405 return;var self=this;function removeNodeCallback(error,removedNodeId)
406 {if(error)
407 return;parentElement.removeChild(self);parentElement._adjustCollapsedRange();}
408 if(!this._node.parentNode||this._node.parentNode.nodeType()===Node.DOCUMENT_NODE )
409 return;this._node.removeNode(removeNodeCallback);},_editAsHTML:function()
410 {var node=this._node;if(node.pseudoType())
411 return;var treeOutline=this.treeOutline;var parentNode=node.parentNode;var index =node.index;var wasExpanded=this.expanded;function selectNode(error,nodeId)
412 {if(error)
413 return;treeOutline._updateModifiedNodes();var newNode=parentNode?parentNode.chil dren()[index]||parentNode:null;if(!newNode)
414 return;treeOutline.selectDOMNode(newNode,true);if(wasExpanded){var newTreeItem=t reeOutline.findTreeElement(newNode);if(newTreeItem)
415 newTreeItem.expand();}}
416 function commitChange(initialValue,value)
417 {if(initialValue!==value)
418 node.setOuterHTML(value,selectNode);else
419 return;}
420 node.getOuterHTML(this._startEditingAsHTML.bind(this,commitChange));},_copyHTML: function()
421 {this._node.copyNode();},_copyCSSPath:function()
422 {InspectorFrontendHost.copyText(WebInspector.DOMPresentationUtils.cssPath(this._ node,true));},_copyXPath:function()
423 {InspectorFrontendHost.copyText(WebInspector.DOMPresentationUtils.xPath(this._no de,true));},_highlightSearchResults:function()
424 {if(!this._searchQuery||!this._searchHighlightsVisible)
425 return;if(this._highlightResult){this._updateSearchHighlight(true);return;}
426 var text=this.listItemElement.textContent;var regexObject=createPlainTextSearchR egex(this._searchQuery,"gi");var offset=0;var match=regexObject.exec(text);var m atchRanges=[];while(match){matchRanges.push(new WebInspector.SourceRange(match.i ndex,match[0].length));match=regexObject.exec(text);}
427 if(!matchRanges.length)
428 matchRanges.push(new WebInspector.SourceRange(0,text.length));this._highlightRes ult=[];WebInspector.highlightSearchResults(this.listItemElement,matchRanges,this ._highlightResult);},_scrollIntoView:function()
429 {function scrollIntoViewCallback(object)
430 {function scrollIntoView()
431 {this.scrollIntoViewIfNeeded(true);}
432 if(object)
433 object.callFunction(scrollIntoView);}
434 WebInspector.RemoteObject.resolveNode(this._node,"",scrollIntoViewCallback);},_v isibleShadowRoots:function()
435 {var roots=this._node.shadowRoots();if(roots.length&&!WebInspector.settings.show UAShadowDOM.get()){roots=roots.filter(function(root){return root.shadowRootType( )===WebInspector.DOMNode.ShadowRootTypes.Author;});}
436 return roots;},_visibleChildren:function()
437 {var visibleChildren=this._visibleShadowRoots();if(this._node.importedDocument() )
438 visibleChildren.push(this._node.importedDocument());if(this._node.templateConten t())
439 visibleChildren.push(this._node.templateContent());var pseudoElements=this._node .pseudoElements();if(pseudoElements[WebInspector.DOMNode.PseudoElementNames.Befo re])
440 visibleChildren.push(pseudoElements[WebInspector.DOMNode.PseudoElementNames.Befo re]);if(this._node.childNodeCount())
441 visibleChildren=visibleChildren.concat(this._node.children());if(pseudoElements[ WebInspector.DOMNode.PseudoElementNames.After])
442 visibleChildren.push(pseudoElements[WebInspector.DOMNode.PseudoElementNames.Afte r]);return visibleChildren;},_visibleChildCount:function()
443 {var childCount=this._node.childNodeCount()+this._visibleShadowRoots().length;if (this._node.importedDocument())
444 ++childCount;if(this._node.templateContent())
445 ++childCount;for(var pseudoType in this._node.pseudoElements())
446 ++childCount;return childCount;},_updateHasChildren:function()
447 {this.hasChildren=!this._elementCloseTag&&!this._showInlineText()&&this._visible ChildCount()>0;},__proto__:TreeElement.prototype}
448 WebInspector.ElementsTreeUpdater=function(treeOutline)
449 {WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.NodeInserte d,this._nodeInserted,this);WebInspector.domModel.addEventListener(WebInspector.D OMModel.Events.NodeRemoved,this._nodeRemoved,this);WebInspector.domModel.addEven tListener(WebInspector.DOMModel.Events.AttrModified,this._attributesUpdated,this );WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemove d,this._attributesUpdated,this);WebInspector.domModel.addEventListener(WebInspec tor.DOMModel.Events.CharacterDataModified,this._characterDataModified,this);WebI nspector.domModel.addEventListener(WebInspector.DOMModel.Events.DocumentUpdated, this._documentUpdated,this);WebInspector.domModel.addEventListener(WebInspector. DOMModel.Events.ChildNodeCountUpdated,this._childNodeCountUpdated,this);this._tr eeOutline=treeOutline;this._recentlyModifiedNodes=new Map();}
450 WebInspector.ElementsTreeUpdater.prototype={_nodeModified:function(node,isUpdate d,parentNode)
451 {if(this._treeOutline._visible)
452 this._updateModifiedNodesSoon();var entry=this._recentlyModifiedNodes.get(node); if(!entry){entry=new WebInspector.ElementsTreeUpdater.UpdateEntry(isUpdated,pare ntNode);this._recentlyModifiedNodes.put(node,entry);return;}
453 entry.isUpdated|=isUpdated;if(parentNode)
454 entry.parent=parentNode;},_documentUpdated:function(event)
455 {var inspectedRootDocument=event.data;this._reset();if(!inspectedRootDocument)
456 return;this._treeOutline.rootDOMNode=inspectedRootDocument;},_attributesUpdated: function(event)
457 {this._nodeModified(event.data.node,true);},_characterDataModified:function(even t)
458 {this._nodeModified(event.data,true);},_nodeInserted:function(event)
459 {this._nodeModified(event.data,false,event.data.parentNode);},_nodeRemoved:funct ion(event)
460 {this._nodeModified(event.data.node,false,event.data.parent);},_childNodeCountUp dated:function(event)
461 {var treeElement=this._treeOutline.findTreeElement(event.data);if(treeElement){v ar oldHasChildren=treeElement.hasChildren;treeElement._updateHasChildren();if(tr eeElement.hasChildren!==oldHasChildren)
462 treeElement.updateTitle();}},_updateModifiedNodesSoon:function()
463 {if(this._updateModifiedNodesTimeout)
464 return;this._updateModifiedNodesTimeout=setTimeout(this._updateModifiedNodes.bin d(this),50);},_updateModifiedNodes:function()
465 {if(this._updateModifiedNodesTimeout){clearTimeout(this._updateModifiedNodesTime out);delete this._updateModifiedNodesTimeout;}
466 var updatedParentTreeElements=[];var hidePanelWhileUpdating=this._recentlyModifi edNodes.size()>10;if(hidePanelWhileUpdating){var treeOutlineContainerElement=thi s._treeOutline.element.parentNode;var originalScrollTop=treeOutlineContainerElem ent?treeOutlineContainerElement.scrollTop:0;this._treeOutline.element.classList. add("hidden");}
467 var nodes=this._recentlyModifiedNodes.keys();for(var i=0,size=nodes.length;i<siz e;++i){var node=nodes[i];var entry=this._recentlyModifiedNodes.get(node);var par ent=entry.parent;if(parent===this._treeOutline._rootDOMNode){this._treeOutline.u pdate();this._treeOutline.element.classList.remove("hidden");return;}
468 if(entry.isUpdated){var nodeItem=this._treeOutline.findTreeElement(node);if(node Item)
469 nodeItem.updateTitle();}
470 var parentNodeItem=parent?this._treeOutline.findTreeElement(parent):null;if(pare ntNodeItem&&!parentNodeItem.alreadyUpdatedChildren){parentNodeItem.updateChildre n();parentNodeItem.alreadyUpdatedChildren=true;updatedParentTreeElements.push(pa rentNodeItem);}}
471 for(var i=0;i<updatedParentTreeElements.length;++i)
472 delete updatedParentTreeElements[i].alreadyUpdatedChildren;if(hidePanelWhileUpda ting){this._treeOutline.element.classList.remove("hidden");if(originalScrollTop)
473 treeOutlineContainerElement.scrollTop=originalScrollTop;this._treeOutline.update Selection();}
474 this._recentlyModifiedNodes.clear();this._treeOutline._fireElementsTreeUpdated(n odes);},_reset:function()
475 {this._treeOutline.rootDOMNode=null;this._treeOutline.selectDOMNode(null,false); WebInspector.domModel.hideDOMNodeHighlight();this._recentlyModifiedNodes.clear() ;}}
476 WebInspector.ElementsTreeUpdater.UpdateEntry=function(isUpdated,parent)
477 {this.isUpdated=isUpdated;if(parent)
478 this.parent=parent;}
479 WebInspector.ElementsTreeOutline.Renderer=function()
480 {}
481 WebInspector.ElementsTreeOutline.Renderer.prototype={render:function(object)
482 {if(!(object instanceof WebInspector.DOMNode))
483 return null;var treeOutline=new WebInspector.ElementsTreeOutline(false,false);tr eeOutline.rootDOMNode=(object);treeOutline.element.classList.add("outline-disclo sure");if(!treeOutline.children[0].hasChildren)
484 treeOutline.element.classList.add("single-node");treeOutline.setVisible(true);tr eeOutline.element.treeElementForTest=treeOutline.children[0];return treeOutline. element;}};WebInspector.EventListenersSidebarPane=function()
485 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Event Listeners"));th is.bodyElement.classList.add("events-pane");this.sections=[];var refreshButton=d ocument.createElement("button");refreshButton.className="pane-title-button refre sh";refreshButton.addEventListener("click",this._refreshButtonClicked.bind(this) ,false);refreshButton.title=WebInspector.UIString("Refresh");this.titleElement.a ppendChild(refreshButton);this.settingsSelectElement=document.createElement("sel ect");this.settingsSelectElement.className="select-filter";var option=document.c reateElement("option");option.value="all";option.label=WebInspector.UIString("Al l Nodes");this.settingsSelectElement.appendChild(option);option=document.createE lement("option");option.value="selected";option.label=WebInspector.UIString("Sel ected Node Only");this.settingsSelectElement.appendChild(option);var filter=WebI nspector.settings.eventListenersFilter.get();if(filter==="all")
92 this.settingsSelectElement[0].selected=true;else if(filter==="selected") 486 this.settingsSelectElement[0].selected=true;else if(filter==="selected")
93 this.settingsSelectElement[1].selected=true;this.settingsSelectElement.addEventL istener("click",function(event){event.consume()},false);this.settingsSelectEleme nt.addEventListener("change",this._changeSetting.bind(this),false);this.titleEle ment.appendChild(this.settingsSelectElement);this._linkifier=new WebInspector.Li nkifier();} 487 this.settingsSelectElement[1].selected=true;this.settingsSelectElement.addEventL istener("click",function(event){event.consume()},false);this.settingsSelectEleme nt.addEventListener("change",this._changeSetting.bind(this),false);this.titleEle ment.appendChild(this.settingsSelectElement);this._linkifier=new WebInspector.Li nkifier();}
94 WebInspector.EventListenersSidebarPane._objectGroupName="event-listeners-sidebar -pane";WebInspector.EventListenersSidebarPane.prototype={update:function(node) 488 WebInspector.EventListenersSidebarPane._objectGroupName="event-listeners-sidebar -pane";WebInspector.EventListenersSidebarPane.prototype={update:function(node)
95 {RuntimeAgent.releaseObjectGroup(WebInspector.EventListenersSidebarPane._objectG roupName);this._linkifier.reset();var body=this.bodyElement;body.removeChildren( );this.sections=[];var self=this;function callback(error,eventListeners){if(erro r) 489 {RuntimeAgent.releaseObjectGroup(WebInspector.EventListenersSidebarPane._objectG roupName);this._linkifier.reset();var body=this.bodyElement;body.removeChildren( );this.sections=[];var self=this;function callback(error,eventListeners){if(erro r)
96 return;var selectedNodeOnly="selected"===WebInspector.settings.eventListenersFil ter.get();var sectionNames=[];var sectionMap={};for(var i=0;i<eventListeners.len gth;++i){var eventListener=eventListeners[i];if(selectedNodeOnly&&(node.id!==eve ntListener.nodeId)) 490 return;var selectedNodeOnly="selected"===WebInspector.settings.eventListenersFil ter.get();var sectionNames=[];var sectionMap={};for(var i=0;i<eventListeners.len gth;++i){var eventListener=eventListeners[i];if(selectedNodeOnly&&(node.id!==eve ntListener.nodeId))
97 continue;eventListener.node=WebInspector.domAgent.nodeForId(eventListener.nodeId );delete eventListener.nodeId;if(/^function _inspectorCommandLineAPI_logEvent\(/ .test(eventListener.handlerBody.toString())) 491 continue;eventListener.node=WebInspector.domModel.nodeForId(eventListener.nodeId );delete eventListener.nodeId;if(/^function _inspectorCommandLineAPI_logEvent\(/ .test(eventListener.handlerBody.toString()))
98 continue;var type=eventListener.type;var section=sectionMap[type];if(!section){s ection=new WebInspector.EventListenersSection(type,node.id,self._linkifier);sect ionMap[type]=section;sectionNames.push(type);self.sections.push(section);} 492 continue;var type=eventListener.type;var section=sectionMap[type];if(!section){s ection=new WebInspector.EventListenersSection(type,node.id,self._linkifier);sect ionMap[type]=section;sectionNames.push(type);self.sections.push(section);}
99 section.addListener(eventListener);} 493 section.addListener(eventListener);}
100 if(sectionNames.length===0){var div=document.createElement("div");div.className= "info";div.textContent=WebInspector.UIString("No Event Listeners");body.appendCh ild(div);return;} 494 if(sectionNames.length===0){var div=document.createElement("div");div.className= "info";div.textContent=WebInspector.UIString("No Event Listeners");body.appendCh ild(div);return;}
101 sectionNames.sort();for(var i=0;i<sectionNames.length;++i){var section=sectionMa p[sectionNames[i]];body.appendChild(section.element);}} 495 sectionNames.sort();for(var i=0;i<sectionNames.length;++i){var section=sectionMa p[sectionNames[i]];body.appendChild(section.element);}}
102 if(node) 496 if(node)
103 node.eventListeners(WebInspector.EventListenersSidebarPane._objectGroupName,call back);this._selectedNode=node;},willHide:function() 497 node.eventListeners(WebInspector.EventListenersSidebarPane._objectGroupName,call back);this._selectedNode=node;},willHide:function()
104 {delete this._selectedNode;},_changeSetting:function() 498 {delete this._selectedNode;},_refreshButtonClicked:function()
499 {if(!this._selectedNode)
500 return;this.update(this._selectedNode);},_changeSetting:function()
105 {var selectedOption=this.settingsSelectElement[this.settingsSelectElement.select edIndex];WebInspector.settings.eventListenersFilter.set(selectedOption.value);th is.update(this._selectedNode);},__proto__:WebInspector.SidebarPane.prototype} 501 {var selectedOption=this.settingsSelectElement[this.settingsSelectElement.select edIndex];WebInspector.settings.eventListenersFilter.set(selectedOption.value);th is.update(this._selectedNode);},__proto__:WebInspector.SidebarPane.prototype}
106 WebInspector.EventListenersSection=function(title,nodeId,linkifier) 502 WebInspector.EventListenersSection=function(title,nodeId,linkifier)
107 {this.eventListeners=[];this._nodeId=nodeId;this._linkifier=linkifier;WebInspect or.PropertiesSection.call(this,title);this.propertiesElement.remove();delete thi s.propertiesElement;delete this.propertiesTreeOutline;this._eventBars=document.c reateElement("div");this._eventBars.className="event-bars";this.element.appendCh ild(this._eventBars);} 503 {this.eventListeners=[];this._nodeId=nodeId;this._linkifier=linkifier;WebInspect or.PropertiesSection.call(this,title);this.propertiesElement.remove();delete thi s.propertiesElement;delete this.propertiesTreeOutline;this._eventBars=document.c reateElement("div");this._eventBars.className="event-bars";this.element.appendCh ild(this._eventBars);}
108 WebInspector.EventListenersSection.prototype={addListener:function(eventListener ) 504 WebInspector.EventListenersSection.prototype={addListener:function(eventListener )
109 {var eventListenerBar=new WebInspector.EventListenerBar(eventListener,this._node Id,this._linkifier);this._eventBars.appendChild(eventListenerBar.element);},__pr oto__:WebInspector.PropertiesSection.prototype} 505 {var eventListenerBar=new WebInspector.EventListenerBar(eventListener,this._node Id,this._linkifier);this._eventBars.appendChild(eventListenerBar.element);},__pr oto__:WebInspector.PropertiesSection.prototype}
110 WebInspector.EventListenerBar=function(eventListener,nodeId,linkifier) 506 WebInspector.EventListenerBar=function(eventListener,nodeId,linkifier)
111 {WebInspector.ObjectPropertiesSection.call(this,WebInspector.RemoteObject.fromPr imitiveValue(""));this.eventListener=eventListener;this._nodeId=nodeId;this._set NodeTitle();this._setFunctionSubtitle(linkifier);this.editable=false;this.elemen t.className="event-bar";this.headerElement.classList.add("source-code");this.pro pertiesElement.className="event-properties properties-tree source-code";} 507 {WebInspector.ObjectPropertiesSection.call(this,WebInspector.RemoteObject.fromPr imitiveValue(""));this.eventListener=eventListener;this._nodeId=nodeId;this._set NodeTitle();this._setFunctionSubtitle(linkifier);this.editable=false;this.elemen t.className="event-bar";this.headerElement.classList.add("source-code");this.pro pertiesElement.className="event-properties properties-tree source-code";}
112 WebInspector.EventListenerBar.prototype={update:function() 508 WebInspector.EventListenerBar.prototype={update:function()
113 {function updateWithNodeObject(nodeObject) 509 {function updateWithNodeObject(nodeObject)
114 {var properties=[];if(this.eventListener.type) 510 {var properties=[];properties.push(WebInspector.RemoteObjectProperty.fromPrimiti veValue("type",this.eventListener.type));properties.push(WebInspector.RemoteObje ctProperty.fromPrimitiveValue("useCapture",this.eventListener.useCapture));prope rties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("isAttribute",th is.eventListener.isAttribute));if(nodeObject)
115 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("type",this .eventListener.type));if(typeof this.eventListener.useCapture!=="undefined")
116 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("useCapture ",this.eventListener.useCapture));if(typeof this.eventListener.isAttribute!=="un defined")
117 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("isAttribut e",this.eventListener.isAttribute));if(nodeObject)
118 properties.push(new WebInspector.RemoteObjectProperty("node",nodeObject));if(typ eof this.eventListener.handler!=="undefined"){var remoteObject=WebInspector.Remo teObject.fromPayload(this.eventListener.handler);properties.push(new WebInspecto r.RemoteObjectProperty("handler",remoteObject));} 511 properties.push(new WebInspector.RemoteObjectProperty("node",nodeObject));if(typ eof this.eventListener.handler!=="undefined"){var remoteObject=WebInspector.Remo teObject.fromPayload(this.eventListener.handler);properties.push(new WebInspecto r.RemoteObjectProperty("handler",remoteObject));}
119 if(typeof this.eventListener.handlerBody!=="undefined")
120 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("listenerBo dy",this.eventListener.handlerBody));if(this.eventListener.sourceName) 512 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("listenerBo dy",this.eventListener.handlerBody));if(this.eventListener.sourceName)
121 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("sourceName ",this.eventListener.sourceName));if(this.eventListener.location) 513 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("sourceName ",this.eventListener.sourceName));properties.push(WebInspector.RemoteObjectPrope rty.fromPrimitiveValue("lineNumber",this.eventListener.location.lineNumber+1));t his.updateProperties(properties);}
122 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("lineNumber ",this.eventListener.location.lineNumber+1));this.updateProperties(properties);}
123 WebInspector.RemoteObject.resolveNode(this.eventListener.node,WebInspector.Event ListenersSidebarPane._objectGroupName,updateWithNodeObject.bind(this));},_setNod eTitle:function() 514 WebInspector.RemoteObject.resolveNode(this.eventListener.node,WebInspector.Event ListenersSidebarPane._objectGroupName,updateWithNodeObject.bind(this));},_setNod eTitle:function()
124 {var node=this.eventListener.node;if(!node) 515 {var node=this.eventListener.node;if(!node)
125 return;if(node.nodeType()===Node.DOCUMENT_NODE){this.titleElement.textContent="d ocument";return;} 516 return;if(node.nodeType()===Node.DOCUMENT_NODE){this.titleElement.textContent="d ocument";return;}
126 if(node.id===this._nodeId){this.titleElement.textContent=WebInspector.DOMPresent ationUtils.appropriateSelectorFor(node);return;} 517 if(node.id===this._nodeId){this.titleElement.textContent=WebInspector.DOMPresent ationUtils.simpleSelector(node);return;}
127 this.titleElement.removeChildren();this.titleElement.appendChild(WebInspector.DO MPresentationUtils.linkifyNodeReference(this.eventListener.node));},_setFunction Subtitle:function(linkifier) 518 this.titleElement.removeChildren();this.titleElement.appendChild(WebInspector.DO MPresentationUtils.linkifyNodeReference(this.eventListener.node));},_setFunction Subtitle:function(linkifier)
128 {if(this.eventListener.location){this.subtitleElement.removeChildren();var urlEl ement;if(this.eventListener.location.scriptId) 519 {this.subtitleElement.removeChildren();var urlElement=linkifier.linkifyRawLocati on(this.eventListener.location);if(!urlElement){var url=this.eventListener.sourc eName;var lineNumber=this.eventListener.location.lineNumber;var columnNumber=0;u rlElement=linkifier.linkifyLocation(url,lineNumber,columnNumber);}
129 urlElement=linkifier.linkifyRawLocation(this.eventListener.location);if(!urlElem ent){var url=this.eventListener.sourceName;var lineNumber=this.eventListener.loc ation.lineNumber;var columnNumber=0;urlElement=linkifier.linkifyLocation(url,lin eNumber,columnNumber);} 520 this.subtitleElement.appendChild(urlElement);},__proto__:WebInspector.ObjectProp ertiesSection.prototype};WebInspector.MetricsSidebarPane=function()
130 this.subtitleElement.appendChild(urlElement);}else{var match=this.eventListener. handlerBody.match(/function ([^\(]+?)\(/);if(match) 521 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Metrics"));WebInspect or.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged ,this._styleSheetOrMediaQueryResultChanged,this);WebInspector.cssModel.addEventL istener(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged,this._styleShe etOrMediaQueryResultChanged,this);WebInspector.domModel.addEventListener(WebInsp ector.DOMModel.Events.AttrModified,this._attributesUpdated,this);WebInspector.do mModel.addEventListener(WebInspector.DOMModel.Events.AttrRemoved,this._attribute sUpdated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.Reso urceTreeModel.EventTypes.FrameResized,this._frameResized,this);}
131 this.subtitleElement.textContent=match[1];else
132 this.subtitleElement.textContent=WebInspector.UIString("(anonymous function)");} },__proto__:WebInspector.ObjectPropertiesSection.prototype};WebInspector.Metrics SidebarPane=function()
133 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Metrics"));WebInspect or.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged ,this._styleSheetOrMediaQueryResultChanged,this);WebInspector.cssModel.addEventL istener(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged,this._styleShe etOrMediaQueryResultChanged,this);WebInspector.domAgent.addEventListener(WebInsp ector.DOMAgent.Events.AttrModified,this._attributesUpdated,this);WebInspector.do mAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved,this._attribute sUpdated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.Reso urceTreeModel.EventTypes.FrameResized,this._frameResized,this);}
134 WebInspector.MetricsSidebarPane.prototype={update:function(node) 522 WebInspector.MetricsSidebarPane.prototype={update:function(node)
135 {if(node) 523 {if(node)
136 this.node=node;this._innerUpdate();},_innerUpdate:function() 524 this.node=node;this._innerUpdate();},_innerUpdate:function()
137 {if(this._isEditingMetrics) 525 {if(this._isEditingMetrics)
138 return;var node=this.node;if(!node||node.nodeType()!==Node.ELEMENT_NODE){this.bo dyElement.removeChildren();return;} 526 return;var node=this.node;if(!node||node.nodeType()!==Node.ELEMENT_NODE){this.bo dyElement.removeChildren();return;}
139 function callback(style) 527 function callback(style)
140 {if(!style||this.node!==node) 528 {if(!style||this.node!==node)
141 return;this._updateMetrics(style);} 529 return;this._updateMetrics(style);}
142 WebInspector.cssModel.getComputedStyleAsync(node.id,callback.bind(this));functio n inlineStyleCallback(style) 530 WebInspector.cssModel.getComputedStyleAsync(node.id,callback.bind(this));functio n inlineStyleCallback(style)
143 {if(!style||this.node!==node) 531 {if(!style||this.node!==node)
144 return;this.inlineStyle=style;} 532 return;this.inlineStyle=style;}
145 WebInspector.cssModel.getInlineStylesAsync(node.id,inlineStyleCallback.bind(this ));},_styleSheetOrMediaQueryResultChanged:function() 533 WebInspector.cssModel.getInlineStylesAsync(node.id,inlineStyleCallback.bind(this ));},_styleSheetOrMediaQueryResultChanged:function()
146 {this._innerUpdate();},_frameResized:function() 534 {this._innerUpdate();},_frameResized:function()
147 {function refreshContents() 535 {function refreshContents()
148 {this._innerUpdate();delete this._activeTimer;} 536 {this._innerUpdate();delete this._activeTimer;}
149 if(this._activeTimer) 537 if(this._activeTimer)
150 clearTimeout(this._activeTimer);this._activeTimer=setTimeout(refreshContents.bin d(this),100);},_attributesUpdated:function(event) 538 clearTimeout(this._activeTimer);this._activeTimer=setTimeout(refreshContents.bin d(this),100);},_attributesUpdated:function(event)
151 {if(this.node!==event.data.node) 539 {if(this.node!==event.data.node)
152 return;this._innerUpdate();},_getPropertyValueAsPx:function(style,propertyName) 540 return;this._innerUpdate();},_getPropertyValueAsPx:function(style,propertyName)
153 {return Number(style.getPropertyValue(propertyName).replace(/px$/,"")||0);},_get Box:function(computedStyle,componentName) 541 {return Number(style.getPropertyValue(propertyName).replace(/px$/,"")||0);},_get Box:function(computedStyle,componentName)
154 {var suffix=componentName==="border"?"-width":"";var left=this._getPropertyValue AsPx(computedStyle,componentName+"-left"+suffix);var top=this._getPropertyValueA sPx(computedStyle,componentName+"-top"+suffix);var right=this._getPropertyValueA sPx(computedStyle,componentName+"-right"+suffix);var bottom=this._getPropertyVal ueAsPx(computedStyle,componentName+"-bottom"+suffix);return{left:left,top:top,ri ght:right,bottom:bottom};},_highlightDOMNode:function(showHighlight,mode,event) 542 {var suffix=componentName==="border"?"-width":"";var left=this._getPropertyValue AsPx(computedStyle,componentName+"-left"+suffix);var top=this._getPropertyValueA sPx(computedStyle,componentName+"-top"+suffix);var right=this._getPropertyValueA sPx(computedStyle,componentName+"-right"+suffix);var bottom=this._getPropertyVal ueAsPx(computedStyle,componentName+"-bottom"+suffix);return{left:left,top:top,ri ght:right,bottom:bottom};},_highlightDOMNode:function(showHighlight,mode,event)
155 {event.consume();var nodeId=showHighlight&&this.node?this.node.id:0;if(nodeId){i f(this._highlightMode===mode) 543 {event.consume();var nodeId=showHighlight&&this.node?this.node.id:0;if(nodeId){i f(this._highlightMode===mode)
156 return;this._highlightMode=mode;WebInspector.domAgent.highlightDOMNode(nodeId,mo de);}else{delete this._highlightMode;WebInspector.domAgent.hideDOMNodeHighlight( );} 544 return;this._highlightMode=mode;WebInspector.domModel.highlightDOMNode(nodeId,mo de);}else{delete this._highlightMode;WebInspector.domModel.hideDOMNodeHighlight( );}
157 for(var i=0;this._boxElements&&i<this._boxElements.length;++i){var element=this. _boxElements[i];if(!nodeId||mode==="all"||element._name===mode) 545 for(var i=0;this._boxElements&&i<this._boxElements.length;++i){var element=this. _boxElements[i];if(!nodeId||mode==="all"||element._name===mode)
158 element.style.backgroundColor=element._backgroundColor;else 546 element.style.backgroundColor=element._backgroundColor;else
159 element.style.backgroundColor="";}},_updateMetrics:function(style) 547 element.style.backgroundColor="";}},_updateMetrics:function(style)
160 {var metricsElement=document.createElement("div");metricsElement.className="metr ics";var self=this;function createBoxPartElement(style,name,side,suffix) 548 {var metricsElement=document.createElement("div");metricsElement.className="metr ics";var self=this;function createBoxPartElement(style,name,side,suffix)
161 {var propertyName=(name!=="position"?name+"-":"")+side+suffix;var value=style.ge tPropertyValue(propertyName);if(value===""||(name!=="position"&&value==="0px")) 549 {var propertyName=(name!=="position"?name+"-":"")+side+suffix;var value=style.ge tPropertyValue(propertyName);if(value===""||(name!=="position"&&value==="0px"))
162 value="\u2012";else if(name==="position"&&value==="auto") 550 value="\u2012";else if(name==="position"&&value==="auto")
163 value="\u2012";value=value.replace(/px$/,"");value=Number.toFixedIfFloating(valu e);var element=document.createElement("div");element.className=side;element.text Content=value;element.addEventListener("dblclick",this.startEditing.bind(this,el ement,name,propertyName,style),false);return element;} 551 value="\u2012";value=value.replace(/px$/,"");value=Number.toFixedIfFloating(valu e);var element=document.createElement("div");element.className=side;element.text Content=value;element.addEventListener("dblclick",this.startEditing.bind(this,el ement,name,propertyName,style),false);return element;}
164 function getContentAreaWidthPx(style) 552 function getContentAreaWidthPx(style)
165 {var width=style.getPropertyValue("width").replace(/px$/,"");if(!isNaN(width)&&s tyle.getPropertyValue("box-sizing")==="border-box"){var borderBox=self._getBox(s tyle,"border");var paddingBox=self._getBox(style,"padding");width=width-borderBo x.left-borderBox.right-paddingBox.left-paddingBox.right;} 553 {var width=style.getPropertyValue("width").replace(/px$/,"");if(!isNaN(width)&&s tyle.getPropertyValue("box-sizing")==="border-box"){var borderBox=self._getBox(s tyle,"border");var paddingBox=self._getBox(style,"padding");width=width-borderBo x.left-borderBox.right-paddingBox.left-paddingBox.right;}
166 return Number.toFixedIfFloating(width);} 554 return Number.toFixedIfFloating(width);}
167 function getContentAreaHeightPx(style) 555 function getContentAreaHeightPx(style)
168 {var height=style.getPropertyValue("height").replace(/px$/,"");if(!isNaN(height) &&style.getPropertyValue("box-sizing")==="border-box"){var borderBox=self._getBo x(style,"border");var paddingBox=self._getBox(style,"padding");height=height-bor derBox.top-borderBox.bottom-paddingBox.top-paddingBox.bottom;} 556 {var height=style.getPropertyValue("height").replace(/px$/,"");if(!isNaN(height) &&style.getPropertyValue("box-sizing")==="border-box"){var borderBox=self._getBo x(style,"border");var paddingBox=self._getBox(style,"padding");height=height-bor derBox.top-borderBox.bottom-paddingBox.top-paddingBox.bottom;}
169 return Number.toFixedIfFloating(height);} 557 return Number.toFixedIfFloating(height);}
170 var noMarginDisplayType={"table-cell":true,"table-column":true,"table-column-gro up":true,"table-footer-group":true,"table-header-group":true,"table-row":true,"t able-row-group":true};var noPaddingDisplayType={"table-column":true,"table-colum n-group":true,"table-footer-group":true,"table-header-group":true,"table-row":tr ue,"table-row-group":true};var noPositionType={"static":true};var boxes=["conten t","padding","border","margin","position"];var boxColors=[WebInspector.Color.Pag eHighlight.Content,WebInspector.Color.PageHighlight.Padding,WebInspector.Color.P ageHighlight.Border,WebInspector.Color.PageHighlight.Margin,WebInspector.Color.f romRGBA([0,0,0,0])];var boxLabels=[WebInspector.UIString("content"),WebInspector .UIString("padding"),WebInspector.UIString("border"),WebInspector.UIString("marg in"),WebInspector.UIString("position")];var previousBox=null;this._boxElements=[ ];for(var i=0;i<boxes.length;++i){var name=boxes[i];if(name==="margin"&&noMargin DisplayType[style.getPropertyValue("display")]) 558 var noMarginDisplayType={"table-cell":true,"table-column":true,"table-column-gro up":true,"table-footer-group":true,"table-header-group":true,"table-row":true,"t able-row-group":true};var noPaddingDisplayType={"table-column":true,"table-colum n-group":true,"table-footer-group":true,"table-header-group":true,"table-row":tr ue,"table-row-group":true};var noPositionType={"static":true};var boxes=["conten t","padding","border","margin","position"];var boxColors=[WebInspector.Color.Pag eHighlight.Content,WebInspector.Color.PageHighlight.Padding,WebInspector.Color.P ageHighlight.Border,WebInspector.Color.PageHighlight.Margin,WebInspector.Color.f romRGBA([0,0,0,0])];var boxLabels=[WebInspector.UIString("content"),WebInspector .UIString("padding"),WebInspector.UIString("border"),WebInspector.UIString("marg in"),WebInspector.UIString("position")];var previousBox=null;this._boxElements=[ ];for(var i=0;i<boxes.length;++i){var name=boxes[i];if(name==="margin"&&noMargin DisplayType[style.getPropertyValue("display")])
171 continue;if(name==="padding"&&noPaddingDisplayType[style.getPropertyValue("displ ay")]) 559 continue;if(name==="padding"&&noPaddingDisplayType[style.getPropertyValue("displ ay")])
172 continue;if(name==="position"&&noPositionType[style.getPropertyValue("position") ]) 560 continue;if(name==="position"&&noPositionType[style.getPropertyValue("position") ])
173 continue;var boxElement=document.createElement("div");boxElement.className=name; boxElement._backgroundColor=boxColors[i].toString(WebInspector.Color.Format.RGBA );boxElement._name=name;boxElement.style.backgroundColor=boxElement._backgroundC olor;boxElement.addEventListener("mouseover",this._highlightDOMNode.bind(this,tr ue,name==="position"?"all":name),false);this._boxElements.push(boxElement);if(na me==="content"){var widthElement=document.createElement("span");widthElement.tex tContent=getContentAreaWidthPx(style);widthElement.addEventListener("dblclick",t his.startEditing.bind(this,widthElement,"width","width",style),false);var height Element=document.createElement("span");heightElement.textContent=getContentAreaH eightPx(style);heightElement.addEventListener("dblclick",this.startEditing.bind( this,heightElement,"height","height",style),false);boxElement.appendChild(widthE lement);boxElement.appendChild(document.createTextNode(" \u00D7 "));boxElement.a ppendChild(heightElement);}else{var suffix=(name==="border"?"-width":"");var lab elElement=document.createElement("div");labelElement.className="label";labelElem ent.textContent=boxLabels[i];boxElement.appendChild(labelElement);boxElement.app endChild(createBoxPartElement.call(this,style,name,"top",suffix));boxElement.app endChild(document.createElement("br"));boxElement.appendChild(createBoxPartEleme nt.call(this,style,name,"left",suffix));if(previousBox) 561 continue;var boxElement=document.createElement("div");boxElement.className=name; boxElement._backgroundColor=boxColors[i].toString(WebInspector.Color.Format.RGBA );boxElement._name=name;boxElement.style.backgroundColor=boxElement._backgroundC olor;boxElement.addEventListener("mouseover",this._highlightDOMNode.bind(this,tr ue,name==="position"?"all":name),false);this._boxElements.push(boxElement);if(na me==="content"){var widthElement=document.createElement("span");widthElement.tex tContent=getContentAreaWidthPx(style);widthElement.addEventListener("dblclick",t his.startEditing.bind(this,widthElement,"width","width",style),false);var height Element=document.createElement("span");heightElement.textContent=getContentAreaH eightPx(style);heightElement.addEventListener("dblclick",this.startEditing.bind( this,heightElement,"height","height",style),false);boxElement.appendChild(widthE lement);boxElement.appendChild(document.createTextNode(" \u00D7 "));boxElement.a ppendChild(heightElement);}else{var suffix=(name==="border"?"-width":"");var lab elElement=document.createElement("div");labelElement.className="label";labelElem ent.textContent=boxLabels[i];boxElement.appendChild(labelElement);boxElement.app endChild(createBoxPartElement.call(this,style,name,"top",suffix));boxElement.app endChild(document.createElement("br"));boxElement.appendChild(createBoxPartEleme nt.call(this,style,name,"left",suffix));if(previousBox)
174 boxElement.appendChild(previousBox);boxElement.appendChild(createBoxPartElement. call(this,style,name,"right",suffix));boxElement.appendChild(document.createElem ent("br"));boxElement.appendChild(createBoxPartElement.call(this,style,name,"bot tom",suffix));} 562 boxElement.appendChild(previousBox);boxElement.appendChild(createBoxPartElement. call(this,style,name,"right",suffix));boxElement.appendChild(document.createElem ent("br"));boxElement.appendChild(createBoxPartElement.call(this,style,name,"bot tom",suffix));}
175 previousBox=boxElement;} 563 previousBox=boxElement;}
176 metricsElement.appendChild(previousBox);metricsElement.addEventListener("mouseov er",this._highlightDOMNode.bind(this,false,""),false);this.bodyElement.removeChi ldren();this.bodyElement.appendChild(metricsElement);},startEditing:function(tar getElement,box,styleProperty,computedStyle) 564 metricsElement.appendChild(previousBox);metricsElement.addEventListener("mouseov er",this._highlightDOMNode.bind(this,false,""),false);this.bodyElement.removeChi ldren();this.bodyElement.appendChild(metricsElement);},startEditing:function(tar getElement,box,styleProperty,computedStyle)
177 {if(WebInspector.isBeingEdited(targetElement)) 565 {if(WebInspector.isBeingEdited(targetElement))
178 return;var context={box:box,styleProperty:styleProperty,computedStyle:computedSt yle};var boundKeyDown=this._handleKeyDown.bind(this,context,styleProperty);conte xt.keyDownHandler=boundKeyDown;targetElement.addEventListener("keydown",boundKey Down,false);this._isEditingMetrics=true;var config=new WebInspector.EditingConfi g(this.editingCommitted.bind(this),this.editingCancelled.bind(this),context);Web Inspector.startEditing(targetElement,config);window.getSelection().setBaseAndExt ent(targetElement,0,targetElement,1);},_handleKeyDown:function(context,styleProp erty,event) 566 return;var context={box:box,styleProperty:styleProperty,computedStyle:computedSt yle};var boundKeyDown=this._handleKeyDown.bind(this,context,styleProperty);conte xt.keyDownHandler=boundKeyDown;targetElement.addEventListener("keydown",boundKey Down,false);this._isEditingMetrics=true;var config=new WebInspector.InplaceEdito r.Config(this.editingCommitted.bind(this),this.editingCancelled.bind(this),conte xt);WebInspector.InplaceEditor.startEditing(targetElement,config);window.getSele ction().setBaseAndExtent(targetElement,0,targetElement,1);},_handleKeyDown:funct ion(context,styleProperty,event)
179 {var element=event.currentTarget;function finishHandler(originalValue,replacemen tString) 567 {var element=event.currentTarget;function finishHandler(originalValue,replacemen tString)
180 {this._applyUserInput(element,replacementString,originalValue,context,false);} 568 {this._applyUserInput(element,replacementString,originalValue,context,false);}
181 function customNumberHandler(number) 569 function customNumberHandler(number)
182 {if(styleProperty!=="margin"&&number<0) 570 {if(styleProperty!=="margin"&&number<0)
183 number=0;return number;} 571 number=0;return number;}
184 WebInspector.handleElementValueModifications(event,element,finishHandler.bind(th is),undefined,customNumberHandler);},editingEnded:function(element,context) 572 WebInspector.handleElementValueModifications(event,element,finishHandler.bind(th is),undefined,customNumberHandler);},editingEnded:function(element,context)
185 {delete this.originalPropertyData;delete this.previousPropertyDataCandidate;elem ent.removeEventListener("keydown",context.keyDownHandler,false);delete this._isE ditingMetrics;},editingCancelled:function(element,context) 573 {delete this.originalPropertyData;delete this.previousPropertyDataCandidate;elem ent.removeEventListener("keydown",context.keyDownHandler,false);delete this._isE ditingMetrics;},editingCancelled:function(element,context)
186 {if("originalPropertyData"in this&&this.inlineStyle){if(!this.originalPropertyDa ta){var pastLastSourcePropertyIndex=this.inlineStyle.pastLastSourcePropertyIndex ();if(pastLastSourcePropertyIndex) 574 {if("originalPropertyData"in this&&this.inlineStyle){if(!this.originalPropertyDa ta){var pastLastSourcePropertyIndex=this.inlineStyle.pastLastSourcePropertyIndex ();if(pastLastSourcePropertyIndex)
187 this.inlineStyle.allProperties[pastLastSourcePropertyIndex-1].setText("",false); }else 575 this.inlineStyle.allProperties[pastLastSourcePropertyIndex-1].setText("",false); }else
188 this.inlineStyle.allProperties[this.originalPropertyData.index].setText(this.ori ginalPropertyData.propertyText,false);} 576 this.inlineStyle.allProperties[this.originalPropertyData.index].setText(this.ori ginalPropertyData.propertyText,false);}
189 this.editingEnded(element,context);this.update();},_applyUserInput:function(elem ent,userInput,previousContent,context,commitEditor) 577 this.editingEnded(element,context);this.update();},_applyUserInput:function(elem ent,userInput,previousContent,context,commitEditor)
190 {if(!this.inlineStyle){return this.editingCancelled(element,context);} 578 {if(!this.inlineStyle){return this.editingCancelled(element,context);}
191 if(commitEditor&&userInput===previousContent) 579 if(commitEditor&&userInput===previousContent)
192 return this.editingCancelled(element,context);if(context.box!=="position"&&(!use rInput||userInput==="\u2012")) 580 return this.editingCancelled(element,context);if(context.box!=="position"&&(!use rInput||userInput==="\u2012"))
193 userInput="0px";else if(context.box==="position"&&(!userInput||userInput==="\u20 12")) 581 userInput="0px";else if(context.box==="position"&&(!userInput||userInput==="\u20 12"))
194 userInput="auto";userInput=userInput.toLowerCase();if(/^\d+$/.test(userInput)) 582 userInput="auto";userInput=userInput.toLowerCase();if(/^\d+$/.test(userInput))
195 userInput+="px";var styleProperty=context.styleProperty;var computedStyle=contex t.computedStyle;if(computedStyle.getPropertyValue("box-sizing")==="border-box"&& (styleProperty==="width"||styleProperty==="height")){if(!userInput.match(/px$/)) {WebInspector.log("For elements with box-sizing: border-box, only absolute conte nt area dimensions can be applied",WebInspector.ConsoleMessage.MessageLevel.Erro r,true);return;} 583 userInput+="px";var styleProperty=context.styleProperty;var computedStyle=contex t.computedStyle;if(computedStyle.getPropertyValue("box-sizing")==="border-box"&& (styleProperty==="width"||styleProperty==="height")){if(!userInput.match(/px$/)) {WebInspector.console.log("For elements with box-sizing: border-box, only absolu te content area dimensions can be applied",WebInspector.ConsoleMessage.MessageLe vel.Error,true);return;}
196 var borderBox=this._getBox(computedStyle,"border");var paddingBox=this._getBox(c omputedStyle,"padding");var userValuePx=Number(userInput.replace(/px$/,""));if(i sNaN(userValuePx)) 584 var borderBox=this._getBox(computedStyle,"border");var paddingBox=this._getBox(c omputedStyle,"padding");var userValuePx=Number(userInput.replace(/px$/,""));if(i sNaN(userValuePx))
197 return;if(styleProperty==="width") 585 return;if(styleProperty==="width")
198 userValuePx+=borderBox.left+borderBox.right+paddingBox.left+paddingBox.right;els e 586 userValuePx+=borderBox.left+borderBox.right+paddingBox.left+paddingBox.right;els e
199 userValuePx+=borderBox.top+borderBox.bottom+paddingBox.top+paddingBox.bottom;use rInput=userValuePx+"px";} 587 userValuePx+=borderBox.top+borderBox.bottom+paddingBox.top+paddingBox.bottom;use rInput=userValuePx+"px";}
200 this.previousPropertyDataCandidate=null;var self=this;var callback=function(styl e){if(!style) 588 this.previousPropertyDataCandidate=null;var self=this;var callback=function(styl e){if(!style)
201 return;self.inlineStyle=style;if(!("originalPropertyData"in self)) 589 return;self.inlineStyle=style;if(!("originalPropertyData"in self))
202 self.originalPropertyData=self.previousPropertyDataCandidate;if(typeof self._hig hlightMode!=="undefined"){WebInspector.domAgent.highlightDOMNode(self.node.id,se lf._highlightMode);} 590 self.originalPropertyData=self.previousPropertyDataCandidate;if(typeof self._hig hlightMode!=="undefined"){WebInspector.domModel.highlightDOMNode(self.node.id,se lf._highlightMode);}
203 if(commitEditor){self.dispatchEventToListeners("metrics edited");self.update();} };var allProperties=this.inlineStyle.allProperties;for(var i=0;i<allProperties.l ength;++i){var property=allProperties[i];if(property.name!==context.stylePropert y||property.inactive) 591 if(commitEditor){self.dispatchEventToListeners("metrics edited");self.update();} };var allProperties=this.inlineStyle.allProperties;for(var i=0;i<allProperties.l ength;++i){var property=allProperties[i];if(property.name!==context.stylePropert y||property.inactive)
204 continue;this.previousPropertyDataCandidate=property;property.setValue(userInput ,commitEditor,true,callback);return;} 592 continue;this.previousPropertyDataCandidate=property;property.setValue(userInput ,commitEditor,true,callback);return;}
205 this.inlineStyle.appendProperty(context.styleProperty,userInput,callback);},edit ingCommitted:function(element,userInput,previousContent,context) 593 this.inlineStyle.appendProperty(context.styleProperty,userInput,callback);},edit ingCommitted:function(element,userInput,previousContent,context)
206 {this.editingEnded(element,context);this._applyUserInput(element,userInput,previ ousContent,context,true);},__proto__:WebInspector.SidebarPane.prototype};WebInsp ector.OverridesView=function() 594 {this.editingEnded(element,context);this._applyUserInput(element,userInput,previ ousContent,context,true);},__proto__:WebInspector.SidebarPane.prototype};WebInsp ector.OverridesView=function()
207 {WebInspector.View.call(this);this.registerRequiredCSS("overrides.css");this.reg isterRequiredCSS("helpScreen.css");this.element.classList.add("overrides-view"," fill","vbox");this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.sh rinkableTabs=false;this._tabbedPane.verticalTabLayout=true;new WebInspector.Over ridesView.DeviceTab().appendAsTab(this._tabbedPane);new WebInspector.OverridesVi ew.ViewportTab().appendAsTab(this._tabbedPane);new WebInspector.OverridesView.Us erAgentTab().appendAsTab(this._tabbedPane);new WebInspector.OverridesView.Sensor sTab().appendAsTab(this._tabbedPane);this._lastSelectedTabSetting=WebInspector.s ettings.createSetting("lastSelectedEmulateTab","device");this._tabbedPane.select Tab(this._lastSelectedTabSetting.get());this._tabbedPane.addEventListener(WebIns pector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._tabbedPan e.show(this.element);this._warningFooter=this.element.createChild("div","overrid es-footer");this._overridesWarningUpdated();WebInspector.overridesSupport.addEve ntListener(WebInspector.OverridesSupport.Events.OverridesWarningUpdated,this._ov erridesWarningUpdated,this);} 595 {WebInspector.VBox.call(this);this.registerRequiredCSS("overrides.css");this.reg isterRequiredCSS("helpScreen.css");this.element.classList.add("overrides-view"); this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.shrinkableTabs=f alse;this._tabbedPane.verticalTabLayout=true;new WebInspector.OverridesView.Devi ceTab().appendAsTab(this._tabbedPane);new WebInspector.OverridesView.ViewportTab ().appendAsTab(this._tabbedPane);new WebInspector.OverridesView.UserAgentTab().a ppendAsTab(this._tabbedPane);new WebInspector.OverridesView.SensorsTab().appendA sTab(this._tabbedPane);this._lastSelectedTabSetting=WebInspector.settings.create Setting("lastSelectedEmulateTab","device");this._tabbedPane.selectTab(this._last SelectedTabSetting.get());this._tabbedPane.addEventListener(WebInspector.TabbedP ane.EventTypes.TabSelected,this._tabSelected,this);this._tabbedPane.show(this.el ement);this._warningFooter=this.element.createChild("div","overrides-footer");th is._overridesWarningUpdated();WebInspector.overridesSupport.addEventListener(Web Inspector.OverridesSupport.Events.OverridesWarningUpdated,this._overridesWarning Updated,this);}
208 WebInspector.OverridesView.prototype={_tabSelected:function(event) 596 WebInspector.OverridesView.prototype={_tabSelected:function(event)
209 {this._lastSelectedTabSetting.set(this._tabbedPane.selectedTabId);},_overridesWa rningUpdated:function() 597 {this._lastSelectedTabSetting.set(this._tabbedPane.selectedTabId);},_overridesWa rningUpdated:function()
210 {var message=WebInspector.overridesSupport.warningMessage();this._warningFooter. enableStyleClass("hidden",!message);this._warningFooter.textContent=message;},__ proto__:WebInspector.View.prototype} 598 {var message=WebInspector.overridesSupport.warningMessage();this._warningFooter. classList.toggle("hidden",!message);this._warningFooter.textContent=message;},__ proto__:WebInspector.VBox.prototype}
211 WebInspector.OverridesView.Tab=function(id,name,settings) 599 WebInspector.OverridesView.Tab=function(id,name,settings)
212 {WebInspector.View.call(this);this._id=id;this._name=name;this._settings=setting s;for(var i=0;i<settings.length;++i) 600 {WebInspector.VBox.call(this);this._id=id;this._name=name;this._settings=setting s;for(var i=0;i<settings.length;++i)
213 settings[i].addChangeListener(this._updateActiveState,this);} 601 settings[i].addChangeListener(this._updateActiveState,this);}
214 WebInspector.OverridesView.Tab.prototype={appendAsTab:function(tabbedPane) 602 WebInspector.OverridesView.Tab.prototype={appendAsTab:function(tabbedPane)
215 {this._tabbedPane=tabbedPane;tabbedPane.appendTab(this._id,this._name,this);this ._updateActiveState();},_updateActiveState:function() 603 {this._tabbedPane=tabbedPane;tabbedPane.appendTab(this._id,this._name,this);this ._updateActiveState();},_updateActiveState:function()
216 {var active=false;for(var i=0;!active&&i<this._settings.length;++i) 604 {var active=false;for(var i=0;!active&&i<this._settings.length;++i)
217 active=this._settings[i].get();this._tabbedPane.element.enableStyleClass("overri des-activate-"+this._id,active);this._tabbedPane.changeTabTitle(this._id,active? this._name+" \u2713":this._name);},_createInput:function(parentElement,id,defaul tText,eventListener,numeric) 605 active=this._settings[i].get();this._tabbedPane.element.classList.toggle("overri des-activate-"+this._id,active);this._tabbedPane.changeTabTitle(this._id,active? this._name+" \u2713":this._name);},_createInput:function(parentElement,id,defaul tText,eventListener,numeric)
218 {var element=parentElement.createChild("input");element.id=id;element.type="text ";element.maxLength=12;element.style.width="80px";element.value=defaultText;elem ent.align="right";if(numeric) 606 {var element=parentElement.createChild("input");element.id=id;element.type="text ";element.maxLength=12;element.style.width="80px";element.value=defaultText;elem ent.align="right";if(numeric)
219 element.className="numeric";element.addEventListener("input",eventListener,false );element.addEventListener("keydown",keyDownListener,false);function keyDownList ener(event) 607 element.className="numeric";element.addEventListener("input",eventListener,false );element.addEventListener("keydown",keyDownListener,false);function keyDownList ener(event)
220 {if(isEnterKey(event)) 608 {if(isEnterKey(event))
221 eventListener(event);} 609 eventListener(event);}
222 return element;},_createNonPersistedCheckbox:function(title,callback) 610 return element;},_createNonPersistedCheckbox:function(title,callback)
223 {var labelElement=document.createElement("label");var checkboxElement=labelEleme nt.createChild("input");checkboxElement.type="checkbox";checkboxElement.checked= false;checkboxElement.addEventListener("click",onclick,false);labelElement.appen dChild(document.createTextNode(title));return labelElement;function onclick() 611 {var labelElement=document.createElement("label");var checkboxElement=labelEleme nt.createChild("input");checkboxElement.type="checkbox";checkboxElement.checked= false;checkboxElement.addEventListener("click",onclick,false);labelElement.appen dChild(document.createTextNode(title));return labelElement;function onclick()
224 {callback(checkboxElement.checked);}},_createSettingCheckbox:function(name,setti ng,callback) 612 {callback(checkboxElement.checked);}},_createSettingCheckbox:function(name,setti ng,callback)
225 {var checkbox=WebInspector.SettingsTab.createCheckbox(name,setting.get.bind(sett ing),listener,true);function listener(value) 613 {var checkbox=WebInspector.SettingsUI.createCheckbox(name,setting.get.bind(setti ng),listener,true);function listener(value)
226 {if(setting.get()===value) 614 {if(setting.get()===value)
227 return;setting.set(value);if(callback) 615 return;setting.set(value);if(callback)
228 callback(value);} 616 callback(value);}
229 setting.addChangeListener(changeListener);function changeListener() 617 setting.addChangeListener(changeListener);function changeListener()
230 {if(checkbox.firstChild.checked!==setting.get()) 618 {if(checkbox.firstChild.checked!==setting.get())
231 checkbox.firstChild.checked=setting.get();} 619 checkbox.firstChild.checked=setting.get();}
232 return checkbox;},__proto__:WebInspector.View.prototype} 620 return checkbox;},__proto__:WebInspector.VBox.prototype}
233 WebInspector.OverridesView.DeviceTab=function() 621 WebInspector.OverridesView.DeviceTab=function()
234 {WebInspector.OverridesView.Tab.call(this,"device",WebInspector.UIString("Device "),[]);this.element.classList.add("overrides-device");this._emulatedDeviceSettin g=WebInspector.settings.createSetting("emulatedDevice","Google Nexus 4");this._e mulateDeviceViewportSetting=WebInspector.settings.overrideDeviceMetrics;this._em ulateDeviceUserAgentSetting=WebInspector.settings.overrideUserAgent;this._device SelectElement=this.element.createChild("select");var devices=WebInspector.Overri desView.DeviceTab._phones.concat(WebInspector.OverridesView.DeviceTab._tablets); devices.sort();var selectionRestored=false;for(var i=0;i<devices.length;++i){var device=devices[i];var option=new Option(device[0],device[0]);option._userAgent= device[1];option._metrics=device[2];this._deviceSelectElement.add(option);if(thi s._emulatedDeviceSetting.get()===device[0]){this._deviceSelectElement.selectedIn dex=i;selectionRestored=true;}} 622 {WebInspector.OverridesView.Tab.call(this,"device",WebInspector.UIString("Device "),[]);this.element.classList.add("overrides-device");this._emulatedDeviceSettin g=WebInspector.settings.createSetting("emulatedDevice","Google Nexus 4");this._e mulateDeviceViewportSetting=WebInspector.settings.overrideDeviceMetrics;this._em ulateDeviceUserAgentSetting=WebInspector.settings.overrideUserAgent;this._device SelectElement=this.element.createChild("select");var devices=WebInspector.Overri desView.DeviceTab._phones.concat(WebInspector.OverridesView.DeviceTab._tablets); devices.sort();var selectionRestored=false;for(var i=0;i<devices.length;++i){var device=devices[i];var option=new Option(device[0],device[0]);option._userAgent= device[1];option._metrics=device[2];this._deviceSelectElement.add(option);if(thi s._emulatedDeviceSetting.get()===device[0]){this._deviceSelectElement.selectedIn dex=i;selectionRestored=true;}}
235 if(!selectionRestored) 623 if(!selectionRestored)
236 this._deviceSelectElement.selectedIndex=devices.length-1;this._deviceSelectEleme nt.addEventListener("change",this._deviceSelected.bind(this),false);this._device SelectElement.addEventListener("dblclick",this._emulateButtonClicked.bind(this), false);this._deviceSelectElement.addEventListener("keypress",this._keyPressed.bi nd(this),false);this._deviceSelectElement.disabled=WebInspector.isInspectingDevi ce();var buttonsBar=this.element.createChild("div");var emulateButton=buttonsBar .createChild("button","settings-tab-text-button");emulateButton.textContent=WebI nspector.UIString("Emulate");emulateButton.addEventListener("click",this._emulat eButtonClicked.bind(this),false);emulateButton.disabled=WebInspector.isInspectin gDevice();this._emulateButton=emulateButton;var resetButton=buttonsBar.createChi ld("button","settings-tab-text-button");resetButton.textContent=WebInspector.UIS tring("Reset");resetButton.addEventListener("click",this._resetButtonClicked.bin d(this),false);this._viewportValueLabel=this.element.createChild("div","override s-device-value-label");this._viewportValueLabel.textContent=WebInspector.UIStrin g("Viewport:");this._viewportValueElement=this._viewportValueLabel.createChild(" span","overrides-device-value");this._userAgentLabel=this.element.createChild("d iv","overrides-device-value-label");this._userAgentLabel.textContent=WebInspecto r.UIString("User agent:");this._userAgentValueElement=this._userAgentLabel.creat eChild("span","overrides-device-value");this._updateValueLabels();} 624 this._deviceSelectElement.selectedIndex=devices.length-1;this._deviceSelectEleme nt.addEventListener("change",this._deviceSelected.bind(this),false);this._device SelectElement.addEventListener("keypress",this._keyPressed.bind(this),false);thi s._deviceSelectElement.disabled=WebInspector.OverridesSupport.isInspectingDevice ();var buttonsBar=this.element.createChild("div");var emulateButton=buttonsBar.c reateChild("button","settings-tab-text-button");emulateButton.textContent=WebIns pector.UIString("Emulate");emulateButton.addEventListener("click",this._emulateB uttonClicked.bind(this),false);emulateButton.disabled=WebInspector.OverridesSupp ort.isInspectingDevice();var resetButton=buttonsBar.createChild("button","settin gs-tab-text-button");resetButton.textContent=WebInspector.UIString("Reset");rese tButton.addEventListener("click",this._resetButtonClicked.bind(this),false);this ._resetButton=resetButton;this._viewportValueLabel=this.element.createChild("div ","overrides-device-value-label");this._viewportValueLabel.textContent=WebInspec tor.UIString("Viewport:");this._viewportValueElement=this._viewportValueLabel.cr eateChild("span","overrides-device-value");this._userAgentLabel=this.element.cre ateChild("div","overrides-device-value-label");this._userAgentLabel.textContent= WebInspector.UIString("User agent:");this._userAgentValueElement=this._userAgent Label.createChild("span","overrides-device-value");this._updateValueLabels();Web Inspector.overridesSupport.addEventListener(WebInspector.OverridesSupport.Events .HasActiveOverridesChanged,this._hasActiveOverridesChanged,this);this._hasActive OverridesChanged();}
237 WebInspector.OverridesView.DeviceTab._phones=[["Apple iPhone 3GS","Mozilla/5.0 ( iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML , like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5","320x480x1"],["Apple iPhone 4","Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) App leWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18. 5","640x960x2"],["Apple iPhone 5","Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like M ac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4 65 Safari/9537.53","640x1136x2"],["BlackBerry Z10","Mozilla/5.0 (BB10; Touch) Ap pleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+" ,"768x1280x2"],["BlackBerry Z30","Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+","720x1280x2"],["G oogle Nexus 4","Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19 ","768x1280x2"],["Google Nexus 5","Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nex us 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 M obile Safari/535.19","1080x1920x3"],["Google Nexus S","Mozilla/5.0 (Linux; U; An droid 2.3.4; en-us; Nexus S Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) V ersion/4.0 Mobile Safari/533.1","480x800x1.5"],["HTC Evo, Touch HD, Desire HD, D esire","Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","480x800 x1.5"],["HTC One X, EVO LTE","Mozilla/5.0 (Linux; Android 4.0.3; HTC One X Build /IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safa ri/535.19","720x1280x2"],["HTC Sensation, Evo 3D","Mozilla/5.0 (Linux; U; Androi d 4.0.3; en-us; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Geck o) Version/4.0 Mobile Safari/534.30","540x960x1.5"],["LG Optimus 2X, Optimus 3D, Optimus Black","Mozilla/5.0 (Linux; U; Android 2.2; en-us; LG-P990/V08c Build/F RG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MMS/ LG-Android-MMS-V1.0/1.2","480x800x1.5"],["LG Optimus G","Mozilla/5.0 (Linux; And roid 4.0; LG-E975 Build/IMM76L) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18 .0.1025.166 Mobile Safari/535.19","768x1280x2"],["LG Optimus LTE, Optimus 4X HD" ,"Mozilla/5.0 (Linux; U; Android 2.3; en-us; LG-P930 Build/GRJ90) AppleWebKit/53 3.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","720x1280x1.7"],["LG Op timus One","Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; LG-MS690 Build/FRG83) A ppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","320x480x1 .5"],["Motorola Defy, Droid, Droid X, Milestone","Mozilla/5.0 (Linux; U; Android 2.0; en-us; Milestone Build/ SHOLS_U2_01.03.1) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17","480x854x1.5"],["Motorola Droid 3, Droi d 4, Droid Razr, Atrix 4G, Atrix 2","Mozilla/5.0 (Linux; U; Android 2.2; en-us; Droid Build/FRG22D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Saf ari/533.1","540x960x1"],["Motorola Droid Razr HD","Mozilla/5.0 (Linux; U; Androi d 2.3; en-us; DROID RAZR 4G Build/6.5.1-73_DHD-11_M1-29) AppleWebKit/533.1 (KHTM L, like Gecko) Version/4.0 Mobile Safari/533.1","720x1280x1"],["Nokia C5, C6, C7 , N97, N8, X7","NokiaN97/21.1.107 (SymbianOS/9.4; Series60/5.0 Mozilla/5.0; Prof ile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebkit/525 (KHTML, like Gecko) Browser NG/7.1.4","360x640x1"],["Nokia Lumia 7X0, Lumia 8XX, Lumia 900, N800, N810, N900 ","Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/ 10.0; ARM; Touch; NOKIA; Lumia 820)","480x800x1.5"],["Samsung Galaxy Note 3","Mo zilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534. 30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","1080x1920x2"],["Samsun g Galaxy Note II","Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO 03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","7 20x1280x2"],["Samsung Galaxy Note","Mozilla/5.0 (Linux; U; Android 2.3; en-us; S AMSUNG-SGH-I717 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version /4.0 Mobile Safari/533.1","800x1280x2"],["Samsung Galaxy S III, Galaxy Nexus","M ozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534 .30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","720x1280x2"],["Samsun g Galaxy S, S II, W","Mozilla/5.0 (Linux; U; Android 2.1; en-us; GT-I9000 Build/ ECLAIR) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523. 12.2","480x800x1.5"],["Samsung Galaxy S4","Mozilla/5.0 (Linux; U; Android 2.1; e n-us; GT-I9000 Build/ECLAIR) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0 .4 Mobile Safari/523.12.2","1080x1920x3"],["Sony Xperia S, Ion","Mozilla/5.0 (Li nux; U; Android 4.0; en-us; LT28at Build/6.1.C.1.111) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","720x1280x2"],["Sony Xperia Sola, U","Mozilla/5.0 (Linux; U; Android 2.3; en-us; SonyEricssonST25i Build/6.0.B.1. 564) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","480 x854x1"],["Sony Xperia Z, Z1","Mozilla/5.0 (Linux; U; Android 4.2; en-us; SonyC6 903 Build/14.1.G.1.518) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobil e Safari/534.30","1080x1920x3"],];WebInspector.OverridesView.DeviceTab._tablets= [["Amazon Amazon Kindle Fire HD 7\u2033","Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire HD Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) V ersion/4.0 Mobile Safari/533.1","1280x800x1.5"],["Amazon Amazon Kindle Fire HD 8 .9\u2033","Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire HD Build/GIN GERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" ,"1920x1200x1.5"],["Amazon Amazon Kindle Fire","Mozilla/5.0 (Linux; U; Android 2 .3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko ) Version/4.0 Mobile Safari/533.1","1024x600x1"],["Apple iPad 1 / 2 / iPad Mini" ,"Mozilla/5.0 (iPad; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KH TML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5","1024x768x1"],["Appl e iPad 3 / 4","Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53","2048x1536x2"],[" BlackBerry PlayBook","Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) Appl eWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+","1024x600x1"],[ "Google Nexus 10","Mozilla/5.0 (Linux; Android 4.3; Nexus 10 Build/JSS15Q) Apple WebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36","2560x1600x 2"],["Google Nexus 7 2","Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36","1920x 1200x2"],["Google Nexus 7","Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15 Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36","12 80x800x1.325"],["Motorola Xoom, Xyboard","Mozilla/5.0 (Linux; U; Android 3.0; en -us; Xoom Build/HRI39) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobi le Safari/523.12.2","1280x800x1"],["Samsung Galaxy Tab 7.7, 8.9, 10.1","Mozilla/ 5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTM L, like Gecko) Version/4.0 Mobile Safari/533.1","1280x800x1"],["Samsung Galaxy T ab","Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKi t/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","1024x600x1"],];Web Inspector.OverridesView.DeviceTab.prototype={_keyPressed:function(e) 625 WebInspector.OverridesView.DeviceTab._phones=[["Apple iPhone 3GS","Mozilla/5.0 ( iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML , like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5","320x480x1"],["Apple iPhone 4","Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) App leWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18. 5","640x960x2"],["Apple iPhone 5","Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like M ac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4 65 Safari/9537.53","640x1136x2"],["BlackBerry Z10","Mozilla/5.0 (BB10; Touch) Ap pleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+" ,"768x1280x2"],["BlackBerry Z30","Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+","720x1280x2"],["G oogle Nexus 4","Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19 ","768x1280x2"],["Google Nexus 5","Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nex us 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 M obile Safari/535.19","1080x1920x3"],["Google Nexus S","Mozilla/5.0 (Linux; U; An droid 2.3.4; en-us; Nexus S Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) V ersion/4.0 Mobile Safari/533.1","480x800x1.5"],["HTC Evo, Touch HD, Desire HD, D esire","Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","480x800 x1.5"],["HTC One X, EVO LTE","Mozilla/5.0 (Linux; Android 4.0.3; HTC One X Build /IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safa ri/535.19","720x1280x2"],["HTC Sensation, Evo 3D","Mozilla/5.0 (Linux; U; Androi d 4.0.3; en-us; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Geck o) Version/4.0 Mobile Safari/534.30","540x960x1.5"],["LG Optimus 2X, Optimus 3D, Optimus Black","Mozilla/5.0 (Linux; U; Android 2.2; en-us; LG-P990/V08c Build/F RG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MMS/ LG-Android-MMS-V1.0/1.2","480x800x1.5"],["LG Optimus G","Mozilla/5.0 (Linux; And roid 4.0; LG-E975 Build/IMM76L) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18 .0.1025.166 Mobile Safari/535.19","768x1280x2"],["LG Optimus LTE, Optimus 4X HD" ,"Mozilla/5.0 (Linux; U; Android 2.3; en-us; LG-P930 Build/GRJ90) AppleWebKit/53 3.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","720x1280x1.7"],["LG Op timus One","Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; LG-MS690 Build/FRG83) A ppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","320x480x1 .5"],["Motorola Defy, Droid, Droid X, Milestone","Mozilla/5.0 (Linux; U; Android 2.0; en-us; Milestone Build/ SHOLS_U2_01.03.1) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17","480x854x1.5"],["Motorola Droid 3, Droi d 4, Droid Razr, Atrix 4G, Atrix 2","Mozilla/5.0 (Linux; U; Android 2.2; en-us; Droid Build/FRG22D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Saf ari/533.1","540x960x1"],["Motorola Droid Razr HD","Mozilla/5.0 (Linux; U; Androi d 2.3; en-us; DROID RAZR 4G Build/6.5.1-73_DHD-11_M1-29) AppleWebKit/533.1 (KHTM L, like Gecko) Version/4.0 Mobile Safari/533.1","720x1280x1"],["Nokia C5, C6, C7 , N97, N8, X7","NokiaN97/21.1.107 (SymbianOS/9.4; Series60/5.0 Mozilla/5.0; Prof ile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebkit/525 (KHTML, like Gecko) Browser NG/7.1.4","360x640x1"],["Nokia Lumia 7X0, Lumia 8XX, Lumia 900, N800, N810, N900 ","Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/ 10.0; ARM; Touch; NOKIA; Lumia 820)","480x800x1.5"],["Samsung Galaxy Note 3","Mo zilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534. 30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","1080x1920x2"],["Samsun g Galaxy Note II","Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO 03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","7 20x1280x2"],["Samsung Galaxy Note","Mozilla/5.0 (Linux; U; Android 2.3; en-us; S AMSUNG-SGH-I717 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version /4.0 Mobile Safari/533.1","800x1280x2"],["Samsung Galaxy S III, Galaxy Nexus","M ozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534 .30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","720x1280x2"],["Samsun g Galaxy S, S II, W","Mozilla/5.0 (Linux; U; Android 2.1; en-us; GT-I9000 Build/ ECLAIR) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523. 12.2","480x800x1.5"],["Samsung Galaxy S4","Mozilla/5.0 (Linux; Android 4.2.2; GT -I9505 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 M obile Safari/537.36","1080x1920x3"],["Sony Xperia S, Ion","Mozilla/5.0 (Linux; U ; Android 4.0; en-us; LT28at Build/6.1.C.1.111) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","720x1280x2"],["Sony Xperia Sola, U","M ozilla/5.0 (Linux; U; Android 2.3; en-us; SonyEricssonST25i Build/6.0.B.1.564) A ppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","480x854x1 "],["Sony Xperia Z, Z1","Mozilla/5.0 (Linux; U; Android 4.2; en-us; SonyC6903 Bu ild/14.1.G.1.518) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safa ri/534.30","1080x1920x3"],];WebInspector.OverridesView.DeviceTab._tablets=[["Ama zon Amazon Kindle Fire HD 7\u2033","Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire HD Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version /4.0 Mobile Safari/533.1","1280x800x1.5"],["Amazon Amazon Kindle Fire HD 8.9\u20 33","Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire HD Build/GINGERBRE AD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","1920 x1200x1.5"],["Amazon Amazon Kindle Fire","Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Vers ion/4.0 Mobile Safari/533.1","1024x600x1"],["Apple iPad 1 / 2 / iPad Mini","Mozi lla/5.0 (iPad; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, l ike Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5","1024x768x1"],["Apple iPad 3 / 4","Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTM L, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53","2048x1536x2"],["BlackB erry PlayBook","Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKi t/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+","1024x600x1"],["Googl e Nexus 10","Mozilla/5.0 (Linux; Android 4.3; Nexus 10 Build/JSS15Q) AppleWebKit /537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36","2560x1600x2"],[" Google Nexus 7 2","Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleW ebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36","1920x1200x2 "],["Google Nexus 7","Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) App leWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36","1280x800 x1.325"],["Motorola Xoom, Xyboard","Mozilla/5.0 (Linux; U; Android 3.0; en-us; X oom Build/HRI39) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobile Saf ari/523.12.2","1280x800x1"],["Samsung Galaxy Tab 7.7, 8.9, 10.1","Mozilla/5.0 (L inux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTML, lik e Gecko) Version/4.0 Mobile Safari/533.1","1280x800x1"],["Samsung Galaxy Tab","M ozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533. 1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","1024x600x1"],];WebInspec tor.OverridesView.DeviceTab.prototype={_keyPressed:function(e)
238 {if(e.keyCode===WebInspector.KeyboardShortcut.Keys.Enter.code) 626 {if(e.keyCode===WebInspector.KeyboardShortcut.Keys.Enter.code)
239 this._emulateButtonClicked();},_emulateButtonClicked:function() 627 this._emulateButtonClicked();},_emulateButtonClicked:function()
240 {var option=this._deviceSelectElement.options[this._deviceSelectElement.selected Index];WebInspector.overridesSupport.emulateDevice(option._metrics,option._userA gent);},_resetButtonClicked:function() 628 {var option=this._deviceSelectElement.options[this._deviceSelectElement.selected Index];WebInspector.overridesSupport.emulateDevice(option._metrics,option._userA gent);},_resetButtonClicked:function()
241 {WebInspector.overridesSupport.reset();},_deviceSelected:function() 629 {WebInspector.overridesSupport.reset();},_hasActiveOverridesChanged:function()
630 {this._resetButton.disabled=!WebInspector.overridesSupport.hasActiveOverrides(); },_deviceSelected:function()
242 {var option=this._deviceSelectElement.options[this._deviceSelectElement.selected Index];this._emulatedDeviceSetting.set(option.value);this._updateValueLabels();} ,_updateValueLabels:function() 631 {var option=this._deviceSelectElement.options[this._deviceSelectElement.selected Index];this._emulatedDeviceSetting.set(option.value);this._updateValueLabels();} ,_updateValueLabels:function()
243 {var option=this._deviceSelectElement.options[this._deviceSelectElement.selected Index];var metrics;if(option._metrics&&(metrics=WebInspector.OverridesSupport.De viceMetrics.parseSetting(option._metrics))) 632 {var option=this._deviceSelectElement.options[this._deviceSelectElement.selected Index];var metrics;if(option._metrics&&(metrics=WebInspector.OverridesSupport.De viceMetrics.parseSetting(option._metrics)))
244 this._viewportValueElement.textContent=WebInspector.UIString("%s \u00D7 %s, devi cePixelRatio = %s",metrics.width,metrics.height,metrics.deviceScaleFactor);else 633 this._viewportValueElement.textContent=WebInspector.UIString("%s \xD7 %s, device PixelRatio = %s",metrics.width,metrics.height,metrics.deviceScaleFactor);else
245 this._viewportValueElement.textContent="";this._userAgentValueElement.textConten t=option._userAgent||"";},__proto__:WebInspector.OverridesView.Tab.prototype} 634 this._viewportValueElement.textContent="";this._userAgentValueElement.textConten t=option._userAgent||"";},__proto__:WebInspector.OverridesView.Tab.prototype}
246 WebInspector.OverridesView.ViewportTab=function() 635 WebInspector.OverridesView.ViewportTab=function()
247 {WebInspector.OverridesView.Tab.call(this,"viewport",WebInspector.UIString("Scre en"),[WebInspector.settings.overrideDeviceMetrics,WebInspector.settings.override CSSMedia]);this.element.classList.add("overrides-viewport");const metricsSetting =WebInspector.settings.deviceMetrics.get();var metrics=WebInspector.OverridesSup port.DeviceMetrics.parseSetting(metricsSetting);var checkbox=this._createSetting Checkbox(WebInspector.UIString("Emulate screen"),WebInspector.settings.overrideD eviceMetrics,this._onMetricsCheckboxClicked.bind(this));checkbox.firstChild.disa bled=WebInspector.isInspectingDevice();WebInspector.settings.deviceMetrics.addCh angeListener(this._updateDeviceMetricsElement,this);this.element.appendChild(che ckbox);this.element.appendChild(this._createDeviceMetricsElement(metrics));this. element.appendChild(this._createMediaEmulationElement());var footnote=this.eleme nt.createChild("p","help-footnote");var footnoteLink=footnote.createChild("a");f ootnoteLink.href="https://developers.google.com/chrome-developer-tools/docs/mobi le-emulation";footnoteLink.target="_blank";footnoteLink.createTextChild(WebInspe ctor.UIString("More information about screen emulation"));this._onMetricsCheckbo xClicked(WebInspector.settings.overrideDeviceMetrics.get());} 636 {WebInspector.OverridesView.Tab.call(this,"viewport",WebInspector.UIString("Scre en"),[WebInspector.settings.overrideDeviceMetrics,WebInspector.settings.override CSSMedia]);this.element.classList.add("overrides-viewport");const metricsSetting =WebInspector.settings.deviceMetrics.get();var metrics=WebInspector.OverridesSup port.DeviceMetrics.parseSetting(metricsSetting);var checkbox=this._createSetting Checkbox(WebInspector.UIString("Emulate screen"),WebInspector.settings.overrideD eviceMetrics,this._onMetricsCheckboxClicked.bind(this));checkbox.firstChild.disa bled=WebInspector.OverridesSupport.isInspectingDevice();WebInspector.settings.de viceMetrics.addChangeListener(this._updateDeviceMetricsElement,this);this.elemen t.appendChild(checkbox);this.element.appendChild(this._createDeviceMetricsElemen t(metrics));this.element.appendChild(this._createMediaEmulationFragment());var f ootnote=this.element.createChild("p","help-footnote");var footnoteLink=footnote. createChild("a");footnoteLink.href="https://developers.google.com/chrome-develop er-tools/docs/mobile-emulation";footnoteLink.target="_blank";footnoteLink.create TextChild(WebInspector.UIString("More information about screen emulation"));this ._onMetricsCheckboxClicked(WebInspector.settings.overrideDeviceMetrics.get());}
248 WebInspector.OverridesView.ViewportTab.prototype={_onMetricsCheckboxClicked:func tion(enabled) 637 WebInspector.OverridesView.ViewportTab.prototype={_onMetricsCheckboxClicked:func tion(enabled)
249 {if(enabled&&!this._widthOverrideElement.value) 638 {if(enabled&&!this._widthOverrideElement.value)
250 this._widthOverrideElement.focus();this._applyDeviceMetricsUserInput();},_applyD eviceMetricsUserInput:function() 639 this._widthOverrideElement.focus();this._applyDeviceMetricsUserInput();},_applyD eviceMetricsUserInput:function()
251 {this._muteRangeListener=true;this._widthRangeInput.value=this._widthOverrideEle ment.value;delete this._muteRangeListener;if(this._applyDeviceMetricsTimer) 640 {this._muteRangeListener=true;this._widthRangeInput.value=this._widthOverrideEle ment.value;delete this._muteRangeListener;if(this._applyDeviceMetricsTimer)
252 clearTimeout(this._applyDeviceMetricsTimer);this._applyDeviceMetricsTimer=setTim eout(this._doApplyDeviceMetricsUserInput.bind(this),50);},_doApplyDeviceMetricsU serInput:function() 641 clearTimeout(this._applyDeviceMetricsTimer);this._applyDeviceMetricsTimer=setTim eout(this._doApplyDeviceMetricsUserInput.bind(this),50);},_doApplyDeviceMetricsU serInput:function()
253 {delete this._applyDeviceMetricsTimer;this._setDeviceMetricsOverride(WebInspecto r.OverridesSupport.DeviceMetrics.parseUserInput(this._widthOverrideElement.value .trim(),this._heightOverrideElement.value.trim(),this._deviceScaleFactorOverride Element.value.trim(),this._textAutosizingOverrideCheckbox.checked),true);},_setD eviceMetricsOverride:function(metrics,userInputModified) 642 {delete this._applyDeviceMetricsTimer;this._setDeviceMetricsOverride(WebInspecto r.OverridesSupport.DeviceMetrics.parseUserInput(this._widthOverrideElement.value .trim(),this._heightOverrideElement.value.trim(),this._deviceScaleFactorOverride Element.value.trim(),this._textAutosizingOverrideCheckbox.checked),true);},_setD eviceMetricsOverride:function(metrics,userInputModified)
254 {function setValid(condition,element) 643 {function setValid(condition,element)
255 {if(condition) 644 {if(condition)
256 element.classList.remove("error-input");else 645 element.classList.remove("error-input");else
257 element.classList.add("error-input");} 646 element.classList.add("error-input");}
258 setValid(metrics&&metrics.isWidthValid(),this._widthOverrideElement);setValid(me trics&&metrics.isHeightValid(),this._heightOverrideElement);setValid(metrics&&me trics.isDeviceScaleFactorValid(),this._deviceScaleFactorOverrideElement);if(!met rics) 647 setValid(metrics&&metrics.isWidthValid(),this._widthOverrideElement);setValid(me trics&&metrics.isHeightValid(),this._heightOverrideElement);setValid(metrics&&me trics.isDeviceScaleFactorValid(),this._deviceScaleFactorOverrideElement);if(!met rics)
259 return;if(!userInputModified){this._widthOverrideElement.value=metrics.widthToIn put();this._heightOverrideElement.value=metrics.heightToInput();this._deviceScal eFactorOverrideElement.value=metrics.deviceScaleFactorToInput();this._textAutosi zingOverrideCheckbox.checked=metrics.textAutosizing;} 648 return;if(!userInputModified){this._widthOverrideElement.value=metrics.widthToIn put();this._heightOverrideElement.value=metrics.heightToInput();this._deviceScal eFactorOverrideElement.value=metrics.deviceScaleFactorToInput();this._textAutosi zingOverrideCheckbox.checked=metrics.textAutosizing;}
260 if(metrics.isValid()){var value=metrics.toSetting();if(value!==WebInspector.sett ings.deviceMetrics.get()) 649 if(metrics.isValid()){var value=metrics.toSetting();if(value!==WebInspector.sett ings.deviceMetrics.get())
261 WebInspector.settings.deviceMetrics.set(value);}},_createDeviceMetricsElement:fu nction(metrics) 650 WebInspector.settings.deviceMetrics.set(value);}},_createDeviceMetricsElement:fu nction(metrics)
262 {var fieldsetElement=WebInspector.SettingsTab.createSettingFieldset(WebInspector .settings.overrideDeviceMetrics);if(WebInspector.isInspectingDevice()) 651 {var fieldsetElement=WebInspector.SettingsUI.createSettingFieldset(WebInspector. settings.overrideDeviceMetrics);if(WebInspector.OverridesSupport.isInspectingDev ice())
263 fieldsetElement.disabled=true;fieldsetElement.id="metrics-override-section";func tion swapDimensionsClicked() 652 fieldsetElement.disabled=true;fieldsetElement.id="metrics-override-section";func tion swapDimensionsClicked()
264 {var widthValue=this._widthOverrideElement.value;this._widthOverrideElement.valu e=this._heightOverrideElement.value;this._heightOverrideElement.value=widthValue ;this._applyDeviceMetricsUserInput();} 653 {var widthValue=this._widthOverrideElement.value;this._widthOverrideElement.valu e=this._heightOverrideElement.value;this._heightOverrideElement.value=widthValue ;this._applyDeviceMetricsUserInput();}
265 var tableElement=fieldsetElement.createChild("table","nowrap");var rowElement=ta bleElement.createChild("tr");var cellElement=rowElement.createChild("td");cellEl ement.appendChild(document.createTextNode(WebInspector.UIString("Resolution:"))) ;cellElement=rowElement.createChild("td");this._widthOverrideElement=this._creat eInput(cellElement,"metrics-override-width",String(metrics.width||screen.width), this._applyDeviceMetricsUserInput.bind(this),true);this._swapDimensionsElement=c ellElement.createChild("button","overrides-swap");this._swapDimensionsElement.ap pendChild(document.createTextNode(" \u21C4 "));this._swapDimensionsElement.title =WebInspector.UIString("Swap dimensions");this._swapDimensionsElement.addEventLi stener("click",swapDimensionsClicked.bind(this),false);this._swapDimensionsEleme nt.tabIndex=-1;this._heightOverrideElement=this._createInput(cellElement,"metric s-override-height",String(metrics.height||screen.height),this._applyDeviceMetric sUserInput.bind(this),true);rowElement=tableElement.createChild("tr");cellElemen t=rowElement.createChild("td");cellElement.colSpan=4;this._widthRangeInput=cellE lement.createChild("input");this._widthRangeInput.type="range";this._widthRangeI nput.min=100;this._widthRangeInput.max=2000;this._widthRangeInput.addEventListen er("change",this._rangeValueChanged.bind(this),false);this._widthRangeInput.valu e=this._widthOverrideElement.value;rowElement=tableElement.createChild("tr");row Element.title=WebInspector.UIString("Ratio between a device's physical pixels an d device-independent pixels.");cellElement=rowElement.createChild("td");cellElem ent.appendChild(document.createTextNode(WebInspector.UIString("Device pixel rati o:")));cellElement=rowElement.createChild("td");this._deviceScaleFactorOverrideE lement=this._createInput(cellElement,"metrics-override-device-scale",String(metr ics.deviceScaleFactor||1),this._applyDeviceMetricsUserInput.bind(this),true);var textAutosizingOverrideElement=this._createNonPersistedCheckbox(WebInspector.UIS tring("Enable text autosizing "),this._applyDeviceMetricsUserInput.bind(this));t extAutosizingOverrideElement.title=WebInspector.UIString("Text autosizing is the feature that boosts font sizes on mobile devices.");this._textAutosizingOverrid eCheckbox=textAutosizingOverrideElement.firstChild;this._textAutosizingOverrideC heckbox.checked=metrics.textAutosizing;fieldsetElement.appendChild(textAutosizin gOverrideElement);var checkbox=this._createSettingCheckbox(WebInspector.UIString ("Emulate viewport"),WebInspector.settings.emulateViewport);fieldsetElement.appe ndChild(checkbox);checkbox=this._createSettingCheckbox(WebInspector.UIString("Sh rink to fit"),WebInspector.settings.deviceFitWindow);fieldsetElement.appendChild (checkbox);return fieldsetElement;},_updateDeviceMetricsElement:function() 654 var tableElement=fieldsetElement.createChild("table","nowrap");var rowElement=ta bleElement.createChild("tr");var cellElement=rowElement.createChild("td");cellEl ement.appendChild(document.createTextNode(WebInspector.UIString("Resolution:"))) ;cellElement=rowElement.createChild("td");this._widthOverrideElement=this._creat eInput(cellElement,"metrics-override-width",String(metrics.width||screen.width), this._applyDeviceMetricsUserInput.bind(this),true);this._swapDimensionsElement=c ellElement.createChild("button","overrides-swap");this._swapDimensionsElement.ap pendChild(document.createTextNode(" \u21C4 "));this._swapDimensionsElement.title =WebInspector.UIString("Swap dimensions");this._swapDimensionsElement.addEventLi stener("click",swapDimensionsClicked.bind(this),false);this._swapDimensionsEleme nt.tabIndex=-1;this._heightOverrideElement=this._createInput(cellElement,"metric s-override-height",String(metrics.height||screen.height),this._applyDeviceMetric sUserInput.bind(this),true);rowElement=tableElement.createChild("tr");cellElemen t=rowElement.createChild("td");cellElement.colSpan=4;this._widthRangeInput=cellE lement.createChild("input");this._widthRangeInput.type="range";this._widthRangeI nput.min=100;this._widthRangeInput.max=2000;this._widthRangeInput.addEventListen er("change",this._rangeValueChanged.bind(this),false);this._widthRangeInput.addE ventListener("input",this._rangeValueChanged.bind(this),false);this._widthRangeI nput.value=this._widthOverrideElement.value;rowElement=tableElement.createChild( "tr");rowElement.title=WebInspector.UIString("Ratio between a device's physical pixels and device-independent pixels.");cellElement=rowElement.createChild("td") ;cellElement.appendChild(document.createTextNode(WebInspector.UIString("Device p ixel ratio:")));cellElement=rowElement.createChild("td");this._deviceScaleFactor OverrideElement=this._createInput(cellElement,"metrics-override-device-scale",St ring(metrics.deviceScaleFactor||1),this._applyDeviceMetricsUserInput.bind(this), true);var textAutosizingOverrideElement=this._createNonPersistedCheckbox(WebInsp ector.UIString("Enable text autosizing "),this._applyDeviceMetricsUserInput.bind (this));textAutosizingOverrideElement.title=WebInspector.UIString("Text autosizi ng is the feature that boosts font sizes on mobile devices.");this._textAutosizi ngOverrideCheckbox=textAutosizingOverrideElement.firstChild;this._textAutosizing OverrideCheckbox.checked=metrics.textAutosizing;fieldsetElement.appendChild(text AutosizingOverrideElement);var checkbox=this._createSettingCheckbox(WebInspector .UIString("Emulate viewport"),WebInspector.settings.emulateViewport);fieldsetEle ment.appendChild(checkbox);checkbox=this._createSettingCheckbox(WebInspector.UIS tring("Shrink to fit"),WebInspector.settings.deviceFitWindow);fieldsetElement.ap pendChild(checkbox);return fieldsetElement;},_updateDeviceMetricsElement:functio n()
266 {const metricsSetting=WebInspector.settings.deviceMetrics.get();var metrics=WebI nspector.OverridesSupport.DeviceMetrics.parseSetting(metricsSetting);if(this._wi dthOverrideElement.value!==metrics.width) 655 {const metricsSetting=WebInspector.settings.deviceMetrics.get();var metrics=WebI nspector.OverridesSupport.DeviceMetrics.parseSetting(metricsSetting);if(this._wi dthOverrideElement.value!==metrics.width)
267 this._widthOverrideElement.value=metrics.width||screen.width;this._muteRangeList ener=true;if(this._widthRangeInput.value!=metrics.width) 656 this._widthOverrideElement.value=metrics.width||screen.width;this._muteRangeList ener=true;if(this._widthRangeInput.value!=metrics.width)
268 this._widthRangeInput.value=metrics.width||screen.width;delete this._muteRangeLi stener;if(this._heightOverrideElement.value!==metrics.height) 657 this._widthRangeInput.value=metrics.width||screen.width;delete this._muteRangeLi stener;if(this._heightOverrideElement.value!==metrics.height)
269 this._heightOverrideElement.value=metrics.height||screen.height;if(this._deviceS caleFactorOverrideElement.value!==metrics.deviceScaleFactor) 658 this._heightOverrideElement.value=metrics.height||screen.height;if(this._deviceS caleFactorOverrideElement.value!==metrics.deviceScaleFactor)
270 this._deviceScaleFactorOverrideElement.value=metrics.deviceScaleFactor||1;if(thi s._textAutosizingOverrideCheckbox.checked!==metrics.textAutosizing) 659 this._deviceScaleFactorOverrideElement.value=metrics.deviceScaleFactor||1;if(thi s._textAutosizingOverrideCheckbox.checked!==metrics.textAutosizing)
271 this._textAutosizingOverrideCheckbox.checked=metrics.textAutosizing||false;},_cr eateMediaEmulationElement:function() 660 this._textAutosizingOverrideCheckbox.checked=metrics.textAutosizing||false;},_cr eateMediaEmulationFragment:function()
272 {var checkbox=WebInspector.SettingsTab.createSettingCheckbox(WebInspector.UIStri ng("CSS media"),WebInspector.settings.overrideCSSMedia,true);var fieldsetElement =WebInspector.SettingsTab.createSettingFieldset(WebInspector.settings.overrideCS SMedia);if(WebInspector.isInspectingDevice()) 661 {var checkbox=WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStrin g("CSS media"),WebInspector.settings.overrideCSSMedia,true);var fieldsetElement= WebInspector.SettingsUI.createSettingFieldset(WebInspector.settings.overrideCSSM edia);if(WebInspector.OverridesSupport.isInspectingDevice())
273 fieldsetElement.disabled=true;checkbox.appendChild(fieldsetElement);var mediaSel ectElement=fieldsetElement.createChild("select");var mediaTypes=WebInspector.CSS StyleModel.MediaTypes;var defaultMedia=WebInspector.settings.emulatedCSSMedia.ge t();for(var i=0;i<mediaTypes.length;++i){var mediaType=mediaTypes[i];if(mediaTyp e==="all"){continue;} 662 fieldsetElement.disabled=true;var mediaSelectElement=fieldsetElement.createChild ("select");var mediaTypes=WebInspector.CSSStyleModel.MediaTypes;var defaultMedia =WebInspector.settings.emulatedCSSMedia.get();for(var i=0;i<mediaTypes.length;++ i){var mediaType=mediaTypes[i];if(mediaType==="all"){continue;}
274 var option=document.createElement("option");option.text=mediaType;option.value=m ediaType;mediaSelectElement.add(option);if(mediaType===defaultMedia) 663 var option=document.createElement("option");option.text=mediaType;option.value=m ediaType;mediaSelectElement.add(option);if(mediaType===defaultMedia)
275 mediaSelectElement.selectedIndex=mediaSelectElement.options.length-1;} 664 mediaSelectElement.selectedIndex=mediaSelectElement.options.length-1;}
276 mediaSelectElement.addEventListener("change",this._emulateMediaChanged.bind(this ,mediaSelectElement),false);return checkbox;},_emulateMediaChanged:function(sele ct) 665 mediaSelectElement.addEventListener("change",this._emulateMediaChanged.bind(this ,mediaSelectElement),false);var fragment=document.createDocumentFragment();fragm ent.appendChild(checkbox);fragment.appendChild(fieldsetElement);return fragment; },_emulateMediaChanged:function(select)
277 {var media=select.options[select.selectedIndex].value;WebInspector.settings.emul atedCSSMedia.set(media);},_rangeValueChanged:function() 666 {var media=select.options[select.selectedIndex].value;WebInspector.settings.emul atedCSSMedia.set(media);},_rangeValueChanged:function()
278 {if(this._muteRangeListener) 667 {if(this._muteRangeListener)
279 return;this._widthOverrideElement.value=this._widthRangeInput.value;this._applyD eviceMetricsUserInput();},__proto__:WebInspector.OverridesView.Tab.prototype} 668 return;this._widthOverrideElement.value=this._widthRangeInput.value;this._applyD eviceMetricsUserInput();},__proto__:WebInspector.OverridesView.Tab.prototype}
280 WebInspector.OverridesView.UserAgentTab=function() 669 WebInspector.OverridesView.UserAgentTab=function()
281 {WebInspector.OverridesView.Tab.call(this,"user-agent",WebInspector.UIString("Us er Agent"),[WebInspector.settings.overrideUserAgent]);this.element.classList.add ("overrides-user-agent");var checkbox=this._createSettingCheckbox(WebInspector.U IString("Spoof user agent"),WebInspector.settings.overrideUserAgent);checkbox.fi rstChild.disabled=WebInspector.isInspectingDevice();this.element.appendChild(che ckbox);this.element.appendChild(this._createUserAgentSelectRowElement());} 670 {WebInspector.OverridesView.Tab.call(this,"user-agent",WebInspector.UIString("Us er Agent"),[WebInspector.settings.overrideUserAgent]);this.element.classList.add ("overrides-user-agent");var checkbox=this._createSettingCheckbox(WebInspector.U IString("Spoof user agent"),WebInspector.settings.overrideUserAgent);checkbox.fi rstChild.disabled=WebInspector.OverridesSupport.isInspectingDevice();this.elemen t.appendChild(checkbox);this.element.appendChild(this._createUserAgentSelectRowE lement());}
282 WebInspector.OverridesView.UserAgentTab._userAgents=[["Chrome 31 \u2014 Windows" ,"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31. 0.1650.16 Safari/537.36"],["Chrome 31 \u2014 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Saf ari/537.36"],["Opera 18 \u2014 Windows","Mozilla/5.0 (Windows NT 6.1) AppleWebKi t/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.1284.68" ],["Opera 18 \u2014 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWe bKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.1284. 68"],["Internet Explorer 10","Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2 ; Trident/6.0)"],["Internet Explorer 9","Mozilla/5.0 (compatible; MSIE 9.0; Wind ows NT 6.1; Trident/5.0)"],["Internet Explorer 8","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"],["Internet Explorer 7","Mozilla/4.0 (compat ible; MSIE 7.0; Windows NT 6.0)"],["Firefox 7 \u2014 Windows","Mozilla/5.0 (Wind ows NT 6.1; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"],["Fire fox 7 \u2014 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/ 20100101 Firefox/7.0.1"],["Firefox 4 \u2014 Windows","Mozilla/5.0 (Windows NT 6. 1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"],["Firefox 4 \u2014 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"],["Fir efox 14 \u2014 Android Mobile","Mozilla/5.0 (Android; Mobile; rv:14.0) Gecko/14. 0 Firefox/14.0"],["Firefox 14 \u2014 Android Tablet","Mozilla/5.0 (Android; Tabl et; rv:14.0) Gecko/14.0 Firefox/14.0"],["Chrome \u2014 Android Mobile","Mozilla/ 5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19"],["Chrome \u2014 Android Tablet","Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/5 35.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19"],["iPhone \u2014 i OS 7","Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.5 1.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4449d Safari/9537.53"],["iPhone \u 2014 iOS 6","Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/5 36.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"],["iPad \u 2014 iOS 7","Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53"],["iPad \u2014 iO S 6","Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, li ke Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"],["Android 2.3 \u2014 Nexu s S","Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWe bKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"],["Android 4.0.2 \u2014 Galaxy Nexus","Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/ 534.30"],["BlackBerry \u2014 PlayBook 2.1","Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/ 536.2+"],["BlackBerry \u2014 9900","Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/ 534.11+"],["BlackBerry \u2014 BB10","Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1 + (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+"],["MeeGo \u2014 Nokia N9","Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) N okiaBrowser/8.5.0 Mobile Safari/534.13"],];WebInspector.OverridesView.UserAgentT ab.prototype={_createUserAgentSelectRowElement:function() 671 WebInspector.OverridesView.UserAgentTab._userAgents=[["Android 4.0.2 \u2014 Gala xy Nexus","Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53 F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"],["A ndroid 2.3 \u2014 Nexus S","Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/5 33.1"],["BlackBerry \u2014 BB10","Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ ( KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+"],["BlackBerry \u201 4 PlayBook 2.1","Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebK it/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+"],["BlackBerry \u201 4 9900","Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/534.11+"],["Chrome 31 \u201 4 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML , like Gecko) Chrome/31.0.1650.63 Safari/537.36"],["Chrome 31 \u2014 Windows","M ozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1 650.16 Safari/537.36"],["Chrome \u2014 Android Tablet","Mozilla/5.0 (Linux; Andr oid 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/1 8.0.1025.166 Safari/535.19"],["Chrome \u2014 Android Mobile","Mozilla/5.0 (Linux ; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Geck o) Chrome/18.0.1025.133 Mobile Safari/535.19"],["Firefox 14 \u2014 Android Mobil e","Mozilla/5.0 (Android; Mobile; rv:14.0) Gecko/14.0 Firefox/14.0"],["Firefox 1 4 \u2014 Android Tablet","Mozilla/5.0 (Android; Tablet; rv:14.0) Gecko/14.0 Fire fox/14.0"],["Firefox 4 \u2014 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"],["Firefox 4 \u2014 Windows","Mozilla/5 .0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"],["Firefox 7 \u2014 Mac","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20100101 Fire fox/7.0.1"],["Firefox 7 \u2014 Windows","Mozilla/5.0 (Windows NT 6.1; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"],["Internet Explorer 10","Moz illa/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)"],["Internet Explo rer 7","Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"],["Internet Explorer 8","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"],["Interne t Explorer 9","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"] ,["iPad \u2014 iOS 7","Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X) AppleWebKi t/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53"],["iPad \u2014 iOS 6","Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"],["iPhone \u2014 iOS 7","Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537 .51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4449d Safari/9537.53"],["iPhone \u2014 iOS 6","Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit /536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25"],["MeeGo \u2014 Nokia N9","Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13"],["Opera 18 \u2014 Mac","Mozilla /5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) C hrome/31.0.1650.63 Safari/537.36 OPR/18.0.1284.68"],["Opera 18 \u2014 Windows"," Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0. 1650.63 Safari/537.36 OPR/18.0.1284.68"],["Opera 12 \u2014 Mac","Opera/9.80 (Mac intosh; Intel Mac OS X 10.9.1) Presto/2.12.388 Version/12.16"],["Opera 12 \u2014 Windows","Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16"],];WebInsp ector.OverridesView.UserAgentTab.prototype={_createUserAgentSelectRowElement:fun ction()
283 {var userAgent=WebInspector.settings.userAgent.get();var userAgents=WebInspector .OverridesView.UserAgentTab._userAgents.concat([[WebInspector.UIString("Other"), "Other"]]);var fieldsetElement=WebInspector.SettingsTab.createSettingFieldset(We bInspector.settings.overrideUserAgent);if(WebInspector.isInspectingDevice()) 672 {var userAgent=WebInspector.settings.userAgent.get();var userAgents=WebInspector .OverridesView.UserAgentTab._userAgents.concat([[WebInspector.UIString("Other"), "Other"]]);var fieldsetElement=WebInspector.SettingsUI.createSettingFieldset(Web Inspector.settings.overrideUserAgent);if(WebInspector.OverridesSupport.isInspect ingDevice())
284 fieldsetElement.disabled=true;this._selectElement=fieldsetElement.createChild("s elect");fieldsetElement.createChild("br");this._otherUserAgentElement=fieldsetEl ement.createChild("input");this._otherUserAgentElement.type="text";this._otherUs erAgentElement.value=userAgent;this._otherUserAgentElement.title=userAgent;var s electionRestored=false;for(var i=0;i<userAgents.length;++i){var agent=userAgents [i];var option=new Option(agent[0],agent[1]);option._metrics=agent[2]?agent[2]:" ";this._selectElement.add(option);if(userAgent===agent[1]){this._selectElement.s electedIndex=i;selectionRestored=true;}} 673 fieldsetElement.disabled=true;this._selectElement=fieldsetElement.createChild("s elect");fieldsetElement.createChild("br");this._otherUserAgentElement=fieldsetEl ement.createChild("input");this._otherUserAgentElement.type="text";this._otherUs erAgentElement.value=userAgent;this._otherUserAgentElement.title=userAgent;var s electionRestored=false;for(var i=0;i<userAgents.length;++i){var agent=userAgents [i];var option=new Option(agent[0],agent[1]);option._metrics=agent[2]?agent[2]:" ";this._selectElement.add(option);if(userAgent===agent[1]){this._selectElement.s electedIndex=i;selectionRestored=true;}}
285 if(!selectionRestored){if(!userAgent) 674 if(!selectionRestored){if(!userAgent)
286 this._selectElement.selectedIndex=0;else 675 this._selectElement.selectedIndex=0;else
287 this._selectElement.selectedIndex=userAgents.length-1;} 676 this._selectElement.selectedIndex=userAgents.length-1;}
288 this._selectElement.addEventListener("change",this._userAgentChanged.bind(this,t rue),false);WebInspector.settings.userAgent.addChangeListener(this._userAgentSet tingChanged,this);fieldsetElement.addEventListener("dblclick",textDoubleClicked. bind(this),false);this._otherUserAgentElement.addEventListener("blur",textChange d.bind(this),false);function textDoubleClicked() 677 this._selectElement.addEventListener("change",this._userAgentChanged.bind(this,t rue),false);WebInspector.settings.userAgent.addChangeListener(this._userAgentSet tingChanged,this);fieldsetElement.addEventListener("dblclick",textDoubleClicked. bind(this),false);this._otherUserAgentElement.addEventListener("blur",textChange d.bind(this),false);function textDoubleClicked()
289 {this._selectElement.selectedIndex=userAgents.length-1;this._userAgentChanged(); } 678 {this._selectElement.selectedIndex=userAgents.length-1;this._userAgentChanged(); }
290 function textChanged() 679 function textChanged()
291 {if(WebInspector.settings.userAgent.get()!==this._otherUserAgentElement.value) 680 {if(WebInspector.settings.userAgent.get()!==this._otherUserAgentElement.value)
292 WebInspector.settings.userAgent.set(this._otherUserAgentElement.value);} 681 WebInspector.settings.userAgent.set(this._otherUserAgentElement.value);}
293 return fieldsetElement;},_userAgentChanged:function(isUserGesture) 682 return fieldsetElement;},_userAgentChanged:function(isUserGesture)
294 {var value=this._selectElement.options[this._selectElement.selectedIndex].value; if(value!=="Other"){WebInspector.settings.userAgent.set(value);this._otherUserAg entElement.value=value;this._otherUserAgentElement.title=value;this._otherUserAg entElement.disabled=true;}else{this._otherUserAgentElement.disabled=false;this._ otherUserAgentElement.focus();}},_userAgentSettingChanged:function() 683 {var value=this._selectElement.options[this._selectElement.selectedIndex].value; if(value!=="Other"){WebInspector.settings.userAgent.set(value);this._otherUserAg entElement.value=value;this._otherUserAgentElement.title=value;this._otherUserAg entElement.disabled=true;}else{this._otherUserAgentElement.disabled=false;this._ otherUserAgentElement.focus();}},_userAgentSettingChanged:function()
295 {var value=WebInspector.settings.userAgent.get();var options=this._selectElement .options;var foundMatch=false;for(var i=0;i<options.length;++i){if(options[i].va lue===value){if(this._selectElement.selectedIndex!==i) 684 {var value=WebInspector.settings.userAgent.get();var options=this._selectElement .options;var foundMatch=false;for(var i=0;i<options.length;++i){if(options[i].va lue===value){if(this._selectElement.selectedIndex!==i)
296 this._selectElement.selectedIndex=i;foundMatch=true;break;}} 685 this._selectElement.selectedIndex=i;foundMatch=true;break;}}
297 this._otherUserAgentElement.disabled=foundMatch;if(!foundMatch) 686 this._otherUserAgentElement.disabled=foundMatch;if(!foundMatch)
298 this._selectElement.selectedIndex=options.length-1;if(this._otherUserAgentElemen t.value!==value){this._otherUserAgentElement.value=value;this._otherUserAgentEle ment.title=value;}},__proto__:WebInspector.OverridesView.Tab.prototype} 687 this._selectElement.selectedIndex=options.length-1;if(this._otherUserAgentElemen t.value!==value){this._otherUserAgentElement.value=value;this._otherUserAgentEle ment.title=value;}},__proto__:WebInspector.OverridesView.Tab.prototype}
299 WebInspector.OverridesView.SensorsTab=function() 688 WebInspector.OverridesView.SensorsTab=function()
300 {WebInspector.OverridesView.Tab.call(this,"sensors",WebInspector.UIString("Senso rs"),[WebInspector.settings.emulateTouchEvents,WebInspector.settings.overrideGeo location,WebInspector.settings.overrideDeviceOrientation]);this.element.classLis t.add("overrides-sensors");this.registerRequiredCSS("accelerometer.css");if(!Web Inspector.isInspectingDevice()) 689 {WebInspector.OverridesView.Tab.call(this,"sensors",WebInspector.UIString("Senso rs"),[WebInspector.settings.emulateTouchEvents,WebInspector.settings.overrideGeo location,WebInspector.settings.overrideDeviceOrientation]);this.element.classLis t.add("overrides-sensors");this.registerRequiredCSS("accelerometer.css");if(!Web Inspector.OverridesSupport.isInspectingDevice())
301 this.element.appendChild(this._createSettingCheckbox(WebInspector.UIString("Emul ate touch screen"),WebInspector.settings.emulateTouchEvents));this._appendGeoloc ationOverrideControl();if(!WebInspector.isInspectingDevice()) 690 this.element.appendChild(this._createSettingCheckbox(WebInspector.UIString("Emul ate touch screen"),WebInspector.settings.emulateTouchEvents));this._appendGeoloc ationOverrideControl();this._apendDeviceOrientationOverrideControl();}
302 this._apendDeviceOrientationOverrideControl();}
303 WebInspector.OverridesView.SensorsTab.prototype={_appendGeolocationOverrideContr ol:function() 691 WebInspector.OverridesView.SensorsTab.prototype={_appendGeolocationOverrideContr ol:function()
304 {const geolocationSetting=WebInspector.settings.geolocationOverride.get();var ge olocation=WebInspector.OverridesSupport.GeolocationPosition.parseSetting(geoloca tionSetting);this.element.appendChild(this._createSettingCheckbox(WebInspector.U IString("Emulate geolocation coordinates"),WebInspector.settings.overrideGeoloca tion,this._geolocationOverrideCheckboxClicked.bind(this)));this.element.appendCh ild(this._createGeolocationOverrideElement(geolocation));this._geolocationOverri deCheckboxClicked(WebInspector.settings.overrideGeolocation.get());},_geolocatio nOverrideCheckboxClicked:function(enabled) 692 {const geolocationSetting=WebInspector.settings.geolocationOverride.get();var ge olocation=WebInspector.OverridesSupport.GeolocationPosition.parseSetting(geoloca tionSetting);this.element.appendChild(this._createSettingCheckbox(WebInspector.U IString("Emulate geolocation coordinates"),WebInspector.settings.overrideGeoloca tion,this._geolocationOverrideCheckboxClicked.bind(this)));this.element.appendCh ild(this._createGeolocationOverrideElement(geolocation));this._geolocationOverri deCheckboxClicked(WebInspector.settings.overrideGeolocation.get());},_geolocatio nOverrideCheckboxClicked:function(enabled)
305 {if(enabled&&!this._latitudeElement.value) 693 {if(enabled&&!this._latitudeElement.value)
306 this._latitudeElement.focus();},_applyGeolocationUserInput:function() 694 this._latitudeElement.focus();},_applyGeolocationUserInput:function()
307 {this._setGeolocationPosition(WebInspector.OverridesSupport.GeolocationPosition. parseUserInput(this._latitudeElement.value.trim(),this._longitudeElement.value.t rim(),this._geolocationErrorElement.checked),true);},_setGeolocationPosition:fun ction(geolocation,userInputModified) 695 {this._setGeolocationPosition(WebInspector.OverridesSupport.GeolocationPosition. parseUserInput(this._latitudeElement.value.trim(),this._longitudeElement.value.t rim(),this._geolocationErrorElement.checked),true);},_setGeolocationPosition:fun ction(geolocation,userInputModified)
308 {if(!geolocation) 696 {if(!geolocation)
309 return;if(!userInputModified){this._latitudeElement.value=geolocation.latitude;t his._longitudeElement.value=geolocation.longitude;} 697 return;if(!userInputModified){this._latitudeElement.value=geolocation.latitude;t his._longitudeElement.value=geolocation.longitude;}
310 var value=geolocation.toSetting();WebInspector.settings.geolocationOverride.set( value);},_createGeolocationOverrideElement:function(geolocation) 698 var value=geolocation.toSetting();WebInspector.settings.geolocationOverride.set( value);},_createGeolocationOverrideElement:function(geolocation)
311 {var fieldsetElement=WebInspector.SettingsTab.createSettingFieldset(WebInspector .settings.overrideGeolocation);fieldsetElement.id="geolocation-override-section" ;var tableElement=fieldsetElement.createChild("table");var rowElement=tableEleme nt.createChild("tr");var cellElement=rowElement.createChild("td");cellElement=ro wElement.createChild("td");cellElement.appendChild(document.createTextNode(WebIn spector.UIString("Lat = ")));this._latitudeElement=this._createInput(cellElement ,"geolocation-override-latitude",String(geolocation.latitude),this._applyGeoloca tionUserInput.bind(this),true);cellElement.appendChild(document.createTextNode(" , "));cellElement.appendChild(document.createTextNode(WebInspector.UIString("Lo n = ")));this._longitudeElement=this._createInput(cellElement,"geolocation-overr ide-longitude",String(geolocation.longitude),this._applyGeolocationUserInput.bin d(this),true);rowElement=tableElement.createChild("tr");cellElement=rowElement.c reateChild("td");cellElement.colSpan=2;var geolocationErrorLabelElement=document .createElement("label");var geolocationErrorCheckboxElement=geolocationErrorLabe lElement.createChild("input");geolocationErrorCheckboxElement.id="geolocation-er ror";geolocationErrorCheckboxElement.type="checkbox";geolocationErrorCheckboxEle ment.checked=!geolocation||geolocation.error;geolocationErrorCheckboxElement.add EventListener("click",this._applyGeolocationUserInput.bind(this),false);geolocat ionErrorLabelElement.appendChild(document.createTextNode(WebInspector.UIString(" Emulate position unavailable")));this._geolocationErrorElement=geolocationErrorC heckboxElement;cellElement.appendChild(geolocationErrorLabelElement);return fiel dsetElement;},_apendDeviceOrientationOverrideControl:function() 699 {var fieldsetElement=WebInspector.SettingsUI.createSettingFieldset(WebInspector. settings.overrideGeolocation);fieldsetElement.id="geolocation-override-section"; var tableElement=fieldsetElement.createChild("table");var rowElement=tableElemen t.createChild("tr");var cellElement=rowElement.createChild("td");cellElement=row Element.createChild("td");cellElement.appendChild(document.createTextNode(WebIns pector.UIString("Lat = ")));this._latitudeElement=this._createInput(cellElement, "geolocation-override-latitude",String(geolocation.latitude),this._applyGeolocat ionUserInput.bind(this),true);cellElement.appendChild(document.createTextNode(" , "));cellElement.appendChild(document.createTextNode(WebInspector.UIString("Lon = ")));this._longitudeElement=this._createInput(cellElement,"geolocation-overri de-longitude",String(geolocation.longitude),this._applyGeolocationUserInput.bind (this),true);rowElement=tableElement.createChild("tr");cellElement=rowElement.cr eateChild("td");cellElement.colSpan=2;var geolocationErrorLabelElement=document. createElement("label");var geolocationErrorCheckboxElement=geolocationErrorLabel Element.createChild("input");geolocationErrorCheckboxElement.id="geolocation-err or";geolocationErrorCheckboxElement.type="checkbox";geolocationErrorCheckboxElem ent.checked=!geolocation||geolocation.error;geolocationErrorCheckboxElement.addE ventListener("click",this._applyGeolocationUserInput.bind(this),false);geolocati onErrorLabelElement.appendChild(document.createTextNode(WebInspector.UIString("E mulate position unavailable")));this._geolocationErrorElement=geolocationErrorCh eckboxElement;cellElement.appendChild(geolocationErrorLabelElement);return field setElement;},_apendDeviceOrientationOverrideControl:function()
312 {const deviceOrientationSetting=WebInspector.settings.deviceOrientationOverride. get();var deviceOrientation=WebInspector.OverridesSupport.DeviceOrientation.pars eSetting(deviceOrientationSetting);this.element.appendChild(this._createSettingC heckbox(WebInspector.UIString("Accelerometer"),WebInspector.settings.overrideDev iceOrientation,this._deviceOrientationOverrideCheckboxClicked.bind(this)));this. element.appendChild(this._createDeviceOrientationOverrideElement(deviceOrientati on));this._deviceOrientationOverrideCheckboxClicked(WebInspector.settings.overri deDeviceOrientation.get());},_deviceOrientationOverrideCheckboxClicked:function( enabled) 700 {const deviceOrientationSetting=WebInspector.settings.deviceOrientationOverride. get();var deviceOrientation=WebInspector.OverridesSupport.DeviceOrientation.pars eSetting(deviceOrientationSetting);this.element.appendChild(this._createSettingC heckbox(WebInspector.UIString("Accelerometer"),WebInspector.settings.overrideDev iceOrientation,this._deviceOrientationOverrideCheckboxClicked.bind(this)));this. element.appendChild(this._createDeviceOrientationOverrideElement(deviceOrientati on));this._deviceOrientationOverrideCheckboxClicked(WebInspector.settings.overri deDeviceOrientation.get());},_deviceOrientationOverrideCheckboxClicked:function( enabled)
313 {if(enabled&&!this._alphaElement.value) 701 {if(enabled&&!this._alphaElement.value)
314 this._alphaElement.focus();},_applyDeviceOrientationUserInput:function() 702 this._alphaElement.focus();},_applyDeviceOrientationUserInput:function()
315 {this._setDeviceOrientation(WebInspector.OverridesSupport.DeviceOrientation.pars eUserInput(this._alphaElement.value.trim(),this._betaElement.value.trim(),this._ gammaElement.value.trim()),WebInspector.OverridesView.SensorsTab.DeviceOrientati onModificationSource.UserInput);},_resetDeviceOrientation:function() 703 {this._setDeviceOrientation(WebInspector.OverridesSupport.DeviceOrientation.pars eUserInput(this._alphaElement.value.trim(),this._betaElement.value.trim(),this._ gammaElement.value.trim()),WebInspector.OverridesView.SensorsTab.DeviceOrientati onModificationSource.UserInput);},_resetDeviceOrientation:function()
316 {this._setDeviceOrientation(new WebInspector.OverridesSupport.DeviceOrientation( 0,0,0),WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource .ResetButton);},_setDeviceOrientation:function(deviceOrientation,modificationSou rce) 704 {this._setDeviceOrientation(new WebInspector.OverridesSupport.DeviceOrientation( 0,0,0),WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource .ResetButton);},_setDeviceOrientation:function(deviceOrientation,modificationSou rce)
317 {if(!deviceOrientation) 705 {if(!deviceOrientation)
318 return;if(modificationSource!=WebInspector.OverridesView.SensorsTab.DeviceOrient ationModificationSource.UserInput){this._alphaElement.value=deviceOrientation.al pha;this._betaElement.value=deviceOrientation.beta;this._gammaElement.value=devi ceOrientation.gamma;} 706 return;if(modificationSource!=WebInspector.OverridesView.SensorsTab.DeviceOrient ationModificationSource.UserInput){this._alphaElement.value=deviceOrientation.al pha;this._betaElement.value=deviceOrientation.beta;this._gammaElement.value=devi ceOrientation.gamma;}
319 if(modificationSource!=WebInspector.OverridesView.SensorsTab.DeviceOrientationMo dificationSource.UserDrag) 707 if(modificationSource!=WebInspector.OverridesView.SensorsTab.DeviceOrientationMo dificationSource.UserDrag)
320 this._setBoxOrientation(deviceOrientation);var value=deviceOrientation.toSetting ();WebInspector.settings.deviceOrientationOverride.set(value);},_createAxisInput :function(parentElement,id,label,defaultText) 708 this._setBoxOrientation(deviceOrientation);var value=deviceOrientation.toSetting ();WebInspector.settings.deviceOrientationOverride.set(value);},_createAxisInput :function(parentElement,id,label,defaultText)
321 {var div=parentElement.createChild("div","accelerometer-axis-input-container");d iv.appendChild(document.createTextNode(label));return this._createInput(div,id,d efaultText,this._applyDeviceOrientationUserInput.bind(this),true);},_createDevic eOrientationOverrideElement:function(deviceOrientation) 709 {var div=parentElement.createChild("div","accelerometer-axis-input-container");d iv.appendChild(document.createTextNode(label));return this._createInput(div,id,d efaultText,this._applyDeviceOrientationUserInput.bind(this),true);},_createDevic eOrientationOverrideElement:function(deviceOrientation)
322 {var fieldsetElement=WebInspector.SettingsTab.createSettingFieldset(WebInspector .settings.overrideDeviceOrientation);fieldsetElement.id="device-orientation-over ride-section";var tableElement=fieldsetElement.createChild("table");var rowEleme nt=tableElement.createChild("tr");var cellElement=rowElement.createChild("td","a ccelerometer-inputs-cell");this._alphaElement=this._createAxisInput(cellElement, "device-orientation-override-alpha","\u03B1: ",String(deviceOrientation.alpha)); this._betaElement=this._createAxisInput(cellElement,"device-orientation-override -beta","\u03B2: ",String(deviceOrientation.beta));this._gammaElement=this._creat eAxisInput(cellElement,"device-orientation-override-gamma","\u03B3: ",String(dev iceOrientation.gamma));var resetButton=cellElement.createChild("button","setting s-tab-text-button accelerometer-reset-button");resetButton.textContent=WebInspec tor.UIString("Reset");resetButton.addEventListener("click",this._resetDeviceOrie ntation.bind(this),false);this._stageElement=rowElement.createChild("td","accele rometer-stage");this._boxElement=this._stageElement.createChild("section","accel erometer-box");this._boxElement.createChild("section","front");this._boxElement. createChild("section","top");this._boxElement.createChild("section","back");this ._boxElement.createChild("section","left");this._boxElement.createChild("section ","right");this._boxElement.createChild("section","bottom");WebInspector.install DragHandle(this._stageElement,this._onBoxDragStart.bind(this),this._onBoxDrag.bi nd(this),this._onBoxDragEnd.bind(this),"move");this._setBoxOrientation(deviceOri entation);return fieldsetElement;},_setBoxOrientation:function(deviceOrientation ) 710 {var fieldsetElement=WebInspector.SettingsUI.createSettingFieldset(WebInspector. settings.overrideDeviceOrientation);fieldsetElement.id="device-orientation-overr ide-section";var tableElement=fieldsetElement.createChild("table");var rowElemen t=tableElement.createChild("tr");var cellElement=rowElement.createChild("td","ac celerometer-inputs-cell");this._alphaElement=this._createAxisInput(cellElement," device-orientation-override-alpha","\u03B1: ",String(deviceOrientation.alpha));t his._betaElement=this._createAxisInput(cellElement,"device-orientation-override- beta","\u03B2: ",String(deviceOrientation.beta));this._gammaElement=this._create AxisInput(cellElement,"device-orientation-override-gamma","\u03B3: ",String(devi ceOrientation.gamma));var resetButton=cellElement.createChild("button","settings -tab-text-button accelerometer-reset-button");resetButton.textContent=WebInspect or.UIString("Reset");resetButton.addEventListener("click",this._resetDeviceOrien tation.bind(this),false);this._stageElement=rowElement.createChild("td","acceler ometer-stage");this._boxElement=this._stageElement.createChild("section","accele rometer-box");this._boxElement.createChild("section","front");this._boxElement.c reateChild("section","top");this._boxElement.createChild("section","back");this. _boxElement.createChild("section","left");this._boxElement.createChild("section" ,"right");this._boxElement.createChild("section","bottom");WebInspector.installD ragHandle(this._stageElement,this._onBoxDragStart.bind(this),this._onBoxDrag.bin d(this),this._onBoxDragEnd.bind(this),"move");this._setBoxOrientation(deviceOrie ntation);return fieldsetElement;},_setBoxOrientation:function(deviceOrientation)
323 {var matrix=new WebKitCSSMatrix();this._boxMatrix=matrix.rotate(deviceOrientatio n.beta,deviceOrientation.gamma,deviceOrientation.alpha);this._boxElement.style.w ebkitTransform=this._boxMatrix.toString();},_onBoxDrag:function(event) 711 {var matrix=new WebKitCSSMatrix();this._boxMatrix=matrix.rotate(-deviceOrientati on.beta,deviceOrientation.gamma,-deviceOrientation.alpha);this._boxElement.style .webkitTransform=this._boxMatrix.toString();},_onBoxDrag:function(event)
324 {var mouseMoveVector=this._calculateRadiusVector(event.x,event.y);if(!mouseMoveV ector) 712 {var mouseMoveVector=this._calculateRadiusVector(event.x,event.y);if(!mouseMoveV ector)
325 return true;event.consume(true);var axis=WebInspector.Geometry.crossProduct(this ._mouseDownVector,mouseMoveVector);axis.normalize();var angle=WebInspector.Geome try.calculateAngle(this._mouseDownVector,mouseMoveVector);var matrix=new WebKitC SSMatrix();var rotationMatrix=matrix.rotateAxisAngle(axis.x,axis.y,axis.z,angle) ;this._currentMatrix=rotationMatrix.multiply(this._boxMatrix) 713 return true;event.consume(true);var axis=WebInspector.Geometry.crossProduct(this ._mouseDownVector,mouseMoveVector);axis.normalize();var angle=WebInspector.Geome try.calculateAngle(this._mouseDownVector,mouseMoveVector);var matrix=new WebKitC SSMatrix();var rotationMatrix=matrix.rotateAxisAngle(axis.x,axis.y,axis.z,angle) ;this._currentMatrix=rotationMatrix.multiply(this._boxMatrix)
326 this._boxElement.style.webkitTransform=this._currentMatrix;var eulerAngles=WebIn spector.Geometry.EulerAngles.fromRotationMatrix(this._currentMatrix);var newOrie ntation=new WebInspector.OverridesSupport.DeviceOrientation(eulerAngles.alpha,eu lerAngles.beta,eulerAngles.gamma);this._setDeviceOrientation(newOrientation,WebI nspector.OverridesView.SensorsTab.DeviceOrientationModificationSource.UserDrag); return false;},_onBoxDragStart:function(event) 714 this._boxElement.style.webkitTransform=this._currentMatrix;var eulerAngles=WebIn spector.Geometry.EulerAngles.fromRotationMatrix(this._currentMatrix);var newOrie ntation=new WebInspector.OverridesSupport.DeviceOrientation(-eulerAngles.alpha,- eulerAngles.beta,eulerAngles.gamma);this._setDeviceOrientation(newOrientation,We bInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource.UserDrag );return false;},_onBoxDragStart:function(event)
327 {if(!WebInspector.settings.overrideDeviceOrientation.get()) 715 {if(!WebInspector.settings.overrideDeviceOrientation.get())
328 return false;this._mouseDownVector=this._calculateRadiusVector(event.x,event.y); if(!this._mouseDownVector) 716 return false;this._mouseDownVector=this._calculateRadiusVector(event.x,event.y); if(!this._mouseDownVector)
329 return false;event.consume(true);return true;},_onBoxDragEnd:function() 717 return false;event.consume(true);return true;},_onBoxDragEnd:function()
330 {this._boxMatrix=this._currentMatrix;},_calculateRadiusVector:function(x,y) 718 {this._boxMatrix=this._currentMatrix;},_calculateRadiusVector:function(x,y)
331 {var rect=this._stageElement.getBoundingClientRect();var radius=Math.max(rect.wi dth,rect.height)/2;var sphereX=(x-rect.left-rect.width/2)/radius;var sphereY=(y- rect.top-rect.height/2)/radius;var sqrSum=sphereX*sphereX+sphereY*sphereY;if(sqr Sum>0.5) 719 {var rect=this._stageElement.getBoundingClientRect();var radius=Math.max(rect.wi dth,rect.height)/2;var sphereX=(x-rect.left-rect.width/2)/radius;var sphereY=(y- rect.top-rect.height/2)/radius;var sqrSum=sphereX*sphereX+sphereY*sphereY;if(sqr Sum>0.5)
332 return new WebInspector.Geometry.Vector(sphereX,sphereY,0.5/Math.sqrt(sqrSum));r eturn new WebInspector.Geometry.Vector(sphereX,sphereY,Math.sqrt(1-sqrSum));},__ proto__:WebInspector.OverridesView.Tab.prototype} 720 return new WebInspector.Geometry.Vector(sphereX,sphereY,0.5/Math.sqrt(sqrSum));r eturn new WebInspector.Geometry.Vector(sphereX,sphereY,Math.sqrt(1-sqrSum));},__ proto__:WebInspector.OverridesView.Tab.prototype}
333 WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource={UserI nput:"userInput",UserDrag:"userDrag",ResetButton:"resetButton"};WebInspector.Pla tformFontsSidebarPane=function() 721 WebInspector.OverridesView.SensorsTab.DeviceOrientationModificationSource={UserI nput:"userInput",UserDrag:"userDrag",ResetButton:"resetButton"};WebInspector.Pla tformFontsSidebarPane=function()
334 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Fonts"));this.element .classList.add("platform-fonts");WebInspector.domAgent.addEventListener(WebInspe ctor.DOMAgent.Events.AttrModified,this._onNodeChange.bind(this));WebInspector.do mAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved,this._onNodeCha nge.bind(this));WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Eve nts.CharacterDataModified,this._onNodeChange.bind(this));this._sectionTitle=docu ment.createElementWithClass("div","sidebar-separator");this.element.insertBefore (this._sectionTitle,this.bodyElement);this._sectionTitle.textContent=WebInspecto r.UIString("Rendered Fonts");this._fontStatsSection=this.bodyElement.createChild ("div","stats-section");} 722 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Fonts"));this.element .classList.add("platform-fonts");WebInspector.domModel.addEventListener(WebInspe ctor.DOMModel.Events.AttrModified,this._onNodeChange.bind(this));WebInspector.do mModel.addEventListener(WebInspector.DOMModel.Events.AttrRemoved,this._onNodeCha nge.bind(this));WebInspector.domModel.addEventListener(WebInspector.DOMModel.Eve nts.CharacterDataModified,this._onNodeChange.bind(this));this._sectionTitle=docu ment.createElementWithClass("div","sidebar-separator");this.element.insertBefore (this._sectionTitle,this.bodyElement);this._sectionTitle.textContent=WebInspecto r.UIString("Rendered Fonts");this._fontStatsSection=this.bodyElement.createChild ("div","stats-section");}
335 WebInspector.PlatformFontsSidebarPane.prototype={_onNodeChange:function() 723 WebInspector.PlatformFontsSidebarPane.prototype={_onNodeChange:function()
336 {if(this._innerUpdateTimeout) 724 {if(this._innerUpdateTimeout)
337 return;this._innerUpdateTimeout=setTimeout(this._innerUpdate.bind(this),100);},u pdate:function(node) 725 return;this._innerUpdateTimeout=setTimeout(this._innerUpdate.bind(this),100);},u pdate:function(node)
338 {if(!node){delete this._node;return;} 726 {if(!node){delete this._node;return;}
339 this._node=node;this._innerUpdate();},_innerUpdate:function() 727 this._node=node;this._innerUpdate();},_innerUpdate:function()
340 {if(this._innerUpdateTimeout){clearTimeout(this._innerUpdateTimeout);delete this ._innerUpdateTimeout;} 728 {if(this._innerUpdateTimeout){clearTimeout(this._innerUpdateTimeout);delete this ._innerUpdateTimeout;}
341 if(!this._node) 729 if(!this._node)
342 return;WebInspector.cssModel.getPlatformFontsForNode(this._node.id,this._refresh UI.bind(this,this._node));},_refreshUI:function(node,cssFamilyName,platformFonts ) 730 return;WebInspector.cssModel.getPlatformFontsForNode(this._node.id,this._refresh UI.bind(this,this._node));},_refreshUI:function(node,cssFamilyName,platformFonts )
343 {if(this._node!==node) 731 {if(this._node!==node)
344 return;this._fontStatsSection.removeChildren();var isEmptySection=!platformFonts ||!platformFonts.length;this._sectionTitle.enableStyleClass("hidden",isEmptySect ion);if(isEmptySection) 732 return;this._fontStatsSection.removeChildren();var isEmptySection=!platformFonts ||!platformFonts.length;this._sectionTitle.classList.toggle("hidden",isEmptySect ion);if(isEmptySection)
345 return;platformFonts.sort(function(a,b){return b.glyphCount-a.glyphCount;});for( var i=0;i<platformFonts.length;++i){var fontStatElement=this._fontStatsSection.c reateChild("div","font-stats-item");var fontNameElement=fontStatElement.createCh ild("span","font-name");fontNameElement.textContent=platformFonts[i].familyName; var fontDelimeterElement=fontStatElement.createChild("span","delimeter");fontDel imeterElement.textContent="\u2014";var fontUsageElement=fontStatElement.createCh ild("span","font-usage");var usage=platformFonts[i].glyphCount;fontUsageElement. textContent=usage===1?WebInspector.UIString("%d glyph",usage):WebInspector.UIStr ing("%d glyphs",usage);}},__proto__:WebInspector.SidebarPane.prototype};WebInspe ctor.PropertiesSidebarPane=function() 733 return;platformFonts.sort(function(a,b){return b.glyphCount-a.glyphCount;});for( var i=0;i<platformFonts.length;++i){var fontStatElement=this._fontStatsSection.c reateChild("div","font-stats-item");var fontNameElement=fontStatElement.createCh ild("span","font-name");fontNameElement.textContent=platformFonts[i].familyName; var fontDelimeterElement=fontStatElement.createChild("span","delimeter");fontDel imeterElement.textContent="\u2014";var fontUsageElement=fontStatElement.createCh ild("span","font-usage");var usage=platformFonts[i].glyphCount;fontUsageElement. textContent=usage===1?WebInspector.UIString("%d glyph",usage):WebInspector.UIStr ing("%d glyphs",usage);}},__proto__:WebInspector.SidebarPane.prototype};WebInspe ctor.PropertiesSidebarPane=function()
346 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Properties"));} 734 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Properties"));}
347 WebInspector.PropertiesSidebarPane._objectGroupName="properties-sidebar-pane";We bInspector.PropertiesSidebarPane.prototype={update:function(node) 735 WebInspector.PropertiesSidebarPane._objectGroupName="properties-sidebar-pane";We bInspector.PropertiesSidebarPane.prototype={update:function(node)
348 {var body=this.bodyElement;if(!node){body.removeChildren();this.sections=[];retu rn;} 736 {var body=this.bodyElement;if(!node){body.removeChildren();this.sections=[];retu rn;}
349 WebInspector.RemoteObject.resolveNode(node,WebInspector.PropertiesSidebarPane._o bjectGroupName,nodeResolved.bind(this));function nodeResolved(object) 737 WebInspector.RemoteObject.resolveNode(node,WebInspector.PropertiesSidebarPane._o bjectGroupName,nodeResolved.bind(this));function nodeResolved(object)
350 {if(!object) 738 {if(!object)
351 return;function protoList() 739 return;function protoList()
352 {var proto=this;var result={};var counter=1;while(proto){result[counter++]=proto ;proto=proto.__proto__;} 740 {var proto=this;var result={};var counter=1;while(proto){result[counter++]=proto ;proto=proto.__proto__;}
353 return result;} 741 return result;}
354 object.callFunction(protoList,undefined,nodePrototypesReady.bind(this));object.r elease();} 742 object.callFunction(protoList,undefined,nodePrototypesReady.bind(this));object.r elease();}
355 function nodePrototypesReady(object,wasThrown) 743 function nodePrototypesReady(object,wasThrown)
356 {if(!object||wasThrown) 744 {if(!object||wasThrown)
357 return;object.getOwnProperties(fillSection.bind(this));} 745 return;object.getOwnProperties(fillSection.bind(this));}
358 function fillSection(prototypes) 746 function fillSection(prototypes)
359 {if(!prototypes) 747 {if(!prototypes)
360 return;var body=this.bodyElement;body.removeChildren();this.sections=[];for(var i=0;i<prototypes.length;++i){if(!parseInt(prototypes[i].name,10)) 748 return;var body=this.bodyElement;body.removeChildren();this.sections=[];for(var i=0;i<prototypes.length;++i){if(!parseInt(prototypes[i].name,10))
361 continue;var prototype=prototypes[i].value;var title=prototype.description;if(ti tle.match(/Prototype$/)) 749 continue;var prototype=prototypes[i].value;var title=prototype.description;if(ti tle.match(/Prototype$/))
362 title=title.replace(/Prototype$/,"");var section=new WebInspector.ObjectProperti esSection(prototype,title);this.sections.push(section);body.appendChild(section. element);}}},__proto__:WebInspector.SidebarPane.prototype};WebInspector.Renderin gOptionsView=function() 750 title=title.replace(/Prototype$/,"");var section=new WebInspector.ObjectProperti esSection(prototype,title);this.sections.push(section);body.appendChild(section. element);}}},__proto__:WebInspector.SidebarPane.prototype};WebInspector.Renderin gOptionsView=function()
363 {WebInspector.View.call(this);this.registerRequiredCSS("helpScreen.css");this.el ement.classList.add("help-indent-labels");var div=this.element.createChild("div" ,"settings-tab help-content help-container");div.appendChild(WebInspector.Settin gsTab.createSettingCheckbox(WebInspector.UIString("Show paint rectangles"),WebIn spector.settings.showPaintRects));div.appendChild(WebInspector.SettingsTab.creat eSettingCheckbox(WebInspector.UIString("Show composited layer borders"),WebInspe ctor.settings.showDebugBorders));div.appendChild(WebInspector.SettingsTab.create SettingCheckbox(WebInspector.UIString("Show FPS meter"),WebInspector.settings.sh owFPSCounter));div.appendChild(WebInspector.SettingsTab.createSettingCheckbox(We bInspector.UIString("Enable continuous page repainting"),WebInspector.settings.c ontinuousPainting));var child=WebInspector.SettingsTab.createSettingCheckbox(Web Inspector.UIString("Show potential scroll bottlenecks"),WebInspector.settings.sh owScrollBottleneckRects);child.title=WebInspector.UIString("Shows areas of the p age that slow down scrolling:\nTouch and mousewheel event listeners can delay sc rolling.\nSome areas need to repaint their content when scrolled.");div.appendCh ild(child);} 751 {WebInspector.VBox.call(this);this.registerRequiredCSS("helpScreen.css");this.el ement.classList.add("help-indent-labels");var div=this.element.createChild("div" ,"settings-tab help-content help-container help-no-columns");div.appendChild(Web Inspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show paint rec tangles"),WebInspector.settings.showPaintRects));div.appendChild(WebInspector.Se ttingsUI.createSettingCheckbox(WebInspector.UIString("Show composited layer bord ers"),WebInspector.settings.showDebugBorders));div.appendChild(WebInspector.Sett ingsUI.createSettingCheckbox(WebInspector.UIString("Show FPS meter"),WebInspecto r.settings.showFPSCounter));div.appendChild(WebInspector.SettingsUI.createSettin gCheckbox(WebInspector.UIString("Enable continuous page repainting"),WebInspecto r.settings.continuousPainting));var child=WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Show potential scroll bottlenecks"),WebInspector. settings.showScrollBottleneckRects);child.title=WebInspector.UIString("Shows are as of the page that slow down scrolling:\nTouch and mousewheel event listeners c an delay scrolling.\nSome areas need to repaint their content when scrolled.");d iv.appendChild(child);}
364 WebInspector.RenderingOptionsView.prototype={__proto__:WebInspector.View.prototy pe};WebInspector.StylesSidebarPane=function(computedStylePane,setPseudoClassCall back) 752 WebInspector.RenderingOptionsView.prototype={__proto__:WebInspector.VBox.prototy pe};WebInspector.StylesSidebarPane=function(computedStylePane,setPseudoClassCall back)
365 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Styles"));this._eleme ntStateButton=document.createElement("button");this._elementStateButton.classNam e="pane-title-button element-state";this._elementStateButton.title=WebInspector. UIString("Toggle Element State");this._elementStateButton.addEventListener("clic k",this._toggleElementStatePane.bind(this),false);this.titleElement.appendChild( this._elementStateButton);var addButton=document.createElement("button");addButt on.className="pane-title-button add";addButton.id="add-style-button-test-id";add Button.title=WebInspector.UIString("New Style Rule");addButton.addEventListener( "click",this._createNewRule.bind(this),false);this.titleElement.appendChild(addB utton);this._computedStylePane=computedStylePane;computedStylePane._stylesSideba rPane=this;this._setPseudoClassCallback=setPseudoClassCallback;this.element.addE ventListener("contextmenu",this._contextMenuEventFired.bind(this),true);WebInspe ctor.settings.colorFormat.addChangeListener(this._colorFormatSettingChanged.bind (this));this._createElementStatePane();this.bodyElement.appendChild(this._elemen tStatePane);this._sectionsContainer=document.createElement("div");this.bodyEleme nt.appendChild(this._sectionsContainer);this._spectrumHelper=new WebInspector.Sp ectrumPopupHelper();this._linkifier=new WebInspector.Linkifier(new WebInspector. Linkifier.DefaultCSSFormatter());WebInspector.cssModel.addEventListener(WebInspe ctor.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetOrMediaQueryResultChan ged,this);WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Even ts.StyleSheetRemoved,this._styleSheetOrMediaQueryResultChanged,this);WebInspecto r.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetOrMediaQueryResultChanged,this);WebInspector.cssModel.addEventLi stener(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged,this._styleShee tOrMediaQueryResultChanged,this);WebInspector.domAgent.addEventListener(WebInspe ctor.DOMAgent.Events.AttrModified,this._attributeChanged,this);WebInspector.domA gent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved,this._attributeCh anged,this);WebInspector.settings.showUserAgentStyles.addChangeListener(this._sh owUserAgentStylesSettingChanged.bind(this));WebInspector.resourceTreeModel.addEv entListener(WebInspector.ResourceTreeModel.EventTypes.FrameResized,this._frameRe sized,this);this.element.classList.add("styles-pane");this.element.enableStyleCl ass("show-user-styles",WebInspector.settings.showUserAgentStyles.get());this.ele ment.addEventListener("mousemove",this._mouseMovedOverElement.bind(this),false); document.body.addEventListener("keydown",this._keyDown.bind(this),false);documen t.body.addEventListener("keyup",this._keyUp.bind(this),false);} 753 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Styles"));this._eleme ntStateButton=document.createElement("button");this._elementStateButton.classNam e="pane-title-button element-state";this._elementStateButton.title=WebInspector. UIString("Toggle Element State");this._elementStateButton.addEventListener("clic k",this._toggleElementStatePane.bind(this),false);this.titleElement.appendChild( this._elementStateButton);var addButton=document.createElement("button");addButt on.className="pane-title-button add";addButton.id="add-style-button-test-id";add Button.title=WebInspector.UIString("New Style Rule");addButton.addEventListener( "click",this._createNewRule.bind(this),false);this.titleElement.appendChild(addB utton);this._computedStylePane=computedStylePane;computedStylePane.setHostingPan e(this);this._setPseudoClassCallback=setPseudoClassCallback;this.element.addEven tListener("contextmenu",this._contextMenuEventFired.bind(this),true);WebInspecto r.settings.colorFormat.addChangeListener(this._colorFormatSettingChanged.bind(th is));this._createElementStatePane();this.bodyElement.appendChild(this._elementSt atePane);this._sectionsContainer=document.createElement("div");this.bodyElement. appendChild(this._sectionsContainer);this._spectrumHelper=new WebInspector.Spect rumPopupHelper();this._linkifier=new WebInspector.Linkifier(new WebInspector.Lin kifier.DefaultCSSFormatter());WebInspector.cssModel.addEventListener(WebInspecto r.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetOrMediaQueryResultChanged ,this);WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events. StyleSheetRemoved,this._styleSheetOrMediaQueryResultChanged,this);WebInspector.c ssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,thi s._styleSheetOrMediaQueryResultChanged,this);WebInspector.cssModel.addEventListe ner(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged,this._styleSheetOr MediaQueryResultChanged,this);WebInspector.domModel.addEventListener(WebInspecto r.DOMModel.Events.AttrModified,this._attributeChanged,this);WebInspector.domMode l.addEventListener(WebInspector.DOMModel.Events.AttrRemoved,this._attributeChang ed,this);WebInspector.settings.showUserAgentStyles.addChangeListener(this._showU serAgentStylesSettingChanged.bind(this));WebInspector.resourceTreeModel.addEvent Listener(WebInspector.ResourceTreeModel.EventTypes.FrameResized,this._frameResiz ed,this);this.element.classList.add("styles-pane");this.element.classList.toggle ("show-user-styles",WebInspector.settings.showUserAgentStyles.get());this.elemen t.addEventListener("mousemove",this._mouseMovedOverElement.bind(this),false);doc ument.body.addEventListener("keydown",this._keyDown.bind(this),false);document.b ody.addEventListener("keyup",this._keyUp.bind(this),false);}
366 WebInspector.StylesSidebarPane.PseudoIdNames=["","first-line","first-letter","be fore","after","selection","","-webkit-scrollbar","-webkit-file-upload-button","- webkit-input-placeholder","-webkit-slider-thumb","-webkit-search-cancel-button", "-webkit-search-decoration","-webkit-search-results-decoration","-webkit-search- results-button","-webkit-media-controls-panel","-webkit-media-controls-play-butt on","-webkit-media-controls-mute-button","-webkit-media-controls-timeline","-web kit-media-controls-timeline-container","-webkit-media-controls-volume-slider","- webkit-media-controls-volume-slider-container","-webkit-media-controls-current-t ime-display","-webkit-media-controls-time-remaining-display","-webkit-media-cont rols-seek-back-button","-webkit-media-controls-seek-forward-button","-webkit-med ia-controls-fullscreen-button","-webkit-media-controls-rewind-button","-webkit-m edia-controls-return-to-realtime-button","-webkit-media-controls-toggle-closed-c aptions-button","-webkit-media-controls-status-display","-webkit-scrollbar-thumb ","-webkit-scrollbar-button","-webkit-scrollbar-track","-webkit-scrollbar-track- piece","-webkit-scrollbar-corner","-webkit-resizer","-webkit-inner-spin-button", "-webkit-outer-spin-button"];WebInspector.StylesSidebarPane._colorRegex=/((?:rgb |hsl)a?\([^)]+\)|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;WebInspector.St ylesSidebarPane.createExclamationMark=function(property) 754 WebInspector.StylesSidebarPane.PseudoIdNames=["","first-line","first-letter","be fore","after","selection","","-webkit-scrollbar","-webkit-file-upload-button","- webkit-input-placeholder","-webkit-slider-thumb","-webkit-search-cancel-button", "-webkit-search-decoration","-webkit-search-results-decoration","-webkit-search- results-button","-webkit-media-controls-panel","-webkit-media-controls-play-butt on","-webkit-media-controls-mute-button","-webkit-media-controls-timeline","-web kit-media-controls-timeline-container","-webkit-media-controls-volume-slider","- webkit-media-controls-volume-slider-container","-webkit-media-controls-current-t ime-display","-webkit-media-controls-time-remaining-display","-webkit-media-cont rols-fullscreen-button","-webkit-media-controls-toggle-closed-captions-button"," -webkit-media-controls-status-display","-webkit-scrollbar-thumb","-webkit-scroll bar-button","-webkit-scrollbar-track","-webkit-scrollbar-track-piece","-webkit-s crollbar-corner","-webkit-resizer","-webkit-inner-spin-button","-webkit-outer-sp in-button"];WebInspector.StylesSidebarPane._colorRegex=/((?:rgb|hsl)a?\([^)]+\)| #[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;WebInspector.StylesSidebarPane.c reateExclamationMark=function(property)
367 {var exclamationElement=document.createElement("div");exclamationElement.classNa me="exclamation-mark"+(WebInspector.StylesSidebarPane._ignoreErrorsForProperty(p roperty)?"":" warning-icon-small");exclamationElement.title=WebInspector.CSSMeta data.cssPropertiesMetainfo.keySet()[property.name.toLowerCase()]?WebInspector.UI String("Invalid property value."):WebInspector.UIString("Unknown property name." );return exclamationElement;} 755 {var exclamationElement=document.createElement("div");exclamationElement.classNa me="exclamation-mark"+(WebInspector.StylesSidebarPane._ignoreErrorsForProperty(p roperty)?"":" warning-icon-small");exclamationElement.title=WebInspector.CSSMeta data.cssPropertiesMetainfo.keySet()[property.name.toLowerCase()]?WebInspector.UI String("Invalid property value."):WebInspector.UIString("Unknown property name." );return exclamationElement;}
368 WebInspector.StylesSidebarPane._colorFormat=function(color) 756 WebInspector.StylesSidebarPane._colorFormat=function(color)
369 {const cf=WebInspector.Color.Format;var format;var formatSetting=WebInspector.se ttings.colorFormat.get();if(formatSetting===cf.Original) 757 {const cf=WebInspector.Color.Format;var format;var formatSetting=WebInspector.se ttings.colorFormat.get();if(formatSetting===cf.Original)
370 format=cf.Original;else if(formatSetting===cf.RGB) 758 format=cf.Original;else if(formatSetting===cf.RGB)
371 format=(color.hasAlpha()?cf.RGBA:cf.RGB);else if(formatSetting===cf.HSL) 759 format=(color.hasAlpha()?cf.RGBA:cf.RGB);else if(formatSetting===cf.HSL)
372 format=(color.hasAlpha()?cf.HSLA:cf.HSL);else if(!color.hasAlpha()) 760 format=(color.hasAlpha()?cf.HSLA:cf.HSL);else if(!color.hasAlpha())
373 format=(color.canBeShortHex()?cf.ShortHEX:cf.HEX);else 761 format=(color.canBeShortHex()?cf.ShortHEX:cf.HEX);else
374 format=cf.RGBA;return format;} 762 format=cf.RGBA;return format;}
375 WebInspector.StylesSidebarPane._ignoreErrorsForProperty=function(property){funct ion hasUnknownVendorPrefix(string) 763 WebInspector.StylesSidebarPane._ignoreErrorsForProperty=function(property){funct ion hasUnknownVendorPrefix(string)
376 {return!string.startsWith("-webkit-")&&/^[-_][\w\d]+-\w/.test(string);} 764 {return!string.startsWith("-webkit-")&&/^[-_][\w\d]+-\w/.test(string);}
377 var name=property.name.toLowerCase();if(name.charAt(0)==="_") 765 var name=property.name.toLowerCase();if(name.charAt(0)==="_")
378 return true;if(name==="filter") 766 return true;if(name==="filter")
379 return true;if(name.startsWith("scrollbar-")) 767 return true;if(name.startsWith("scrollbar-"))
380 return true;if(hasUnknownVendorPrefix(name)) 768 return true;if(hasUnknownVendorPrefix(name))
381 return true;var value=property.value.toLowerCase();if(value.endsWith("\9")) 769 return true;var value=property.value.toLowerCase();if(value.endsWith("\9"))
382 return true;if(hasUnknownVendorPrefix(value)) 770 return true;if(hasUnknownVendorPrefix(value))
383 return true;return false;} 771 return true;return false;}
384 WebInspector.StylesSidebarPane.prototype={_contextMenuEventFired:function(event) 772 WebInspector.StylesSidebarPane.prototype={_contextMenuEventFired:function(event)
385 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicabl eItems((event.target));contextMenu.show();},get _forcedPseudoClasses() 773 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicabl eItems((event.target));contextMenu.show();},setFilterBoxContainers:function(matc hedStylesElement,computedStylesElement)
774 {matchedStylesElement.appendChild(this._createCSSFilterControl());this._computed StylePane.setFilterBoxContainer(computedStylesElement);},_createCSSFilterControl :function()
775 {var filterInput=this._createPropertyFilterElement(false,searchHandler.bind(this ));function searchHandler(regex)
776 {this._filterRegex=regex;}
777 return filterInput;},get _forcedPseudoClasses()
386 {return this.node?(this.node.getUserProperty("pseudoState")||undefined):undefine d;},_updateForcedPseudoStateInputs:function() 778 {return this.node?(this.node.getUserProperty("pseudoState")||undefined):undefine d;},_updateForcedPseudoStateInputs:function()
387 {if(!this.node) 779 {if(!this.node)
388 return;var hasPseudoType=!!this.node.pseudoType();this._elementStateButton.enabl eStyleClass("hidden",hasPseudoType);this._elementStatePane.enableStyleClass("exp anded",!hasPseudoType&&this._elementStateButton.classList.contains("toggled"));v ar nodePseudoState=this._forcedPseudoClasses;if(!nodePseudoState) 780 return;var hasPseudoType=!!this.node.pseudoType();this._elementStateButton.class List.toggle("hidden",hasPseudoType);this._elementStatePane.classList.toggle("exp anded",!hasPseudoType&&this._elementStateButton.classList.contains("toggled"));v ar nodePseudoState=this._forcedPseudoClasses;if(!nodePseudoState)
389 nodePseudoState=[];var inputs=this._elementStatePane.inputs;for(var i=0;i<inputs .length;++i) 781 nodePseudoState=[];var inputs=this._elementStatePane.inputs;for(var i=0;i<inputs .length;++i)
390 inputs[i].checked=nodePseudoState.indexOf(inputs[i].state)>=0;},update:function( node,forceUpdate) 782 inputs[i].checked=nodePseudoState.indexOf(inputs[i].state)>=0;},update:function( node,forceUpdate)
391 {this._spectrumHelper.hide();this._discardElementUnderMouse();var refresh=false; if(forceUpdate) 783 {this._spectrumHelper.hide();this._discardElementUnderMouse();var refresh=false; if(forceUpdate)
392 delete this.node;if(!forceUpdate&&(node===this.node)) 784 delete this.node;if(!forceUpdate&&(node===this.node))
393 refresh=true;if(node&&node.nodeType()===Node.TEXT_NODE&&node.parentNode) 785 refresh=true;if(node&&node.nodeType()===Node.TEXT_NODE&&node.parentNode)
394 node=node.parentNode;if(node&&node.nodeType()!==Node.ELEMENT_NODE) 786 node=node.parentNode;if(node&&node.nodeType()!==Node.ELEMENT_NODE)
395 node=null;if(node) 787 node=null;if(node)
396 this.node=node;else 788 this.node=node;else
397 node=this.node;this._updateForcedPseudoStateInputs();if(refresh) 789 node=this.node;this._updateForcedPseudoStateInputs();if(refresh)
398 this._refreshUpdate();else 790 this._refreshUpdate();else
399 this._rebuildUpdate();},_refreshUpdate:function(editedSection,forceFetchComputed Style,userCallback) 791 this._rebuildUpdate();},_refreshUpdate:function(editedSection,forceFetchComputed Style,userCallback)
400 {if(this._refreshUpdateInProgress){this._lastNodeForInnerRefresh=this.node;retur n;} 792 {var callbackWrapper=function()
793 {if(this._filterRegex)
794 this._updateFilter(false);if(userCallback)
795 userCallback();}.bind(this);if(this._refreshUpdateInProgress){this._lastNodeForI nnerRefresh=this.node;return;}
401 var node=this._validateNode(userCallback);if(!node) 796 var node=this._validateNode(userCallback);if(!node)
402 return;function computedStyleCallback(computedStyle) 797 return;function computedStyleCallback(computedStyle)
403 {delete this._refreshUpdateInProgress;if(this._lastNodeForInnerRefresh){delete t his._lastNodeForInnerRefresh;this._refreshUpdate(editedSection,forceFetchCompute dStyle,userCallback);return;} 798 {delete this._refreshUpdateInProgress;if(this._lastNodeForInnerRefresh){delete t his._lastNodeForInnerRefresh;this._refreshUpdate(editedSection,forceFetchCompute dStyle,callbackWrapper);return;}
404 if(this.node===node&&computedStyle) 799 if(this.node===node&&computedStyle)
405 this._innerRefreshUpdate(node,computedStyle,editedSection);if(userCallback) 800 this._innerRefreshUpdate(node,computedStyle,editedSection);callbackWrapper();}
406 userCallback();} 801 if(this._computedStylePane.isShowing()||forceFetchComputedStyle){this._refreshUp dateInProgress=true;WebInspector.cssModel.getComputedStyleAsync(node.id,computed StyleCallback.bind(this));}else{this._innerRefreshUpdate(node,null,editedSection );callbackWrapper();}},_rebuildUpdate:function()
407 if(this._computedStylePane.isShowing()||forceFetchComputedStyle){this._refreshUp dateInProgress=true;WebInspector.cssModel.getComputedStyleAsync(node.id,computed StyleCallback.bind(this));}else{this._innerRefreshUpdate(node,null,editedSection );if(userCallback)
408 userCallback();}},_rebuildUpdate:function()
409 {if(this._rebuildUpdateInProgress){this._lastNodeForInnerRebuild=this.node;retur n;} 802 {if(this._rebuildUpdateInProgress){this._lastNodeForInnerRebuild=this.node;retur n;}
410 var node=this._validateNode();if(!node) 803 var node=this._validateNode();if(!node)
411 return;this._rebuildUpdateInProgress=true;var resultStyles={};function stylesCal lback(matchedResult) 804 return;this._rebuildUpdateInProgress=true;var resultStyles={};function stylesCal lback(matchedResult)
412 {delete this._rebuildUpdateInProgress;var lastNodeForRebuild=this._lastNodeForIn nerRebuild;if(lastNodeForRebuild){delete this._lastNodeForInnerRebuild;if(lastNo deForRebuild!==this.node){this._rebuildUpdate();return;}} 805 {delete this._rebuildUpdateInProgress;var lastNodeForRebuild=this._lastNodeForIn nerRebuild;if(lastNodeForRebuild){delete this._lastNodeForInnerRebuild;if(lastNo deForRebuild!==this.node){this._rebuildUpdate();return;}}
413 if(matchedResult&&this.node===node){resultStyles.matchedCSSRules=matchedResult.m atchedCSSRules;resultStyles.pseudoElements=matchedResult.pseudoElements;resultSt yles.inherited=matchedResult.inherited;this._innerRebuildUpdate(node,resultStyle s);} 806 if(matchedResult&&this.node===node){resultStyles.matchedCSSRules=matchedResult.m atchedCSSRules;resultStyles.pseudoElements=matchedResult.pseudoElements;resultSt yles.inherited=matchedResult.inherited;this._innerRebuildUpdate(node,resultStyle s);}
414 if(lastNodeForRebuild){this._rebuildUpdate();return;}} 807 if(lastNodeForRebuild){this._rebuildUpdate();return;}}
415 function inlineCallback(inlineStyle,attributesStyle) 808 function inlineCallback(inlineStyle,attributesStyle)
416 {resultStyles.inlineStyle=inlineStyle;resultStyles.attributesStyle=attributesSty le;} 809 {resultStyles.inlineStyle=inlineStyle;resultStyles.attributesStyle=attributesSty le;}
417 function computedCallback(computedStyle) 810 function computedCallback(computedStyle)
418 {resultStyles.computedStyle=computedStyle;} 811 {resultStyles.computedStyle=computedStyle;}
419 if(this._computedStylePane.isShowing()) 812 if(this._computedStylePane.isShowing())
420 WebInspector.cssModel.getComputedStyleAsync(node.id,computedCallback.bind(this)) ;WebInspector.cssModel.getInlineStylesAsync(node.id,inlineCallback.bind(this));W ebInspector.cssModel.getMatchedStylesAsync(node.id,true,true,stylesCallback.bind (this));},_validateNode:function(userCallback) 813 WebInspector.cssModel.getComputedStyleAsync(node.id,computedCallback);WebInspect or.cssModel.getInlineStylesAsync(node.id,inlineCallback);WebInspector.cssModel.g etMatchedStylesAsync(node.id,true,true,stylesCallback.bind(this));},_validateNod e:function(userCallback)
421 {if(!this.node){this._sectionsContainer.removeChildren();this._computedStylePane .bodyElement.removeChildren();this.sections={};if(userCallback) 814 {if(!this.node){this._sectionsContainer.removeChildren();this._computedStylePane .bodyElement.removeChildren();this.sections={};if(userCallback)
422 userCallback();return null;} 815 userCallback();return null;}
423 return this.node;},_styleSheetOrMediaQueryResultChanged:function() 816 return this.node;},_styleSheetOrMediaQueryResultChanged:function()
424 {if(this._userOperation||this._isEditingStyle) 817 {if(this._userOperation||this._isEditingStyle)
425 return;this._rebuildUpdate();},_frameResized:function() 818 return;this._rebuildUpdate();},_frameResized:function()
426 {function refreshContents() 819 {function refreshContents()
427 {this._rebuildUpdate();delete this._activeTimer;} 820 {this._rebuildUpdate();delete this._activeTimer;}
428 if(this._activeTimer) 821 if(this._activeTimer)
429 clearTimeout(this._activeTimer);this._activeTimer=setTimeout(refreshContents.bin d(this),100);},_attributeChanged:function(event) 822 clearTimeout(this._activeTimer);this._activeTimer=setTimeout(refreshContents.bin d(this),100);},_attributeChanged:function(event)
430 {if(this._isEditingStyle||this._userOperation) 823 {if(this._isEditingStyle||this._userOperation)
431 return;if(!this._canAffectCurrentStyles(event.data.node)) 824 return;if(!this._canAffectCurrentStyles(event.data.node))
432 return;this._rebuildUpdate();},_canAffectCurrentStyles:function(node) 825 return;this._rebuildUpdate();},_canAffectCurrentStyles:function(node)
433 {return this.node&&(this.node===node||node.parentNode===this.node.parentNode||no de.isAncestor(this.node));},_innerRefreshUpdate:function(node,computedStyle,edit edSection) 826 {return this.node&&(this.node===node||node.parentNode===this.node.parentNode||no de.isAncestor(this.node));},_innerRefreshUpdate:function(node,computedStyle,edit edSection)
434 {for(var pseudoId in this.sections){var styleRules=this._refreshStyleRules(this. sections[pseudoId],computedStyle);var usedProperties={};this._markUsedProperties (styleRules,usedProperties);this._refreshSectionsForStyleRules(styleRules,usedPr operties,editedSection);} 827 {for(var pseudoId in this.sections){var styleRules=this._refreshStyleRules(this. sections[pseudoId],computedStyle);var usedProperties={};this._markUsedProperties (styleRules,usedProperties);this._refreshSectionsForStyleRules(styleRules,usedPr operties,editedSection);}
435 if(computedStyle) 828 if(computedStyle)
436 this.sections[0][0].rebuildComputedTrace(this.sections[0]);this._nodeStylesUpdat edForTest(node,false);},_innerRebuildUpdate:function(node,styles) 829 this.sections[0][0].rebuildComputedTrace(this.sections[0]);this._nodeStylesUpdat edForTest(node,false);},_innerRebuildUpdate:function(node,styles)
437 {this._sectionsContainer.removeChildren();this._computedStylePane.bodyElement.re moveChildren();this._linkifier.reset();var styleRules=this._rebuildStyleRules(no de,styles);var usedProperties={};this._markUsedProperties(styleRules,usedPropert ies);this.sections[0]=this._rebuildSectionsForStyleRules(styleRules,usedProperti es,null);var anchorElement=this.sections[0].inheritedPropertiesSeparatorElement; if(styles.computedStyle) 830 {this._sectionsContainer.removeChildren();this._computedStylePane.bodyElement.re moveChildren();this._linkifier.reset();var styleRules=this._rebuildStyleRules(no de,styles);var usedProperties={};this._markUsedProperties(styleRules,usedPropert ies);this.sections[0]=this._rebuildSectionsForStyleRules(styleRules,usedProperti es,null);var anchorElement=this.sections[0].inheritedPropertiesSeparatorElement; if(styles.computedStyle)
438 this.sections[0][0].rebuildComputedTrace(this.sections[0]);for(var i=0;i<styles. pseudoElements.length;++i){var pseudoElementCSSRules=styles.pseudoElements[i];st yleRules=[];var pseudoId=pseudoElementCSSRules.pseudoId;var entry={isStyleSepara tor:true,pseudoId:pseudoId};styleRules.push(entry);for(var j=pseudoElementCSSRul es.rules.length-1;j>=0;--j){var rule=pseudoElementCSSRules.rules[j];styleRules.p ush({style:rule.style,selectorText:rule.selectorText,media:rule.media,sourceURL: rule.resourceURL(),rule:rule,editable:!!(rule.style&&rule.style.id)});} 831 this.sections[0][0].rebuildComputedTrace(this.sections[0]);for(var i=0;i<styles. pseudoElements.length;++i){var pseudoElementCSSRules=styles.pseudoElements[i];st yleRules=[];var pseudoId=pseudoElementCSSRules.pseudoId;var entry={isStyleSepara tor:true,pseudoId:pseudoId};styleRules.push(entry);for(var j=pseudoElementCSSRul es.rules.length-1;j>=0;--j){var rule=pseudoElementCSSRules.rules[j];styleRules.p ush({style:rule.style,selectorText:rule.selectorText,media:rule.media,sourceURL: rule.resourceURL(),rule:rule,editable:!!(rule.style&&rule.style.id)});}
439 usedProperties={};this._markUsedProperties(styleRules,usedProperties);this.secti ons[pseudoId]=this._rebuildSectionsForStyleRules(styleRules,usedProperties,ancho rElement);} 832 usedProperties={};this._markUsedProperties(styleRules,usedProperties);this.secti ons[pseudoId]=this._rebuildSectionsForStyleRules(styleRules,usedProperties,ancho rElement);}
440 this._nodeStylesUpdatedForTest(node,true);},_nodeStylesUpdatedForTest:function(n ode,rebuild) 833 if(this._filterRegex)
834 this._updateFilter(false);this._nodeStylesUpdatedForTest(node,true);},_nodeStyle sUpdatedForTest:function(node,rebuild)
441 {},_refreshStyleRules:function(sections,computedStyle) 835 {},_refreshStyleRules:function(sections,computedStyle)
442 {var nodeComputedStyle=computedStyle;var styleRules=[];for(var i=0;sections&&i<s ections.length;++i){var section=sections[i];if(section.isBlank) 836 {var nodeComputedStyle=computedStyle;var styleRules=[];for(var i=0;sections&&i<s ections.length;++i){var section=sections[i];if(section.isBlank)
443 continue;if(section.computedStyle) 837 continue;if(section.computedStyle)
444 section.styleRule.style=nodeComputedStyle;var styleRule={section:section,style:s ection.styleRule.style,computedStyle:section.computedStyle,rule:section.rule,edi table:!!(section.styleRule.style&&section.styleRule.style.id),isAttribute:sectio n.styleRule.isAttribute,isInherited:section.styleRule.isInherited,parentNode:sec tion.styleRule.parentNode};styleRules.push(styleRule);} 838 section.styleRule.style=nodeComputedStyle;var styleRule={section:section,style:s ection.styleRule.style,computedStyle:section.computedStyle,rule:section.rule,edi table:!!(section.styleRule.style&&section.styleRule.style.id),isAttribute:sectio n.styleRule.isAttribute,isInherited:section.styleRule.isInherited,parentNode:sec tion.styleRule.parentNode};styleRules.push(styleRule);}
445 return styleRules;},_rebuildStyleRules:function(node,styles) 839 return styleRules;},_rebuildStyleRules:function(node,styles)
446 {var nodeComputedStyle=styles.computedStyle;this.sections={};var styleRules=[];f unction addAttributesStyle() 840 {var nodeComputedStyle=styles.computedStyle;this.sections={};var styleRules=[];f unction addAttributesStyle()
447 {if(!styles.attributesStyle) 841 {if(!styles.attributesStyle)
448 return;var attrStyle={style:styles.attributesStyle,editable:false};attrStyle.sel ectorText=node.nodeNameInCorrectCase()+"["+WebInspector.UIString("Attributes Sty le")+"]";styleRules.push(attrStyle);} 842 return;var attrStyle={style:styles.attributesStyle,editable:false};attrStyle.sel ectorText=node.nodeNameInCorrectCase()+"["+WebInspector.UIString("Attributes Sty le")+"]";styleRules.push(attrStyle);}
449 styleRules.push({computedStyle:true,selectorText:"",style:nodeComputedStyle,edit able:false});if(!!node.pseudoType()) 843 styleRules.push({computedStyle:true,selectorText:"",style:nodeComputedStyle,edit able:false});if(!!node.pseudoType())
450 styleRules.push({isStyleSeparator:true,isPlaceholder:true});if(styles.inlineStyl e&&node.nodeType()===Node.ELEMENT_NODE){var inlineStyle={selectorText:"element.s tyle",style:styles.inlineStyle,isAttribute:true};styleRules.push(inlineStyle);} 844 styleRules.push({isStyleSeparator:true,isPlaceholder:true});if(styles.inlineStyl e&&node.nodeType()===Node.ELEMENT_NODE){var inlineStyle={selectorText:"element.s tyle",style:styles.inlineStyle,isAttribute:true};styleRules.push(inlineStyle);}
451 var addedAttributesStyle;for(var i=styles.matchedCSSRules.length-1;i>=0;--i){var rule=styles.matchedCSSRules[i];if((rule.isUser||rule.isUserAgent)&&!addedAttrib utesStyle){addedAttributesStyle=true;addAttributesStyle();} 845 var addedAttributesStyle;for(var i=styles.matchedCSSRules.length-1;i>=0;--i){var rule=styles.matchedCSSRules[i];if((rule.isUser||rule.isUserAgent)&&!addedAttrib utesStyle){addedAttributesStyle=true;addAttributesStyle();}
452 styleRules.push({style:rule.style,selectorText:rule.selectorText,media:rule.medi a,sourceURL:rule.resourceURL(),rule:rule,editable:!!(rule.style&&rule.style.id)} );} 846 styleRules.push({style:rule.style,selectorText:rule.selectorText,media:rule.medi a,sourceURL:rule.resourceURL(),rule:rule,editable:!!(rule.style&&rule.style.id)} );}
453 if(!addedAttributesStyle) 847 if(!addedAttributesStyle)
454 addAttributesStyle();var parentNode=node.parentNode;function insertInheritedNode Separator(node) 848 addAttributesStyle();var parentNode=node.parentNode;function insertInheritedNode Separator(node)
455 {var entry={};entry.isStyleSeparator=true;entry.node=node;styleRules.push(entry) ;} 849 {var entry={};entry.isStyleSeparator=true;entry.node=node;styleRules.push(entry) ;}
456 for(var parentOrdinal=0;parentOrdinal<styles.inherited.length;++parentOrdinal){v ar parentStyles=styles.inherited[parentOrdinal];var separatorInserted=false;if(p arentStyles.inlineStyle){if(this._containsInherited(parentStyles.inlineStyle)){v ar inlineStyle={selectorText:WebInspector.UIString("Style Attribute"),style:pare ntStyles.inlineStyle,isAttribute:true,isInherited:true,parentNode:parentNode};if (!separatorInserted){insertInheritedNodeSeparator(parentNode);separatorInserted= true;} 850 for(var parentOrdinal=0;parentOrdinal<styles.inherited.length;++parentOrdinal){v ar parentStyles=styles.inherited[parentOrdinal];var separatorInserted=false;if(p arentStyles.inlineStyle){if(this._containsInherited(parentStyles.inlineStyle)){v ar inlineStyle={selectorText:WebInspector.UIString("Style Attribute"),style:pare ntStyles.inlineStyle,isAttribute:true,isInherited:true,parentNode:parentNode};if (!separatorInserted){insertInheritedNodeSeparator(parentNode);separatorInserted= true;}
457 styleRules.push(inlineStyle);}} 851 styleRules.push(inlineStyle);}}
458 for(var i=parentStyles.matchedCSSRules.length-1;i>=0;--i){var rulePayload=parent Styles.matchedCSSRules[i];if(!this._containsInherited(rulePayload.style)) 852 for(var i=parentStyles.matchedCSSRules.length-1;i>=0;--i){var rulePayload=parent Styles.matchedCSSRules[i];if(!this._containsInherited(rulePayload.style))
459 continue;var rule=rulePayload;if(!separatorInserted){insertInheritedNodeSeparato r(parentNode);separatorInserted=true;} 853 continue;var rule=rulePayload;if(!separatorInserted){insertInheritedNodeSeparato r(parentNode);separatorInserted=true;}
460 styleRules.push({style:rule.style,selectorText:rule.selectorText,media:rule.medi a,sourceURL:rule.resourceURL(),rule:rule,isInherited:true,parentNode:parentNode, editable:!!(rule.style&&rule.style.id)});} 854 styleRules.push({style:rule.style,selectorText:rule.selectorText,media:rule.medi a,sourceURL:rule.resourceURL(),rule:rule,isInherited:true,parentNode:parentNode, editable:!!(rule.style&&rule.style.id)});}
461 parentNode=parentNode.parentNode;} 855 parentNode=parentNode.parentNode;}
462 return styleRules;},_markUsedProperties:function(styleRules,usedProperties) 856 return styleRules;},_markUsedProperties:function(styleRules,usedProperties)
463 {var foundImportantProperties={};var propertyToEffectiveRule={};var inheritedPro pertyToNode={};for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i]; if(styleRule.computedStyle||styleRule.isStyleSeparator) 857 {var foundImportantProperties={};var propertyToEffectiveRule={};var inheritedPro pertyToNode={};for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i]; if(styleRule.computedStyle||styleRule.isStyleSeparator)
464 continue;if(styleRule.section&&styleRule.section.noAffect) 858 continue;if(styleRule.section&&styleRule.section.noAffect)
465 continue;styleRule.usedProperties={};var style=styleRule.style;var allProperties =style.allProperties;for(var j=0;j<allProperties.length;++j){var property=allPro perties[j];if(!property.isLive||!property.parsedOk) 859 continue;styleRule.usedProperties={};var style=styleRule.style;var allProperties =style.allProperties;for(var j=0;j<allProperties.length;++j){var property=allPro perties[j];if(!property.isLive||!property.parsedOk)
466 continue;if(styleRule.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited (property.name)) 860 continue;if(styleRule.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited (property.name))
467 continue;var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(proper ty.name);if(foundImportantProperties.hasOwnProperty(canonicalName)) 861 continue;var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(proper ty.name);if(foundImportantProperties.hasOwnProperty(canonicalName))
468 continue;var isImportant=property.priority.length;if(!isImportant&&usedPropertie s.hasOwnProperty(canonicalName)) 862 continue;if(!property.important&&usedProperties.hasOwnProperty(canonicalName))
469 continue;var isKnownProperty=propertyToEffectiveRule.hasOwnProperty(canonicalNam e);if(!isKnownProperty&&styleRule.isInherited&&!inheritedPropertyToNode[canonica lName]) 863 continue;var isKnownProperty=propertyToEffectiveRule.hasOwnProperty(canonicalNam e);if(!isKnownProperty&&styleRule.isInherited&&!inheritedPropertyToNode[canonica lName])
470 inheritedPropertyToNode[canonicalName]=styleRule.parentNode;if(isImportant){if(s tyleRule.isInherited&&isKnownProperty&&styleRule.parentNode!==inheritedPropertyT oNode[canonicalName]) 864 inheritedPropertyToNode[canonicalName]=styleRule.parentNode;if(property.importan t){if(styleRule.isInherited&&isKnownProperty&&styleRule.parentNode!==inheritedPr opertyToNode[canonicalName])
471 continue;foundImportantProperties[canonicalName]=true;if(isKnownProperty) 865 continue;foundImportantProperties[canonicalName]=true;if(isKnownProperty)
472 delete propertyToEffectiveRule[canonicalName].usedProperties[canonicalName];} 866 delete propertyToEffectiveRule[canonicalName].usedProperties[canonicalName];}
473 styleRule.usedProperties[canonicalName]=true;usedProperties[canonicalName]=true; propertyToEffectiveRule[canonicalName]=styleRule;}}},_refreshSectionsForStyleRul es:function(styleRules,usedProperties,editedSection) 867 styleRule.usedProperties[canonicalName]=true;usedProperties[canonicalName]=true; propertyToEffectiveRule[canonicalName]=styleRule;}}},_refreshSectionsForStyleRul es:function(styleRules,usedProperties,editedSection)
474 {for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i];var section=st yleRule.section;if(styleRule.computedStyle){section._usedProperties=usedProperti es;section.update();}else{section._usedProperties=styleRule.usedProperties;secti on.update(section===editedSection);}}},_rebuildSectionsForStyleRules:function(st yleRules,usedProperties,anchorElement) 868 {for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i];var section=st yleRule.section;if(styleRule.computedStyle){section._usedProperties=usedProperti es;section.update();}else{section._usedProperties=styleRule.usedProperties;secti on.update(section===editedSection);}}},_rebuildSectionsForStyleRules:function(st yleRules,usedProperties,anchorElement)
475 {var sections=[];for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i ];if(styleRule.isStyleSeparator){var separatorElement=document.createElement("di v");if(styleRule.isPlaceholder){separatorElement.className="styles-sidebar-place holder";this._sectionsContainer.insertBefore(separatorElement,anchorElement);con tinue;} 869 {var sections=[];for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i ];if(styleRule.isStyleSeparator){var separatorElement=document.createElement("di v");if(styleRule.isPlaceholder){separatorElement.className="styles-sidebar-place holder";this._sectionsContainer.insertBefore(separatorElement,anchorElement);con tinue;}
476 separatorElement.className="sidebar-separator";if(styleRule.node){var link=WebIn spector.DOMPresentationUtils.linkifyNodeReference(styleRule.node);separatorEleme nt.appendChild(document.createTextNode(WebInspector.UIString("Inherited from")+" "));separatorElement.appendChild(link);if(!sections.inheritedPropertiesSeparato rElement) 870 separatorElement.className="sidebar-separator";if(styleRule.node){var link=WebIn spector.DOMPresentationUtils.linkifyNodeReference(styleRule.node);separatorEleme nt.appendChild(document.createTextNode(WebInspector.UIString("Inherited from")+" "));separatorElement.appendChild(link);if(!sections.inheritedPropertiesSeparato rElement)
477 sections.inheritedPropertiesSeparatorElement=separatorElement;}else if("pseudoId "in styleRule){var pseudoName=WebInspector.StylesSidebarPane.PseudoIdNames[style Rule.pseudoId];if(pseudoName) 871 sections.inheritedPropertiesSeparatorElement=separatorElement;}else if("pseudoId "in styleRule){var pseudoName=WebInspector.StylesSidebarPane.PseudoIdNames[style Rule.pseudoId];if(pseudoName)
478 separatorElement.textContent=WebInspector.UIString("Pseudo ::%s element",pseudoN ame);else 872 separatorElement.textContent=WebInspector.UIString("Pseudo ::%s element",pseudoN ame);else
479 separatorElement.textContent=WebInspector.UIString("Pseudo element");}else 873 separatorElement.textContent=WebInspector.UIString("Pseudo element");}else
480 separatorElement.textContent=styleRule.text;this._sectionsContainer.insertBefore (separatorElement,anchorElement);continue;} 874 separatorElement.textContent=styleRule.text;this._sectionsContainer.insertBefore (separatorElement,anchorElement);continue;}
481 var computedStyle=styleRule.computedStyle;var editable=styleRule.editable;if(typ eof editable==="undefined") 875 var computedStyle=styleRule.computedStyle;var editable=styleRule.editable;if(typ eof editable==="undefined")
482 editable=true;if(computedStyle) 876 editable=true;if(computedStyle)
483 var section=new WebInspector.ComputedStylePropertiesSection(this,styleRule,usedP roperties);else{var section=new WebInspector.StylePropertiesSection(this,styleRu le,editable,styleRule.isInherited);section._markSelectorMatches();} 877 var section=new WebInspector.ComputedStylePropertiesSection(this,styleRule,usedP roperties);else{var section=new WebInspector.StylePropertiesSection(this,styleRu le,editable,styleRule.isInherited);section._markSelectorMatches();}
484 section.expanded=true;if(computedStyle) 878 section.expanded=true;if(computedStyle)
485 this._computedStylePane.bodyElement.appendChild(section.element);else 879 this._computedStylePane.bodyElement.appendChild(section.element);else
486 this._sectionsContainer.insertBefore(section.element,anchorElement);sections.pus h(section);} 880 this._sectionsContainer.insertBefore(section.element,anchorElement);sections.pus h(section);}
487 return sections;},_containsInherited:function(style) 881 return sections;},_containsInherited:function(style)
488 {var properties=style.allProperties;for(var i=0;i<properties.length;++i){var pro perty=properties[i];if(property.isLive&&WebInspector.CSSMetadata.isPropertyInher ited(property.name)) 882 {var properties=style.allProperties;for(var i=0;i<properties.length;++i){var pro perty=properties[i];if(property.isLive&&WebInspector.CSSMetadata.isPropertyInher ited(property.name))
489 return true;} 883 return true;}
490 return false;},_colorFormatSettingChanged:function(event) 884 return false;},_colorFormatSettingChanged:function(event)
491 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];for(var i=0;i<sections.length;++i) 885 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];for(var i=0;i<sections.length;++i)
492 sections[i].update(true);}},_createNewRule:function(event) 886 sections[i].update(true);}},_createNewRule:function(event)
493 {event.consume();this.expand();this.addBlankSection().startEditingSelector();},a ddBlankSection:function() 887 {event.consume();this.expand();this.addBlankSection().startEditingSelector();},a ddBlankSection:function()
494 {var blankSection=new WebInspector.BlankStylePropertiesSection(this,this.node?We bInspector.DOMPresentationUtils.appropriateSelectorFor(this.node,true):"");var e lementStyleSection=this.sections[0][1];this._sectionsContainer.insertBefore(blan kSection.element,elementStyleSection.element.nextSibling);this.sections[0].splic e(2,0,blankSection);return blankSection;},removeSection:function(section) 888 {var blankSection=new WebInspector.BlankStylePropertiesSection(this,this.node?We bInspector.DOMPresentationUtils.simpleSelector(this.node):"");var elementStyleSe ction=this.sections[0][1];this._sectionsContainer.insertBefore(blankSection.elem ent,elementStyleSection.element.nextSibling);this.sections[0].splice(2,0,blankSe ction);return blankSection;},removeSection:function(section)
495 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];var ind ex=sections.indexOf(section);if(index===-1) 889 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];var ind ex=sections.indexOf(section);if(index===-1)
496 continue;sections.splice(index,1);section.element.remove();}},_toggleElementStat ePane:function(event) 890 continue;sections.splice(index,1);section.element.remove();}},_toggleElementStat ePane:function(event)
497 {event.consume();var buttonToggled=!this._elementStateButton.classList.contains( "toggled");if(buttonToggled) 891 {event.consume();var buttonToggled=!this._elementStateButton.classList.contains( "toggled");if(buttonToggled)
498 this.expand();this._elementStateButton.enableStyleClass("toggled",buttonToggled) ;this._elementStatePane.enableStyleClass("expanded",buttonToggled);},_createElem entStatePane:function() 892 this.expand();this._elementStateButton.classList.toggle("toggled",buttonToggled) ;this._elementStatePane.classList.toggle("expanded",buttonToggled);},_createElem entStatePane:function()
499 {this._elementStatePane=document.createElement("div");this._elementStatePane.cla ssName="styles-element-state-pane source-code";var table=document.createElement( "table");var inputs=[];this._elementStatePane.inputs=inputs;function clickListen er(event) 893 {this._elementStatePane=document.createElement("div");this._elementStatePane.cla ssName="styles-element-state-pane source-code";var table=document.createElement( "table");var inputs=[];this._elementStatePane.inputs=inputs;function clickListen er(event)
500 {var node=this._validateNode();if(!node) 894 {var node=this._validateNode();if(!node)
501 return;this._setPseudoClassCallback(node.id,event.target.state,event.target.chec ked);} 895 return;this._setPseudoClassCallback(node.id,event.target.state,event.target.chec ked);}
502 function createCheckbox(state) 896 function createCheckbox(state)
503 {var td=document.createElement("td");var label=document.createElement("label");v ar input=document.createElement("input");input.type="checkbox";input.state=state ;input.addEventListener("click",clickListener.bind(this),false);inputs.push(inpu t);label.appendChild(input);label.appendChild(document.createTextNode(":"+state) );td.appendChild(label);return td;} 897 {var td=document.createElement("td");var label=document.createElement("label");v ar input=document.createElement("input");input.type="checkbox";input.state=state ;input.addEventListener("click",clickListener.bind(this),false);inputs.push(inpu t);label.appendChild(input);label.appendChild(document.createTextNode(":"+state) );td.appendChild(label);return td;}
504 var tr=document.createElement("tr");tr.appendChild(createCheckbox.call(this,"act ive"));tr.appendChild(createCheckbox.call(this,"hover"));table.appendChild(tr);t r=document.createElement("tr");tr.appendChild(createCheckbox.call(this,"focus")) ;tr.appendChild(createCheckbox.call(this,"visited"));table.appendChild(tr);this. _elementStatePane.appendChild(table);},_showUserAgentStylesSettingChanged:functi on(event) 898 var tr=table.createChild("tr");tr.appendChild(createCheckbox.call(this,"active") );tr.appendChild(createCheckbox.call(this,"hover"));tr=table.createChild("tr");t r.appendChild(createCheckbox.call(this,"focus"));tr.appendChild(createCheckbox.c all(this,"visited"));this._elementStatePane.appendChild(table);},filterRegex:fun ction()
505 {var showStyles=(event.data);this.element.enableStyleClass("show-user-styles",sh owStyles);},willHide:function() 899 {return this._filterRegex;},_createPropertyFilterElement:function(isComputedStyl eFilter,filterCallback)
900 {var input=document.createElement("input");input.type="text";input.placeholder=i sComputedStyleFilter?WebInspector.UIString("Filter"):WebInspector.UIString("Find in Styles");var boundSearchHandler=searchHandler.bind(this);function searchHand ler()
901 {var regex=input.value?new RegExp(input.value.escapeForRegExp(),"i"):null;filter Callback(regex);input.parentNode.classList.toggle("styles-filter-engaged",!!inpu t.value);this._updateFilter(isComputedStyleFilter);}
902 input.addEventListener("input",boundSearchHandler,false);function keydownHandler (event)
903 {var Esc="U+001B";if(event.keyIdentifier!==Esc||!input.value)
904 return;event.consume(true);input.value="";boundSearchHandler();}
905 input.addEventListener("keydown",keydownHandler,false);return input;},_updateFil ter:function(isComputedStyleFilter)
906 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];for(var i=0;i<sections.length;++i){var section=sections[i];if(isComputedStyleFilter!==! !section.computedStyle)
907 continue;section._updateFilter();}}},_showUserAgentStylesSettingChanged:function (event)
908 {var showStyles=(event.data);this.element.classList.toggle("show-user-styles",sh owStyles);},willHide:function()
506 {this._spectrumHelper.hide();this._discardElementUnderMouse();},_discardElementU nderMouse:function() 909 {this._spectrumHelper.hide();this._discardElementUnderMouse();},_discardElementU nderMouse:function()
507 {if(this._elementUnderMouse) 910 {if(this._elementUnderMouse)
508 this._elementUnderMouse.classList.remove("styles-panel-hovered");delete this._el ementUnderMouse;},_mouseMovedOverElement:function(e) 911 this._elementUnderMouse.classList.remove("styles-panel-hovered");delete this._el ementUnderMouse;},_mouseMovedOverElement:function(e)
509 {if(this._elementUnderMouse&&e.target!==this._elementUnderMouse) 912 {if(this._elementUnderMouse&&e.target!==this._elementUnderMouse)
510 this._discardElementUnderMouse();this._elementUnderMouse=e.target;if(WebInspecto r.KeyboardShortcut.eventHasCtrlOrMeta(e)) 913 this._discardElementUnderMouse();this._elementUnderMouse=e.target;if(WebInspecto r.KeyboardShortcut.eventHasCtrlOrMeta(e))
511 this._elementUnderMouse.classList.add("styles-panel-hovered");},_keyDown:functio n(e) 914 this._elementUnderMouse.classList.add("styles-panel-hovered");},_keyDown:functio n(e)
512 {if((!WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Ctrl. code)||(WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Met a.code)){if(this._elementUnderMouse) 915 {if((!WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Ctrl. code)||(WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Met a.code)){if(this._elementUnderMouse)
513 this._elementUnderMouse.classList.add("styles-panel-hovered");}},_keyUp:function (e) 916 this._elementUnderMouse.classList.add("styles-panel-hovered");}},_keyUp:function (e)
514 {if((!WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Ctrl. code)||(WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Met a.code)){this._discardElementUnderMouse();}},__proto__:WebInspector.SidebarPane. prototype} 917 {if((!WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Ctrl. code)||(WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Met a.code)){this._discardElementUnderMouse();}},__proto__:WebInspector.SidebarPane. prototype}
515 WebInspector.ComputedStyleSidebarPane=function() 918 WebInspector.ComputedStyleSidebarPane=function()
516 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Computed Style"));} 919 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Computed Style"));}
517 WebInspector.ComputedStyleSidebarPane.prototype={wasShown:function() 920 WebInspector.ComputedStyleSidebarPane.prototype={setHostingPane:function(pane)
921 {this._stylesSidebarPane=pane;},setFilterBoxContainer:function(element)
922 {element.appendChild(this._stylesSidebarPane._createPropertyFilterElement(true,f ilterCallback.bind(this)));function filterCallback(regex)
923 {this._filterRegex=regex;}},wasShown:function()
518 {WebInspector.SidebarPane.prototype.wasShown.call(this);if(!this._hasFreshConten t) 924 {WebInspector.SidebarPane.prototype.wasShown.call(this);if(!this._hasFreshConten t)
519 this.prepareContent();},prepareContent:function(callback) 925 this.prepareContent();},prepareContent:function(callback)
520 {function wrappedCallback(){this._hasFreshContent=true;if(callback) 926 {function wrappedCallback(){this._hasFreshContent=true;if(callback)
521 callback();delete this._hasFreshContent;} 927 callback();delete this._hasFreshContent;}
522 this._stylesSidebarPane._refreshUpdate(null,true,wrappedCallback.bind(this));},_ _proto__:WebInspector.SidebarPane.prototype} 928 this._stylesSidebarPane._refreshUpdate(null,true,wrappedCallback.bind(this));},f ilterRegex:function()
929 {return this._filterRegex;},__proto__:WebInspector.SidebarPane.prototype}
523 WebInspector.StylePropertiesSection=function(parentPane,styleRule,editable,isInh erited) 930 WebInspector.StylePropertiesSection=function(parentPane,styleRule,editable,isInh erited)
524 {WebInspector.PropertiesSection.call(this,"");this._parentPane=parentPane;this.s tyleRule=styleRule;this.rule=this.styleRule.rule;this.editable=editable;this.isI nherited=isInherited;var extraClasses=(this.rule&&(this.rule.isUser||this.rule.i sUserAgent)?" user-rule":"");this.element.className="styles-section matched-styl es monospace"+extraClasses;this.propertiesElement.classList.remove("properties-t ree");if(styleRule.media){for(var i=styleRule.media.length-1;i>=0;--i){var media =styleRule.media[i];var mediaDataElement=this.titleElement.createChild("div","me dia");var mediaText;switch(media.source){case WebInspector.CSSMedia.Source.LINKE D_SHEET:case WebInspector.CSSMedia.Source.INLINE_SHEET:mediaText="media=\""+medi a.text+"\"";break;case WebInspector.CSSMedia.Source.MEDIA_RULE:mediaText="@media "+media.text;break;case WebInspector.CSSMedia.Source.IMPORT_RULE:mediaText="@im port "+media.text;break;} 931 {WebInspector.PropertiesSection.call(this,"");this._parentPane=parentPane;this.s tyleRule=styleRule;this.rule=this.styleRule.rule;this.editable=editable;this.isI nherited=isInherited;var extraClasses=(this.rule&&(this.rule.isUser||this.rule.i sUserAgent)?" user-rule":"");this.element.className="styles-section matched-styl es monospace"+extraClasses;this.propertiesElement.classList.remove("properties-t ree");if(styleRule.media){for(var i=styleRule.media.length-1;i>=0;--i){var media =styleRule.media[i];var mediaDataElement=this.titleElement.createChild("div","me dia");var mediaText;switch(media.source){case WebInspector.CSSMedia.Source.LINKE D_SHEET:case WebInspector.CSSMedia.Source.INLINE_SHEET:mediaText="media=\""+medi a.text+"\"";break;case WebInspector.CSSMedia.Source.MEDIA_RULE:mediaText="@media "+media.text;break;case WebInspector.CSSMedia.Source.IMPORT_RULE:mediaText="@im port "+media.text;break;}
525 if(media.sourceURL){var refElement=mediaDataElement.createChild("div","subtitle" );var rawLocation;var mediaHeader;if(media.range){mediaHeader=media.header();if( mediaHeader){var lineNumber=media.lineNumberInSource();var columnNumber=media.co lumnNumberInSource();console.assert(typeof lineNumber!=="undefined"&&typeof colu mnNumber!=="undefined");rawLocation=new WebInspector.CSSLocation(media.sourceURL ,lineNumber,columnNumber);}} 932 if(media.sourceURL){var refElement=mediaDataElement.createChild("div","subtitle" );var rawLocation;var mediaHeader;if(media.range){mediaHeader=media.header();if( mediaHeader){var lineNumber=media.lineNumberInSource();var columnNumber=media.co lumnNumberInSource();console.assert(typeof lineNumber!=="undefined"&&typeof colu mnNumber!=="undefined");rawLocation=new WebInspector.CSSLocation(media.sourceURL ,lineNumber,columnNumber);}}
526 var anchor;if(rawLocation) 933 var anchor;if(rawLocation)
527 anchor=this._parentPane._linkifier.linkifyCSSLocation(mediaHeader.id,rawLocation );else{anchor=WebInspector.linkifyResourceAsNode(media.sourceURL,undefined,"subt itle",media.sourceURL);} 934 anchor=this._parentPane._linkifier.linkifyCSSLocation(mediaHeader.id,rawLocation );else{anchor=WebInspector.linkifyResourceAsNode(media.sourceURL,undefined,"subt itle",media.sourceURL);}
528 anchor.preferredPanel="sources";anchor.style.float="right";refElement.appendChil d(anchor);} 935 anchor.style.float="right";refElement.appendChild(anchor);}
529 var mediaTextElement=mediaDataElement.createChild("span");mediaTextElement.textC ontent=mediaText;mediaTextElement.title=media.text;}} 936 var mediaTextElement=mediaDataElement.createChild("span");mediaTextElement.textC ontent=mediaText;mediaTextElement.title=media.text;}}
530 var selectorContainer=document.createElement("div");this._selectorElement=docume nt.createElement("span");this._selectorElement.textContent=styleRule.selectorTex t;selectorContainer.appendChild(this._selectorElement);var openBrace=document.cr eateElement("span");openBrace.textContent=" {";selectorContainer.appendChild(ope nBrace);selectorContainer.addEventListener("mousedown",this._handleEmptySpaceMou seDown.bind(this),false);selectorContainer.addEventListener("click",this._handle SelectorContainerClick.bind(this),false);var closeBrace=document.createElement(" div");closeBrace.textContent="}";this.element.appendChild(closeBrace);this._sele ctorElement.addEventListener("click",this._handleSelectorClick.bind(this),false) ;this.element.addEventListener("mousedown",this._handleEmptySpaceMouseDown.bind( this),false);this.element.addEventListener("click",this._handleEmptySpaceClick.b ind(this),false);if(this.rule){if(this.rule.isUserAgent||this.rule.isUser) 937 var selectorContainer=document.createElement("div");this._selectorElement=docume nt.createElement("span");this._selectorElement.textContent=styleRule.selectorTex t;selectorContainer.appendChild(this._selectorElement);var openBrace=document.cr eateElement("span");openBrace.textContent=" {";selectorContainer.appendChild(ope nBrace);selectorContainer.addEventListener("mousedown",this._handleEmptySpaceMou seDown.bind(this),false);selectorContainer.addEventListener("click",this._handle SelectorContainerClick.bind(this),false);var closeBrace=document.createElement(" div");closeBrace.textContent="}";this.element.appendChild(closeBrace);this._sele ctorElement.addEventListener("click",this._handleSelectorClick.bind(this),false) ;this.element.addEventListener("mousedown",this._handleEmptySpaceMouseDown.bind( this),false);this.element.addEventListener("click",this._handleEmptySpaceClick.b ind(this),false);if(this.rule){if(this.rule.isUserAgent||this.rule.isUser)
531 this.editable=false;else{if(this.rule.id) 938 this.editable=false;else{if(this.rule.id)
532 this.navigable=!!this.rule.resourceURL();} 939 this.navigable=!!this.rule.resourceURL();}
533 this.titleElement.classList.add("styles-selector");} 940 this.titleElement.classList.add("styles-selector");}
534 this._usedProperties=styleRule.usedProperties;this._selectorRefElement=document. createElement("div");this._selectorRefElement.className="subtitle";this._updateR uleOrigin();selectorContainer.insertBefore(this._selectorRefElement,selectorCont ainer.firstChild);this.titleElement.appendChild(selectorContainer);this._selecto rContainer=selectorContainer;if(isInherited) 941 this._usedProperties=styleRule.usedProperties;this._selectorRefElement=document. createElement("div");this._selectorRefElement.className="subtitle";this._updateR uleOrigin();selectorContainer.insertBefore(this._selectorRefElement,selectorCont ainer.firstChild);this.titleElement.appendChild(selectorContainer);this._selecto rContainer=selectorContainer;if(isInherited)
535 this.element.classList.add("styles-show-inherited");if(this.navigable) 942 this.element.classList.add("styles-show-inherited");if(this.navigable)
536 this.element.classList.add("navigable");if(!this.editable) 943 this.element.classList.add("navigable");if(!this.editable)
537 this.element.classList.add("read-only");} 944 this.element.classList.add("read-only");}
538 WebInspector.StylePropertiesSection.prototype={get pane() 945 WebInspector.StylePropertiesSection.prototype={get pane()
539 {return this._parentPane;},collapse:function() 946 {return this._parentPane;},collapse:function()
947 {},handleClick:function()
540 {},isPropertyInherited:function(propertyName) 948 {},isPropertyInherited:function(propertyName)
541 {if(this.isInherited){return!WebInspector.CSSMetadata.isPropertyInherited(proper tyName);} 949 {if(this.isInherited){return!WebInspector.CSSMetadata.isPropertyInherited(proper tyName);}
542 return false;},isPropertyOverloaded:function(propertyName,isShorthand) 950 return false;},isPropertyOverloaded:function(propertyName,isShorthand)
543 {if(!this._usedProperties||this.noAffect) 951 {if(!this._usedProperties||this.noAffect)
544 return false;if(this.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited( propertyName)){return false;} 952 return false;if(this.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited( propertyName)){return false;}
545 var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(propertyName);v ar used=(canonicalName in this._usedProperties);if(used||!isShorthand) 953 var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(propertyName);v ar used=(canonicalName in this._usedProperties);if(used||!isShorthand)
546 return!used;var longhandProperties=this.styleRule.style.longhandProperties(prope rtyName);for(var j=0;j<longhandProperties.length;++j){var individualProperty=lon ghandProperties[j];if(WebInspector.CSSMetadata.canonicalPropertyName(individualP roperty.name)in this._usedProperties) 954 return!used;var longhandProperties=this.styleRule.style.longhandProperties(prope rtyName);for(var j=0;j<longhandProperties.length;++j){var individualProperty=lon ghandProperties[j];if(WebInspector.CSSMetadata.canonicalPropertyName(individualP roperty.name)in this._usedProperties)
547 return false;} 955 return false;}
548 return true;},nextEditableSibling:function() 956 return true;},nextEditableSibling:function()
549 {var curSection=this;do{curSection=curSection.nextSibling;}while(curSection&&!cu rSection.editable);if(!curSection){curSection=this.firstSibling;while(curSection &&!curSection.editable) 957 {var curSection=this;do{curSection=curSection.nextSibling;}while(curSection&&!cu rSection.editable);if(!curSection){curSection=this.firstSibling;while(curSection &&!curSection.editable)
550 curSection=curSection.nextSibling;} 958 curSection=curSection.nextSibling;}
551 return(curSection&&curSection.editable)?curSection:null;},previousEditableSiblin g:function() 959 return(curSection&&curSection.editable)?curSection:null;},previousEditableSiblin g:function()
552 {var curSection=this;do{curSection=curSection.previousSibling;}while(curSection& &!curSection.editable);if(!curSection){curSection=this.lastSibling;while(curSect ion&&!curSection.editable) 960 {var curSection=this;do{curSection=curSection.previousSibling;}while(curSection& &!curSection.editable);if(!curSection){curSection=this.lastSibling;while(curSect ion&&!curSection.editable)
553 curSection=curSection.previousSibling;} 961 curSection=curSection.previousSibling;}
554 return(curSection&&curSection.editable)?curSection:null;},update:function(full) 962 return(curSection&&curSection.editable)?curSection:null;},update:function(full)
555 {if(this.styleRule.selectorText) 963 {if(this.styleRule.selectorText)
556 this._selectorElement.textContent=this.styleRule.selectorText;this._markSelector Matches();if(full){this.propertiesTreeOutline.removeChildren();this.populated=fa lse;}else{var child=this.propertiesTreeOutline.children[0];while(child){child.ov erloaded=this.isPropertyOverloaded(child.name,child.isShorthand);child=child.tra verseNextTreeElement(false,null,true);}} 964 this._selectorElement.textContent=this.styleRule.selectorText;this._markSelector Matches();if(full){this.propertiesTreeOutline.removeChildren();this.populated=fa lse;}else{var child=this.propertiesTreeOutline.children[0];while(child){child.ov erloaded=this.isPropertyOverloaded(child.name,child.isShorthand);child=child.tra verseNextTreeElement(false,null,true);}}
557 this.afterUpdate();},afterUpdate:function() 965 this.afterUpdate();},afterUpdate:function()
558 {if(this._afterUpdate){this._afterUpdate(this);delete this._afterUpdate;}},onpop ulate:function() 966 {if(this._afterUpdate){this._afterUpdate(this);delete this._afterUpdate;}},onpop ulate:function()
559 {var style=this.styleRule.style;var allProperties=style.allProperties;this.uniqu eProperties=[];var styleHasEditableSource=this.editable&&!!style.range;if(styleH asEditableSource){for(var i=0;i<allProperties.length;++i){var property=allProper ties[i];this.uniqueProperties.push(property);if(property.styleBased) 967 {var style=this.styleRule.style;var allProperties=style.allProperties;this.uniqu eProperties=[];var styleHasEditableSource=this.editable&&!!style.range;if(styleH asEditableSource){for(var i=0;i<allProperties.length;++i){var property=allProper ties[i];this.uniqueProperties.push(property);if(property.styleBased)
560 continue;var isShorthand=!!WebInspector.CSSMetadata.cssPropertiesMetainfo.longha nds(property.name);var inherited=this.isPropertyInherited(property.name);var ove rloaded=property.inactive||this.isPropertyOverloaded(property.name);var item=new WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,style,pro perty,isShorthand,inherited,overloaded);this.propertiesTreeOutline.appendChild(i tem);} 968 continue;var isShorthand=!!WebInspector.CSSMetadata.cssPropertiesMetainfo.longha nds(property.name);var inherited=this.isPropertyInherited(property.name);var ove rloaded=property.inactive||this.isPropertyOverloaded(property.name);var item=new WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,style,pro perty,isShorthand,inherited,overloaded);this.propertiesTreeOutline.appendChild(i tem);}
561 return;} 969 return;}
562 var generatedShorthands={};for(var i=0;i<allProperties.length;++i){var property= allProperties[i];this.uniqueProperties.push(property);var isShorthand=!!WebInspe ctor.CSSMetadata.cssPropertiesMetainfo.longhands(property.name);var shorthands=i sShorthand?null:WebInspector.CSSMetadata.cssPropertiesMetainfo.shorthands(proper ty.name);var shorthandPropertyAvailable=false;for(var j=0;shorthands&&!shorthand PropertyAvailable&&j<shorthands.length;++j){var shorthand=shorthands[j];if(short hand in generatedShorthands){shorthandPropertyAvailable=true;continue;} 970 var generatedShorthands={};for(var i=0;i<allProperties.length;++i){var property= allProperties[i];this.uniqueProperties.push(property);var isShorthand=!!WebInspe ctor.CSSMetadata.cssPropertiesMetainfo.longhands(property.name);var shorthands=i sShorthand?null:WebInspector.CSSMetadata.cssPropertiesMetainfo.shorthands(proper ty.name);var shorthandPropertyAvailable=false;for(var j=0;shorthands&&!shorthand PropertyAvailable&&j<shorthands.length;++j){var shorthand=shorthands[j];if(short hand in generatedShorthands){shorthandPropertyAvailable=true;continue;}
563 if(style.getLiveProperty(shorthand)){shorthandPropertyAvailable=true;continue;} 971 if(style.getLiveProperty(shorthand)){shorthandPropertyAvailable=true;continue;}
564 if(!style.shorthandValue(shorthand)){shorthandPropertyAvailable=false;continue;} 972 if(!style.shorthandValue(shorthand)){shorthandPropertyAvailable=false;continue;}
565 var shorthandProperty=new WebInspector.CSSProperty(style,style.allProperties.len gth,shorthand,style.shorthandValue(shorthand),"","style",true,true);var overload ed=property.inactive||this.isPropertyOverloaded(property.name,true);var item=new WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,style,sho rthandProperty,true,false,overloaded);this.propertiesTreeOutline.appendChild(ite m);generatedShorthands[shorthand]=shorthandProperty;shorthandPropertyAvailable=t rue;} 973 var shorthandProperty=new WebInspector.CSSProperty(style,style.allProperties.len gth,shorthand,style.shorthandValue(shorthand),false,false,true,true);var overloa ded=property.inactive||this.isPropertyOverloaded(property.name,true);var item=ne w WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,style,sh orthandProperty,true,false,overloaded);this.propertiesTreeOutline.appendChild(it em);generatedShorthands[shorthand]=shorthandProperty;shorthandPropertyAvailable= true;}
566 if(shorthandPropertyAvailable) 974 if(shorthandPropertyAvailable)
567 continue;var inherited=this.isPropertyInherited(property.name);var overloaded=pr operty.inactive||this.isPropertyOverloaded(property.name,isShorthand);var item=n ew WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,style,p roperty,isShorthand,inherited,overloaded);this.propertiesTreeOutline.appendChild (item);}},_markSelectorMatches:function() 975 continue;var inherited=this.isPropertyInherited(property.name);var overloaded=pr operty.inactive||this.isPropertyOverloaded(property.name,isShorthand);var item=n ew WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,style,p roperty,isShorthand,inherited,overloaded);this.propertiesTreeOutline.appendChild (item);}},_updateFilter:function()
976 {if(this.styleRule.isAttribute)
977 return;var regex=this._parentPane.filterRegex();var hideRule=regex&&!regex.test( this.element.textContent);this.element.classList.toggle("hidden",hideRule);if(hi deRule)
978 return;var children=this.propertiesTreeOutline.children;for(var i=0;i<children.l ength;++i)
979 children[i]._updateFilter();if(this.styleRule.rule)
980 this._markSelectorHighlights();},_markSelectorMatches:function()
568 {var rule=this.styleRule.rule;if(!rule) 981 {var rule=this.styleRule.rule;if(!rule)
569 return;var matchingSelectors=rule.matchingSelectors;if(this.noAffect||matchingSe lectors) 982 return;var matchingSelectors=rule.matchingSelectors;if(this.noAffect||matchingSe lectors)
570 this._selectorElement.className="selector";if(!matchingSelectors) 983 this._selectorElement.className="selector";if(!matchingSelectors)
571 return;var selectors=rule.selectors;var fragment=document.createDocumentFragment ();var currentMatch=0;for(var i=0;i<selectors.length;++i){if(i) 984 return;var selectors=rule.selectors;var fragment=document.createDocumentFragment ();var currentMatch=0;for(var i=0;i<selectors.length;++i){if(i)
572 fragment.appendChild(document.createTextNode(", "));var isSelectorMatching=match ingSelectors[currentMatch]===i;if(isSelectorMatching) 985 fragment.appendChild(document.createTextNode(", "));var isSelectorMatching=match ingSelectors[currentMatch]===i;if(isSelectorMatching)
573 ++currentMatch;var rawLocation=new WebInspector.CSSLocation(rule.sourceURL,rule. lineNumberInSource(i),rule.columnNumberInSource(i));var matchingSelectorClass=is SelectorMatching?" selector-matches":"";var selectorElement=document.createEleme nt("span");selectorElement.className="simple-selector"+matchingSelectorClass;if( rule.id) 986 ++currentMatch;var rawLocation=new WebInspector.CSSLocation(rule.sourceURL,rule. lineNumberInSource(i),rule.columnNumberInSource(i));var matchingSelectorClass=is SelectorMatching?" selector-matches":"";var selectorElement=document.createEleme nt("span");selectorElement.className="simple-selector"+matchingSelectorClass;if( rule.id)
574 selectorElement._selectorIndex=i;selectorElement.textContent=selectors[i].value; fragment.appendChild(selectorElement);} 987 selectorElement._selectorIndex=i;selectorElement.textContent=selectors[i].value; fragment.appendChild(selectorElement);}
575 this._selectorElement.removeChildren();this._selectorElement.appendChild(fragmen t);},_checkWillCancelEditing:function() 988 this._selectorElement.removeChildren();this._selectorElement.appendChild(fragmen t);this._markSelectorHighlights();},_markSelectorHighlights:function()
989 {var selectors=this._selectorElement.getElementsByClassName("simple-selector");v ar regex=this.pane.filterRegex();for(var i=0;i<selectors.length;++i){var selecto rMatchesFilter=regex&&regex.test(selectors[i].textContent);selectors[i].classLis t.toggle("filter-match",selectorMatchesFilter);}},_checkWillCancelEditing:functi on()
576 {var willCauseCancelEditing=this._willCauseCancelEditing;delete this._willCauseC ancelEditing;return willCauseCancelEditing;},_handleSelectorContainerClick:funct ion(event) 990 {var willCauseCancelEditing=this._willCauseCancelEditing;delete this._willCauseC ancelEditing;return willCauseCancelEditing;},_handleSelectorContainerClick:funct ion(event)
577 {if(this._checkWillCancelEditing()||!this.editable) 991 {if(this._checkWillCancelEditing()||!this.editable)
578 return;if(event.target===this._selectorContainer) 992 return;if(event.target===this._selectorContainer)
579 this.addNewBlankProperty(0).startEditing();},addNewBlankProperty:function(index) 993 this.addNewBlankProperty(0).startEditing();},addNewBlankProperty:function(index)
580 {var style=this.styleRule.style;var property=style.newBlankProperty(index);var i tem=new WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,st yle,property,false,false,false);index=property.index;this.propertiesTreeOutline. insertChild(item,index);item.listItemElement.textContent="";item._newProperty=tr ue;item.updateTitle();return item;},_createRuleOriginNode:function() 994 {var style=this.styleRule.style;var property=style.newBlankProperty(index);var i tem=new WebInspector.StylePropertyTreeElement(this._parentPane,this.styleRule,st yle,property,false,false,false);index=property.index;this.propertiesTreeOutline. insertChild(item,index);item.listItemElement.textContent="";item._newProperty=tr ue;item.updateTitle();return item;},_createRuleOriginNode:function()
581 {function linkifyUncopyable(url,line) 995 {function linkifyUncopyable(url,line)
582 {var link=WebInspector.linkifyResourceAsNode(url,line,"",url+":"+(line+1));link. preferredPanel="sources";link.classList.add("webkit-html-resource-link");link.se tAttribute("data-uncopyable",link.textContent);link.textContent="";return link;} 996 {var link=WebInspector.linkifyResourceAsNode(url,line,"",url+":"+(line+1));link. classList.add("webkit-html-resource-link");link.setAttribute("data-uncopyable",l ink.textContent);link.textContent="";return link;}
583 if(this.styleRule.sourceURL){var firstMatchingIndex=this.styleRule.rule.matching Selectors&&this.rule.matchingSelectors.length?this.rule.matchingSelectors[0]:0;v ar matchingSelectorLocation=new WebInspector.CSSLocation(this.styleRule.sourceUR L,this.rule.lineNumberInSource(firstMatchingIndex),this.rule.columnNumberInSourc e(firstMatchingIndex));return this._parentPane._linkifier.linkifyCSSLocation(thi s.rule.id.styleSheetId,matchingSelectorLocation)||linkifyUncopyable(this.styleRu le.sourceURL,this.rule.lineNumberInSource());} 997 if(this.styleRule.sourceURL){var firstMatchingIndex=this.styleRule.rule.matching Selectors&&this.rule.matchingSelectors.length?this.rule.matchingSelectors[0]:0;v ar matchingSelectorLocation=new WebInspector.CSSLocation(this.styleRule.sourceUR L,this.rule.lineNumberInSource(firstMatchingIndex),this.rule.columnNumberInSourc e(firstMatchingIndex));return this._parentPane._linkifier.linkifyCSSLocation(thi s.rule.id.styleSheetId,matchingSelectorLocation)||linkifyUncopyable(this.styleRu le.sourceURL,this.rule.lineNumberInSource());}
584 if(!this.rule) 998 if(!this.rule)
585 return document.createTextNode("");if(this.rule.isUserAgent) 999 return document.createTextNode("");if(this.rule.isUserAgent)
586 return document.createTextNode(WebInspector.UIString("user agent stylesheet"));i f(this.rule.isUser) 1000 return document.createTextNode(WebInspector.UIString("user agent stylesheet"));i f(this.rule.isUser)
587 return document.createTextNode(WebInspector.UIString("user stylesheet"));if(this .rule.isViaInspector) 1001 return document.createTextNode(WebInspector.UIString("user stylesheet"));if(this .rule.isViaInspector)
588 return document.createTextNode(WebInspector.UIString("via inspector"));return do cument.createTextNode("");},_handleEmptySpaceMouseDown:function() 1002 return document.createTextNode(WebInspector.UIString("via inspector"));return do cument.createTextNode("");},_handleEmptySpaceMouseDown:function()
589 {this._willCauseCancelEditing=this._parentPane._isEditingStyle;},_handleEmptySpa ceClick:function(event) 1003 {this._willCauseCancelEditing=this._parentPane._isEditingStyle;},_handleEmptySpa ceClick:function(event)
590 {if(!this.editable) 1004 {if(!this.editable)
591 return;if(!window.getSelection().isCollapsed) 1005 return;if(!window.getSelection().isCollapsed)
592 return;if(this._checkWillCancelEditing()) 1006 return;if(this._checkWillCancelEditing())
593 return;if(event.target.classList.contains("header")||this.element.classList.cont ains("read-only")||event.target.enclosingNodeOrSelfWithClass("media")){event.con sume();return;} 1007 return;if(event.target.classList.contains("header")||this.element.classList.cont ains("read-only")||event.target.enclosingNodeOrSelfWithClass("media")){event.con sume();return;}
594 this.expand();this.addNewBlankProperty().startEditing();},_handleSelectorClick:f unction(event) 1008 this.expand();this.addNewBlankProperty().startEditing();},_handleSelectorClick:f unction(event)
595 {if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&this.navigable&&eve nt.target.classList.contains("simple-selector")){var index=event.target._selecto rIndex;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.rul e.id.styleSheetId);var uiLocation=styleSheetHeader.rawLocationToUILocation(this. rule.lineNumberInSource(index),this.rule.columnNumberInSource(index));if(uiLocat ion) 1009 {if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&this.navigable&&eve nt.target.classList.contains("simple-selector")){var index=event.target._selecto rIndex;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.rul e.id.styleSheetId);var uiLocation=styleSheetHeader.rawLocationToUILocation(this. rule.lineNumberInSource(index),this.rule.columnNumberInSource(index));WebInspect or.Revealer.reveal(uiLocation);return;}
596 WebInspector.panel("sources").showUILocation(uiLocation);return;}
597 this._startEditingOnMouseEvent();event.consume(true);},_startEditingOnMouseEvent :function() 1010 this._startEditingOnMouseEvent();event.consume(true);},_startEditingOnMouseEvent :function()
598 {if(!this.editable) 1011 {if(!this.editable)
599 return;if(!this.rule&&this.propertiesTreeOutline.children.length===0){this.expan d();this.addNewBlankProperty().startEditing();return;} 1012 return;if(!this.rule&&this.propertiesTreeOutline.children.length===0){this.expan d();this.addNewBlankProperty().startEditing();return;}
600 if(!this.rule) 1013 if(!this.rule)
601 return;this.startEditingSelector();},startEditingSelector:function() 1014 return;this.startEditingSelector();},startEditingSelector:function()
602 {var element=this._selectorElement;if(WebInspector.isBeingEdited(element)) 1015 {var element=this._selectorElement;if(WebInspector.isBeingEdited(element))
603 return;element.scrollIntoViewIfNeeded(false);element.textContent=element.textCon tent;var config=new WebInspector.EditingConfig(this.editingSelectorCommitted.bin d(this),this.editingSelectorCancelled.bind(this));WebInspector.startEditing(this ._selectorElement,config);window.getSelection().setBaseAndExtent(element,0,eleme nt,1);this._parentPane._isEditingStyle=true;},_moveEditorFromSelector:function(m oveDirection) 1016 return;element.scrollIntoViewIfNeeded(false);element.textContent=element.textCon tent;var config=new WebInspector.InplaceEditor.Config(this.editingSelectorCommit ted.bind(this),this.editingSelectorCancelled.bind(this));WebInspector.InplaceEdi tor.startEditing(this._selectorElement,config);window.getSelection().setBaseAndE xtent(element,0,element,1);this._parentPane._isEditingStyle=true;},_moveEditorFr omSelector:function(moveDirection)
604 {this._markSelectorMatches();if(!moveDirection) 1017 {this._markSelectorMatches();if(!moveDirection)
605 return;if(moveDirection==="forward"){this.expand();var firstChild=this.propertie sTreeOutline.children[0];while(firstChild&&firstChild.inherited) 1018 return;if(moveDirection==="forward"){this.expand();var firstChild=this.propertie sTreeOutline.children[0];while(firstChild&&firstChild.inherited)
606 firstChild=firstChild.nextSibling;if(!firstChild) 1019 firstChild=firstChild.nextSibling;if(!firstChild)
607 this.addNewBlankProperty().startEditing();else 1020 this.addNewBlankProperty().startEditing();else
608 firstChild.startEditing(firstChild.nameElement);}else{var previousSection=this.p reviousEditableSibling();if(!previousSection) 1021 firstChild.startEditing(firstChild.nameElement);}else{var previousSection=this.p reviousEditableSibling();if(!previousSection)
609 return;previousSection.expand();previousSection.addNewBlankProperty().startEditi ng();}},editingSelectorCommitted:function(element,newContent,oldContent,context, moveDirection) 1022 return;previousSection.expand();previousSection.addNewBlankProperty().startEditi ng();}},editingSelectorCommitted:function(element,newContent,oldContent,context, moveDirection)
610 {this._editingSelectorEnded();if(newContent) 1023 {this._editingSelectorEnded();if(newContent)
611 newContent=newContent.trim();if(newContent===oldContent){this._selectorElement.t extContent=newContent;this._moveEditorFromSelector(moveDirection);return;} 1024 newContent=newContent.trim();if(newContent===oldContent){this._selectorElement.t extContent=newContent;this._moveEditorFromSelector(moveDirection);return;}
612 var selectedNode=this._parentPane.node;function successCallback(newRule) 1025 var selectedNode=this._parentPane.node;function successCallback(newRule)
613 {var doesAffectSelectedNode=newRule.matchingSelectors.length>0;if(!doesAffectSel ectedNode){this.noAffect=true;this.element.classList.add("no-affect");}else{dele te this.noAffect;this.element.classList.remove("no-affect");} 1026 {var doesAffectSelectedNode=newRule.matchingSelectors.length>0;if(!doesAffectSel ectedNode){this.noAffect=true;this.element.classList.add("no-affect");}else{dele te this.noAffect;this.element.classList.remove("no-affect");}
614 this.rule=newRule;this.styleRule={section:this,style:newRule.style,selectorText: newRule.selectorText,media:newRule.media,sourceURL:newRule.resourceURL(),rule:ne wRule};this._parentPane.update(selectedNode);this._updateRuleOrigin();finishOper ationAndMoveEditor.call(this,moveDirection);} 1027 this.rule=newRule;this.styleRule={section:this,style:newRule.style,selectorText: newRule.selectorText,media:newRule.media,sourceURL:newRule.resourceURL(),rule:ne wRule};this._parentPane.update(selectedNode);this._updateRuleOrigin();finishOper ationAndMoveEditor.call(this,moveDirection);}
615 function finishOperationAndMoveEditor(direction) 1028 function finishOperationAndMoveEditor(direction)
616 {delete this._parentPane._userOperation;this._moveEditorFromSelector(direction); } 1029 {delete this._parentPane._userOperation;this._moveEditorFromSelector(direction); }
617 this._parentPane._userOperation=true;WebInspector.cssModel.setRuleSelector(this. rule.id,selectedNode?selectedNode.id:0,newContent,successCallback.bind(this),fin ishOperationAndMoveEditor.bind(this,moveDirection));},_updateRuleOrigin:function () 1030 this._parentPane._userOperation=true;WebInspector.cssModel.setRuleSelector(this. rule.id,selectedNode?selectedNode.id:0,newContent,successCallback.bind(this),fin ishOperationAndMoveEditor.bind(this,moveDirection));},_updateRuleOrigin:function ()
618 {this._selectorRefElement.removeChildren();this._selectorRefElement.appendChild( this._createRuleOriginNode());},_editingSelectorEnded:function() 1031 {this._selectorRefElement.removeChildren();this._selectorRefElement.appendChild( this._createRuleOriginNode());},_editingSelectorEnded:function()
619 {delete this._parentPane._isEditingStyle;},editingSelectorCancelled:function() 1032 {delete this._parentPane._isEditingStyle;},editingSelectorCancelled:function()
620 {this._editingSelectorEnded();this._markSelectorMatches();},__proto__:WebInspect or.PropertiesSection.prototype} 1033 {this._editingSelectorEnded();this._markSelectorMatches();},__proto__:WebInspect or.PropertiesSection.prototype}
621 WebInspector.ComputedStylePropertiesSection=function(stylesPane,styleRule,usedPr operties) 1034 WebInspector.ComputedStylePropertiesSection=function(stylesPane,styleRule,usedPr operties)
622 {WebInspector.PropertiesSection.call(this,"");var showInheritedCheckbox=new WebI nspector.Checkbox(WebInspector.UIString("Show inherited properties"),"sidebar-pa ne-subtitle");this.headerElement.appendChild(showInheritedCheckbox.element);this ._hasFreshContent=false;function showInheritedToggleFunction() 1035 {WebInspector.PropertiesSection.call(this,"");var subtitle=this.headerElement.cr eateChild("div","sidebar-pane-subtitle vbox");var showInheritedCheckbox=new WebI nspector.Checkbox(WebInspector.UIString("Show inherited properties"),"hbox");sub title.appendChild(showInheritedCheckbox.element);this._hasFreshContent=false;fun ction showInheritedToggleFunction()
623 {var showInherited=showInheritedCheckbox.checked;WebInspector.settings.showInher itedComputedStyleProperties.set(showInherited);if(showInherited) 1036 {var showInherited=showInheritedCheckbox.checked;WebInspector.settings.showInher itedComputedStyleProperties.set(showInherited);if(showInherited)
624 this.element.classList.add("styles-show-inherited");else 1037 this.element.classList.add("styles-show-inherited");else
625 this.element.classList.remove("styles-show-inherited");} 1038 this.element.classList.remove("styles-show-inherited");}
626 showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this));t his.element.className="styles-section monospace read-only computed-style";if(Web Inspector.settings.showInheritedComputedStyleProperties.get()){this.element.clas sList.add("styles-show-inherited");showInheritedCheckbox.checked=true;} 1039 showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this));t his.element.className="styles-section monospace read-only computed-style";if(Web Inspector.settings.showInheritedComputedStyleProperties.get()){this.element.clas sList.add("styles-show-inherited");showInheritedCheckbox.checked=true;}
627 this._stylesPane=stylesPane;this.styleRule=styleRule;this._usedProperties=usedPr operties;this._alwaysShowComputedProperties={"display":true,"height":true,"width ":true};this.computedStyle=true;this._propertyTreeElements={};this._expandedProp ertyNames={};} 1040 this._stylesPane=stylesPane;this.styleRule=styleRule;this._usedProperties=usedPr operties;this._alwaysShowComputedProperties={"display":true,"height":true,"width ":true};this.computedStyle=true;this._propertyTreeElements={};this._expandedProp ertyNames={};}
628 WebInspector.ComputedStylePropertiesSection.prototype={collapse:function(dontRem emberState) 1041 WebInspector.ComputedStylePropertiesSection.prototype={collapse:function(dontRem emberState)
629 {},_isPropertyInherited:function(propertyName) 1042 {},_isPropertyInherited:function(propertyName)
630 {var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(propertyName); return!(canonicalName in this._usedProperties)&&!(canonicalName in this._alwaysS howComputedProperties);},update:function() 1043 {var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(propertyName); return!(canonicalName in this._usedProperties)&&!(canonicalName in this._alwaysS howComputedProperties);},update:function()
631 {this._expandedPropertyNames={};for(var name in this._propertyTreeElements){if(t his._propertyTreeElements[name].expanded) 1044 {this._expandedPropertyNames={};for(var name in this._propertyTreeElements){if(t his._propertyTreeElements[name].expanded)
632 this._expandedPropertyNames[name]=true;} 1045 this._expandedPropertyNames[name]=true;}
633 this._propertyTreeElements={};this.propertiesTreeOutline.removeChildren();this.p opulated=false;},onpopulate:function() 1046 this._propertyTreeElements={};this.propertiesTreeOutline.removeChildren();this.p opulated=false;},_updateFilter:function()
1047 {var children=this.propertiesTreeOutline.children;for(var i=0;i<children.length; ++i)
1048 children[i]._updateFilter();},onpopulate:function()
634 {function sorter(a,b) 1049 {function sorter(a,b)
635 {return a.name.compareTo(b.name);} 1050 {return a.name.compareTo(b.name);}
636 var style=this.styleRule.style;if(!style) 1051 var style=this.styleRule.style;if(!style)
637 return;var uniqueProperties=[];var allProperties=style.allProperties;for(var i=0 ;i<allProperties.length;++i) 1052 return;var uniqueProperties=[];var allProperties=style.allProperties;for(var i=0 ;i<allProperties.length;++i)
638 uniqueProperties.push(allProperties[i]);uniqueProperties.sort(sorter);this._prop ertyTreeElements={};for(var i=0;i<uniqueProperties.length;++i){var property=uniq ueProperties[i];var inherited=this._isPropertyInherited(property.name);var item= new WebInspector.ComputedStylePropertyTreeElement(this._stylesPane,this.styleRul e,style,property,inherited);this.propertiesTreeOutline.appendChild(item);this._p ropertyTreeElements[property.name]=item;}},rebuildComputedTrace:function(section s) 1053 uniqueProperties.push(allProperties[i]);uniqueProperties.sort(sorter);this._prop ertyTreeElements={};for(var i=0;i<uniqueProperties.length;++i){var property=uniq ueProperties[i];var inherited=this._isPropertyInherited(property.name);var item= new WebInspector.ComputedStylePropertyTreeElement(this._stylesPane,this.styleRul e,style,property,inherited);this.propertiesTreeOutline.appendChild(item);this._p ropertyTreeElements[property.name]=item;}},rebuildComputedTrace:function(section s)
639 {for(var i=0;i<sections.length;++i){var section=sections[i];if(section.computedS tyle||section.isBlank) 1054 {for(var i=0;i<sections.length;++i){var section=sections[i];if(section.computedS tyle||section.isBlank)
640 continue;for(var j=0;j<section.uniqueProperties.length;++j){var property=section .uniqueProperties[j];if(property.disabled) 1055 continue;for(var j=0;j<section.uniqueProperties.length;++j){var property=section .uniqueProperties[j];if(property.disabled)
641 continue;if(section.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited(p roperty.name)) 1056 continue;if(section.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited(p roperty.name))
642 continue;var treeElement=this._propertyTreeElements[property.name.toLowerCase()] ;if(treeElement){var fragment=document.createDocumentFragment();var selector=fra gment.createChild("span");selector.style.color="gray";selector.textContent=secti on.styleRule.selectorText;fragment.appendChild(document.createTextNode(" - "+pro perty.value+" "));var subtitle=fragment.createChild("span");subtitle.style.float ="right";subtitle.appendChild(section._createRuleOriginNode());var childElement= new TreeElement(fragment,null,false);treeElement.appendChild(childElement);if(pr operty.inactive||section.isPropertyOverloaded(property.name)) 1057 continue;var treeElement=this._propertyTreeElements[property.name.toLowerCase()] ;if(treeElement){var fragment=document.createDocumentFragment();var selector=fra gment.createChild("span");selector.style.color="gray";selector.textContent=secti on.styleRule.selectorText;fragment.appendChild(document.createTextNode(" - "+pro perty.value+" "));var subtitle=fragment.createChild("span");subtitle.style.float ="right";subtitle.appendChild(section._createRuleOriginNode());var childElement= new TreeElement(fragment,null,false);treeElement.appendChild(childElement);if(pr operty.inactive||section.isPropertyOverloaded(property.name))
643 childElement.listItemElement.classList.add("overloaded");if(!property.parsedOk){ childElement.listItemElement.classList.add("not-parsed-ok");childElement.listIte mElement.insertBefore(WebInspector.StylesSidebarPane.createExclamationMark(prope rty),childElement.listItemElement.firstChild);if(WebInspector.StylesSidebarPane. _ignoreErrorsForProperty(property)) 1058 childElement.listItemElement.classList.add("overloaded");if(!property.parsedOk){ childElement.listItemElement.classList.add("not-parsed-ok");childElement.listIte mElement.insertBefore(WebInspector.StylesSidebarPane.createExclamationMark(prope rty),childElement.listItemElement.firstChild);if(WebInspector.StylesSidebarPane. _ignoreErrorsForProperty(property))
644 childElement.listItemElement.classList.add("has-ignorable-error");}}}} 1059 childElement.listItemElement.classList.add("has-ignorable-error");}}}}
645 for(var name in this._expandedPropertyNames){if(name in this._propertyTreeElemen ts) 1060 for(var name in this._expandedPropertyNames){if(name in this._propertyTreeElemen ts)
646 this._propertyTreeElements[name].expand();}},__proto__:WebInspector.PropertiesSe ction.prototype} 1061 this._propertyTreeElements[name].expand();}},__proto__:WebInspector.PropertiesSe ction.prototype}
647 WebInspector.BlankStylePropertiesSection=function(stylesPane,defaultSelectorText ) 1062 WebInspector.BlankStylePropertiesSection=function(stylesPane,defaultSelectorText )
648 {WebInspector.StylePropertiesSection.call(this,stylesPane,{selectorText:defaultS electorText,rule:{isViaInspector:true}},true,false);this.element.classList.add(" blank-section");} 1063 {WebInspector.StylePropertiesSection.call(this,stylesPane,{selectorText:defaultS electorText,rule:{isViaInspector:true}},true,false);this.element.classList.add(" blank-section");}
649 WebInspector.BlankStylePropertiesSection.prototype={get isBlank() 1064 WebInspector.BlankStylePropertiesSection.prototype={get isBlank()
650 {return!this._normal;},expand:function() 1065 {return!this._normal;},expand:function()
651 {if(!this.isBlank) 1066 {if(!this.isBlank)
652 WebInspector.StylePropertiesSection.prototype.expand.call(this);},editingSelecto rCommitted:function(element,newContent,oldContent,context,moveDirection) 1067 WebInspector.StylePropertiesSection.prototype.expand.call(this);},editingSelecto rCommitted:function(element,newContent,oldContent,context,moveDirection)
653 {if(!this.isBlank){WebInspector.StylePropertiesSection.prototype.editingSelector Committed.call(this,element,newContent,oldContent,context,moveDirection);return; } 1068 {if(!this.isBlank){WebInspector.StylePropertiesSection.prototype.editingSelector Committed.call(this,element,newContent,oldContent,context,moveDirection);return; }
654 function successCallback(newRule) 1069 function successCallback(newRule)
655 {var doesSelectorAffectSelectedNode=newRule.matchingSelectors.length>0;var style Rule={section:this,style:newRule.style,selectorText:newRule.selectorText,sourceU RL:newRule.resourceURL(),rule:newRule};this.makeNormal(styleRule);if(!doesSelect orAffectSelectedNode){this.noAffect=true;this.element.classList.add("no-affect") ;} 1070 {var doesSelectorAffectSelectedNode=newRule.matchingSelectors.length>0;var style Rule={section:this,style:newRule.style,selectorText:newRule.selectorText,sourceU RL:newRule.resourceURL(),rule:newRule};this.makeNormal(styleRule);if(!doesSelect orAffectSelectedNode){this.noAffect=true;this.element.classList.add("no-affect") ;}
656 this._updateRuleOrigin();this.expand();if(this.element.parentElement) 1071 this._updateRuleOrigin();this.expand();if(this.element.parentElement)
657 this._moveEditorFromSelector(moveDirection);delete this._parentPane._userOperati on;this._editingSelectorEnded();this._markSelectorMatches();} 1072 this._moveEditorFromSelector(moveDirection);delete this._parentPane._userOperati on;this._editingSelectorEnded();this._markSelectorMatches();}
658 if(newContent) 1073 if(newContent)
659 newContent=newContent.trim();this._parentPane._userOperation=true;WebInspector.c ssModel.addRule(this.pane.node.id,newContent,successCallback.bind(this),this.edi tingSelectorCancelled.bind(this));},editingSelectorCancelled:function() 1074 newContent=newContent.trim();this._parentPane._userOperation=true;WebInspector.c ssModel.requestViaInspectorStylesheet(this.pane.node,viaInspectorCallback.bind(t his));function viaInspectorCallback(styleSheetHeader)
1075 {if(!styleSheetHeader){this.editingSelectorCancelled();return;}
1076 WebInspector.cssModel.addRule(styleSheetHeader.id,this.pane.node,newContent,succ essCallback.bind(this),this.editingSelectorCancelled.bind(this));}},editingSelec torCancelled:function()
660 {delete this._parentPane._userOperation;if(!this.isBlank){WebInspector.StyleProp ertiesSection.prototype.editingSelectorCancelled.call(this);return;} 1077 {delete this._parentPane._userOperation;if(!this.isBlank){WebInspector.StyleProp ertiesSection.prototype.editingSelectorCancelled.call(this);return;}
661 this._editingSelectorEnded();this.pane.removeSection(this);},makeNormal:function (styleRule) 1078 this._editingSelectorEnded();this.pane.removeSection(this);},makeNormal:function (styleRule)
662 {this.element.classList.remove("blank-section");this.styleRule=styleRule;this.ru le=styleRule.rule;this._normal=true;},__proto__:WebInspector.StylePropertiesSect ion.prototype} 1079 {this.element.classList.remove("blank-section");this.styleRule=styleRule;this.ru le=styleRule.rule;this._normal=true;},__proto__:WebInspector.StylePropertiesSect ion.prototype}
663 WebInspector.StylePropertyTreeElementBase=function(styleRule,style,property,inhe rited,overloaded,hasChildren) 1080 WebInspector.StylePropertyTreeElementBase=function(styleRule,style,property,inhe rited,overloaded,hasChildren)
664 {this._styleRule=styleRule;this.style=style;this.property=property;this._inherit ed=inherited;this._overloaded=overloaded;TreeElement.call(this,"",null,hasChildr en);this.selectable=false;} 1081 {this._styleRule=styleRule;this.style=style;this.property=property;this._inherit ed=inherited;this._overloaded=overloaded;TreeElement.call(this,"",null,hasChildr en);this.selectable=false;}
665 WebInspector.StylePropertyTreeElementBase.prototype={node:function() 1082 WebInspector.StylePropertyTreeElementBase.prototype={node:function()
666 {return null;},editablePane:function() 1083 {return null;},editablePane:function()
667 {return null;},get inherited() 1084 {return null;},parentPane:function()
1085 {throw"Not implemented";},get inherited()
668 {return this._inherited;},hasIgnorableError:function() 1086 {return this._inherited;},hasIgnorableError:function()
669 {return!this.parsedOk&&WebInspector.StylesSidebarPane._ignoreErrorsForProperty(t his.property);},set inherited(x) 1087 {return!this.parsedOk&&WebInspector.StylesSidebarPane._ignoreErrorsForProperty(t his.property);},set inherited(x)
670 {if(x===this._inherited) 1088 {if(x===this._inherited)
671 return;this._inherited=x;this.updateState();},get overloaded() 1089 return;this._inherited=x;this.updateState();},get overloaded()
672 {return this._overloaded;},set overloaded(x) 1090 {return this._overloaded;},set overloaded(x)
673 {if(x===this._overloaded) 1091 {if(x===this._overloaded)
674 return;this._overloaded=x;this.updateState();},get disabled() 1092 return;this._overloaded=x;this.updateState();},get disabled()
675 {return this.property.disabled;},get name() 1093 {return this.property.disabled;},get name()
676 {if(!this.disabled||!this.property.text) 1094 {if(!this.disabled||!this.property.text)
677 return this.property.name;var text=this.property.text;var index=text.indexOf(":" );if(index<1) 1095 return this.property.name;var text=this.property.text;var index=text.indexOf(":" );if(index<1)
678 return this.property.name;text=text.substring(0,index).trim();if(text.startsWith ("/*")) 1096 return this.property.name;text=text.substring(0,index).trim();if(text.startsWith ("/*"))
679 text=text.substring(2).trim();return text;},get priority() 1097 text=text.substring(2).trim();return text;},get value()
680 {if(this.disabled)
681 return"";return this.property.priority;},get value()
682 {if(!this.disabled||!this.property.text) 1098 {if(!this.disabled||!this.property.text)
683 return this.property.value;var match=this.property.text.match(/(.*);\s*/);if(!ma tch||!match[1]) 1099 return this.property.value;var match=this.property.text.match(/(.*);\s*/);if(!ma tch||!match[1])
684 return this.property.value;var text=match[1];var index=text.indexOf(":");if(inde x<1) 1100 return this.property.value;var text=match[1];var index=text.indexOf(":");if(inde x<1)
685 return this.property.value;return text.substring(index+1).trim();},get parsedOk( ) 1101 return this.property.value;return text.substring(index+1).trim();},get parsedOk( )
686 {return this.property.parsedOk;},onattach:function() 1102 {return this.property.parsedOk;},onattach:function()
687 {this.updateTitle();},updateTitle:function() 1103 {this.updateTitle();},updateTitle:function()
688 {var value=this.value;this.updateState();var nameElement=document.createElement( "span");nameElement.className="webkit-css-property";nameElement.textContent=this .name;nameElement.title=this.property.propertyText;this.nameElement=nameElement; this._expandElement=document.createElement("span");this._expandElement.className ="expand-element";var valueElement=document.createElement("span");valueElement.c lassName="value";this.valueElement=valueElement;function processValue(regex,proc essor,nextProcessor,valueText) 1104 {var value=this.value;this.updateState();var nameElement=document.createElement( "span");nameElement.className="webkit-css-property";nameElement.textContent=this .name;nameElement.title=this.property.propertyText;this.nameElement=nameElement; this._expandElement=document.createElement("span");this._expandElement.className ="expand-element";var valueElement=document.createElement("span");valueElement.c lassName="value";this.valueElement=valueElement;function processValue(regex,proc essor,nextProcessor,valueText)
689 {var container=document.createDocumentFragment();var items=valueText.replace(reg ex,"\0$1\0").split("\0");for(var i=0;i<items.length;++i){if((i%2)===0){if(nextPr ocessor) 1105 {var container=document.createDocumentFragment();var items=valueText.replace(reg ex,"\0$1\0").split("\0");for(var i=0;i<items.length;++i){if((i%2)===0){if(nextPr ocessor)
690 container.appendChild(nextProcessor(items[i]));else 1106 container.appendChild(nextProcessor(items[i]));else
691 container.appendChild(document.createTextNode(items[i]));}else{var processedNode =processor(items[i]);if(processedNode) 1107 container.appendChild(document.createTextNode(items[i]));}else{var processedNode =processor(items[i]);if(processedNode)
692 container.appendChild(processedNode);}} 1108 container.appendChild(processedNode);}}
693 return container;} 1109 return container;}
694 function linkifyURL(url) 1110 function linkifyURL(url)
695 {var hrefUrl=url;var match=hrefUrl.match(/['"]?([^'"]+)/);if(match) 1111 {var hrefUrl=url;var match=hrefUrl.match(/['"]?([^'"]+)/);if(match)
696 hrefUrl=match[1];var container=document.createDocumentFragment();container.appen dChild(document.createTextNode("url("));if(this._styleRule.sourceURL) 1112 hrefUrl=match[1];var container=document.createDocumentFragment();container.appen dChild(document.createTextNode("url("));if(this._styleRule.sourceURL)
697 hrefUrl=WebInspector.ParsedURL.completeURL(this._styleRule.sourceURL,hrefUrl);el se if(this.node()) 1113 hrefUrl=WebInspector.ParsedURL.completeURL(this._styleRule.sourceURL,hrefUrl);el se if(this.node())
698 hrefUrl=this.node().resolveURL(hrefUrl);var hasResource=hrefUrl&&!!WebInspector. resourceForURL(hrefUrl);container.appendChild(WebInspector.linkifyURLAsNode(href Url||url,url,undefined,!hasResource));container.appendChild(document.createTextN ode(")"));return container;} 1114 hrefUrl=this.node().resolveURL(hrefUrl);var hasResource=hrefUrl&&!!WebInspector. resourceForURL(hrefUrl);container.appendChild(WebInspector.linkifyURLAsNode(href Url||url,url,undefined,!hasResource));container.appendChild(document.createTextN ode(")"));return container;}
699 if(value){var colorProcessor=processValue.bind(this,WebInspector.StylesSidebarPa ne._colorRegex,this._processColor.bind(this,nameElement,valueElement),null);valu eElement.appendChild(processValue(/url\(\s*([^)]+)\s*\)/g,linkifyURL.bind(this), WebInspector.CSSMetadata.isColorAwareProperty(this.name)&&this.parsedOk?colorPro cessor:null,value));} 1115 if(value){var colorProcessor=processValue.bind(null,WebInspector.StylesSidebarPa ne._colorRegex,this._processColor.bind(this,nameElement,valueElement),null);valu eElement.appendChild(processValue(/url\(\s*([^)]+)\s*\)/g,linkifyURL.bind(this), WebInspector.CSSMetadata.isColorAwareProperty(this.name)&&this.parsedOk?colorPro cessor:null,value));}
700 this.listItemElement.removeChildren();nameElement.normalize();valueElement.norma lize();if(!this.treeOutline) 1116 this.listItemElement.removeChildren();nameElement.normalize();valueElement.norma lize();if(!this.treeOutline)
701 return;if(this.disabled) 1117 return;if(this.disabled)
702 this.listItemElement.createChild("span","styles-clipboard-only").createTextChild ("/* ");this.listItemElement.appendChild(nameElement);this.listItemElement.appen dChild(document.createTextNode(": "));this.listItemElement.appendChild(this._exp andElement);this.listItemElement.appendChild(valueElement);this.listItemElement. appendChild(document.createTextNode(";"));if(this.disabled) 1118 this.listItemElement.createChild("span","styles-clipboard-only").createTextChild ("/* ");this.listItemElement.appendChild(nameElement);this.listItemElement.appen dChild(document.createTextNode(": "));this.listItemElement.appendChild(this._exp andElement);this.listItemElement.appendChild(valueElement);this.listItemElement. appendChild(document.createTextNode(";"));if(this.disabled)
703 this.listItemElement.createChild("span","styles-clipboard-only").createTextChild (" */");if(!this.parsedOk){this.hasChildren=false;this.listItemElement.classList .add("not-parsed-ok");this.listItemElement.insertBefore(WebInspector.StylesSideb arPane.createExclamationMark(this.property),this.listItemElement.firstChild);} 1119 this.listItemElement.createChild("span","styles-clipboard-only").createTextChild (" */");if(!this.parsedOk){this.hasChildren=false;this.listItemElement.classList .add("not-parsed-ok");this.listItemElement.insertBefore(WebInspector.StylesSideb arPane.createExclamationMark(this.property),this.listItemElement.firstChild);}
704 if(this.property.inactive) 1120 if(this.property.inactive)
705 this.listItemElement.classList.add("inactive");},_processColor:function(nameElem ent,valueElement,text) 1121 this.listItemElement.classList.add("inactive");this._updateFilter();},_updateFil ter:function()
1122 {var regEx=this.parentPane().filterRegex();this.listItemElement.classList.toggle ("filter-match",!!regEx&&(regEx.test(this.property.name)||regEx.test(this.proper ty.value)));},_processColor:function(nameElement,valueElement,text)
706 {var color=WebInspector.Color.parse(text);if(!color) 1123 {var color=WebInspector.Color.parse(text);if(!color)
707 return document.createTextNode(text);var format=WebInspector.StylesSidebarPane._ colorFormat(color);var spectrumHelper=this.editablePane()&&this.editablePane()._ spectrumHelper;var spectrum=spectrumHelper?spectrumHelper.spectrum():null;var is Editable=!!(this._styleRule&&this._styleRule.editable!==false);var colorSwatch=n ew WebInspector.ColorSwatch(!isEditable);colorSwatch.setColorString(text);colorS watch.element.addEventListener("click",swatchClick.bind(this),false);var scrolle rElement;var boundSpectrumChanged=spectrumChanged.bind(this);var boundSpectrumHi dden=spectrumHidden.bind(this);function spectrumChanged(e) 1124 return document.createTextNode(text);var format=WebInspector.StylesSidebarPane._ colorFormat(color);var spectrumHelper=this.editablePane()&&this.editablePane()._ spectrumHelper;var spectrum=spectrumHelper?spectrumHelper.spectrum():null;var is Editable=!!(this._styleRule&&this._styleRule.editable!==false);var colorSwatch=n ew WebInspector.ColorSwatch(!isEditable);colorSwatch.setColorString(text);colorS watch.element.addEventListener("click",swatchClick.bind(this),false);var scrolle rElement;var boundSpectrumChanged=spectrumChanged.bind(this);var boundSpectrumHi dden=spectrumHidden.bind(this);function spectrumChanged(e)
708 {var colorString=(e.data);spectrum.displayText=colorString;colorValueElement.tex tContent=colorString;colorSwatch.setColorString(colorString);this.applyStyleText (nameElement.textContent+": "+valueElement.textContent,false,false,false);} 1125 {var colorString=(e.data);spectrum.displayText=colorString;colorValueElement.tex tContent=colorString;colorSwatch.setColorString(colorString);this.applyStyleText (nameElement.textContent+": "+valueElement.textContent,false,false,false);}
709 function spectrumHidden(event) 1126 function spectrumHidden(event)
710 {if(scrollerElement) 1127 {if(scrollerElement)
711 scrollerElement.removeEventListener("scroll",repositionSpectrum,false);var commi tEdit=event.data;var propertyText=!commitEdit&&this.originalPropertyText?this.or iginalPropertyText:(nameElement.textContent+": "+valueElement.textContent);this. applyStyleText(propertyText,true,true,false);spectrum.removeEventListener(WebIns pector.Spectrum.Events.ColorChanged,boundSpectrumChanged);spectrumHelper.removeE ventListener(WebInspector.SpectrumPopupHelper.Events.Hidden,boundSpectrumHidden) ;delete this.editablePane()._isEditingStyle;delete this.originalPropertyText;} 1128 scrollerElement.removeEventListener("scroll",repositionSpectrum,false);var commi tEdit=event.data;var propertyText=!commitEdit&&this.originalPropertyText?this.or iginalPropertyText:(nameElement.textContent+": "+valueElement.textContent);this. applyStyleText(propertyText,true,true,false);spectrum.removeEventListener(WebIns pector.Spectrum.Events.ColorChanged,boundSpectrumChanged);spectrumHelper.removeE ventListener(WebInspector.SpectrumPopupHelper.Events.Hidden,boundSpectrumHidden) ;delete this.editablePane()._isEditingStyle;delete this.originalPropertyText;}
712 function repositionSpectrum() 1129 function repositionSpectrum()
713 {spectrumHelper.reposition(colorSwatch.element);} 1130 {spectrumHelper.reposition(colorSwatch.element);}
714 function swatchClick(e) 1131 function swatchClick(e)
715 {e.consume(true);if(!spectrumHelper||e.shiftKey){changeColorDisplay();return;} 1132 {e.consume(true);if(!spectrumHelper||e.shiftKey){changeColorDisplay();return;}
(...skipping 20 matching lines...) Expand all
736 this.listItemElement.classList.add("inherited");else 1153 this.listItemElement.classList.add("inherited");else
737 this.listItemElement.classList.remove("inherited");if(this.overloaded) 1154 this.listItemElement.classList.remove("inherited");if(this.overloaded)
738 this.listItemElement.classList.add("overloaded");else 1155 this.listItemElement.classList.add("overloaded");else
739 this.listItemElement.classList.remove("overloaded");if(this.disabled) 1156 this.listItemElement.classList.remove("overloaded");if(this.disabled)
740 this.listItemElement.classList.add("disabled");else 1157 this.listItemElement.classList.add("disabled");else
741 this.listItemElement.classList.remove("disabled");},__proto__:TreeElement.protot ype} 1158 this.listItemElement.classList.remove("disabled");},__proto__:TreeElement.protot ype}
742 WebInspector.ComputedStylePropertyTreeElement=function(stylesPane,styleRule,styl e,property,inherited) 1159 WebInspector.ComputedStylePropertyTreeElement=function(stylesPane,styleRule,styl e,property,inherited)
743 {WebInspector.StylePropertyTreeElementBase.call(this,styleRule,style,property,in herited,false,false);this._stylesPane=stylesPane;} 1160 {WebInspector.StylePropertyTreeElementBase.call(this,styleRule,style,property,in herited,false,false);this._stylesPane=stylesPane;}
744 WebInspector.ComputedStylePropertyTreeElement.prototype={node:function() 1161 WebInspector.ComputedStylePropertyTreeElement.prototype={node:function()
745 {return this._stylesPane.node;},editablePane:function() 1162 {return this._stylesPane.node;},editablePane:function()
746 {return null;},__proto__:WebInspector.StylePropertyTreeElementBase.prototype} 1163 {return null;},parentPane:function()
1164 {return this._stylesPane._computedStylePane;},_updateFilter:function()
1165 {var regEx=this.parentPane().filterRegex();this.listItemElement.classList.toggle ("hidden",!!regEx&&(!regEx.test(this.property.name)&&!regEx.test(this.property.v alue)));},__proto__:WebInspector.StylePropertyTreeElementBase.prototype}
747 WebInspector.StylePropertyTreeElement=function(stylesPane,styleRule,style,proper ty,isShorthand,inherited,overloaded) 1166 WebInspector.StylePropertyTreeElement=function(stylesPane,styleRule,style,proper ty,isShorthand,inherited,overloaded)
748 {WebInspector.StylePropertyTreeElementBase.call(this,styleRule,style,property,in herited,overloaded,isShorthand);this._parentPane=stylesPane;this.isShorthand=isS horthand;} 1167 {WebInspector.StylePropertyTreeElementBase.call(this,styleRule,style,property,in herited,overloaded,isShorthand);this._parentPane=stylesPane;this.isShorthand=isS horthand;}
749 WebInspector.StylePropertyTreeElement.prototype={node:function() 1168 WebInspector.StylePropertyTreeElement.prototype={node:function()
750 {return this._parentPane.node;},editablePane:function() 1169 {return this._parentPane.node;},editablePane:function()
1170 {return this._parentPane;},parentPane:function()
751 {return this._parentPane;},section:function() 1171 {return this._parentPane;},section:function()
752 {return this.treeOutline&&this.treeOutline.section;},_updatePane:function(userCa llback) 1172 {return this.treeOutline&&this.treeOutline.section;},_updatePane:function(userCa llback)
753 {var section=this.section();if(section&&section.pane) 1173 {var section=this.section();if(section&&section.pane)
754 section.pane._refreshUpdate(section,false,userCallback);else{if(userCallback) 1174 section.pane._refreshUpdate(section,false,userCallback);else{if(userCallback)
755 userCallback();}},toggleEnabled:function(event) 1175 userCallback();}},toggleEnabled:function(event)
756 {var disabled=!event.target.checked;function callback(newStyle) 1176 {var disabled=!event.target.checked;function callback(newStyle)
757 {if(!newStyle) 1177 {delete this._parentPane._userOperation;if(!newStyle)
758 return;newStyle.parentRule=this.style.parentRule;this.style=newStyle;this._style Rule.style=newStyle;var section=this.section();if(section&&section.pane) 1178 return;newStyle.parentRule=this.style.parentRule;this.style=newStyle;this._style Rule.style=newStyle;var section=this.section();if(section&&section.pane)
759 section.pane.dispatchEventToListeners("style property toggled");this._updatePane ();delete this._parentPane._userOperation;} 1179 section.pane.dispatchEventToListeners("style property toggled");this._updatePane ();}
760 this._parentPane._userOperation=true;this.property.setDisabled(disabled,callback .bind(this));event.consume();},onpopulate:function() 1180 this._parentPane._userOperation=true;this.property.setDisabled(disabled,callback .bind(this));event.consume();},onpopulate:function()
761 {if(this.children.length||!this.isShorthand) 1181 {if(this.children.length||!this.isShorthand)
762 return;var longhandProperties=this.style.longhandProperties(this.name);for(var i =0;i<longhandProperties.length;++i){var name=longhandProperties[i].name;var inhe rited=false;var overloaded=false;var section=this.section();if(section){inherite d=section.isPropertyInherited(name);overloaded=section.isPropertyOverloaded(name );} 1182 return;var longhandProperties=this.style.longhandProperties(this.name);for(var i =0;i<longhandProperties.length;++i){var name=longhandProperties[i].name;var inhe rited=false;var overloaded=false;var section=this.section();if(section){inherite d=section.isPropertyInherited(name);overloaded=section.isPropertyOverloaded(name );}
763 var liveProperty=this.style.getLiveProperty(name);if(!liveProperty) 1183 var liveProperty=this.style.getLiveProperty(name);if(!liveProperty)
764 continue;var item=new WebInspector.StylePropertyTreeElement(this._parentPane,thi s._styleRule,this.style,liveProperty,false,inherited,overloaded);this.appendChil d(item);}},onattach:function() 1184 continue;var item=new WebInspector.StylePropertyTreeElement(this._parentPane,thi s._styleRule,this.style,liveProperty,false,inherited,overloaded);this.appendChil d(item);}},onattach:function()
765 {WebInspector.StylePropertyTreeElementBase.prototype.onattach.call(this);this.li stItemElement.addEventListener("mousedown",this._mouseDown.bind(this));this.list ItemElement.addEventListener("mouseup",this._resetMouseDownElement.bind(this));t his.listItemElement.addEventListener("click",this._mouseClick.bind(this));},_mou seDown:function(event) 1185 {WebInspector.StylePropertyTreeElementBase.prototype.onattach.call(this);this.li stItemElement.addEventListener("mousedown",this._mouseDown.bind(this));this.list ItemElement.addEventListener("mouseup",this._resetMouseDownElement.bind(this));t his.listItemElement.addEventListener("click",this._mouseClick.bind(this));},_mou seDown:function(event)
766 {if(this._parentPane){this._parentPane._mouseDownTreeElement=this;this._parentPa ne._mouseDownTreeElementIsName=this._isNameElement(event.target);this._parentPan e._mouseDownTreeElementIsValue=this._isValueElement(event.target);}},_resetMouse DownElement:function() 1186 {if(this._parentPane){this._parentPane._mouseDownTreeElement=this;this._parentPa ne._mouseDownTreeElementIsName=this._isNameElement(event.target);this._parentPan e._mouseDownTreeElementIsValue=this._isValueElement(event.target);}},_resetMouse DownElement:function()
767 {if(this._parentPane){delete this._parentPane._mouseDownTreeElement;delete this. _parentPane._mouseDownTreeElementIsName;delete this._parentPane._mouseDownTreeEl ementIsValue;}},updateTitle:function() 1187 {if(this._parentPane){delete this._parentPane._mouseDownTreeElement;delete this. _parentPane._mouseDownTreeElementIsName;delete this._parentPane._mouseDownTreeEl ementIsValue;}},updateTitle:function()
768 {WebInspector.StylePropertyTreeElementBase.prototype.updateTitle.call(this);if(t his.parsedOk&&this.section()&&this.parent.root){var enabledCheckboxElement=docum ent.createElement("input");enabledCheckboxElement.className="enabled-button";ena bledCheckboxElement.type="checkbox";enabledCheckboxElement.checked=!this.disable d;enabledCheckboxElement.addEventListener("click",this.toggleEnabled.bind(this), false);this.listItemElement.insertBefore(enabledCheckboxElement,this.listItemEle ment.firstChild);}},_mouseClick:function(event) 1188 {WebInspector.StylePropertyTreeElementBase.prototype.updateTitle.call(this);if(t his.parsedOk&&this.section()&&this.parent.root){var enabledCheckboxElement=docum ent.createElement("input");enabledCheckboxElement.className="enabled-button";ena bledCheckboxElement.type="checkbox";enabledCheckboxElement.checked=!this.disable d;enabledCheckboxElement.addEventListener("click",this.toggleEnabled.bind(this), false);this.listItemElement.insertBefore(enabledCheckboxElement,this.listItemEle ment.firstChild);}},_mouseClick:function(event)
769 {if(!window.getSelection().isCollapsed) 1189 {if(!window.getSelection().isCollapsed)
770 return;event.consume(true);if(event.target===this.listItemElement){var section=t his.section();if(!section||!section.editable) 1190 return;event.consume(true);if(event.target===this.listItemElement){var section=t his.section();if(!section||!section.editable)
771 return;if(section._checkWillCancelEditing()) 1191 return;if(section._checkWillCancelEditing())
772 return;section.addNewBlankProperty(this.property.index+1).startEditing();return; } 1192 return;section.addNewBlankProperty(this.property.index+1).startEditing();return; }
773 if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&this.section().navig able){this._navigateToSource(event.target);return;} 1193 if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&this.section().navig able){this._navigateToSource(event.target);return;}
774 this.startEditing(event.target);},_navigateToSource:function(element) 1194 this.startEditing(event.target);},_navigateToSource:function(element)
775 {console.assert(this.section().navigable);var propertyNameClicked=element===this .nameElement;var uiLocation=this.property.uiLocation(propertyNameClicked);if(!ui Location) 1195 {console.assert(this.section().navigable);var propertyNameClicked=element===this .nameElement;WebInspector.Revealer.reveal(this.property.uiLocation(propertyNameC licked));},_isNameElement:function(element)
776 return;WebInspector.panel("sources").showUILocation(uiLocation);},_isNameElement :function(element)
777 {return element.enclosingNodeOrSelfWithClass("webkit-css-property")===this.nameE lement;},_isValueElement:function(element) 1196 {return element.enclosingNodeOrSelfWithClass("webkit-css-property")===this.nameE lement;},_isValueElement:function(element)
778 {return!!element.enclosingNodeOrSelfWithClass("value");},startEditing:function(s electElement) 1197 {return!!element.enclosingNodeOrSelfWithClass("value");},startEditing:function(s electElement)
779 {if(this.parent.isShorthand) 1198 {if(this.parent.isShorthand)
780 return;if(selectElement===this._expandElement) 1199 return;if(selectElement===this._expandElement)
781 return;var section=this.section();if(section&&!section.editable) 1200 return;var section=this.section();if(section&&!section.editable)
782 return;if(!selectElement) 1201 return;if(!selectElement)
783 selectElement=this.nameElement;else 1202 selectElement=this.nameElement;else
784 selectElement=selectElement.enclosingNodeOrSelfWithClass("webkit-css-property")| |selectElement.enclosingNodeOrSelfWithClass("value");if(WebInspector.isBeingEdit ed(selectElement)) 1203 selectElement=selectElement.enclosingNodeOrSelfWithClass("webkit-css-property")| |selectElement.enclosingNodeOrSelfWithClass("value");if(WebInspector.isBeingEdit ed(selectElement))
785 return;var isEditingName=selectElement===this.nameElement;if(!isEditingName) 1204 return;var isEditingName=selectElement===this.nameElement;if(!isEditingName)
786 this.valueElement.textContent=restoreURLs(this.valueElement.textContent,this.val ue);function restoreURLs(fieldValue,modelValue) 1205 this.valueElement.textContent=restoreURLs(this.valueElement.textContent,this.val ue);function restoreURLs(fieldValue,modelValue)
787 {const urlRegex=/\b(url\([^)]*\))/g;var splitFieldValue=fieldValue.split(urlRege x);if(splitFieldValue.length===1) 1206 {const urlRegex=/\b(url\([^)]*\))/g;var splitFieldValue=fieldValue.split(urlRege x);if(splitFieldValue.length===1)
788 return fieldValue;var modelUrlRegex=new RegExp(urlRegex);for(var i=1;i<splitFiel dValue.length;i+=2){var match=modelUrlRegex.exec(modelValue);if(match) 1207 return fieldValue;var modelUrlRegex=new RegExp(urlRegex);for(var i=1;i<splitFiel dValue.length;i+=2){var match=modelUrlRegex.exec(modelValue);if(match)
789 splitFieldValue[i]=match[0];} 1208 splitFieldValue[i]=match[0];}
790 return splitFieldValue.join("");} 1209 return splitFieldValue.join("");}
791 var context={expanded:this.expanded,hasChildren:this.hasChildren,isEditingName:i sEditingName,previousContent:selectElement.textContent};this.hasChildren=false;i f(selectElement.parentElement) 1210 var context={expanded:this.expanded,hasChildren:this.hasChildren,isEditingName:i sEditingName,previousContent:selectElement.textContent};this.hasChildren=false;i f(selectElement.parentElement)
792 selectElement.parentElement.classList.add("child-editing");selectElement.textCon tent=selectElement.textContent;function pasteHandler(context,event) 1211 selectElement.parentElement.classList.add("child-editing");selectElement.textCon tent=selectElement.textContent;function pasteHandler(context,event)
793 {var data=event.clipboardData.getData("Text");if(!data) 1212 {var data=event.clipboardData.getData("Text");if(!data)
794 return;var colonIdx=data.indexOf(":");if(colonIdx<0) 1213 return;var colonIdx=data.indexOf(":");if(colonIdx<0)
795 return;var name=data.substring(0,colonIdx).trim();var value=data.substring(colon Idx+1).trim();event.preventDefault();if(!("originalName"in context)){context.ori ginalName=this.nameElement.textContent;context.originalValue=this.valueElement.t extContent;} 1214 return;var name=data.substring(0,colonIdx).trim();var value=data.substring(colon Idx+1).trim();event.preventDefault();if(!("originalName"in context)){context.ori ginalName=this.nameElement.textContent;context.originalValue=this.valueElement.t extContent;}
796 this.property.name=name;this.property.value=value;this.nameElement.textContent=n ame;this.valueElement.textContent=value;this.nameElement.normalize();this.valueE lement.normalize();this.editingCommitted(event.target.textContent,context,"forwa rd");} 1215 this.property.name=name;this.property.value=value;this.nameElement.textContent=n ame;this.valueElement.textContent=value;this.nameElement.normalize();this.valueE lement.normalize();this.editingCommitted(event.target.textContent,context,"forwa rd");}
797 function blurListener(context,event) 1216 function blurListener(context,event)
798 {var treeElement=this._parentPane._mouseDownTreeElement;var moveDirection="";if( treeElement===this){if(isEditingName&&this._parentPane._mouseDownTreeElementIsVa lue) 1217 {var treeElement=this._parentPane._mouseDownTreeElement;var moveDirection="";if( treeElement===this){if(isEditingName&&this._parentPane._mouseDownTreeElementIsVa lue)
799 moveDirection="forward";if(!isEditingName&&this._parentPane._mouseDownTreeElemen tIsName) 1218 moveDirection="forward";if(!isEditingName&&this._parentPane._mouseDownTreeElemen tIsName)
800 moveDirection="backward";} 1219 moveDirection="backward";}
801 this.editingCommitted(event.target.textContent,context,moveDirection);} 1220 this.editingCommitted(event.target.textContent,context,moveDirection);}
802 delete this.originalPropertyText;this._parentPane._isEditingStyle=true;if(select Element.parentElement) 1221 delete this.originalPropertyText;this._parentPane._isEditingStyle=true;if(select Element.parentElement)
803 selectElement.parentElement.scrollIntoViewIfNeeded(false);var applyItemCallback= !isEditingName?this._applyFreeFlowStyleTextEdit.bind(this,true):undefined;this._ prompt=new WebInspector.StylesSidebarPane.CSSPropertyPrompt(isEditingName?WebIns pector.CSSMetadata.cssPropertiesMetainfo:WebInspector.CSSMetadata.keywordsForPro perty(this.nameElement.textContent),this,isEditingName);if(applyItemCallback){th is._prompt.addEventListener(WebInspector.TextPrompt.Events.ItemApplied,applyItem Callback,this);this._prompt.addEventListener(WebInspector.TextPrompt.Events.Item Accepted,applyItemCallback,this);} 1222 selectElement.parentElement.scrollIntoViewIfNeeded(false);var applyItemCallback= !isEditingName?this._applyFreeFlowStyleTextEdit.bind(this,true):undefined;this._ prompt=new WebInspector.StylesSidebarPane.CSSPropertyPrompt(isEditingName?WebIns pector.CSSMetadata.cssPropertiesMetainfo:WebInspector.CSSMetadata.keywordsForPro perty(this.nameElement.textContent),this,isEditingName);if(applyItemCallback){th is._prompt.addEventListener(WebInspector.TextPrompt.Events.ItemApplied,applyItem Callback,this);this._prompt.addEventListener(WebInspector.TextPrompt.Events.Item Accepted,applyItemCallback,this);}
804 var proxyElement=this._prompt.attachAndStartEditing(selectElement,blurListener.b ind(this,context));proxyElement.addEventListener("keydown",this.editingNameValue KeyDown.bind(this,context),false);if(isEditingName) 1223 var proxyElement=this._prompt.attachAndStartEditing(selectElement,blurListener.b ind(this,context));proxyElement.addEventListener("keydown",this.editingNameValue KeyDown.bind(this,context),false);proxyElement.addEventListener("keypress",this. editingNameValueKeyPress.bind(this,context),false);if(isEditingName)
805 proxyElement.addEventListener("paste",pasteHandler.bind(this,context),false);win dow.getSelection().setBaseAndExtent(selectElement,0,selectElement,1);},editingNa meValueKeyDown:function(context,event) 1224 proxyElement.addEventListener("paste",pasteHandler.bind(this,context),false);win dow.getSelection().setBaseAndExtent(selectElement,0,selectElement,1);},editingNa meValueKeyDown:function(context,event)
806 {if(event.handled) 1225 {if(event.handled)
807 return;var isEditingName=context.isEditingName;var result;function shouldCommitV alueSemicolon(text,cursorPosition) 1226 return;var isEditingName=context.isEditingName;var result;if(isEnterKey(event)){ event.preventDefault();result="forward";}else if(event.keyCode===WebInspector.Ke yboardShortcut.Keys.Esc.code||event.keyIdentifier==="U+001B")
1227 result="cancel";else if(!isEditingName&&this._newProperty&&event.keyCode===WebIn spector.KeyboardShortcut.Keys.Backspace.code){var selection=window.getSelection( );if(selection.isCollapsed&&!selection.focusOffset){event.preventDefault();resul t="backward";}}else if(event.keyIdentifier==="U+0009"){result=event.shiftKey?"ba ckward":"forward";event.preventDefault();}
1228 if(result){switch(result){case"cancel":this.editingCancelled(null,context);break ;case"forward":case"backward":this.editingCommitted(event.target.textContent,con text,result);break;}
1229 event.consume();return;}
1230 if(!isEditingName)
1231 this._applyFreeFlowStyleTextEdit(false);},editingNameValueKeyPress:function(cont ext,event)
1232 {function shouldCommitValueSemicolon(text,cursorPosition)
808 {var openQuote="";for(var i=0;i<cursorPosition;++i){var ch=text[i];if(ch==="\\"& &openQuote!=="") 1233 {var openQuote="";for(var i=0;i<cursorPosition;++i){var ch=text[i];if(ch==="\\"& &openQuote!=="")
809 ++i;else if(!openQuote&&(ch==="\""||ch==="'")) 1234 ++i;else if(!openQuote&&(ch==="\""||ch==="'"))
810 openQuote=ch;else if(openQuote===ch) 1235 openQuote=ch;else if(openQuote===ch)
811 openQuote="";} 1236 openQuote="";}
812 return!openQuote;} 1237 return!openQuote;}
813 var isFieldInputTerminated=(event.keyCode===WebInspector.KeyboardShortcut.Keys.S emicolon.code)&&(isEditingName?event.shiftKey:(!event.shiftKey&&shouldCommitValu eSemicolon(event.target.textContent,event.target.selectionLeftOffset())));if(isE nterKey(event)||isFieldInputTerminated){event.preventDefault();result="forward"; }else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code||event.keyI dentifier==="U+001B") 1238 var keyChar=String.fromCharCode(event.charCode);var isFieldInputTerminated=(cont ext.isEditingName?keyChar===":":keyChar===";"&&shouldCommitValueSemicolon(event. target.textContent,event.target.selectionLeftOffset()));if(isFieldInputTerminate d){event.consume(true);this.editingCommitted(event.target.textContent,context,"f orward");return;}},_applyFreeFlowStyleTextEdit:function(now)
814 result="cancel";else if(!isEditingName&&this._newProperty&&event.keyCode===WebIn spector.KeyboardShortcut.Keys.Backspace.code){var selection=window.getSelection( );if(selection.isCollapsed&&!selection.focusOffset){event.preventDefault();resul t="backward";}}else if(event.keyIdentifier==="U+0009"){result=event.shiftKey?"ba ckward":"forward";event.preventDefault();}
815 if(result){switch(result){case"cancel":this.editingCancelled(null,context);break ;case"forward":case"backward":this.editingCommitted(event.target.textContent,con text,result);break;}
816 event.consume();return;}
817 if(!isEditingName)
818 this._applyFreeFlowStyleTextEdit(false);},_applyFreeFlowStyleTextEdit:function(n ow)
819 {if(this._applyFreeFlowStyleTextEditTimer) 1239 {if(this._applyFreeFlowStyleTextEditTimer)
820 clearTimeout(this._applyFreeFlowStyleTextEditTimer);function apply() 1240 clearTimeout(this._applyFreeFlowStyleTextEditTimer);function apply()
821 {var valueText=this.valueElement.textContent;if(valueText.indexOf(";")===-1) 1241 {var valueText=this.valueElement.textContent;if(valueText.indexOf(";")===-1)
822 this.applyStyleText(this.nameElement.textContent+": "+valueText,false,false,fals e);} 1242 this.applyStyleText(this.nameElement.textContent+": "+valueText,false,false,fals e);}
823 if(now) 1243 if(now)
824 apply.call(this);else 1244 apply.call(this);else
825 this._applyFreeFlowStyleTextEditTimer=setTimeout(apply.bind(this),100);},kickFre eFlowStyleEditForTest:function() 1245 this._applyFreeFlowStyleTextEditTimer=setTimeout(apply.bind(this),100);},kickFre eFlowStyleEditForTest:function()
826 {this._applyFreeFlowStyleTextEdit(true);},editingEnded:function(context) 1246 {this._applyFreeFlowStyleTextEdit(true);},editingEnded:function(context)
827 {this._resetMouseDownElement();if(this._applyFreeFlowStyleTextEditTimer) 1247 {this._resetMouseDownElement();if(this._applyFreeFlowStyleTextEditTimer)
828 clearTimeout(this._applyFreeFlowStyleTextEditTimer);this.hasChildren=context.has Children;if(context.expanded) 1248 clearTimeout(this._applyFreeFlowStyleTextEditTimer);this.hasChildren=context.has Children;if(context.expanded)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 WebInspector.TextPrompt.prototype.onMouseWheel.call(this,event);},tabKeyPressed: function() 1314 WebInspector.TextPrompt.prototype.onMouseWheel.call(this,event);},tabKeyPressed: function()
895 {this.acceptAutoComplete();return false;},_handleNameOrValueUpDown:function(even t) 1315 {this.acceptAutoComplete();return false;},_handleNameOrValueUpDown:function(even t)
896 {function finishHandler(originalValue,replacementString) 1316 {function finishHandler(originalValue,replacementString)
897 {this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textContent+": " +this._sidebarPane.valueElement.textContent,false,false,false);} 1317 {this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textContent+": " +this._sidebarPane.valueElement.textContent,false,false,false);}
898 if(!this._isEditingName&&WebInspector.handleElementValueModifications(event,this ._sidebarPane.valueElement,finishHandler.bind(this),this._isValueSuggestion.bind (this))) 1318 if(!this._isEditingName&&WebInspector.handleElementValueModifications(event,this ._sidebarPane.valueElement,finishHandler.bind(this),this._isValueSuggestion.bind (this)))
899 return true;return false;},_isValueSuggestion:function(word) 1319 return true;return false;},_isValueSuggestion:function(word)
900 {if(!word) 1320 {if(!word)
901 return false;word=word.toLowerCase();return this._cssCompletions.keySet().hasOwn Property(word);},_buildPropertyCompletions:function(proxyElement,wordRange,force ,completionsReadyCallback) 1321 return false;word=word.toLowerCase();return this._cssCompletions.keySet().hasOwn Property(word);},_buildPropertyCompletions:function(proxyElement,wordRange,force ,completionsReadyCallback)
902 {var prefix=wordRange.toString().toLowerCase();if(!prefix&&!force&&(this._isEdit ingName||proxyElement.textContent.length)){completionsReadyCallback([]);return;} 1322 {var prefix=wordRange.toString().toLowerCase();if(!prefix&&!force&&(this._isEdit ingName||proxyElement.textContent.length)){completionsReadyCallback([]);return;}
903 var results=this._cssCompletions.startsWith(prefix);var selectedIndex=this._cssC ompletions.mostUsedOf(results);completionsReadyCallback(results,selectedIndex);} ,__proto__:WebInspector.TextPrompt.prototype};WebInspector.ElementsPanel=functio n() 1323 var results=this._cssCompletions.startsWith(prefix);var selectedIndex=this._cssC ompletions.mostUsedOf(results);completionsReadyCallback(results,selectedIndex);} ,__proto__:WebInspector.TextPrompt.prototype};WebInspector.ElementsPanel=functio n()
904 {WebInspector.Panel.call(this,"elements");this.registerRequiredCSS("breadcrumbLi st.css");this.registerRequiredCSS("elementsPanel.css");this.registerRequiredCSS( "textPrompt.css");this.setHideOnDetach();const initialSidebarWidth=325;const min imumContentWidthPercent=0.34;const initialSidebarHeight=325;const minimumContent HeightPercent=0.34;this.createSidebarView(this.element,WebInspector.SidebarView. SidebarPosition.End,initialSidebarWidth,initialSidebarHeight);this.splitView.sid ebarElement().classList.add("vbox");this.splitView.setSidebarElementConstraints( Preferences.minElementsSidebarWidth,Preferences.minElementsSidebarHeight);this.s plitView.setMainElementConstraints(minimumContentWidthPercent,minimumContentHeig htPercent);this.splitView.addEventListener(WebInspector.SidebarView.EventTypes.R esized,this._updateTreeOutlineVisibleWidth.bind(this));this._searchableView=new WebInspector.SearchableView(this);this.splitView.mainElement().classList.add("vb ox");this.splitView.setMainView(this._searchableView);var stackElement=this._sea rchableView.element;this.contentElement=stackElement.createChild("div");this.con tentElement.id="elements-content";this.contentElement.classList.add("outline-dis closure");this.contentElement.classList.add("source-code");if(!WebInspector.sett ings.domWordWrap.get()) 1324 {WebInspector.Panel.call(this,"elements");this.registerRequiredCSS("breadcrumbLi st.css");this.registerRequiredCSS("elementsPanel.css");this.registerRequiredCSS( "textPrompt.css");this.setHideOnDetach();this._splitView=new WebInspector.SplitV iew(true,true,"elementsPanelSplitViewState",325,325);this._splitView.addEventLis tener(WebInspector.SplitView.Events.SidebarSizeChanged,this._updateTreeOutlineVi sibleWidth.bind(this));this._splitView.show(this.element);this._searchableView=n ew WebInspector.SearchableView(this);this._searchableView.setMinimumSize(25,19); this._searchableView.show(this._splitView.mainElement());var stackElement=this._ searchableView.element;this.contentElement=stackElement.createChild("div");this. contentElement.id="elements-content";this.contentElement.classList.add("outline- disclosure");this.contentElement.classList.add("source-code");if(!WebInspector.s ettings.domWordWrap.get())
905 this.contentElement.classList.add("nowrap");WebInspector.settings.domWordWrap.ad dChangeListener(this._domWordWrapSettingChanged.bind(this));this.contentElement. addEventListener("contextmenu",this._contextMenuEventFired.bind(this),true);this .splitView.sidebarElement().addEventListener("contextmenu",this._sidebarContextM enuEventFired.bind(this),false);this.treeOutline=new WebInspector.ElementsTreeOu tline(true,true,this._populateContextMenu.bind(this),this._setPseudoClassForNode Id.bind(this));this.treeOutline.wireToDomAgent();this.treeOutline.addEventListen er(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,this._selectedNod eChanged,this);this.treeOutline.addEventListener(WebInspector.ElementsTreeOutlin e.Events.ElementsTreeUpdated,this._updateBreadcrumbIfNeeded,this);var crumbsCont ainer=stackElement.createChild("div");crumbsContainer.id="elements-crumbs";this. crumbsElement=crumbsContainer.createChild("div","crumbs");this.crumbsElement.add EventListener("mousemove",this._mouseMovedInCrumbs.bind(this),false);this.crumbs Element.addEventListener("mouseout",this._mouseMovedOutOfCrumbs.bind(this),false );this.sidebarPanes={};this.sidebarPanes.platformFonts=new WebInspector.Platform FontsSidebarPane();this.sidebarPanes.computedStyle=new WebInspector.ComputedStyl eSidebarPane();this.sidebarPanes.styles=new WebInspector.StylesSidebarPane(this. sidebarPanes.computedStyle,this._setPseudoClassForNodeId.bind(this));this.sideba rPanes.metrics=new WebInspector.MetricsSidebarPane();this.sidebarPanes.propertie s=new WebInspector.PropertiesSidebarPane();this.sidebarPanes.domBreakpoints=WebI nspector.domBreakpointsSidebarPane.createProxy(this);this.sidebarPanes.eventList eners=new WebInspector.EventListenersSidebarPane();this.sidebarPanes.styles.addE ventListener(WebInspector.SidebarPane.EventTypes.wasShown,this.updateStyles.bind (this,false));this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPan e.EventTypes.wasShown,this.updateMetrics.bind(this));this.sidebarPanes.platformF onts.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown,this.updatePl atformFonts.bind(this));this.sidebarPanes.properties.addEventListener(WebInspect or.SidebarPane.EventTypes.wasShown,this.updateProperties.bind(this));this.sideba rPanes.eventListeners.addEventListener(WebInspector.SidebarPane.EventTypes.wasSh own,this.updateEventListeners.bind(this));this.sidebarPanes.styles.addEventListe ner("style edited",this._stylesPaneEdited,this);this.sidebarPanes.styles.addEven tListener("style property toggled",this._stylesPaneEdited,this);this.sidebarPane s.metrics.addEventListener("metrics edited",this._metricsPaneEdited,this);this._ extensionSidebarPanes=[];WebInspector.dockController.addEventListener(WebInspect or.DockController.Events.DockSideChanged,this._dockSideChanged.bind(this));WebIn spector.settings.splitVerticallyWhenDockedToRight.addChangeListener(this._dockSi deChanged.bind(this));this._dockSideChanged();this._popoverHelper=new WebInspect or.PopoverHelper(this.element,this._getPopoverAnchor.bind(this),this._showPopove r.bind(this));this._popoverHelper.setTimeout(0);WebInspector.domAgent.addEventLi stener(WebInspector.DOMAgent.Events.DocumentUpdated,this._documentUpdatedEvent,t his);WebInspector.settings.showShadowDOM.addChangeListener(this._showShadowDOMCh anged.bind(this));if(WebInspector.domAgent.existingDocument()) 1325 this.contentElement.classList.add("nowrap");WebInspector.settings.domWordWrap.ad dChangeListener(this._domWordWrapSettingChanged.bind(this));this.contentElement. addEventListener("contextmenu",this._contextMenuEventFired.bind(this),true);this ._splitView.sidebarElement().addEventListener("contextmenu",this._sidebarContext MenuEventFired.bind(this),false);this.treeOutline=new WebInspector.ElementsTreeO utline(true,true,this._populateContextMenu.bind(this),this._setPseudoClassForNod eId.bind(this));this.treeOutline.wireToDomAgent();this.treeOutline.addEventListe ner(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,this._selectedNo deChanged,this);this.treeOutline.addEventListener(WebInspector.ElementsTreeOutli ne.Events.ElementsTreeUpdated,this._updateBreadcrumbIfNeeded,this);var crumbsCon tainer=stackElement.createChild("div");crumbsContainer.id="elements-crumbs";this .crumbsElement=crumbsContainer.createChild("div","crumbs");this.crumbsElement.ad dEventListener("mousemove",this._mouseMovedInCrumbs.bind(this),false);this.crumb sElement.addEventListener("mouseout",this._mouseMovedOutOfCrumbs.bind(this),fals e);this.sidebarPanes={};this.sidebarPanes.platformFonts=new WebInspector.Platfor mFontsSidebarPane();this.sidebarPanes.computedStyle=new WebInspector.ComputedSty leSidebarPane();this.sidebarPanes.styles=new WebInspector.StylesSidebarPane(this .sidebarPanes.computedStyle,this._setPseudoClassForNodeId.bind(this));this._matc hedStylesFilterBoxContainer=document.createElement("div");this._matchedStylesFil terBoxContainer.className="sidebar-pane-filter-box";this._computedStylesFilterBo xContainer=document.createElement("div");this._computedStylesFilterBoxContainer. className="sidebar-pane-filter-box";this.sidebarPanes.styles.setFilterBoxContain ers(this._matchedStylesFilterBoxContainer,this._computedStylesFilterBoxContainer );this.sidebarPanes.metrics=new WebInspector.MetricsSidebarPane();this.sidebarPa nes.properties=new WebInspector.PropertiesSidebarPane();this.sidebarPanes.domBre akpoints=WebInspector.domBreakpointsSidebarPane.createProxy(this);this.sidebarPa nes.eventListeners=new WebInspector.EventListenersSidebarPane();this.sidebarPane s.styles.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown,this.upda teStyles.bind(this,false));this.sidebarPanes.metrics.addEventListener(WebInspect or.SidebarPane.EventTypes.wasShown,this.updateMetrics.bind(this));this.sidebarPa nes.platformFonts.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown, this.updatePlatformFonts.bind(this));this.sidebarPanes.properties.addEventListen er(WebInspector.SidebarPane.EventTypes.wasShown,this.updateProperties.bind(this) );this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.Eve ntTypes.wasShown,this.updateEventListeners.bind(this));this.sidebarPanes.styles. addEventListener("style edited",this._stylesPaneEdited,this);this.sidebarPanes.s tyles.addEventListener("style property toggled",this._stylesPaneEdited,this);thi s.sidebarPanes.metrics.addEventListener("metrics edited",this._metricsPaneEdited ,this);this._extensionSidebarPanes=[];WebInspector.dockController.addEventListen er(WebInspector.DockController.Events.DockSideChanged,this._dockSideChanged.bind (this));WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener (this._dockSideChanged.bind(this));this._dockSideChanged();this._popoverHelper=n ew WebInspector.PopoverHelper(this.element,this._getPopoverAnchor.bind(this),thi s._showPopover.bind(this));this._popoverHelper.setTimeout(0);WebInspector.domMod el.addEventListener(WebInspector.DOMModel.Events.DocumentUpdated,this._documentU pdatedEvent,this);WebInspector.settings.showUAShadowDOM.addChangeListener(this._ showUAShadowDOMChanged.bind(this));WebInspector.cssModel.addEventListener(WebIns pector.CSSStyleModel.Events.ModelWasEnabled,this._updateSidebars,this);}
906 this._documentUpdated(WebInspector.domAgent.existingDocument());WebInspector.css Model.addEventListener(WebInspector.CSSStyleModel.Events.ModelWasEnabled,this._u pdateSidebars,this);}
907 WebInspector.ElementsPanel.prototype={_updateTreeOutlineVisibleWidth:function() 1326 WebInspector.ElementsPanel.prototype={_updateTreeOutlineVisibleWidth:function()
908 {if(!this.treeOutline) 1327 {if(!this.treeOutline)
909 return;var width=this.splitView.element.offsetWidth;if(this.splitView.isVertical ()) 1328 return;var width=this._splitView.element.offsetWidth;if(this._splitView.isVertic al())
910 width-=this.splitView.sidebarWidth();this.treeOutline.setVisibleWidth(width);thi s.updateBreadcrumbSizes();},defaultFocusedElement:function() 1329 width-=this._splitView.sidebarSize();this.treeOutline.setVisibleWidth(width);thi s.treeOutline.updateSelection();this.updateBreadcrumbSizes();},defaultFocusedEle ment:function()
911 {return this.treeOutline.element;},searchableView:function() 1330 {return this.treeOutline.element;},searchableView:function()
912 {return this._searchableView;},statusBarResized:function() 1331 {return this._searchableView;},wasShown:function()
913 {this.updateBreadcrumbSizes();},wasShown:function()
914 {if(this.treeOutline.element.parentElement!==this.contentElement) 1332 {if(this.treeOutline.element.parentElement!==this.contentElement)
915 this.contentElement.appendChild(this.treeOutline.element);WebInspector.Panel.pro totype.wasShown.call(this);this.updateBreadcrumb();this.treeOutline.updateSelect ion();this.treeOutline.setVisible(true);if(!this.treeOutline.rootDOMNode) 1333 this.contentElement.appendChild(this.treeOutline.element);WebInspector.Panel.pro totype.wasShown.call(this);this.updateBreadcrumb();this.treeOutline.updateSelect ion();this.treeOutline.setVisible(true);if(!this.treeOutline.rootDOMNode)
916 WebInspector.domAgent.requestDocument();},willHide:function() 1334 if(WebInspector.domModel.existingDocument())
917 {WebInspector.domAgent.hideDOMNodeHighlight();this.treeOutline.setVisible(false) ;this._popoverHelper.hidePopover();this.contentElement.removeChild(this.treeOutl ine.element);WebInspector.Panel.prototype.willHide.call(this);},onResize:functio n() 1335 this._documentUpdated(WebInspector.domModel.existingDocument());else
918 {this.treeOutline.updateSelection();this.updateBreadcrumbSizes();},_setPseudoCla ssForNodeId:function(nodeId,pseudoClass,enable) 1336 WebInspector.domModel.requestDocument();},willHide:function()
919 {var node=WebInspector.domAgent.nodeForId(nodeId);if(!node) 1337 {WebInspector.domModel.hideDOMNodeHighlight();this.treeOutline.setVisible(false) ;this._popoverHelper.hidePopover();this.contentElement.removeChild(this.treeOutl ine.element);WebInspector.Panel.prototype.willHide.call(this);},onResize:functio n()
1338 {this._updateTreeOutlineVisibleWidth();},omitDefaultSelection:function()
1339 {this._omitDefaultSelection=true;},stopOmittingDefaultSelection:function()
1340 {delete this._omitDefaultSelection;},_setPseudoClassForNodeId:function(nodeId,ps eudoClass,enable)
1341 {var node=WebInspector.domModel.nodeForId(nodeId);if(!node)
920 return;var pseudoClasses=node.getUserProperty(WebInspector.ElementsTreeOutline.P seudoStateDecorator.PropertyName);if(enable){pseudoClasses=pseudoClasses||[];if( pseudoClasses.indexOf(pseudoClass)>=0) 1342 return;var pseudoClasses=node.getUserProperty(WebInspector.ElementsTreeOutline.P seudoStateDecorator.PropertyName);if(enable){pseudoClasses=pseudoClasses||[];if( pseudoClasses.indexOf(pseudoClass)>=0)
921 return;pseudoClasses.push(pseudoClass);node.setUserProperty(WebInspector.Element sTreeOutline.PseudoStateDecorator.PropertyName,pseudoClasses);}else{if(!pseudoCl asses||pseudoClasses.indexOf(pseudoClass)<0) 1343 return;pseudoClasses.push(pseudoClass);node.setUserProperty(WebInspector.Element sTreeOutline.PseudoStateDecorator.PropertyName,pseudoClasses);}else{if(!pseudoCl asses||pseudoClasses.indexOf(pseudoClass)<0)
922 return;pseudoClasses.remove(pseudoClass);if(!pseudoClasses.length) 1344 return;pseudoClasses.remove(pseudoClass);if(!pseudoClasses.length)
923 node.removeUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecorator.Pr opertyName);} 1345 node.removeUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecorator.Pr opertyName);}
924 this.treeOutline.updateOpenCloseTags(node);WebInspector.cssModel.forcePseudoStat e(node.id,node.getUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecor ator.PropertyName));this._metricsPaneEdited();this._stylesPaneEdited();WebInspec tor.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{ action:WebInspector.UserMetrics.UserActionNames.ForcedElementState,selector:WebI nspector.DOMPresentationUtils.appropriateSelectorFor(node,false),enabled:enable, state:pseudoClass});},_selectedNodeChanged:function() 1346 this.treeOutline.updateOpenCloseTags(node);WebInspector.cssModel.forcePseudoStat e(node.id,node.getUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecor ator.PropertyName));this._metricsPaneEdited();this._stylesPaneEdited();WebInspec tor.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{ action:WebInspector.UserMetrics.UserActionNames.ForcedElementState,selector:WebI nspector.DOMPresentationUtils.fullQualifiedSelector(node,false),enabled:enable,s tate:pseudoClass});},_selectedNodeChanged:function()
925 {var selectedNode=this.selectedDOMNode();if(!selectedNode&&this._lastValidSelect edNode) 1347 {var selectedNode=this.selectedDOMNode();if(!selectedNode&&this._lastValidSelect edNode)
926 this._selectedPathOnReset=this._lastValidSelectedNode.path();this.updateBreadcru mb(false);this._updateSidebars();if(selectedNode){ConsoleAgent.addInspectedNode( selectedNode.id);this._lastValidSelectedNode=selectedNode;} 1348 this._selectedPathOnReset=this._lastValidSelectedNode.path();this.updateBreadcru mb(false);this._updateSidebars();if(selectedNode){ConsoleAgent.addInspectedNode( selectedNode.id);this._lastValidSelectedNode=selectedNode;}
927 WebInspector.notifications.dispatchEventToListeners(WebInspector.ElementsTreeOut line.Events.SelectedNodeChanged);},_updateSidebars:function() 1349 WebInspector.notifications.dispatchEventToListeners(WebInspector.NotificationSer vice.Events.SelectedNodeChanged);},_updateSidebars:function()
928 {for(var pane in this.sidebarPanes) 1350 {for(var pane in this.sidebarPanes)
929 this.sidebarPanes[pane].needsUpdate=true;this.updateStyles(true);this.updateMetr ics();this.updatePlatformFonts();this.updateProperties();this.updateEventListene rs();},_reset:function() 1351 this.sidebarPanes[pane].needsUpdate=true;this.updateStyles(true);this.updateMetr ics();this.updatePlatformFonts();this.updateProperties();this.updateEventListene rs();},_reset:function()
930 {delete this.currentQuery;},_documentUpdatedEvent:function(event) 1352 {delete this.currentQuery;},_documentUpdatedEvent:function(event)
931 {this._documentUpdated(event.data);},_documentUpdated:function(inspectedRootDocu ment) 1353 {this._documentUpdated(event.data);},_documentUpdated:function(inspectedRootDocu ment)
932 {this._reset();this.searchCanceled();this.treeOutline.rootDOMNode=inspectedRootD ocument;if(!inspectedRootDocument){if(this.isShowing()) 1354 {this._reset();this.searchCanceled();this.treeOutline.rootDOMNode=inspectedRootD ocument;if(!inspectedRootDocument){if(this.isShowing())
933 WebInspector.domAgent.requestDocument();return;} 1355 WebInspector.domModel.requestDocument();return;}
934 WebInspector.domBreakpointsSidebarPane.restoreBreakpoints();function selectNode( candidateFocusNode) 1356 WebInspector.domBreakpointsSidebarPane.restoreBreakpoints();function selectNode( candidateFocusNode)
935 {if(!candidateFocusNode) 1357 {if(!candidateFocusNode)
936 candidateFocusNode=inspectedRootDocument.body||inspectedRootDocument.documentEle ment;if(!candidateFocusNode) 1358 candidateFocusNode=inspectedRootDocument.body||inspectedRootDocument.documentEle ment;if(!candidateFocusNode)
937 return;this.selectDOMNode(candidateFocusNode);if(this.treeOutline.selectedTreeEl ement) 1359 return;this.selectDOMNode(candidateFocusNode);if(this.treeOutline.selectedTreeEl ement)
938 this.treeOutline.selectedTreeElement.expand();} 1360 this.treeOutline.selectedTreeElement.expand();}
939 function selectLastSelectedNode(nodeId) 1361 function selectLastSelectedNode(nodeId)
940 {if(this.selectedDOMNode()){return;} 1362 {if(this.selectedDOMNode()){return;}
941 var node=nodeId?WebInspector.domAgent.nodeForId(nodeId):null;selectNode.call(thi s,node);} 1363 var node=nodeId?WebInspector.domModel.nodeForId(nodeId):null;selectNode.call(thi s,node);}
942 if(this._selectedPathOnReset) 1364 if(this._omitDefaultSelection)
943 WebInspector.domAgent.pushNodeByPathToFrontend(this._selectedPathOnReset,selectL astSelectedNode.bind(this));else 1365 return;if(this._selectedPathOnReset)
1366 WebInspector.domModel.pushNodeByPathToFrontend(this._selectedPathOnReset,selectL astSelectedNode.bind(this));else
944 selectNode.call(this,null);delete this._selectedPathOnReset;},searchCanceled:fun ction() 1367 selectNode.call(this,null);delete this._selectedPathOnReset;},searchCanceled:fun ction()
945 {delete this._searchQuery;this._hideSearchHighlights();this._searchableView.upda teSearchMatchesCount(0);delete this._currentSearchResultIndex;delete this._searc hResults;WebInspector.domAgent.cancelSearch();},performSearch:function(query,sho uldJump) 1368 {delete this._searchQuery;this._hideSearchHighlights();this._searchableView.upda teSearchMatchesCount(0);delete this._currentSearchResultIndex;delete this._searc hResults;WebInspector.domModel.cancelSearch();},performSearch:function(query,sho uldJump)
946 {this.searchCanceled();const whitespaceTrimmedQuery=query.trim();if(!whitespaceT rimmedQuery.length) 1369 {this.searchCanceled();const whitespaceTrimmedQuery=query.trim();if(!whitespaceT rimmedQuery.length)
947 return;this._searchQuery=query;function resultCountCallback(resultCount) 1370 return;this._searchQuery=query;function resultCountCallback(resultCount)
948 {this._searchableView.updateSearchMatchesCount(resultCount);if(!resultCount) 1371 {this._searchableView.updateSearchMatchesCount(resultCount);if(!resultCount)
949 return;this._searchResults=new Array(resultCount);this._currentSearchResultIndex =-1;if(shouldJump) 1372 return;this._searchResults=new Array(resultCount);this._currentSearchResultIndex =-1;if(shouldJump)
950 this.jumpToNextSearchResult();} 1373 this.jumpToNextSearchResult();}
951 WebInspector.domAgent.performSearch(whitespaceTrimmedQuery,resultCountCallback.b ind(this));},_contextMenuEventFired:function(event) 1374 WebInspector.domModel.performSearch(whitespaceTrimmedQuery,resultCountCallback.b ind(this));},_contextMenuEventFired:function(event)
952 {function toggleWordWrap() 1375 {var contextMenu=new WebInspector.ContextMenu(event);this.treeOutline.populateCo ntextMenu(contextMenu,event);contextMenu.show();},_domWordWrapSettingChanged:fun ction(event)
953 {WebInspector.settings.domWordWrap.set(!WebInspector.settings.domWordWrap.get()) ;}
954 var contextMenu=new WebInspector.ContextMenu(event);this.treeOutline.populateCon textMenu(contextMenu,event);if(WebInspector.experimentsSettings.cssRegions.isEna bled()){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIStri ng(WebInspector.useLowerCaseMenuTitles()?"CSS named flows\u2026":"CSS Named Flow s\u2026"),this._showNamedFlowCollections.bind(this));}
955 contextMenu.appendSeparator();contextMenu.appendCheckboxItem(WebInspector.UIStri ng(WebInspector.useLowerCaseMenuTitles()?"Word wrap":"Word Wrap"),toggleWordWrap .bind(this),WebInspector.settings.domWordWrap.get());contextMenu.show();},_showN amedFlowCollections:function()
956 {if(!WebInspector.cssNamedFlowCollectionsView)
957 WebInspector.cssNamedFlowCollectionsView=new WebInspector.CSSNamedFlowCollection sView();WebInspector.cssNamedFlowCollectionsView.showInDrawer();},_domWordWrapSe ttingChanged:function(event)
958 {if(event.data) 1376 {if(event.data)
959 this.contentElement.classList.remove("nowrap");else 1377 this.contentElement.classList.remove("nowrap");else
960 this.contentElement.classList.add("nowrap");var selectedNode=this.selectedDOMNod e();if(!selectedNode) 1378 this.contentElement.classList.add("nowrap");var selectedNode=this.selectedDOMNod e();if(!selectedNode)
961 return;var treeElement=this.treeOutline.findTreeElement(selectedNode);if(treeEle ment) 1379 return;var treeElement=this.treeOutline.findTreeElement(selectedNode);if(treeEle ment)
962 treeElement.updateSelection();},switchToAndFocus:function(node) 1380 treeElement.updateSelection();},switchToAndFocus:function(node)
963 {this._searchableView.cancelSearch();WebInspector.inspectorView.setCurrentPanel( this);this.selectDOMNode(node,true);},_populateContextMenu:function(contextMenu, node) 1381 {this._searchableView.cancelSearch();WebInspector.inspectorView.setCurrentPanel( this);this.selectDOMNode(node,true);},_populateContextMenu:function(contextMenu, node)
964 {contextMenu.appendSeparator();var pane=WebInspector.domBreakpointsSidebarPane;p ane.populateNodeContextMenu(node,contextMenu);},_getPopoverAnchor:function(eleme nt) 1382 {contextMenu.appendSeparator();var pane=WebInspector.domBreakpointsSidebarPane;p ane.populateNodeContextMenu(node,contextMenu);},_getPopoverAnchor:function(eleme nt)
965 {var anchor=element.enclosingNodeOrSelfWithClass("webkit-html-resource-link");if (anchor){if(!anchor.href) 1383 {var anchor=element.enclosingNodeOrSelfWithClass("webkit-html-resource-link");if (anchor){if(!anchor.href)
966 return null;var resource=WebInspector.resourceTreeModel.resourceForURL(anchor.hr ef);if(!resource||resource.type!==WebInspector.resourceTypes.Image) 1384 return null;var resource=WebInspector.resourceTreeModel.resourceForURL(anchor.hr ef);if(!resource||resource.type!==WebInspector.resourceTypes.Image)
967 return null;anchor.removeAttribute("title");} 1385 return null;anchor.removeAttribute("title");}
(...skipping 11 matching lines...) Expand all
979 return;popover.setCanShrink(false);popover.show(contents,anchor);}},jumpToNextSe archResult:function() 1397 return;popover.setCanShrink(false);popover.show(contents,anchor);}},jumpToNextSe archResult:function()
980 {if(!this._searchResults) 1398 {if(!this._searchResults)
981 return;this._hideSearchHighlights();if(++this._currentSearchResultIndex>=this._s earchResults.length) 1399 return;this._hideSearchHighlights();if(++this._currentSearchResultIndex>=this._s earchResults.length)
982 this._currentSearchResultIndex=0;this._highlightCurrentSearchResult();},jumpToPr eviousSearchResult:function() 1400 this._currentSearchResultIndex=0;this._highlightCurrentSearchResult();},jumpToPr eviousSearchResult:function()
983 {if(!this._searchResults) 1401 {if(!this._searchResults)
984 return;this._hideSearchHighlights();if(--this._currentSearchResultIndex<0) 1402 return;this._hideSearchHighlights();if(--this._currentSearchResultIndex<0)
985 this._currentSearchResultIndex=(this._searchResults.length-1);this._highlightCur rentSearchResult();},_highlightCurrentSearchResult:function() 1403 this._currentSearchResultIndex=(this._searchResults.length-1);this._highlightCur rentSearchResult();},_highlightCurrentSearchResult:function()
986 {var index=this._currentSearchResultIndex;var searchResults=this._searchResults; var searchResult=searchResults[index];if(searchResult===null){this._searchableVi ew.updateCurrentMatchIndex(index);return;} 1404 {var index=this._currentSearchResultIndex;var searchResults=this._searchResults; var searchResult=searchResults[index];if(searchResult===null){this._searchableVi ew.updateCurrentMatchIndex(index);return;}
987 function searchCallback(node) 1405 function searchCallback(node)
988 {searchResults[index]=node;this._highlightCurrentSearchResult();} 1406 {searchResults[index]=node;this._highlightCurrentSearchResult();}
989 if(typeof searchResult==="undefined"){WebInspector.domAgent.searchResult(index,s earchCallback.bind(this));return;} 1407 if(typeof searchResult==="undefined"){WebInspector.domModel.searchResult(index,s earchCallback.bind(this));return;}
990 this._searchableView.updateCurrentMatchIndex(index);var treeElement=this.treeOut line.findTreeElement(searchResult);if(treeElement){treeElement.highlightSearchRe sults(this._searchQuery);treeElement.reveal();var matches=treeElement.listItemEl ement.getElementsByClassName("highlighted-search-result");if(matches.length) 1408 this._searchableView.updateCurrentMatchIndex(index);var treeElement=this.treeOut line.findTreeElement(searchResult);if(treeElement){treeElement.highlightSearchRe sults(this._searchQuery);treeElement.reveal();var matches=treeElement.listItemEl ement.getElementsByClassName("highlighted-search-result");if(matches.length)
991 matches[0].scrollIntoViewIfNeeded();}},_hideSearchHighlights:function() 1409 matches[0].scrollIntoViewIfNeeded();}},_hideSearchHighlights:function()
992 {if(!this._searchResults) 1410 {if(!this._searchResults)
993 return;var searchResult=this._searchResults[this._currentSearchResultIndex];if(! searchResult) 1411 return;var searchResult=this._searchResults[this._currentSearchResultIndex];if(! searchResult)
994 return;var treeElement=this.treeOutline.findTreeElement(searchResult);if(treeEle ment) 1412 return;var treeElement=this.treeOutline.findTreeElement(searchResult);if(treeEle ment)
995 treeElement.hideSearchHighlights();},selectedDOMNode:function() 1413 treeElement.hideSearchHighlights();},selectedDOMNode:function()
996 {return this.treeOutline.selectedDOMNode();},selectDOMNode:function(node,focus) 1414 {return this.treeOutline.selectedDOMNode();},selectDOMNode:function(node,focus)
997 {this.treeOutline.selectDOMNode(node,focus);},_updateBreadcrumbIfNeeded:function (event) 1415 {this.treeOutline.selectDOMNode(node,focus);},_updateBreadcrumbIfNeeded:function (event)
998 {var nodes=(event.data||[]);if(!nodes.length) 1416 {var nodes=(event.data||[]);if(!nodes.length)
999 return;var crumbs=this.crumbsElement;for(var crumb=crumbs.firstChild;crumb;crumb =crumb.nextSibling){if(nodes.indexOf(crumb.representedObject)!==-1){this.updateB readcrumb(true);return;}}},_stylesPaneEdited:function() 1417 return;var crumbs=this.crumbsElement;for(var crumb=crumbs.firstChild;crumb;crumb =crumb.nextSibling){if(nodes.indexOf(crumb.representedObject)!==-1){this.updateB readcrumb(true);return;}}},_stylesPaneEdited:function()
1000 {this.sidebarPanes.metrics.needsUpdate=true;this.updateMetrics();this.sidebarPan es.platformFonts.needsUpdate=true;this.updatePlatformFonts();},_metricsPaneEdite d:function() 1418 {this.sidebarPanes.metrics.needsUpdate=true;this.updateMetrics();this.sidebarPan es.platformFonts.needsUpdate=true;this.updatePlatformFonts();},_metricsPaneEdite d:function()
1001 {this.sidebarPanes.styles.needsUpdate=true;this.updateStyles(true);},_mouseMoved InCrumbs:function(event) 1419 {this.sidebarPanes.styles.needsUpdate=true;this.updateStyles(true);},_mouseMoved InCrumbs:function(event)
1002 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);var crumb Element=nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");WebInspector.domAge nt.highlightDOMNode(crumbElement?crumbElement.representedObject.id:0);if("_mouse OutOfCrumbsTimeout"in this){clearTimeout(this._mouseOutOfCrumbsTimeout);delete t his._mouseOutOfCrumbsTimeout;}},_mouseMovedOutOfCrumbs:function(event) 1420 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);var crumb Element=nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");WebInspector.domMod el.highlightDOMNode(crumbElement?crumbElement.representedObject.id:0);if("_mouse OutOfCrumbsTimeout"in this){clearTimeout(this._mouseOutOfCrumbsTimeout);delete t his._mouseOutOfCrumbsTimeout;}},_mouseMovedOutOfCrumbs:function(event)
1003 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUn derMouse&&nodeUnderMouse.isDescendant(this.crumbsElement)) 1421 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUn derMouse&&nodeUnderMouse.isDescendant(this.crumbsElement))
1004 return;WebInspector.domAgent.hideDOMNodeHighlight();this._mouseOutOfCrumbsTimeou t=setTimeout(this.updateBreadcrumbSizes.bind(this),1000);},updateBreadcrumb:func tion(forceUpdate) 1422 return;WebInspector.domModel.hideDOMNodeHighlight();this._mouseOutOfCrumbsTimeou t=setTimeout(this.updateBreadcrumbSizes.bind(this),1000);},updateBreadcrumb:func tion(forceUpdate)
1005 {if(!this.isShowing()) 1423 {if(!this.isShowing())
1006 return;var crumbs=this.crumbsElement;var handled=false;var crumb=crumbs.firstChi ld;while(crumb){if(crumb.representedObject===this.selectedDOMNode()){crumb.class List.add("selected");handled=true;}else{crumb.classList.remove("selected");} 1424 return;var crumbs=this.crumbsElement;var handled=false;var crumb=crumbs.firstChi ld;while(crumb){if(crumb.representedObject===this.selectedDOMNode()){crumb.class List.add("selected");handled=true;}else{crumb.classList.remove("selected");}
1007 crumb=crumb.nextSibling;} 1425 crumb=crumb.nextSibling;}
1008 if(handled&&!forceUpdate){this.updateBreadcrumbSizes();return;} 1426 if(handled&&!forceUpdate){this.updateBreadcrumbSizes();return;}
1009 crumbs.removeChildren();var panel=this;function selectCrumbFunction(event) 1427 crumbs.removeChildren();var panel=this;function selectCrumbFunction(event)
1010 {var crumb=event.currentTarget;if(crumb.classList.contains("collapsed")){if(crum b===panel.crumbsElement.firstChild){var currentCrumb=crumb;while(currentCrumb){v ar hidden=currentCrumb.classList.contains("hidden");var collapsed=currentCrumb.c lassList.contains("collapsed");if(!hidden&&!collapsed) 1428 {var crumb=event.currentTarget;if(crumb.classList.contains("collapsed")){if(crum b===panel.crumbsElement.firstChild){var currentCrumb=crumb;while(currentCrumb){v ar hidden=currentCrumb.classList.contains("hidden");var collapsed=currentCrumb.c lassList.contains("collapsed");if(!hidden&&!collapsed)
1011 break;crumb=currentCrumb;currentCrumb=currentCrumb.nextSibling;}} 1429 break;crumb=currentCrumb;currentCrumb=currentCrumb.nextSibling;}}
1012 panel.updateBreadcrumbSizes(crumb);}else 1430 panel.updateBreadcrumbSizes(crumb);}else
1013 panel.selectDOMNode(crumb.representedObject,true);event.preventDefault();} 1431 panel.selectDOMNode(crumb.representedObject,true);event.preventDefault();}
1014 for(var current=this.selectedDOMNode();current;current=current.parentNode){if(cu rrent.nodeType()===Node.DOCUMENT_NODE) 1432 for(var current=this.selectedDOMNode();current;current=current.parentNode){if(cu rrent.nodeType()===Node.DOCUMENT_NODE)
1015 continue;crumb=document.createElement("span");crumb.className="crumb";crumb.repr esentedObject=current;crumb.addEventListener("mousedown",selectCrumbFunction,fal se);var crumbTitle="";switch(current.nodeType()){case Node.ELEMENT_NODE:if(curre nt.pseudoType()) 1433 continue;crumb=document.createElement("span");crumb.className="crumb";crumb.repr esentedObject=current;crumb.addEventListener("mousedown",selectCrumbFunction,fal se);var crumbTitle="";switch(current.nodeType()){case Node.ELEMENT_NODE:if(curre nt.pseudoType())
1016 crumbTitle="::"+current.pseudoType();else 1434 crumbTitle="::"+current.pseudoType();else
1017 WebInspector.DOMPresentationUtils.decorateNodeLabel(current,crumb);break;case No de.TEXT_NODE:crumbTitle=WebInspector.UIString("(text)");break;case Node.COMMENT_ NODE:crumbTitle="<!-->";break;case Node.DOCUMENT_TYPE_NODE:crumbTitle="<!DOCTYPE >";break;case Node.DOCUMENT_FRAGMENT_NODE:crumbTitle=current.shadowRootType()?"# shadow-root":current.nodeNameInCorrectCase();break;default:crumbTitle=current.no deNameInCorrectCase();} 1435 WebInspector.DOMPresentationUtils.decorateNodeLabel(current,crumb);break;case No de.TEXT_NODE:crumbTitle=WebInspector.UIString("(text)");break;case Node.COMMENT_ NODE:crumbTitle="<!-->";break;case Node.DOCUMENT_TYPE_NODE:crumbTitle="<!DOCTYPE >";break;case Node.DOCUMENT_FRAGMENT_NODE:crumbTitle=current.shadowRootType()?"# shadow-root":current.nodeNameInCorrectCase();break;default:crumbTitle=current.no deNameInCorrectCase();}
1018 if(!crumb.childNodes.length){var nameElement=document.createElement("span");name Element.textContent=crumbTitle;crumb.appendChild(nameElement);crumb.title=crumbT itle;} 1436 if(!crumb.childNodes.length){var nameElement=document.createElement("span");name Element.textContent=crumbTitle;crumb.appendChild(nameElement);crumb.title=crumbT itle;}
1019 if(current===this.selectedDOMNode()) 1437 if(current===this.selectedDOMNode())
1020 crumb.classList.add("selected");if(!crumbs.childNodes.length) 1438 crumb.classList.add("selected");crumbs.insertBefore(crumb,crumbs.firstChild);}
1021 crumb.classList.add("end");crumbs.insertBefore(crumb,crumbs.firstChild);} 1439 this.updateBreadcrumbSizes();},updateBreadcrumbSizes:function(focusedCrumb)
1022 if(crumbs.hasChildNodes())
1023 crumbs.lastChild.classList.add("start");this.updateBreadcrumbSizes();},updateBre adcrumbSizes:function(focusedCrumb)
1024 {if(!this.isShowing()) 1440 {if(!this.isShowing())
1025 return;if(document.body.offsetWidth<=0){return;} 1441 return;var crumbs=this.crumbsElement;if(!crumbs.firstChild)
1026 var crumbs=this.crumbsElement;if(!crumbs.childNodes.length||crumbs.offsetWidth<= 0) 1442 return;var selectedIndex=0;var focusedIndex=0;var selectedCrumb;for(var i=0;i<cr umbs.childNodes.length;++i){var crumb=crumbs.childNodes[i];if(!selectedCrumb&&cr umb.classList.contains("selected")){selectedCrumb=crumb;selectedIndex=i;}
1027 return;var selectedIndex=0;var focusedIndex=0;var selectedCrumb;var i=0;var crum b=crumbs.firstChild;while(crumb){if(!selectedCrumb&&crumb.classList.contains("se lected")){selectedCrumb=crumb;selectedIndex=i;}
1028 if(crumb===focusedCrumb) 1443 if(crumb===focusedCrumb)
1029 focusedIndex=i;if(crumb!==crumbs.lastChild) 1444 focusedIndex=i;crumb.classList.remove("compact","collapsed","hidden");}
1030 crumb.classList.remove("start");if(crumb!==crumbs.firstChild) 1445 var contentElementWidth=this.contentElement.offsetWidth;var normalSizes=[];for(v ar i=0;i<crumbs.childNodes.length;++i){var crumb=crumbs.childNodes[i];normalSize s[i]=crumb.offsetWidth;}
1031 crumb.classList.remove("end");crumb.classList.remove("compact");crumb.classList. remove("collapsed");crumb.classList.remove("hidden");crumb=crumb.nextSibling;++i ;} 1446 var compactSizes=[];for(var i=0;i<crumbs.childNodes.length;++i){var crumb=crumbs .childNodes[i];crumb.classList.add("compact");}
1032 crumbs.firstChild.classList.add("end");crumbs.lastChild.classList.add("start");v ar contentElement=this.contentElement;function crumbsAreSmallerThanContainer() 1447 for(var i=0;i<crumbs.childNodes.length;++i){var crumb=crumbs.childNodes[i];compa ctSizes[i]=crumb.offsetWidth;}
1033 {const rightPadding=10;return crumbs.offsetWidth+rightPadding<contentElement.off setWidth;} 1448 crumbs.firstChild.classList.add("collapsed");var collapsedSize=crumbs.firstChild .offsetWidth;for(var i=0;i<crumbs.childNodes.length;++i){var crumb=crumbs.childN odes[i];crumb.classList.remove("compact","collapsed");}
1449 function crumbsAreSmallerThanContainer()
1450 {var totalSize=0;for(var i=0;i<crumbs.childNodes.length;++i){var crumb=crumbs.ch ildNodes[i];if(crumb.classList.contains("hidden"))
1451 continue;if(crumb.classList.contains("collapsed")){totalSize+=collapsedSize;cont inue;}
1452 totalSize+=crumb.classList.contains("compact")?compactSizes[i]:normalSizes[i];}
1453 const rightPadding=10;return totalSize+rightPadding<contentElementWidth;}
1034 if(crumbsAreSmallerThanContainer()) 1454 if(crumbsAreSmallerThanContainer())
1035 return;var BothSides=0;var AncestorSide=-1;var ChildSide=1;function makeCrumbsSm aller(shrinkingFunction,direction,significantCrumb) 1455 return;var BothSides=0;var AncestorSide=-1;var ChildSide=1;function makeCrumbsSm aller(shrinkingFunction,direction)
1036 {if(!significantCrumb) 1456 {var significantCrumb=focusedCrumb||selectedCrumb;var significantIndex=significa ntCrumb===selectedCrumb?selectedIndex:focusedIndex;function shrinkCrumbAtIndex(i ndex)
1037 significantCrumb=(focusedCrumb||selectedCrumb);if(significantCrumb===selectedCru mb)
1038 var significantIndex=selectedIndex;else if(significantCrumb===focusedCrumb)
1039 var significantIndex=focusedIndex;else{var significantIndex=0;for(var i=0;i<crum bs.childNodes.length;++i){if(crumbs.childNodes[i]===significantCrumb){significan tIndex=i;break;}}}
1040 function shrinkCrumbAtIndex(index)
1041 {var shrinkCrumb=crumbs.childNodes[index];if(shrinkCrumb&&shrinkCrumb!==signific antCrumb) 1457 {var shrinkCrumb=crumbs.childNodes[index];if(shrinkCrumb&&shrinkCrumb!==signific antCrumb)
1042 shrinkingFunction(shrinkCrumb);if(crumbsAreSmallerThanContainer()) 1458 shrinkingFunction(shrinkCrumb);if(crumbsAreSmallerThanContainer())
1043 return true;return false;} 1459 return true;return false;}
1044 if(direction){var index=(direction>0?0:crumbs.childNodes.length-1);while(index!= =significantIndex){if(shrinkCrumbAtIndex(index)) 1460 if(direction){var index=(direction>0?0:crumbs.childNodes.length-1);while(index!= =significantIndex){if(shrinkCrumbAtIndex(index))
1045 return true;index+=(direction>0?1:-1);}}else{var startIndex=0;var endIndex=crumb s.childNodes.length-1;while(startIndex!=significantIndex||endIndex!=significantI ndex){var startDistance=significantIndex-startIndex;var endDistance=endIndex-sig nificantIndex;if(startDistance>=endDistance) 1461 return true;index+=(direction>0?1:-1);}}else{var startIndex=0;var endIndex=crumb s.childNodes.length-1;while(startIndex!=significantIndex||endIndex!=significantI ndex){var startDistance=significantIndex-startIndex;var endDistance=endIndex-sig nificantIndex;if(startDistance>=endDistance)
1046 var index=startIndex++;else 1462 var index=startIndex++;else
1047 var index=endIndex--;if(shrinkCrumbAtIndex(index)) 1463 var index=endIndex--;if(shrinkCrumbAtIndex(index))
1048 return true;}} 1464 return true;}}
1049 return false;} 1465 return false;}
1050 function coalesceCollapsedCrumbs() 1466 function coalesceCollapsedCrumbs()
1051 {var crumb=crumbs.firstChild;var collapsedRun=false;var newStartNeeded=false;var newEndNeeded=false;while(crumb){var hidden=crumb.classList.contains("hidden");i f(!hidden){var collapsed=crumb.classList.contains("collapsed");if(collapsedRun&& collapsed){crumb.classList.add("hidden");crumb.classList.remove("compact");crumb .classList.remove("collapsed");if(crumb.classList.contains("start")){crumb.class List.remove("start");newStartNeeded=true;} 1467 {var crumb=crumbs.firstChild;var collapsedRun=false;var newStartNeeded=false;var newEndNeeded=false;while(crumb){var hidden=crumb.classList.contains("hidden");i f(!hidden){var collapsed=crumb.classList.contains("collapsed");if(collapsedRun&& collapsed){crumb.classList.add("hidden");crumb.classList.remove("compact");crumb .classList.remove("collapsed");if(crumb.classList.contains("start")){crumb.class List.remove("start");newStartNeeded=true;}
1052 if(crumb.classList.contains("end")){crumb.classList.remove("end");newEndNeeded=t rue;} 1468 if(crumb.classList.contains("end")){crumb.classList.remove("end");newEndNeeded=t rue;}
1053 continue;} 1469 continue;}
1054 collapsedRun=collapsed;if(newEndNeeded){newEndNeeded=false;crumb.classList.add(" end");}}else 1470 collapsedRun=collapsed;if(newEndNeeded){newEndNeeded=false;crumb.classList.add(" end");}}else
1055 collapsedRun=true;crumb=crumb.nextSibling;} 1471 collapsedRun=true;crumb=crumb.nextSibling;}
1056 if(newStartNeeded){crumb=crumbs.lastChild;while(crumb){if(!crumb.classList.conta ins("hidden")){crumb.classList.add("start");break;} 1472 if(newStartNeeded){crumb=crumbs.lastChild;while(crumb){if(!crumb.classList.conta ins("hidden")){crumb.classList.add("start");break;}
1057 crumb=crumb.previousSibling;}}} 1473 crumb=crumb.previousSibling;}}}
1058 function compact(crumb) 1474 function compact(crumb)
1059 {if(crumb.classList.contains("hidden")) 1475 {if(crumb.classList.contains("hidden"))
1060 return;crumb.classList.add("compact");} 1476 return;crumb.classList.add("compact");}
1061 function collapse(crumb,dontCoalesce) 1477 function collapse(crumb,dontCoalesce)
1062 {if(crumb.classList.contains("hidden")) 1478 {if(crumb.classList.contains("hidden"))
1063 return;crumb.classList.add("collapsed");crumb.classList.remove("compact");if(!do ntCoalesce) 1479 return;crumb.classList.add("collapsed");crumb.classList.remove("compact");if(!do ntCoalesce)
1064 coalesceCollapsedCrumbs();} 1480 coalesceCollapsedCrumbs();}
1065 if(!focusedCrumb){if(makeCrumbsSmaller(compact,ChildSide)) 1481 if(!focusedCrumb){if(makeCrumbsSmaller(compact,ChildSide))
1066 return;if(makeCrumbsSmaller(collapse,ChildSide)) 1482 return;if(makeCrumbsSmaller(collapse,ChildSide))
1067 return;} 1483 return;}
1068 if(makeCrumbsSmaller(compact,(focusedCrumb?BothSides:AncestorSide))) 1484 if(makeCrumbsSmaller(compact,focusedCrumb?BothSides:AncestorSide))
1069 return;if(makeCrumbsSmaller(collapse,(focusedCrumb?BothSides:AncestorSide))) 1485 return;if(makeCrumbsSmaller(collapse,focusedCrumb?BothSides:AncestorSide))
1070 return;if(!selectedCrumb) 1486 return;if(!selectedCrumb)
1071 return;compact(selectedCrumb);if(crumbsAreSmallerThanContainer()) 1487 return;compact(selectedCrumb);if(crumbsAreSmallerThanContainer())
1072 return;collapse(selectedCrumb,true);},updateStyles:function(forceUpdate) 1488 return;collapse(selectedCrumb,true);},updateStyles:function(forceUpdate)
1073 {if(!WebInspector.cssModel.isEnabled()) 1489 {if(!WebInspector.cssModel.isEnabled())
1074 return;var stylesSidebarPane=this.sidebarPanes.styles;var computedStylePane=this .sidebarPanes.computedStyle;if((!stylesSidebarPane.isShowing()&&!computedStylePa ne.isShowing())||!stylesSidebarPane.needsUpdate) 1490 return;var stylesSidebarPane=this.sidebarPanes.styles;var computedStylePane=this .sidebarPanes.computedStyle;if((!stylesSidebarPane.isShowing()&&!computedStylePa ne.isShowing())||!stylesSidebarPane.needsUpdate)
1075 return;stylesSidebarPane.update(this.selectedDOMNode(),forceUpdate);stylesSideba rPane.needsUpdate=false;},updateMetrics:function() 1491 return;stylesSidebarPane.update(this.selectedDOMNode(),forceUpdate);stylesSideba rPane.needsUpdate=false;},updateMetrics:function()
1076 {if(!WebInspector.cssModel.isEnabled()) 1492 {if(!WebInspector.cssModel.isEnabled())
1077 return;var metricsSidebarPane=this.sidebarPanes.metrics;if(!metricsSidebarPane.i sShowing()||!metricsSidebarPane.needsUpdate) 1493 return;var metricsSidebarPane=this.sidebarPanes.metrics;if(!metricsSidebarPane.i sShowing()||!metricsSidebarPane.needsUpdate)
1078 return;metricsSidebarPane.update(this.selectedDOMNode());metricsSidebarPane.need sUpdate=false;},updatePlatformFonts:function() 1494 return;metricsSidebarPane.update(this.selectedDOMNode());metricsSidebarPane.need sUpdate=false;},updatePlatformFonts:function()
1079 {if(!WebInspector.cssModel.isEnabled()) 1495 {if(!WebInspector.cssModel.isEnabled())
1080 return;var platformFontsSidebar=this.sidebarPanes.platformFonts;if(!platformFont sSidebar.isShowing()||!platformFontsSidebar.needsUpdate) 1496 return;var platformFontsSidebar=this.sidebarPanes.platformFonts;if(!platformFont sSidebar.isShowing()||!platformFontsSidebar.needsUpdate)
1081 return;platformFontsSidebar.update(this.selectedDOMNode());platformFontsSidebar. needsUpdate=false;},updateProperties:function() 1497 return;platformFontsSidebar.update(this.selectedDOMNode());platformFontsSidebar. needsUpdate=false;},updateProperties:function()
1082 {var propertiesSidebarPane=this.sidebarPanes.properties;if(!propertiesSidebarPan e.isShowing()||!propertiesSidebarPane.needsUpdate) 1498 {var propertiesSidebarPane=this.sidebarPanes.properties;if(!propertiesSidebarPan e.isShowing()||!propertiesSidebarPane.needsUpdate)
1083 return;propertiesSidebarPane.update(this.selectedDOMNode());propertiesSidebarPan e.needsUpdate=false;},updateEventListeners:function() 1499 return;propertiesSidebarPane.update(this.selectedDOMNode());propertiesSidebarPan e.needsUpdate=false;},updateEventListeners:function()
1084 {var eventListenersSidebarPane=this.sidebarPanes.eventListeners;if(!eventListene rsSidebarPane.isShowing()||!eventListenersSidebarPane.needsUpdate) 1500 {var eventListenersSidebarPane=this.sidebarPanes.eventListeners;if(!eventListene rsSidebarPane.isShowing()||!eventListenersSidebarPane.needsUpdate)
1085 return;eventListenersSidebarPane.update(this.selectedDOMNode());eventListenersSi debarPane.needsUpdate=false;},handleShortcut:function(event) 1501 return;eventListenersSidebarPane.update(this.selectedDOMNode());eventListenersSi debarPane.needsUpdate=false;},handleShortcut:function(event)
1086 {function handleUndoRedo() 1502 {function handleUndoRedo()
1087 {if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&!event.shiftKey&&ev ent.keyIdentifier==="U+005A"){WebInspector.domAgent.undo(this._updateSidebars.bi nd(this));event.handled=true;return;} 1503 {if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&!event.shiftKey&&ev ent.keyIdentifier==="U+005A"){WebInspector.domModel.undo(this._updateSidebars.bi nd(this));event.handled=true;return;}
1088 var isRedoKey=WebInspector.isMac()?event.metaKey&&event.shiftKey&&event.keyIdent ifier==="U+005A":event.ctrlKey&&event.keyIdentifier==="U+0059";if(isRedoKey){DOM Agent.redo(this._updateSidebars.bind(this));event.handled=true;}} 1504 var isRedoKey=WebInspector.isMac()?event.metaKey&&event.shiftKey&&event.keyIdent ifier==="U+005A":event.ctrlKey&&event.keyIdentifier==="U+0059";if(isRedoKey){DOM Agent.redo(this._updateSidebars.bind(this));event.handled=true;}}
1089 if(!this.treeOutline.editing()){handleUndoRedo.call(this);if(event.handled) 1505 if(!this.treeOutline.editing()){handleUndoRedo.call(this);if(event.handled)
1090 return;} 1506 return;}
1091 this.treeOutline.handleShortcut(event);},handleCopyEvent:function(event) 1507 this.treeOutline.handleShortcut(event);},handleCopyEvent:function(event)
1092 {var currentFocusElement=WebInspector.currentFocusElement();if(currentFocusEleme nt&&WebInspector.isBeingEdited(currentFocusElement)) 1508 {var currentFocusElement=WebInspector.currentFocusElement();if(currentFocusEleme nt&&WebInspector.isBeingEdited(currentFocusElement))
1093 return;if(!window.getSelection().isCollapsed) 1509 return;if(!window.getSelection().isCollapsed)
1094 return;event.clipboardData.clearData();event.preventDefault();this.selectedDOMNo de().copyNode();},sidebarResized:function(event) 1510 return;event.clipboardData.clearData();event.preventDefault();this.selectedDOMNo de().copyNode();},_leaveUserAgentShadowDOM:function(node)
1095 {this.treeOutline.updateSelection();},revealAndSelectNode:function(nodeId) 1511 {var userAgentShadowRoot=node.ancestorUserAgentShadowRoot();return userAgentShad owRoot?(userAgentShadowRoot.parentNode):node;},revealAndSelectNode:function(node Id)
1096 {WebInspector.inspectorView.setCurrentPanel(this);var node=WebInspector.domAgent .nodeForId(nodeId);if(!node) 1512 {WebInspector.inspectorView.setCurrentPanel(this);var node=WebInspector.domModel .nodeForId(nodeId);if(!node)
1097 return;while(!WebInspector.ElementsTreeOutline.showShadowDOM()&&node&&node.isInS hadowTree()) 1513 return;node=WebInspector.settings.showUAShadowDOM.get()?node:this._leaveUserAgen tShadowDOM(node);WebInspector.domModel.highlightDOMNodeForTwoSeconds(nodeId);thi s.selectDOMNode(node,true);},appendApplicableItems:function(event,contextMenu,ta rget)
1098 node=node.parentNode;WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId) ;this.selectDOMNode(node,true);},appendApplicableItems:function(event,contextMen u,target)
1099 {function selectNode(nodeId) 1514 {function selectNode(nodeId)
1100 {if(nodeId) 1515 {if(nodeId)
1101 WebInspector.domAgent.inspectElement(nodeId);} 1516 WebInspector.domModel.inspectElement(nodeId);}
1102 function revealElement(remoteObject) 1517 function revealElement(remoteObject)
1103 {remoteObject.pushNodeToFrontend(selectNode);} 1518 {remoteObject.pushNodeToFrontend(selectNode);}
1104 var commandCallback;if(target instanceof WebInspector.RemoteObject){var remoteOb ject=(target);if(remoteObject.subtype==="node") 1519 var commandCallback;if(target instanceof WebInspector.RemoteObject){var remoteOb ject=(target);if(remoteObject.subtype==="node")
1105 commandCallback=revealElement.bind(this,remoteObject);}else if(target instanceof WebInspector.DOMNode){var domNode=(target);if(domNode.id) 1520 commandCallback=revealElement.bind(null,remoteObject);}else if(target instanceof WebInspector.DOMNode){var domNode=(target);if(domNode.id)
1106 commandCallback=WebInspector.domAgent.inspectElement.bind(WebInspector.domAgent, domNode.id);} 1521 commandCallback=WebInspector.domModel.inspectElement.bind(WebInspector.domModel, domNode.id);}
1107 if(!commandCallback) 1522 if(!commandCallback)
1108 return;if(this.treeOutline.element.isAncestor(event.target)) 1523 return;if(this.treeOutline.element.isAncestor(event.target))
1109 return;contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles()?"Reveal in E lements panel":"Reveal in Elements Panel",commandCallback);},_sidebarContextMenu EventFired:function(event) 1524 return;contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles()?"Reveal in E lements panel":"Reveal in Elements Panel",commandCallback);},_sidebarContextMenu EventFired:function(event)
1110 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.show();},_dockS ideChanged:function() 1525 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.show();},_dockS ideChanged:function()
1111 {var dockSide=WebInspector.dockController.dockSide();var vertically=dockSide===W ebInspector.DockController.State.DockedToRight&&WebInspector.settings.splitVerti callyWhenDockedToRight.get();this._splitVertically(vertically);},_showShadowDOMC hanged:function() 1526 {var vertically=WebInspector.dockController.isVertical()&&WebInspector.settings. splitVerticallyWhenDockedToRight.get();this._splitVertically(vertically);},_show UAShadowDOMChanged:function()
1112 {this.treeOutline.update();},_splitVertically:function(vertically) 1527 {this.treeOutline.update();},_splitVertically:function(vertically)
1113 {if(this.sidebarPaneView&&vertically===!this.splitView.isVertical()) 1528 {if(this.sidebarPaneView&&vertically===!this._splitView.isVertical())
1114 return;if(this.sidebarPaneView){this.sidebarPaneView.detach();this.splitView.uni nstallResizer(this.sidebarPaneView.headerElement());} 1529 return;if(this.sidebarPaneView){this.sidebarPaneView.detach();this._splitView.un installResizer(this.sidebarPaneView.headerElement());}
1115 this.splitView.setVertical(!vertically);var computedPane=new WebInspector.Sideba rPane(WebInspector.UIString("Computed"));computedPane.element.classList.add("com posite");computedPane.element.classList.add("fill");var expandComputed=computedP ane.expand.bind(computedPane);computedPane.bodyElement.appendChild(this.sidebarP anes.computedStyle.titleElement);computedPane.bodyElement.classList.add("metrics -and-computed");this.sidebarPanes.computedStyle.show(computedPane.bodyElement);t his.sidebarPanes.computedStyle.setExpandCallback(expandComputed);this.sidebarPan es.platformFonts.show(computedPane.bodyElement);function showMetrics(pane,before Element) 1530 this._splitView.setVertical(!vertically);var computedPane=new WebInspector.Sideb arPane(WebInspector.UIString("Computed"));computedPane.element.classList.add("co mposite");computedPane.element.classList.add("fill");var expandComputed=computed Pane.expand.bind(computedPane);computedPane.bodyElement.classList.add("metrics-a nd-computed");this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); var matchedStylePanesWrapper=document.createElement("div");matchedStylePanesWrap per.className="style-panes-wrapper";var computedStylePanesWrapper=document.creat eElement("div");computedStylePanesWrapper.className="style-panes-wrapper";functi on showMetrics(inComputedStyle)
1116 {this.sidebarPanes.metrics.show(pane.bodyElement,beforeElement);} 1531 {if(inComputedStyle)
1532 this.sidebarPanes.metrics.show(computedStylePanesWrapper,this.sidebarPanes.compu tedStyle.element);else
1533 this.sidebarPanes.metrics.show(matchedStylePanesWrapper);}
1117 function tabSelected(event) 1534 function tabSelected(event)
1118 {var tabId=(event.data.tabId);if(tabId===computedPane.title()) 1535 {var tabId=(event.data.tabId);if(tabId===computedPane.title())
1119 showMetrics.call(this,computedPane,this.sidebarPanes.computedStyle.element);if(t abId===stylesPane.title()) 1536 showMetrics.call(this,true);else if(tabId===stylesPane.title())
1120 showMetrics.call(this,stylesPane);} 1537 showMetrics.call(this,false);}
1121 this.sidebarPaneView=new WebInspector.SidebarTabbedPane();if(vertically){this.sp litView.installResizer(this.sidebarPaneView.headerElement());this.sidebarPanes.m etrics.show(computedPane.bodyElement,this.sidebarPanes.computedStyle.element);th is.sidebarPanes.metrics.setExpandCallback(expandComputed);var compositePane=new WebInspector.SidebarPane(this.sidebarPanes.styles.title());compositePane.element .classList.add("composite");compositePane.element.classList.add("fill");var expa ndComposite=compositePane.expand.bind(compositePane);var splitView=new WebInspec tor.SplitView(true,"StylesPaneSplitRatio",0.5);splitView.show(compositePane.body Element);splitView.setFirstView(this.sidebarPanes.styles);splitView.firstElement ().appendChild(this.sidebarPanes.styles.titleElement);this.sidebarPanes.styles.s etExpandCallback(expandComposite);splitView.setSecondView(computedPane);computed Pane.setExpandCallback(expandComposite);this.sidebarPaneView.addPane(compositePa ne);}else{var stylesPane=new WebInspector.SidebarPane(this.sidebarPanes.styles.t itle());stylesPane.element.classList.add("composite");stylesPane.element.classLi st.add("fill");var expandStyles=stylesPane.expand.bind(stylesPane);stylesPane.bo dyElement.classList.add("metrics-and-styles");this.sidebarPanes.styles.show(styl esPane.bodyElement);this.sidebarPanes.styles.setExpandCallback(expandStyles);thi s.sidebarPanes.metrics.setExpandCallback(expandStyles);stylesPane.bodyElement.ap pendChild(this.sidebarPanes.styles.titleElement);this.sidebarPaneView.addEventLi stener(WebInspector.TabbedPane.EventTypes.TabSelected,tabSelected,this);showMetr ics.call(this,stylesPane);this.sidebarPaneView.addPane(stylesPane);this.sidebarP aneView.addPane(computedPane);} 1538 this.sidebarPaneView=new WebInspector.SidebarTabbedPane();if(vertically){this._s plitView.installResizer(this.sidebarPaneView.headerElement());this.sidebarPanes. metrics.setExpandCallback(expandComputed);var compositePane=new WebInspector.Sid ebarPane(this.sidebarPanes.styles.title());compositePane.element.classList.add(" composite");compositePane.element.classList.add("fill");var expandComposite=comp ositePane.expand.bind(compositePane);var splitView=new WebInspector.SplitView(tr ue,true,"stylesPaneSplitViewState",0.5);splitView.show(compositePane.bodyElement );splitView.mainElement().appendChild(matchedStylePanesWrapper);splitView.sideba rElement().appendChild(computedStylePanesWrapper);this.sidebarPanes.styles.setEx pandCallback(expandComposite);computedPane.show(computedStylePanesWrapper);compu tedPane.setExpandCallback(expandComposite);splitView.mainElement().appendChild(t his._matchedStylesFilterBoxContainer);splitView.sidebarElement().appendChild(thi s._computedStylesFilterBoxContainer);this.sidebarPaneView.addPane(compositePane) ;}else{var stylesPane=new WebInspector.SidebarPane(this.sidebarPanes.styles.titl e());stylesPane.element.classList.add("composite");stylesPane.element.classList. add("fill");var expandStyles=stylesPane.expand.bind(stylesPane);stylesPane.bodyE lement.classList.add("metrics-and-styles");stylesPane.bodyElement.appendChild(ma tchedStylePanesWrapper);computedPane.bodyElement.appendChild(computedStylePanesW rapper);this.sidebarPanes.styles.setExpandCallback(expandStyles);this.sidebarPan es.metrics.setExpandCallback(expandStyles);this.sidebarPaneView.addEventListener (WebInspector.TabbedPane.EventTypes.TabSelected,tabSelected,this);stylesPane.bod yElement.appendChild(this._matchedStylesFilterBoxContainer);computedPane.bodyEle ment.appendChild(this._computedStylesFilterBoxContainer);this.sidebarPaneView.ad dPane(stylesPane);this.sidebarPaneView.addPane(computedPane);}
1122 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);this.sidebarPaneV iew.addPane(this.sidebarPanes.domBreakpoints);this.sidebarPaneView.addPane(this. sidebarPanes.properties);this._extensionSidebarPanesContainer=this.sidebarPaneVi ew;for(var i=0;i<this._extensionSidebarPanes.length;++i) 1539 this.sidebarPanes.styles.show(matchedStylePanesWrapper);this.sidebarPanes.comput edStyle.show(computedStylePanesWrapper);matchedStylePanesWrapper.appendChild(thi s.sidebarPanes.styles.titleElement);showMetrics.call(this,vertically);this.sideb arPanes.platformFonts.show(computedStylePanesWrapper);this.sidebarPaneView.addPa ne(this.sidebarPanes.eventListeners);this.sidebarPaneView.addPane(this.sidebarPa nes.domBreakpoints);this.sidebarPaneView.addPane(this.sidebarPanes.properties);t his._extensionSidebarPanesContainer=this.sidebarPaneView;for(var i=0;i<this._ext ensionSidebarPanes.length;++i)
1123 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarPanes[i]);thi s.splitView.setSidebarView(this.sidebarPaneView);this.sidebarPanes.styles.expand ();},addExtensionSidebarPane:function(id,pane) 1540 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarPanes[i]);thi s.sidebarPaneView.show(this._splitView.sidebarElement());this.sidebarPanes.style s.expand();},addExtensionSidebarPane:function(id,pane)
1124 {this._extensionSidebarPanes.push(pane);this._extensionSidebarPanesContainer.add Pane(pane);},__proto__:WebInspector.Panel.prototype} 1541 {this._extensionSidebarPanes.push(pane);this._extensionSidebarPanesContainer.add Pane(pane);},__proto__:WebInspector.Panel.prototype}
1125 WebInspector.ElementsPanel.ContextMenuProvider=function() 1542 WebInspector.ElementsPanel.ContextMenuProvider=function()
1126 {} 1543 {}
1127 WebInspector.ElementsPanel.ContextMenuProvider.prototype={appendApplicableItems: function(event,contextMenu,target) 1544 WebInspector.ElementsPanel.ContextMenuProvider.prototype={appendApplicableItems: function(event,contextMenu,target)
1128 {WebInspector.panel("elements").appendApplicableItems(event,contextMenu,target); }} 1545 {(WebInspector.inspectorView.panel("elements")).appendApplicableItems(event,cont extMenu,target);}}
1129 WebInspector.ElementsPanel.OverridesViewFactory=function() 1546 WebInspector.ElementsPanel.DOMNodeRevealer=function()
1130 {WebInspector.Drawer.SingletonViewFactory.call(this,WebInspector.OverridesView); } 1547 {}
1131 WebInspector.ElementsPanel.OverridesViewFactory.prototype={__proto__:WebInspecto r.Drawer.SingletonViewFactory.prototype} 1548 WebInspector.ElementsPanel.DOMNodeRevealer.prototype={reveal:function(node)
1132 WebInspector.ElementsPanel.RenderingViewFactory=function() 1549 {if(!(node instanceof WebInspector.DOMNode))
1133 {WebInspector.Drawer.SingletonViewFactory.call(this,WebInspector.RenderingOption sView);} 1550 return;if(WebInspector.inspectElementModeController&&WebInspector.inspectElement ModeController.enabled()){InspectorFrontendHost.bringToFront();WebInspector.insp ectElementModeController.disable();}
1134 WebInspector.ElementsPanel.RenderingViewFactory.prototype={__proto__:WebInspecto r.Drawer.SingletonViewFactory.prototype} 1551 (WebInspector.inspectorView.panel("elements")).revealAndSelectNode(node.id);}}
OLDNEW
« no previous file with comments | « chrome_linux/resources/inspector/ConsolePanel.js ('k') | chrome_linux/resources/inspector/ExtensionServer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698