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

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

Issue 42163002: Roll Linux reference build to official build 31.0.1650.34 (trunk r224845, branch r230433) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years, 2 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.CSSNamedFlowCollectionsView=function()
2 {WebInspector.SidebarView.call(this,WebInspector.SidebarView.SidebarPosition.Sta rt);this.registerRequiredCSS("cssNamedFlows.css");this._namedFlows={};this._cont entNodes={};this._regionNodes={};this.element.addStyleClass("css-named-flow-coll ections-view");this.element.addStyleClass("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.addStyleClass("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 {WebInspector.SidebarView.call(this,WebInspector.SidebarView.SidebarPosition.Sta rt);this.registerRequiredCSS("cssNamedFlows.css");this._namedFlows={};this._cont entNodes={};this._regionNodes={};this.element.addStyleClass("css-named-flow-coll ections-view");this.element.addStyleClass("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.addStyleClass("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());}
3 WebInspector.CSSNamedFlowCollectionsView.prototype={showInDrawer:function() 3 WebInspector.CSSNamedFlowCollectionsView.prototype={showInDrawer:function()
4 {WebInspector.showViewInDrawer(this._statusElement,this);},reset:function() 4 {WebInspector.showViewInDrawer(this._statusElement,this);},reset:function()
5 {if(!this._document) 5 {if(!this._document)
6 return;WebInspector.cssModel.getNamedFlowCollectionAsync(this._document.id,this. _resetNamedFlows.bind(this));},_setDocument:function(document) 6 return;WebInspector.cssModel.getNamedFlowCollectionAsync(this._document.id,this. _resetNamedFlows.bind(this));},_setDocument:function(document)
7 {this._document=document;this.reset();},_documentUpdated:function(event) 7 {this._document=document;this.reset();},_documentUpdated:function(event)
8 {var document=(event.data);this._setDocument(document);},_setSidebarHasContent:f unction(hasContent) 8 {var document=(event.data);this._setDocument(document);},_setSidebarHasContent:f unction(hasContent)
9 {if(hasContent){if(!this._emptyElement.parentNode) 9 {if(hasContent){if(!this._emptyElement.parentNode)
10 return;this._sidebarContentElement.removeChild(this._emptyElement);this._sidebar ContentElement.appendChild(this._flowListElement);}else{if(!this._flowListElemen t.parentNode) 10 return;this._sidebarContentElement.removeChild(this._emptyElement);this._sidebar ContentElement.appendChild(this._flowListElement);}else{if(!this._flowListElemen t.parentNode)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 WebInspector.FlowTreeElement.prototype={setOverset:function(newOverset) 58 WebInspector.FlowTreeElement.prototype={setOverset:function(newOverset)
59 {if(this._overset===newOverset) 59 {if(this._overset===newOverset)
60 return;if(newOverset){this.title.addStyleClass("named-flow-overflow");this.toolt ip=WebInspector.UIString("Overflows.");}else{this.title.removeStyleClass("named- flow-overflow");this.tooltip="";} 60 return;if(newOverset){this.title.addStyleClass("named-flow-overflow");this.toolt ip=WebInspector.UIString("Overflows.");}else{this.title.removeStyleClass("named- flow-overflow");this.tooltip="";}
61 this._overset=newOverset;},__proto__:TreeElement.prototype};WebInspector.CSSName dFlowView=function(flow) 61 this._overset=newOverset;},__proto__:TreeElement.prototype};WebInspector.CSSName dFlowView=function(flow)
62 {WebInspector.View.call(this);this.element.addStyleClass("css-named-flow");this. element.addStyleClass("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) 62 {WebInspector.View.call(this);this.element.addStyleClass("css-named-flow");this. element.addStyleClass("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 this._insertContentNode(content[i]);var regions=flow.regions;for(var i=0;i<regio ns.length;++i) 63 this._insertContentNode(content[i]);var regions=flow.regions;for(var i=0;i<regio ns.length;++i)
64 this._insertRegion(regions[i]);} 64 this._insertRegion(regions[i]);}
65 WebInspector.CSSNamedFlowView.OversetTypeMessageMap={empty:"empty",fit:"fit",ove rset:"overset"} 65 WebInspector.CSSNamedFlowView.OversetTypeMessageMap={empty:"empty",fit:"fit",ove rset:"overset"}
66 WebInspector.CSSNamedFlowView.prototype={_createFlowTreeOutline:function(rootDOM Node) 66 WebInspector.CSSNamedFlowView.prototype={_createFlowTreeOutline:function(rootDOM Node)
67 {if(!rootDOMNode) 67 {if(!rootDOMNode)
68 return null;var treeOutline=new WebInspector.ElementsTreeOutline(false,false,tru e);treeOutline.element.addStyleClass("named-flow-element");treeOutline.setVisibl e(true);treeOutline.rootDOMNode=rootDOMNode;treeOutline.wireToDomAgent();WebInsp ector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, treeOutline._elementsTreeUpdater._documentUpdated,treeOutline._elementsTreeUpdat er);return treeOutline;},_insertContentNode:function(contentNodeId,index) 68 return null;var treeOutline=new WebInspector.ElementsTreeOutline(false,false);tr eeOutline.element.addStyleClass("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 treeOutline=this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(con tentNodeId));var treeItem=new TreeElement(treeOutline.element,treeOutline);if(in dex===undefined){this._contentTreeItem.appendChild(treeItem);return;} 69 {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 this._contentTreeItem.insertChild(treeItem,index);},_insertRegion:function(regio n,index) 70 this._contentTreeItem.insertChild(treeItem,index);},_insertRegion:function(regio n,index)
71 {var treeOutline=this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(reg ion.nodeId));treeOutline.element.addStyleClass("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;} 71 {var treeOutline=this._createFlowTreeOutline(WebInspector.domAgent.nodeForId(reg ion.nodeId));treeOutline.element.addStyleClass("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 this._regionsTreeItem.insertChild(treeItem,index);},get flow() 72 this._regionsTreeItem.insertChild(treeItem,index);},get flow()
73 {return this._flow;},set flow(newFlow) 73 {return this._flow;},set flow(newFlow)
74 {this._update(newFlow);},_updateRegionOverset:function(regionTreeItem,newRegionO verset,oldRegionOverset) 74 {this._update(newFlow);},_updateRegionOverset:function(regionTreeItem,newRegionO verset,oldRegionOverset)
75 {var element=regionTreeItem.representedObject.element;element.removeStyleClass(" region-"+oldRegionOverset);element.addStyleClass("region-"+newRegionOverset);var oversetText=WebInspector.UIString(WebInspector.CSSNamedFlowView.OversetTypeMess ageMap[newRegionOverset]);regionTreeItem.tooltip=WebInspector.UIString("Region i s %s.",oversetText);},_mergeContentNodes:function(oldContent,newContent) 75 {var element=regionTreeItem.representedObject.element;element.removeStyleClass(" region-"+oldRegionOverset);element.addStyleClass("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 {var nodeIdSet={};for(var i=0;i<newContent.length;++i) 76 {var nodeIdSet={};for(var i=0;i<newContent.length;++i)
77 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;} 77 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 if(newContentIndex===newContent.length){this._contentTreeItem.removeChildAtIndex (contentTreeChildIndex);++oldContentIndex;continue;} 78 if(newContentIndex===newContent.length){this._contentTreeItem.removeChildAtIndex (contentTreeChildIndex);++oldContentIndex;continue;}
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 {event.consume();var nodeId=showHighlight&&this.node?this.node.id:0;if(nodeId){i f(this._highlightMode===mode) 150 {event.consume();var nodeId=showHighlight&&this.node?this.node.id:0;if(nodeId){i f(this._highlightMode===mode)
151 return;this._highlightMode=mode;WebInspector.domAgent.highlightDOMNode(nodeId,mo de);}else{delete this._highlightMode;WebInspector.domAgent.hideDOMNodeHighlight( );} 151 return;this._highlightMode=mode;WebInspector.domAgent.highlightDOMNode(nodeId,mo de);}else{delete this._highlightMode;WebInspector.domAgent.hideDOMNodeHighlight( );}
152 for(var i=0;this._boxElements&&i<this._boxElements.length;++i){var element=this. _boxElements[i];if(!nodeId||mode==="all"||element._name===mode) 152 for(var i=0;this._boxElements&&i<this._boxElements.length;++i){var element=this. _boxElements[i];if(!nodeId||mode==="all"||element._name===mode)
153 element.style.backgroundColor=element._backgroundColor;else 153 element.style.backgroundColor=element._backgroundColor;else
154 element.style.backgroundColor="";}},_updateMetrics:function(style) 154 element.style.backgroundColor="";}},_updateMetrics:function(style)
155 {var metricsElement=document.createElement("div");metricsElement.className="metr ics";var self=this;function createBoxPartElement(style,name,side,suffix) 155 {var metricsElement=document.createElement("div");metricsElement.className="metr ics";var self=this;function createBoxPartElement(style,name,side,suffix)
156 {var propertyName=(name!=="position"?name+"-":"")+side+suffix;var value=style.ge tPropertyValue(propertyName);if(value===""||(name!=="position"&&value==="0px")) 156 {var propertyName=(name!=="position"?name+"-":"")+side+suffix;var value=style.ge tPropertyValue(propertyName);if(value===""||(name!=="position"&&value==="0px"))
157 value="\u2012";else if(name==="position"&&value==="auto") 157 value="\u2012";else if(name==="position"&&value==="auto")
158 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;} 158 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;}
159 function getContentAreaWidthPx(style) 159 function getContentAreaWidthPx(style)
160 {var width=style.getPropertyValue("width").replace(/px$/,"");if(style.getPropert yValue("box-sizing")==="border-box"){var borderBox=self._getBox(style,"border"); var paddingBox=self._getBox(style,"padding");width=width-borderBox.left-borderBo x.right-paddingBox.left-paddingBox.right;} 160 {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;}
161 return Number.toFixedIfFloating(width);} 161 return Number.toFixedIfFloating(width);}
162 function getContentAreaHeightPx(style) 162 function getContentAreaHeightPx(style)
163 {var height=style.getPropertyValue("height").replace(/px$/,"");if(style.getPrope rtyValue("box-sizing")==="border-box"){var borderBox=self._getBox(style,"border" );var paddingBox=self._getBox(style,"padding");height=height-borderBox.top-borde rBox.bottom-paddingBox.top-paddingBox.bottom;} 163 {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;}
164 return Number.toFixedIfFloating(height);} 164 return Number.toFixedIfFloating(height);}
165 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")]) 165 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")])
166 continue;if(name==="padding"&&noPaddingDisplayType[style.getPropertyValue("displ ay")]) 166 continue;if(name==="padding"&&noPaddingDisplayType[style.getPropertyValue("displ ay")])
167 continue;if(name==="position"&&noPositionType[style.getPropertyValue("position") ]) 167 continue;if(name==="position"&&noPositionType[style.getPropertyValue("position") ])
168 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) 168 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)
169 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));} 169 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));}
170 previousBox=boxElement;} 170 previousBox=boxElement;}
171 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) 171 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)
172 {if(WebInspector.isBeingEdited(targetElement)) 172 {if(WebInspector.isBeingEdited(targetElement))
173 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) 173 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)
(...skipping 17 matching lines...) Expand all
191 var borderBox=this._getBox(computedStyle,"border");var paddingBox=this._getBox(c omputedStyle,"padding");var userValuePx=Number(userInput.replace(/px$/,""));if(i sNaN(userValuePx)) 191 var borderBox=this._getBox(computedStyle,"border");var paddingBox=this._getBox(c omputedStyle,"padding");var userValuePx=Number(userInput.replace(/px$/,""));if(i sNaN(userValuePx))
192 return;if(styleProperty==="width") 192 return;if(styleProperty==="width")
193 userValuePx+=borderBox.left+borderBox.right+paddingBox.left+paddingBox.right;els e 193 userValuePx+=borderBox.left+borderBox.right+paddingBox.left+paddingBox.right;els e
194 userValuePx+=borderBox.top+borderBox.bottom+paddingBox.top+paddingBox.bottom;use rInput=userValuePx+"px";} 194 userValuePx+=borderBox.top+borderBox.bottom+paddingBox.top+paddingBox.bottom;use rInput=userValuePx+"px";}
195 this.previousPropertyDataCandidate=null;var self=this;var callback=function(styl e){if(!style) 195 this.previousPropertyDataCandidate=null;var self=this;var callback=function(styl e){if(!style)
196 return;self.inlineStyle=style;if(!("originalPropertyData"in self)) 196 return;self.inlineStyle=style;if(!("originalPropertyData"in self))
197 self.originalPropertyData=self.previousPropertyDataCandidate;if(typeof self._hig hlightMode!=="undefined"){WebInspector.domAgent.highlightDOMNode(self.node.id,se lf._highlightMode);} 197 self.originalPropertyData=self.previousPropertyDataCandidate;if(typeof self._hig hlightMode!=="undefined"){WebInspector.domAgent.highlightDOMNode(self.node.id,se lf._highlightMode);}
198 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) 198 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)
199 continue;this.previousPropertyDataCandidate=property;property.setValue(userInput ,commitEditor,true,callback);return;} 199 continue;this.previousPropertyDataCandidate=property;property.setValue(userInput ,commitEditor,true,callback);return;}
200 this.inlineStyle.appendProperty(context.styleProperty,userInput,callback);},edit ingCommitted:function(element,userInput,previousContent,context) 200 this.inlineStyle.appendProperty(context.styleProperty,userInput,callback);},edit ingCommitted:function(element,userInput,previousContent,context)
201 {this.editingEnded(element,context);this._applyUserInput(element,userInput,previ ousContent,context,true);},__proto__:WebInspector.SidebarPane.prototype};WebInsp ector.PropertiesSidebarPane=function() 201 {this.editingEnded(element,context);this._applyUserInput(element,userInput,previ ousContent,context,true);},__proto__:WebInspector.SidebarPane.prototype};WebInsp ector.PlatformFontsSidebarPane=function()
202 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Fonts"));this.element .addStyleClass("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));var cssFontSection=this .element.createChild("div","stats-section monospace");var cssFontPrefix=cssFontS ection.createChild("span","webkit-css-property");cssFontPrefix.textContent="font -family";cssFontSection.createTextChild(":");this._cssFontValue=cssFontSection.c reateChild("span","css-font-value");this._fontStatsSection=this.element.createCh ild("div","stats-section");}
203 WebInspector.PlatformFontsSidebarPane.prototype={_onNodeChange:function()
204 {if(this._innerUpdateTimeout)
205 return;this._innerUpdateTimeout=setTimeout(this._innerUpdate.bind(this),100);},u pdate:function(node)
206 {if(!node){delete this._node;return;}
207 this._node=node;this._innerUpdate();},_innerUpdate:function()
208 {if(this._innerUpdateTimeout){clearTimeout(this._innerUpdateTimeout);delete this ._innerUpdateTimeout;}
209 if(!this._node)
210 return;WebInspector.cssModel.getPlatformFontsForNode(this._node.id,this._refresh UI.bind(this,this._node));},_refreshUI:function(node,cssFamilyName,platformFonts )
211 {if(this._node!==node)
212 return;this._cssFontValue.textContent=cssFamilyName+";";this._fontStatsSection.r emoveChildren();if(!platformFonts||!platformFonts.length)
213 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()
202 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Properties"));} 214 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Properties"));}
203 WebInspector.PropertiesSidebarPane._objectGroupName="properties-sidebar-pane";We bInspector.PropertiesSidebarPane.prototype={update:function(node) 215 WebInspector.PropertiesSidebarPane._objectGroupName="properties-sidebar-pane";We bInspector.PropertiesSidebarPane.prototype={update:function(node)
204 {var body=this.bodyElement;if(!node){body.removeChildren();this.sections=[];retu rn;} 216 {var body=this.bodyElement;if(!node){body.removeChildren();this.sections=[];retu rn;}
205 WebInspector.RemoteObject.resolveNode(node,WebInspector.PropertiesSidebarPane._o bjectGroupName,nodeResolved.bind(this));function nodeResolved(object) 217 WebInspector.RemoteObject.resolveNode(node,WebInspector.PropertiesSidebarPane._o bjectGroupName,nodeResolved.bind(this));function nodeResolved(object)
206 {if(!object) 218 {if(!object)
207 return;function protoList() 219 return;function protoList()
208 {var proto=this;var result={};var counter=1;while(proto){result[counter++]=proto ;proto=proto.__proto__;} 220 {var proto=this;var result={};var counter=1;while(proto){result[counter++]=proto ;proto=proto.__proto__;}
209 return result;} 221 return result;}
210 object.callFunction(protoList,undefined,nodePrototypesReady.bind(this));object.r elease();} 222 object.callFunction(protoList,undefined,nodePrototypesReady.bind(this));object.r elease();}
211 function nodePrototypesReady(object) 223 function nodePrototypesReady(object)
(...skipping 20 matching lines...) Expand all
232 return true;if(name==="filter") 244 return true;if(name==="filter")
233 return true;if(name.startsWith("scrollbar-")) 245 return true;if(name.startsWith("scrollbar-"))
234 return true;if(hasUnknownVendorPrefix(name)) 246 return true;if(hasUnknownVendorPrefix(name))
235 return true;var value=property.value.toLowerCase();if(value.endsWith("\9")) 247 return true;var value=property.value.toLowerCase();if(value.endsWith("\9"))
236 return true;if(hasUnknownVendorPrefix(value)) 248 return true;if(hasUnknownVendorPrefix(value))
237 return true;return false;} 249 return true;return false;}
238 WebInspector.StylesSidebarPane.prototype={_contextMenuEventFired:function(event) 250 WebInspector.StylesSidebarPane.prototype={_contextMenuEventFired:function(event)
239 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicabl eItems(event.target);contextMenu.show();},get _forcedPseudoClasses() 251 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicabl eItems(event.target);contextMenu.show();},get _forcedPseudoClasses()
240 {return this.node?(this.node.getUserProperty("pseudoState")||undefined):undefine d;},_updateForcedPseudoStateInputs:function() 252 {return this.node?(this.node.getUserProperty("pseudoState")||undefined):undefine d;},_updateForcedPseudoStateInputs:function()
241 {if(!this.node) 253 {if(!this.node)
242 return;var nodePseudoState=this._forcedPseudoClasses;if(!nodePseudoState) 254 return;var hasPseudoType=!!this.node.pseudoType();this._elementStateButton.enabl eStyleClass("hidden",hasPseudoType);this._elementStatePane.enableStyleClass("exp anded",!hasPseudoType&&this._elementStateButton.hasStyleClass("toggled"));var no dePseudoState=this._forcedPseudoClasses;if(!nodePseudoState)
243 nodePseudoState=[];var inputs=this._elementStatePane.inputs;for(var i=0;i<inputs .length;++i) 255 nodePseudoState=[];var inputs=this._elementStatePane.inputs;for(var i=0;i<inputs .length;++i)
244 inputs[i].checked=nodePseudoState.indexOf(inputs[i].state)>=0;},update:function( node,forceUpdate) 256 inputs[i].checked=nodePseudoState.indexOf(inputs[i].state)>=0;},update:function( node,forceUpdate)
245 {this._spectrumHelper.hide();this._discardElementUnderMouse();var refresh=false; if(forceUpdate) 257 {this._spectrumHelper.hide();this._discardElementUnderMouse();var refresh=false; if(forceUpdate)
246 delete this.node;if(!forceUpdate&&(node===this.node)) 258 delete this.node;if(!forceUpdate&&(node===this.node))
247 refresh=true;if(node&&node.nodeType()===Node.TEXT_NODE&&node.parentNode) 259 refresh=true;if(node&&node.nodeType()===Node.TEXT_NODE&&node.parentNode)
248 node=node.parentNode;if(node&&node.nodeType()!==Node.ELEMENT_NODE) 260 node=node.parentNode;if(node&&node.nodeType()!==Node.ELEMENT_NODE)
249 node=null;if(node) 261 node=null;if(node)
250 this.node=node;else 262 this.node=node;else
251 node=this.node;this._updateForcedPseudoStateInputs();if(refresh) 263 node=this.node;this._updateForcedPseudoStateInputs();if(refresh)
252 this._refreshUpdate();else 264 this._refreshUpdate();else
(...skipping 24 matching lines...) Expand all
277 return this.node;},_styleSheetOrMediaQueryResultChanged:function() 289 return this.node;},_styleSheetOrMediaQueryResultChanged:function()
278 {if(this._userOperation||this._isEditingStyle) 290 {if(this._userOperation||this._isEditingStyle)
279 return;this._rebuildUpdate();},_attributeChanged:function(event) 291 return;this._rebuildUpdate();},_attributeChanged:function(event)
280 {if(this._isEditingStyle||this._userOperation) 292 {if(this._isEditingStyle||this._userOperation)
281 return;if(!this._canAffectCurrentStyles(event.data.node)) 293 return;if(!this._canAffectCurrentStyles(event.data.node))
282 return;this._rebuildUpdate();},_canAffectCurrentStyles:function(node) 294 return;this._rebuildUpdate();},_canAffectCurrentStyles:function(node)
283 {return this.node&&(this.node===node||node.parentNode===this.node.parentNode||no de.isAncestor(this.node));},_innerRefreshUpdate:function(node,computedStyle,edit edSection) 295 {return this.node&&(this.node===node||node.parentNode===this.node.parentNode||no de.isAncestor(this.node));},_innerRefreshUpdate:function(node,computedStyle,edit edSection)
284 {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);} 296 {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);}
285 if(computedStyle) 297 if(computedStyle)
286 this.sections[0][0].rebuildComputedTrace(this.sections[0]);this._nodeStylesUpdat edForTest(node,false);},_innerRebuildUpdate:function(node,styles) 298 this.sections[0][0].rebuildComputedTrace(this.sections[0]);this._nodeStylesUpdat edForTest(node,false);},_innerRebuildUpdate:function(node,styles)
287 {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,0,null);var anchorElement=this.sections[0].inheritedPropertiesSeparatorElemen t;if(styles.computedStyle) 299 {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)
288 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)});} 300 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)});}
289 usedProperties={};this._markUsedProperties(styleRules,usedProperties);this.secti ons[pseudoId]=this._rebuildSectionsForStyleRules(styleRules,usedProperties,pseud oId,anchorElement);} 301 usedProperties={};this._markUsedProperties(styleRules,usedProperties);this.secti ons[pseudoId]=this._rebuildSectionsForStyleRules(styleRules,usedProperties,ancho rElement);}
290 this._nodeStylesUpdatedForTest(node,true);},_nodeStylesUpdatedForTest:function(n ode,rebuild) 302 this._nodeStylesUpdatedForTest(node,true);},_nodeStylesUpdatedForTest:function(n ode,rebuild)
291 {},_refreshStyleRules:function(sections,computedStyle) 303 {},_refreshStyleRules:function(sections,computedStyle)
292 {var nodeComputedStyle=computedStyle;var styleRules=[];for(var i=0;sections&&i<s ections.length;++i){var section=sections[i];if(section.isBlank) 304 {var nodeComputedStyle=computedStyle;var styleRules=[];for(var i=0;sections&&i<s ections.length;++i){var section=sections[i];if(section.isBlank)
293 continue;if(section.computedStyle) 305 continue;if(section.computedStyle)
294 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);} 306 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);}
295 return styleRules;},_rebuildStyleRules:function(node,styles) 307 return styleRules;},_rebuildStyleRules:function(node,styles)
296 {var nodeComputedStyle=styles.computedStyle;this.sections={};var styleRules=[];f unction addAttributesStyle() 308 {var nodeComputedStyle=styles.computedStyle;this.sections={};var styleRules=[];f unction addAttributesStyle()
297 {if(!styles.attributesStyle) 309 {if(!styles.attributesStyle)
298 return;var attrStyle={style:styles.attributesStyle,editable:false};attrStyle.sel ectorText=node.nodeNameInCorrectCase()+"["+WebInspector.UIString("Attributes Sty le")+"]";styleRules.push(attrStyle);} 310 return;var attrStyle={style:styles.attributesStyle,editable:false};attrStyle.sel ectorText=node.nodeNameInCorrectCase()+"["+WebInspector.UIString("Attributes Sty le")+"]";styleRules.push(attrStyle);}
299 styleRules.push({computedStyle:true,selectorText:"",style:nodeComputedStyle,edit able:false});if(styles.inlineStyle&&node.nodeType()===Node.ELEMENT_NODE){var inl ineStyle={selectorText:"element.style",style:styles.inlineStyle,isAttribute:true };styleRules.push(inlineStyle);} 311 styleRules.push({computedStyle:true,selectorText:"",style:nodeComputedStyle,edit able:false});if(!!node.pseudoType())
312 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);}
300 var addedAttributesStyle;for(var i=styles.matchedCSSRules.length-1;i>=0;--i){var rule=styles.matchedCSSRules[i];if(!WebInspector.settings.showUserAgentStyles.ge t()&&(rule.isUser||rule.isUserAgent)) 313 var addedAttributesStyle;for(var i=styles.matchedCSSRules.length-1;i>=0;--i){var rule=styles.matchedCSSRules[i];if(!WebInspector.settings.showUserAgentStyles.ge t()&&(rule.isUser||rule.isUserAgent))
301 continue;if((rule.isUser||rule.isUserAgent)&&!addedAttributesStyle){addedAttribu tesStyle=true;addAttributesStyle();} 314 continue;if((rule.isUser||rule.isUserAgent)&&!addedAttributesStyle){addedAttribu tesStyle=true;addAttributesStyle();}
302 styleRules.push({style:rule.style,selectorText:rule.selectorText,media:rule.medi a,sourceURL:rule.resourceURL(),rule:rule,editable:!!(rule.style&&rule.style.id)} );} 315 styleRules.push({style:rule.style,selectorText:rule.selectorText,media:rule.medi a,sourceURL:rule.resourceURL(),rule:rule,editable:!!(rule.style&&rule.style.id)} );}
303 if(!addedAttributesStyle) 316 if(!addedAttributesStyle)
304 addAttributesStyle();var parentNode=node.parentNode;function insertInheritedNode Separator(node) 317 addAttributesStyle();var parentNode=node.parentNode;function insertInheritedNode Separator(node)
305 {var entry={};entry.isStyleSeparator=true;entry.node=node;styleRules.push(entry) ;} 318 {var entry={};entry.isStyleSeparator=true;entry.node=node;styleRules.push(entry) ;}
306 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;} 319 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;}
307 styleRules.push(inlineStyle);}} 320 styleRules.push(inlineStyle);}}
308 for(var i=parentStyles.matchedCSSRules.length-1;i>=0;--i){var rulePayload=parent Styles.matchedCSSRules[i];if(!this._containsInherited(rulePayload.style)) 321 for(var i=parentStyles.matchedCSSRules.length-1;i>=0;--i){var rulePayload=parent Styles.matchedCSSRules[i];if(!this._containsInherited(rulePayload.style))
309 continue;var rule=rulePayload;if(!WebInspector.settings.showUserAgentStyles.get( )&&(rule.isUser||rule.isUserAgent)) 322 continue;var rule=rulePayload;if(!WebInspector.settings.showUserAgentStyles.get( )&&(rule.isUser||rule.isUserAgent))
310 continue;if(!separatorInserted){insertInheritedNodeSeparator(parentNode);separat orInserted=true;} 323 continue;if(!separatorInserted){insertInheritedNodeSeparator(parentNode);separat orInserted=true;}
311 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)});} 324 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)});}
312 parentNode=parentNode.parentNode;} 325 parentNode=parentNode.parentNode;}
313 return styleRules;},_markUsedProperties:function(styleRules,usedProperties) 326 return styleRules;},_markUsedProperties:function(styleRules,usedProperties)
314 {var foundImportantProperties={};var propertyToEffectiveRule={};var inheritedPro pertyToNode={};for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i]; if(styleRule.computedStyle||styleRule.isStyleSeparator) 327 {var foundImportantProperties={};var propertyToEffectiveRule={};var inheritedPro pertyToNode={};for(var i=0;i<styleRules.length;++i){var styleRule=styleRules[i]; if(styleRule.computedStyle||styleRule.isStyleSeparator)
315 continue;if(styleRule.section&&styleRule.section.noAffect) 328 continue;if(styleRule.section&&styleRule.section.noAffect)
316 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) 329 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)
317 continue;if(styleRule.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited (property.name)) 330 continue;if(styleRule.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited (property.name))
318 continue;var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(proper ty.name);if(foundImportantProperties.hasOwnProperty(canonicalName)) 331 continue;var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(proper ty.name);if(foundImportantProperties.hasOwnProperty(canonicalName))
319 continue;var isImportant=property.priority.length;if(!isImportant&&usedPropertie s.hasOwnProperty(canonicalName)) 332 continue;var isImportant=property.priority.length;if(!isImportant&&usedPropertie s.hasOwnProperty(canonicalName))
320 continue;var isKnownProperty=propertyToEffectiveRule.hasOwnProperty(canonicalNam e);if(!isKnownProperty&&styleRule.isInherited&&!inheritedPropertyToNode[canonica lName]) 333 continue;var isKnownProperty=propertyToEffectiveRule.hasOwnProperty(canonicalNam e);if(!isKnownProperty&&styleRule.isInherited&&!inheritedPropertyToNode[canonica lName])
321 inheritedPropertyToNode[canonicalName]=styleRule.parentNode;if(isImportant){if(s tyleRule.isInherited&&isKnownProperty&&styleRule.parentNode!==inheritedPropertyT oNode[canonicalName]) 334 inheritedPropertyToNode[canonicalName]=styleRule.parentNode;if(isImportant){if(s tyleRule.isInherited&&isKnownProperty&&styleRule.parentNode!==inheritedPropertyT oNode[canonicalName])
322 continue;foundImportantProperties[canonicalName]=true;if(isKnownProperty) 335 continue;foundImportantProperties[canonicalName]=true;if(isKnownProperty)
323 delete propertyToEffectiveRule[canonicalName].usedProperties[canonicalName];} 336 delete propertyToEffectiveRule[canonicalName].usedProperties[canonicalName];}
324 styleRule.usedProperties[canonicalName]=true;usedProperties[canonicalName]=true; propertyToEffectiveRule[canonicalName]=styleRule;}}},_refreshSectionsForStyleRul es:function(styleRules,usedProperties,editedSection) 337 styleRule.usedProperties[canonicalName]=true;usedProperties[canonicalName]=true; propertyToEffectiveRule[canonicalName]=styleRule;}}},_refreshSectionsForStyleRul es:function(styleRules,usedProperties,editedSection)
325 {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,pseudoId,anchorElement) 338 {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)
326 {var sections=[];var lastWasSeparator=true;for(var i=0;i<styleRules.length;++i){ var styleRule=styleRules[i];if(styleRule.isStyleSeparator){var separatorElement= document.createElement("div");separatorElement.className="sidebar-separator";if( styleRule.node){var link=WebInspector.DOMPresentationUtils.linkifyNodeReference( styleRule.node);separatorElement.appendChild(document.createTextNode(WebInspecto r.UIString("Inherited from")+" "));separatorElement.appendChild(link);if(!sectio ns.inheritedPropertiesSeparatorElement) 339 {var sections=[];var lastWasSeparator=true;for(var i=0;i<styleRules.length;++i){ var styleRule=styleRules[i];if(styleRule.isStyleSeparator){var separatorElement= document.createElement("div");if(styleRule.isPlaceholder){separatorElement.class Name="styles-sidebar-placeholder";this._sectionsContainer.insertBefore(separator Element,anchorElement);continue;}
340 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)
327 sections.inheritedPropertiesSeparatorElement=separatorElement;}else if("pseudoId "in styleRule){var pseudoName=WebInspector.StylesSidebarPane.PseudoIdNames[style Rule.pseudoId];if(pseudoName) 341 sections.inheritedPropertiesSeparatorElement=separatorElement;}else if("pseudoId "in styleRule){var pseudoName=WebInspector.StylesSidebarPane.PseudoIdNames[style Rule.pseudoId];if(pseudoName)
328 separatorElement.textContent=WebInspector.UIString("Pseudo ::%s element",pseudoN ame);else 342 separatorElement.textContent=WebInspector.UIString("Pseudo ::%s element",pseudoN ame);else
329 separatorElement.textContent=WebInspector.UIString("Pseudo element");}else 343 separatorElement.textContent=WebInspector.UIString("Pseudo element");}else
330 separatorElement.textContent=styleRule.text;this._sectionsContainer.insertBefore (separatorElement,anchorElement);lastWasSeparator=true;continue;} 344 separatorElement.textContent=styleRule.text;this._sectionsContainer.insertBefore (separatorElement,anchorElement);lastWasSeparator=true;continue;}
331 var computedStyle=styleRule.computedStyle;var editable=styleRule.editable;if(typ eof editable==="undefined") 345 var computedStyle=styleRule.computedStyle;var editable=styleRule.editable;if(typ eof editable==="undefined")
332 editable=true;if(computedStyle) 346 editable=true;if(computedStyle)
333 var section=new WebInspector.ComputedStylePropertiesSection(this,styleRule,usedP roperties);else{var section=new WebInspector.StylePropertiesSection(this,styleRu le,editable,styleRule.isInherited,lastWasSeparator);section._markSelectorMatches ();} 347 var section=new WebInspector.ComputedStylePropertiesSection(this,styleRule,usedP roperties);else{var section=new WebInspector.StylePropertiesSection(this,styleRu le,editable,styleRule.isInherited,lastWasSeparator);section._markSelectorMatches ();}
334 section.expanded=true;if(computedStyle){this._computedStylePane.bodyElement.appe ndChild(section.element);lastWasSeparator=true;}else{this._sectionsContainer.ins ertBefore(section.element,anchorElement);lastWasSeparator=false;} 348 section.expanded=true;if(computedStyle){this._computedStylePane.bodyElement.appe ndChild(section.element);lastWasSeparator=true;}else{this._sectionsContainer.ins ertBefore(section.element,anchorElement);lastWasSeparator=false;}
335 sections.push(section);} 349 sections.push(section);}
336 return sections;},_containsInherited:function(style) 350 return sections;},_containsInherited:function(style)
337 {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)) 351 {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))
338 return true;} 352 return true;}
339 return false;},_colorFormatSettingChanged:function(event) 353 return false;},_colorFormatSettingChanged:function(event)
340 {this._updateColorFormatFilter();for(var pseudoId in this.sections){var sections =this.sections[pseudoId];for(var i=0;i<sections.length;++i) 354 {this._updateColorFormatFilter();for(var pseudoId in this.sections){var sections =this.sections[pseudoId];for(var i=0;i<sections.length;++i)
341 sections[i].update(true);}},_updateColorFormatFilter:function() 355 sections[i].update(true);}},_updateColorFormatFilter:function()
342 {var selectedIndex=0;var value=WebInspector.settings.colorFormat.get();var optio ns=this.settingsSelectElement.options;for(var i=0;i<options.length;++i){if(optio ns[i].value===value){selectedIndex=i;break;}} 356 {var selectedIndex=0;var value=WebInspector.settings.colorFormat.get();var optio ns=this.settingsSelectElement.options;for(var i=0;i<options.length;++i){if(optio ns[i].value===value){selectedIndex=i;break;}}
343 this.settingsSelectElement.selectedIndex=selectedIndex;},_changeSetting:function (event) 357 this.settingsSelectElement.selectedIndex=selectedIndex;},_changeSetting:function (event)
344 {var options=this.settingsSelectElement.options;var selectedOption=options[this. settingsSelectElement.selectedIndex];WebInspector.settings.colorFormat.set(selec tedOption.value);},_createNewRule:function(event) 358 {var options=this.settingsSelectElement.options;var selectedOption=options[this. settingsSelectElement.selectedIndex];WebInspector.settings.colorFormat.set(selec tedOption.value);},_createNewRule:function(event)
345 {event.consume();this.expand();this.addBlankSection().startEditingSelector();},a ddBlankSection:function() 359 {event.consume();this.expand();this.addBlankSection().startEditingSelector();},a ddBlankSection:function()
346 {var blankSection=new WebInspector.BlankStylePropertiesSection(this,this.node?th is.node.appropriateSelectorFor(true):"");var elementStyleSection=this.sections[0 ][1];this._sectionsContainer.insertBefore(blankSection.element,elementStyleSecti on.element.nextSibling);this.sections[0].splice(2,0,blankSection);return blankSe ction;},removeSection:function(section) 360 {var blankSection=new WebInspector.BlankStylePropertiesSection(this,this.node?th is.node.appropriateSelectorFor(true):"");var elementStyleSection=this.sections[0 ][1];this._sectionsContainer.insertBefore(blankSection.element,elementStyleSecti on.element.nextSibling);this.sections[0].splice(2,0,blankSection);return blankSe ction;},removeSection:function(section)
347 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];var ind ex=sections.indexOf(section);if(index===-1) 361 {for(var pseudoId in this.sections){var sections=this.sections[pseudoId];var ind ex=sections.indexOf(section);if(index===-1)
348 continue;sections.splice(index,1);section.element.remove();}},_toggleElementStat ePane:function(event) 362 continue;sections.splice(index,1);section.element.remove();}},_toggleElementStat ePane:function(event)
349 {event.consume();if(!this._elementStateButton.hasStyleClass("toggled")){this.exp and();this._elementStateButton.addStyleClass("toggled");this._elementStatePane.a ddStyleClass("expanded");}else{this._elementStateButton.removeStyleClass("toggle d");this._elementStatePane.removeStyleClass("expanded");}},_createElementStatePa ne:function() 363 {event.consume();var buttonToggled=!this._elementStateButton.hasStyleClass("togg led");if(buttonToggled)
364 this.expand();this._elementStateButton.enableStyleClass("toggled",buttonToggled) ;this._elementStatePane.enableStyleClass("expanded",buttonToggled);},_createElem entStatePane:function()
350 {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) 365 {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)
351 {var node=this._validateNode();if(!node) 366 {var node=this._validateNode();if(!node)
352 return;this._setPseudoClassCallback(node.id,event.target.state,event.target.chec ked);} 367 return;this._setPseudoClassCallback(node.id,event.target.state,event.target.chec ked);}
353 function createCheckbox(state) 368 function createCheckbox(state)
354 {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;} 369 {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;}
355 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() 370 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()
356 {this._rebuildUpdate();},willHide:function() 371 {this._rebuildUpdate();},willHide:function()
357 {this._spectrumHelper.hide();this._discardElementUnderMouse();},_discardElementU nderMouse:function() 372 {this._spectrumHelper.hide();this._discardElementUnderMouse();},_discardElementU nderMouse:function()
358 {if(this._elementUnderMouse) 373 {if(this._elementUnderMouse)
359 this._elementUnderMouse.removeStyleClass("styles-panel-hovered");delete this._el ementUnderMouse;},_mouseMovedOverElement:function(e) 374 this._elementUnderMouse.removeStyleClass("styles-panel-hovered");delete this._el ementUnderMouse;},_mouseMovedOverElement:function(e)
360 {if(this._elementUnderMouse&&e.target!==this._elementUnderMouse) 375 {if(this._elementUnderMouse&&e.target!==this._elementUnderMouse)
361 this._discardElementUnderMouse();this._elementUnderMouse=e.target;if(WebInspecto r.KeyboardShortcut.eventHasCtrlOrMeta(e)) 376 this._discardElementUnderMouse();this._elementUnderMouse=e.target;if(WebInspecto r.KeyboardShortcut.eventHasCtrlOrMeta(e))
362 this._elementUnderMouse.addStyleClass("styles-panel-hovered");},_keyDown:functio n(e) 377 this._elementUnderMouse.addStyleClass("styles-panel-hovered");},_keyDown:functio n(e)
363 {if((!WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Ctrl. code)||(WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Met a.code)){if(this._elementUnderMouse) 378 {if((!WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Ctrl. code)||(WebInspector.isMac()&&e.keyCode===WebInspector.KeyboardShortcut.Keys.Met a.code)){if(this._elementUnderMouse)
364 this._elementUnderMouse.addStyleClass("styles-panel-hovered");}},_keyUp:function (e) 379 this._elementUnderMouse.addStyleClass("styles-panel-hovered");}},_keyUp:function (e)
365 {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} 380 {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}
366 WebInspector.ComputedStyleSidebarPane=function() 381 WebInspector.ComputedStyleSidebarPane=function()
367 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Computed Style"));var showInheritedCheckbox=new WebInspector.Checkbox(WebInspector.UIString("Show inh erited"),"sidebar-pane-subtitle");this.titleElement.appendChild(showInheritedChe ckbox.element);if(WebInspector.settings.showInheritedComputedStyleProperties.get ()){this.bodyElement.addStyleClass("show-inherited");showInheritedCheckbox.check ed=true;} 382 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Computed Style"));var showInheritedCheckbox=new WebInspector.Checkbox(WebInspector.UIString("Show inh erited"),"sidebar-pane-subtitle");this.titleElement.appendChild(showInheritedChe ckbox.element);if(WebInspector.settings.showInheritedComputedStyleProperties.get ()){this.bodyElement.addStyleClass("show-inherited");showInheritedCheckbox.check ed=true;}
368 function showInheritedToggleFunction(event) 383 function showInheritedToggleFunction()
369 {WebInspector.settings.showInheritedComputedStyleProperties.set(showInheritedChe ckbox.checked);if(WebInspector.settings.showInheritedComputedStyleProperties.get ()) 384 {WebInspector.settings.showInheritedComputedStyleProperties.set(showInheritedChe ckbox.checked);if(WebInspector.settings.showInheritedComputedStyleProperties.get ())
370 this.bodyElement.addStyleClass("show-inherited");else 385 this.bodyElement.addStyleClass("show-inherited");else
371 this.bodyElement.removeStyleClass("show-inherited");} 386 this.bodyElement.removeStyleClass("show-inherited");}
372 showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this));} 387 showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this));}
373 WebInspector.ComputedStyleSidebarPane.prototype={wasShown:function() 388 WebInspector.ComputedStyleSidebarPane.prototype={wasShown:function()
374 {WebInspector.SidebarPane.prototype.wasShown.call(this);if(!this._hasFreshConten t) 389 {WebInspector.SidebarPane.prototype.wasShown.call(this);if(!this._hasFreshConten t)
375 this.prepareContent();},prepareContent:function(callback) 390 this.prepareContent();},prepareContent:function(callback)
376 {function wrappedCallback(){this._hasFreshContent=true;if(callback) 391 {function wrappedCallback(){this._hasFreshContent=true;if(callback)
377 callback();delete this._hasFreshContent;} 392 callback();delete this._hasFreshContent;}
378 this._stylesSidebarPane._refreshUpdate(null,true,wrappedCallback.bind(this));},_ _proto__:WebInspector.SidebarPane.prototype} 393 this._stylesSidebarPane._refreshUpdate(null,true,wrappedCallback.bind(this));},_ _proto__:WebInspector.SidebarPane.prototype}
379 WebInspector.StylePropertiesSection=function(parentPane,styleRule,editable,isInh erited,isFirstSection) 394 WebInspector.StylePropertiesSection=function(parentPane,styleRule,editable,isInh erited,isFirstSection)
380 {WebInspector.PropertiesSection.call(this,"");this.element.className="styles-sec tion matched-styles monospace"+(isFirstSection?" first-styles-section":"");this. propertiesElement.removeStyleClass("properties-tree");this._parentPane=parentPan e;this.styleRule=styleRule;this.rule=this.styleRule.rule;this.editable=editable; this.isInherited=isInherited;if(styleRule.media){for(var i=styleRule.media.lengt h-1;i>=0;--i){var media=styleRule.media[i];var mediaDataElement=this.titleElemen t.createChild("div","media");var mediaText;switch(media.source){case WebInspecto r.CSSMedia.Source.LINKED_SHEET:case WebInspector.CSSMedia.Source.INLINE_SHEET:me diaText="media=\""+media.text+"\"";break;case WebInspector.CSSMedia.Source.MEDIA _RULE:mediaText="@media "+media.text;break;case WebInspector.CSSMedia.Source.IMP ORT_RULE:mediaText="@import "+media.text;break;} 395 {WebInspector.PropertiesSection.call(this,"");this.element.className="styles-sec tion matched-styles monospace"+(isFirstSection?" first-styles-section":"");this. propertiesElement.removeStyleClass("properties-tree");this._parentPane=parentPan e;this.styleRule=styleRule;this.rule=this.styleRule.rule;this.editable=editable; this.isInherited=isInherited;if(styleRule.media){for(var i=styleRule.media.lengt h-1;i>=0;--i){var media=styleRule.media[i];var mediaDataElement=this.titleElemen t.createChild("div","media");var mediaText;switch(media.source){case WebInspecto r.CSSMedia.Source.LINKED_SHEET:case WebInspector.CSSMedia.Source.INLINE_SHEET:me diaText="media=\""+media.text+"\"";break;case WebInspector.CSSMedia.Source.MEDIA _RULE:mediaText="@media "+media.text;break;case WebInspector.CSSMedia.Source.IMP ORT_RULE:mediaText="@import "+media.text;break;}
381 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);}} 396 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);}}
382 var anchor;if(rawLocation) 397 var anchor;if(rawLocation)
383 anchor=this._parentPane._linkifier.linkifyCSSLocation(mediaHeader.id,rawLocation );else{anchor=WebInspector.linkifyResourceAsNode(media.sourceURL,undefined,"subt itle",media.sourceURL);} 398 anchor=this._parentPane._linkifier.linkifyCSSLocation(mediaHeader.id,rawLocation );else{anchor=WebInspector.linkifyResourceAsNode(media.sourceURL,undefined,"subt itle",media.sourceURL);}
384 anchor.preferredPanel="scripts";anchor.style.float="right";refElement.appendChil d(anchor);} 399 anchor.preferredPanel="sources";anchor.style.float="right";refElement.appendChil d(anchor);}
385 var mediaTextElement=mediaDataElement.createChild("span");mediaTextElement.textC ontent=mediaText;mediaTextElement.title=media.text;}} 400 var mediaTextElement=mediaDataElement.createChild("span");mediaTextElement.textC ontent=mediaText;mediaTextElement.title=media.text;}}
386 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) 401 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)
387 this.editable=false;else{if(this.rule.id) 402 this.editable=false;else{if(this.rule.id)
388 this.navigable=!!this.rule.resourceURL();} 403 this.navigable=!!this.rule.resourceURL();}
389 this.titleElement.addStyleClass("styles-selector");} 404 this.titleElement.addStyleClass("styles-selector");}
390 this._usedProperties=styleRule.usedProperties;this._selectorRefElement=document. createElement("div");this._selectorRefElement.className="subtitle";this._selecto rRefElement.appendChild(this._createRuleOriginNode());selectorContainer.insertBe fore(this._selectorRefElement,selectorContainer.firstChild);this.titleElement.ap pendChild(selectorContainer);this._selectorContainer=selectorContainer;if(isInhe rited) 405 this._usedProperties=styleRule.usedProperties;this._selectorRefElement=document. createElement("div");this._selectorRefElement.className="subtitle";this._selecto rRefElement.appendChild(this._createRuleOriginNode());selectorContainer.insertBe fore(this._selectorRefElement,selectorContainer.firstChild);this.titleElement.ap pendChild(selectorContainer);this._selectorContainer=selectorContainer;if(isInhe rited)
391 this.element.addStyleClass("show-inherited");if(this.navigable) 406 this.element.addStyleClass("show-inherited");if(this.navigable)
392 this.element.addStyleClass("navigable");if(!this.editable) 407 this.element.addStyleClass("navigable");if(!this.editable)
393 this.element.addStyleClass("read-only");} 408 this.element.addStyleClass("read-only");}
394 WebInspector.StylePropertiesSection.prototype={get pane() 409 WebInspector.StylePropertiesSection.prototype={get pane()
395 {return this._parentPane;},collapse:function(dontRememberState) 410 {return this._parentPane;},collapse:function()
396 {},isPropertyInherited:function(propertyName) 411 {},isPropertyInherited:function(propertyName)
397 {if(this.isInherited){return!WebInspector.CSSMetadata.isPropertyInherited(proper tyName);} 412 {if(this.isInherited){return!WebInspector.CSSMetadata.isPropertyInherited(proper tyName);}
398 return false;},isPropertyOverloaded:function(propertyName,isShorthand) 413 return false;},isPropertyOverloaded:function(propertyName,isShorthand)
399 {if(!this._usedProperties||this.noAffect) 414 {if(!this._usedProperties||this.noAffect)
400 return false;if(this.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited( propertyName)){return false;} 415 return false;if(this.isInherited&&!WebInspector.CSSMetadata.isPropertyInherited( propertyName)){return false;}
401 var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(propertyName);v ar used=(canonicalName in this._usedProperties);if(used||!isShorthand) 416 var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(propertyName);v ar used=(canonicalName in this._usedProperties);if(used||!isShorthand)
402 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) 417 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)
403 return false;} 418 return false;}
404 return true;},nextEditableSibling:function() 419 return true;},nextEditableSibling:function()
405 {var curSection=this;do{curSection=curSection.nextSibling;}while(curSection&&!cu rSection.editable);if(!curSection){curSection=this.firstSibling;while(curSection &&!curSection.editable) 420 {var curSection=this;do{curSection=curSection.nextSibling;}while(curSection&&!cu rSection.editable);if(!curSection){curSection=this.firstSibling;while(curSection &&!curSection.editable)
406 curSection=curSection.nextSibling;} 421 curSection=curSection.nextSibling;}
407 return(curSection&&curSection.editable)?curSection:null;},previousEditableSiblin g:function() 422 return(curSection&&curSection.editable)?curSection:null;},previousEditableSiblin g:function()
408 {var curSection=this;do{curSection=curSection.previousSibling;}while(curSection& &!curSection.editable);if(!curSection){curSection=this.lastSibling;while(curSect ion&&!curSection.editable) 423 {var curSection=this;do{curSection=curSection.previousSibling;}while(curSection& &!curSection.editable);if(!curSection){curSection=this.lastSibling;while(curSect ion&&!curSection.editable)
409 curSection=curSection.previousSibling;} 424 curSection=curSection.previousSibling;}
410 return(curSection&&curSection.editable)?curSection:null;},update:function(full) 425 return(curSection&&curSection.editable)?curSection:null;},update:function(full)
411 {if(this.styleRule.selectorText) 426 {if(this.styleRule.selectorText)
412 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);}} 427 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);}}
413 this.afterUpdate();},afterUpdate:function() 428 this.afterUpdate();},afterUpdate:function()
414 {if(this._afterUpdate){this._afterUpdate(this);delete this._afterUpdate;}},onpop ulate:function() 429 {if(this._afterUpdate){this._afterUpdate(this);delete this._afterUpdate;}},onpop ulate:function()
415 {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) 430 {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)
416 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);} 431 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);}
417 return;} 432 return;}
418 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;} 433 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;}
419 if(style.getLiveProperty(shorthand)){shorthandPropertyAvailable=true;continue;} 434 if(style.getLiveProperty(shorthand)){shorthandPropertyAvailable=true;continue;}
420 if(!style.shorthandValue(shorthand)){shorthandPropertyAvailable=false;continue;} 435 if(!style.shorthandValue(shorthand)){shorthandPropertyAvailable=false;continue;}
421 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;} 436 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;}
422 if(shorthandPropertyAvailable) 437 if(shorthandPropertyAvailable)
423 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);}},findTreeElementWithName:function(name) 438 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()
424 {var treeElement=this.propertiesTreeOutline.children[0];while(treeElement){if(tr eeElement.name===name)
425 return treeElement;treeElement=treeElement.traverseNextTreeElement(true,null,tru e);}
426 return null;},_markSelectorMatches:function()
427 {var rule=this.styleRule.rule;if(!rule) 439 {var rule=this.styleRule.rule;if(!rule)
428 return;var matchingSelectors=rule.matchingSelectors;if(this.noAffect||matchingSe lectors) 440 return;var matchingSelectors=rule.matchingSelectors;if(this.noAffect||matchingSe lectors)
429 this._selectorElement.className="selector";if(!matchingSelectors) 441 this._selectorElement.className="selector";if(!matchingSelectors)
430 return;var selectors=rule.selectors;var fragment=document.createDocumentFragment ();var currentMatch=0;for(var i=0,lastSelectorIndex=selectors.length-1;i<=lastSe lectorIndex;++i){var selectorNode;var textNode=document.createTextNode(selectors [i]);if(matchingSelectors[currentMatch]===i){++currentMatch;selectorNode=documen t.createElement("span");selectorNode.className="selector-matches";selectorNode.a ppendChild(textNode);}else 442 return;var selectors=rule.selectors;var fragment=document.createDocumentFragment ();var currentMatch=0;for(var i=0,lastSelectorIndex=selectors.length-1;i<=lastSe lectorIndex;++i){var selectorNode;var textNode=document.createTextNode(selectors [i]);if(matchingSelectors[currentMatch]===i){++currentMatch;selectorNode=documen t.createElement("span");selectorNode.className="selector-matches";selectorNode.a ppendChild(textNode);}else
431 selectorNode=textNode;fragment.appendChild(selectorNode);if(i!==lastSelectorInde x) 443 selectorNode=textNode;fragment.appendChild(selectorNode);if(i!==lastSelectorInde x)
432 fragment.appendChild(document.createTextNode(", "));} 444 fragment.appendChild(document.createTextNode(", "));}
433 this._selectorElement.removeChildren();this._selectorElement.appendChild(fragmen t);},_checkWillCancelEditing:function() 445 this._selectorElement.removeChildren();this._selectorElement.appendChild(fragmen t);},_checkWillCancelEditing:function()
434 {var willCauseCancelEditing=this._willCauseCancelEditing;delete this._willCauseC ancelEditing;return willCauseCancelEditing;},_handleSelectorContainerClick:funct ion(event) 446 {var willCauseCancelEditing=this._willCauseCancelEditing;delete this._willCauseC ancelEditing;return willCauseCancelEditing;},_handleSelectorContainerClick:funct ion(event)
435 {if(this._checkWillCancelEditing()||!this.editable) 447 {if(this._checkWillCancelEditing()||!this.editable)
436 return;if(event.target===this._selectorContainer) 448 return;if(event.target===this._selectorContainer)
437 this.addNewBlankProperty(0).startEditing();},addNewBlankProperty:function(index) 449 this.addNewBlankProperty(0).startEditing();},addNewBlankProperty:function(index)
438 {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() 450 {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()
439 {function linkifyUncopyable(url,line) 451 {function linkifyUncopyable(url,line)
440 {var link=WebInspector.linkifyResourceAsNode(url,line,"",url+":"+(line+1));link. preferredPanel="scripts";link.classList.add("webkit-html-resource-link");link.se tAttribute("data-uncopyable",link.textContent);link.textContent="";return link;} 452 {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;}
441 if(this.styleRule.sourceURL) 453 if(this.styleRule.sourceURL)
442 return this._parentPane._linkifier.linkifyCSSLocation(this.rule.id.styleSheetId, this.rule.rawLocation)||linkifyUncopyable(this.styleRule.sourceURL,this.rule.lin eNumberInSource());if(!this.rule) 454 return this._parentPane._linkifier.linkifyCSSLocation(this.rule.id.styleSheetId, this.rule.rawLocation)||linkifyUncopyable(this.styleRule.sourceURL,this.rule.lin eNumberInSource());if(!this.rule)
443 return document.createTextNode("");if(this.rule.isUserAgent) 455 return document.createTextNode("");if(this.rule.isUserAgent)
444 return document.createTextNode(WebInspector.UIString("user agent stylesheet"));i f(this.rule.isUser) 456 return document.createTextNode(WebInspector.UIString("user agent stylesheet"));i f(this.rule.isUser)
445 return document.createTextNode(WebInspector.UIString("user stylesheet"));if(this .rule.isViaInspector) 457 return document.createTextNode(WebInspector.UIString("user stylesheet"));if(this .rule.isViaInspector)
446 return document.createTextNode(WebInspector.UIString("via inspector"));return do cument.createTextNode("");},_handleEmptySpaceMouseDown:function(event) 458 return document.createTextNode(WebInspector.UIString("via inspector"));return do cument.createTextNode("");},_handleEmptySpaceMouseDown:function()
447 {this._willCauseCancelEditing=this._parentPane._isEditingStyle;},_handleEmptySpa ceClick:function(event) 459 {this._willCauseCancelEditing=this._parentPane._isEditingStyle;},_handleEmptySpa ceClick:function(event)
448 {if(!this.editable) 460 {if(!this.editable)
449 return;if(!window.getSelection().isCollapsed) 461 return;if(!window.getSelection().isCollapsed)
450 return;if(this._checkWillCancelEditing()) 462 return;if(this._checkWillCancelEditing())
451 return;if(event.target.hasStyleClass("header")||this.element.hasStyleClass("read -only")||event.target.enclosingNodeOrSelfWithClass("media")){event.consume();ret urn;} 463 return;if(event.target.hasStyleClass("header")||this.element.hasStyleClass("read -only")||event.target.enclosingNodeOrSelfWithClass("media")){event.consume();ret urn;}
452 this.expand();this.addNewBlankProperty().startEditing();},_handleSelectorClick:f unction(event) 464 this.expand();this.addNewBlankProperty().startEditing();},_handleSelectorClick:f unction(event)
453 {this._startEditingOnMouseEvent();event.consume(true);},_startEditingOnMouseEven t:function() 465 {this._startEditingOnMouseEvent();event.consume(true);},_startEditingOnMouseEven t:function()
454 {if(!this.editable) 466 {if(!this.editable)
455 return;if(!this.rule&&this.propertiesTreeOutline.children.length===0){this.expan d();this.addNewBlankProperty().startEditing();return;} 467 return;if(!this.rule&&this.propertiesTreeOutline.children.length===0){this.expan d();this.addNewBlankProperty().startEditing();return;}
456 if(!this.rule) 468 if(!this.rule)
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 section.pane._refreshUpdate(section,false,userCallback);else{if(userCallback) 614 section.pane._refreshUpdate(section,false,userCallback);else{if(userCallback)
603 userCallback();}},toggleEnabled:function(event) 615 userCallback();}},toggleEnabled:function(event)
604 {var disabled=!event.target.checked;function callback(newStyle) 616 {var disabled=!event.target.checked;function callback(newStyle)
605 {if(!newStyle) 617 {if(!newStyle)
606 return;newStyle.parentRule=this.style.parentRule;this.style=newStyle;this._style Rule.style=newStyle;var section=this.section();if(section&&section.pane) 618 return;newStyle.parentRule=this.style.parentRule;this.style=newStyle;this._style Rule.style=newStyle;var section=this.section();if(section&&section.pane)
607 section.pane.dispatchEventToListeners("style property toggled");this._updatePane ();delete this._parentPane._userOperation;} 619 section.pane.dispatchEventToListeners("style property toggled");this._updatePane ();delete this._parentPane._userOperation;}
608 this._parentPane._userOperation=true;this.property.setDisabled(disabled,callback .bind(this));event.consume();},onpopulate:function() 620 this._parentPane._userOperation=true;this.property.setDisabled(disabled,callback .bind(this));event.consume();},onpopulate:function()
609 {if(this.children.length||!this.isShorthand) 621 {if(this.children.length||!this.isShorthand)
610 return;var longhandProperties=this.style.longhandProperties(this.name);for(var i =0;i<longhandProperties.length;++i){var name=longhandProperties[i].name;var sect ion=this.section();if(section){var inherited=section.isPropertyInherited(name);v ar overloaded=section.isPropertyOverloaded(name);} 622 return;var longhandProperties=this.style.longhandProperties(this.name);for(var i =0;i<longhandProperties.length;++i){var name=longhandProperties[i].name;var sect ion=this.section();if(section){var inherited=section.isPropertyInherited(name);v ar overloaded=section.isPropertyOverloaded(name);}
611 var liveProperty=this.style.getLiveProperty(name);if(!liveProperty) 623 var liveProperty=this.style.getLiveProperty(name);if(!liveProperty)
612 continue;var item=new WebInspector.StylePropertyTreeElement(this._parentPane,thi s._styleRule,this.style,liveProperty,false,inherited,overloaded);this.appendChil d(item);}},restoreNameElement:function() 624 continue;var item=new WebInspector.StylePropertyTreeElement(this._parentPane,thi s._styleRule,this.style,liveProperty,false,inherited,overloaded);this.appendChil d(item);}},onattach:function()
613 {if(this.nameElement===this.listItemElement.querySelector(".webkit-css-property" ))
614 return;this.nameElement=document.createElement("span");this.nameElement.classNam e="webkit-css-property";this.nameElement.textContent="";this.listItemElement.ins ertBefore(this.nameElement,this.listItemElement.firstChild);},onattach:function( )
615 {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) 625 {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)
616 {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() 626 {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()
617 {if(this._parentPane){delete this._parentPane._mouseDownTreeElement;delete this. _parentPane._mouseDownTreeElementIsName;delete this._parentPane._mouseDownTreeEl ementIsValue;}},updateTitle:function() 627 {if(this._parentPane){delete this._parentPane._mouseDownTreeElement;delete this. _parentPane._mouseDownTreeElementIsName;delete this._parentPane._mouseDownTreeEl ementIsValue;}},updateTitle:function()
618 {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) 628 {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)
619 {if(!window.getSelection().isCollapsed) 629 {if(!window.getSelection().isCollapsed)
620 return;event.consume(true);if(event.target===this.listItemElement){var section=t his.section();if(!section||!section.editable) 630 return;event.consume(true);if(event.target===this.listItemElement){var section=t his.section();if(!section||!section.editable)
621 return;if(section._checkWillCancelEditing()) 631 return;if(section._checkWillCancelEditing())
622 return;section.addNewBlankProperty(this.property.index+1).startEditing();return; } 632 return;section.addNewBlankProperty(this.property.index+1).startEditing();return; }
623 if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&this.section().navig able){this._navigateToSource(event.target);return;} 633 if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&this.section().navig able){this._navigateToSource(event.target);return;}
624 this.startEditing(event.target);},_navigateToSource:function(element) 634 this.startEditing(event.target);},_navigateToSource:function(element)
625 {console.assert(this.section().navigable);var propertyNameClicked=element===this .nameElement;var uiLocation=this.property.uiLocation(propertyNameClicked);if(!ui Location) 635 {console.assert(this.section().navigable);var propertyNameClicked=element===this .nameElement;var uiLocation=this.property.uiLocation(propertyNameClicked);if(!ui Location)
626 return;WebInspector.showPanel("scripts").showUISourceCode(uiLocation.uiSourceCod e,uiLocation.lineNumber,uiLocation.columnNumber);},_isNameElement:function(eleme nt) 636 return;WebInspector.showPanel("sources").showUILocation(uiLocation);},_isNameEle ment:function(element)
627 {return element.enclosingNodeOrSelfWithClass("webkit-css-property")===this.nameE lement;},_isValueElement:function(element) 637 {return element.enclosingNodeOrSelfWithClass("webkit-css-property")===this.nameE lement;},_isValueElement:function(element)
628 {return!!element.enclosingNodeOrSelfWithClass("value");},startEditing:function(s electElement) 638 {return!!element.enclosingNodeOrSelfWithClass("value");},startEditing:function(s electElement)
629 {if(this.parent.isShorthand) 639 {if(this.parent.isShorthand)
630 return;if(selectElement===this._expandElement) 640 return;if(selectElement===this._expandElement)
631 return;var section=this.section();if(section&&!section.editable) 641 return;var section=this.section();if(section&&!section.editable)
632 return;if(!selectElement) 642 return;if(!selectElement)
633 selectElement=this.nameElement;else 643 selectElement=this.nameElement;else
634 selectElement=selectElement.enclosingNodeOrSelfWithClass("webkit-css-property")| |selectElement.enclosingNodeOrSelfWithClass("value");var isEditingName=selectEle ment===this.nameElement;if(!isEditingName){if(selectElement!==this.valueElement) {selectElement=this.valueElement;} 644 selectElement=selectElement.enclosingNodeOrSelfWithClass("webkit-css-property")| |selectElement.enclosingNodeOrSelfWithClass("value");if(WebInspector.isBeingEdit ed(selectElement))
635 this.valueElement.textContent=(!this._newProperty&&WebInspector.CSSMetadata.isCo lorAwareProperty(this.name))?formatColors(this.value):this.value;} 645 return;var isEditingName=selectElement===this.nameElement;if(!isEditingName)
636 function formatColors(value) 646 this.valueElement.textContent=restoreURLs(this.valueElement.textContent,this.val ue);function restoreURLs(fieldValue,modelValue)
637 {var result=[];var items=value.replace(WebInspector.StylesSidebarPane._colorRege x,"\0$1\0").split("\0");for(var i=0;i<items.length;++i){var color=WebInspector.C olor.parse(items[i]);result.push(color?color.toString(WebInspector.StylesSidebar Pane._colorFormat(color)):items[i]);} 647 {const urlRegex=/\b(url\([^)]*\))/g;var splitFieldValue=fieldValue.split(urlRege x);if(splitFieldValue.length===1)
638 return result.join("");} 648 return fieldValue;var modelUrlRegex=new RegExp(urlRegex);for(var i=1;i<splitFiel dValue.length;i+=2){var match=modelUrlRegex.exec(modelValue);if(match)
639 if(WebInspector.isBeingEdited(selectElement)) 649 splitFieldValue[i]=match[0];}
640 return;var context={expanded:this.expanded,hasChildren:this.hasChildren,isEditin gName:isEditingName,previousContent:selectElement.textContent};this.hasChildren= false;if(selectElement.parentElement) 650 return splitFieldValue.join("");}
651 var context={expanded:this.expanded,hasChildren:this.hasChildren,isEditingName:i sEditingName,previousContent:selectElement.textContent};this.hasChildren=false;i f(selectElement.parentElement)
641 selectElement.parentElement.addStyleClass("child-editing");selectElement.textCon tent=selectElement.textContent;function pasteHandler(context,event) 652 selectElement.parentElement.addStyleClass("child-editing");selectElement.textCon tent=selectElement.textContent;function pasteHandler(context,event)
642 {var data=event.clipboardData.getData("Text");if(!data) 653 {var data=event.clipboardData.getData("Text");if(!data)
643 return;var colonIdx=data.indexOf(":");if(colonIdx<0) 654 return;var colonIdx=data.indexOf(":");if(colonIdx<0)
644 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;} 655 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;}
645 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(null,event.target.textContent,context.p reviousContent,context,"forward");} 656 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");}
646 function blurListener(context,event) 657 function blurListener(context,event)
647 {var treeElement=this._parentPane._mouseDownTreeElement;var moveDirection="";if( treeElement===this){if(isEditingName&&this._parentPane._mouseDownTreeElementIsVa lue) 658 {var treeElement=this._parentPane._mouseDownTreeElement;var moveDirection="";if( treeElement===this){if(isEditingName&&this._parentPane._mouseDownTreeElementIsVa lue)
648 moveDirection="forward";if(!isEditingName&&this._parentPane._mouseDownTreeElemen tIsName) 659 moveDirection="forward";if(!isEditingName&&this._parentPane._mouseDownTreeElemen tIsName)
649 moveDirection="backward";} 660 moveDirection="backward";}
650 this.editingCommitted(null,event.target.textContent,context.previousContent,cont ext,moveDirection);} 661 this.editingCommitted(event.target.textContent,context,moveDirection);}
651 delete this.originalPropertyText;this._parentPane._isEditingStyle=true;if(select Element.parentElement) 662 delete this.originalPropertyText;this._parentPane._isEditingStyle=true;if(select Element.parentElement)
652 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);} 663 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);}
653 var proxyElement=this._prompt.attachAndStartEditing(selectElement,blurListener.b ind(this,context));proxyElement.addEventListener("keydown",this.editingNameValue KeyDown.bind(this,context),false);if(isEditingName) 664 var proxyElement=this._prompt.attachAndStartEditing(selectElement,blurListener.b ind(this,context));proxyElement.addEventListener("keydown",this.editingNameValue KeyDown.bind(this,context),false);if(isEditingName)
654 proxyElement.addEventListener("paste",pasteHandler.bind(this,context));window.ge tSelection().setBaseAndExtent(selectElement,0,selectElement,1);},editingNameValu eKeyDown:function(context,event) 665 proxyElement.addEventListener("paste",pasteHandler.bind(this,context));window.ge tSelection().setBaseAndExtent(selectElement,0,selectElement,1);},editingNameValu eKeyDown:function(context,event)
655 {if(event.handled) 666 {if(event.handled)
656 return;var isEditingName=context.isEditingName;var result;function shouldCommitV alueSemicolon(text,cursorPosition) 667 return;var isEditingName=context.isEditingName;var result;function shouldCommitV alueSemicolon(text,cursorPosition)
657 {var openQuote="";for(var i=0;i<cursorPosition;++i){var ch=text[i];if(ch==="\\"& &openQuote!=="") 668 {var openQuote="";for(var i=0;i<cursorPosition;++i){var ch=text[i];if(ch==="\\"& &openQuote!=="")
658 ++i;else if(!openQuote&&(ch==="\""||ch==="'")) 669 ++i;else if(!openQuote&&(ch==="\""||ch==="'"))
659 openQuote=ch;else if(openQuote===ch) 670 openQuote=ch;else if(openQuote===ch)
660 openQuote="";} 671 openQuote="";}
661 return!openQuote;} 672 return!openQuote;}
662 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") 673 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")
663 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();} 674 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();}
664 if(result){switch(result){case"cancel":this.editingCancelled(null,context);break ;case"forward":case"backward":this.editingCommitted(null,event.target.textConten t,context.previousContent,context,result);break;} 675 if(result){switch(result){case"cancel":this.editingCancelled(null,context);break ;case"forward":case"backward":this.editingCommitted(event.target.textContent,con text,result);break;}
665 event.consume();return;} 676 event.consume();return;}
666 if(!isEditingName) 677 if(!isEditingName)
667 this._applyFreeFlowStyleTextEdit(false);},_applyFreeFlowStyleTextEdit:function(n ow) 678 this._applyFreeFlowStyleTextEdit(false);},_applyFreeFlowStyleTextEdit:function(n ow)
668 {if(this._applyFreeFlowStyleTextEditTimer) 679 {if(this._applyFreeFlowStyleTextEditTimer)
669 clearTimeout(this._applyFreeFlowStyleTextEditTimer);function apply() 680 clearTimeout(this._applyFreeFlowStyleTextEditTimer);function apply()
670 {var valueText=this.valueElement.textContent;if(valueText.indexOf(";")===-1) 681 {var valueText=this.valueElement.textContent;if(valueText.indexOf(";")===-1)
671 this.applyStyleText(this.nameElement.textContent+": "+valueText,false,false,fals e);} 682 this.applyStyleText(this.nameElement.textContent+": "+valueText,false,false,fals e);}
672 if(now) 683 if(now)
673 apply.call(this);else 684 apply.call(this);else
674 this._applyFreeFlowStyleTextEditTimer=setTimeout(apply.bind(this),100);},kickFre eFlowStyleEditForTest:function() 685 this._applyFreeFlowStyleTextEditTimer=setTimeout(apply.bind(this),100);},kickFre eFlowStyleEditForTest:function()
675 {this._applyFreeFlowStyleTextEdit(true);},editingEnded:function(context) 686 {this._applyFreeFlowStyleTextEdit(true);},editingEnded:function(context)
676 {this._resetMouseDownElement();if(this._applyFreeFlowStyleTextEditTimer) 687 {this._resetMouseDownElement();if(this._applyFreeFlowStyleTextEditTimer)
677 clearTimeout(this._applyFreeFlowStyleTextEditTimer);this.hasChildren=context.has Children;if(context.expanded) 688 clearTimeout(this._applyFreeFlowStyleTextEditTimer);this.hasChildren=context.has Children;if(context.expanded)
678 this.expand();var editedElement=context.isEditingName?this.nameElement:this.valu eElement;if(editedElement.parentElement) 689 this.expand();var editedElement=context.isEditingName?this.nameElement:this.valu eElement;if(editedElement.parentElement)
679 editedElement.parentElement.removeStyleClass("child-editing");delete this._paren tPane._isEditingStyle;},editingCancelled:function(element,context) 690 editedElement.parentElement.removeStyleClass("child-editing");delete this._paren tPane._isEditingStyle;},editingCancelled:function(element,context)
680 {this._removePrompt();this._revertStyleUponEditingCanceled(this.originalProperty Text);this.editingEnded(context);},_revertStyleUponEditingCanceled:function(orig inalPropertyText) 691 {this._removePrompt();this._revertStyleUponEditingCanceled(this.originalProperty Text);this.editingEnded(context);},_revertStyleUponEditingCanceled:function(orig inalPropertyText)
681 {if(typeof originalPropertyText==="string"){delete this.originalPropertyText;thi s.applyStyleText(originalPropertyText,true,false,true);}else{if(this._newPropert y) 692 {if(typeof originalPropertyText==="string"){delete this.originalPropertyText;thi s.applyStyleText(originalPropertyText,true,false,true);}else{if(this._newPropert y)
682 this.treeOutline.removeChild(this);else 693 this.treeOutline.removeChild(this);else
683 this.updateTitle();}},_findSibling:function(moveDirection) 694 this.updateTitle();}},_findSibling:function(moveDirection)
684 {var target=this;do{target=(moveDirection==="forward"?target.nextSibling:target. previousSibling);}while(target&&target.inherited);return target;},editingCommitt ed:function(element,userInput,previousContent,context,moveDirection) 695 {var target=this;do{target=(moveDirection==="forward"?target.nextSibling:target. previousSibling);}while(target&&target.inherited);return target;},editingCommitt ed:function(userInput,context,moveDirection)
685 {this._removePrompt();this.editingEnded(context);var isEditingName=context.isEdi tingName;var createNewProperty,moveToPropertyName,moveToSelector;var isDataPaste d="originalName"in context;var isDirtyViaPaste=isDataPasted&&(this.nameElement.t extContent!==context.originalName||this.valueElement.textContent!==context.origi nalValue);var isPropertySplitPaste=isDataPasted&&isEditingName&&this.valueElemen t.textContent!==context.originalValue;var moveTo=this;var moveToOther=(isEditing Name^(moveDirection==="forward"));var abandonNewProperty=this._newProperty&&!use rInput&&(moveToOther||isEditingName);if(moveDirection==="forward"&&(!isEditingNa me||isPropertySplitPaste)||moveDirection==="backward"&&isEditingName){moveTo=mov eTo._findSibling(moveDirection);if(moveTo) 696 {this._removePrompt();this.editingEnded(context);var isEditingName=context.isEdi tingName;var createNewProperty,moveToPropertyName,moveToSelector;var isDataPaste d="originalName"in context;var isDirtyViaPaste=isDataPasted&&(this.nameElement.t extContent!==context.originalName||this.valueElement.textContent!==context.origi nalValue);var isPropertySplitPaste=isDataPasted&&isEditingName&&this.valueElemen t.textContent!==context.originalValue;var moveTo=this;var moveToOther=(isEditing Name^(moveDirection==="forward"));var abandonNewProperty=this._newProperty&&!use rInput&&(moveToOther||isEditingName);if(moveDirection==="forward"&&(!isEditingNa me||isPropertySplitPaste)||moveDirection==="backward"&&isEditingName){moveTo=mov eTo._findSibling(moveDirection);if(moveTo)
686 moveToPropertyName=moveTo.name;else if(moveDirection==="forward"&&(!this._newPro perty||userInput)) 697 moveToPropertyName=moveTo.name;else if(moveDirection==="forward"&&(!this._newPro perty||userInput))
687 createNewProperty=true;else if(moveDirection==="backward") 698 createNewProperty=true;else if(moveDirection==="backward")
688 moveToSelector=true;} 699 moveToSelector=true;}
689 var moveToIndex=moveTo&&this.treeOutline?this.treeOutline.children.indexOf(moveT o):-1;var blankInput=/^\s*$/.test(userInput);var shouldCommitNewProperty=this._n ewProperty&&(isPropertySplitPaste||moveToOther||(!moveDirection&&!isEditingName) ||(isEditingName&&blankInput));var section=this.section();if(((userInput!==previ ousContent||isDirtyViaPaste)&&!this._newProperty)||shouldCommitNewProperty){sect ion._afterUpdate=moveToNextCallback.bind(this,this._newProperty,!blankInput,sect ion);var propertyText;if(blankInput||(this._newProperty&&/^\s*$/.test(this.value Element.textContent))) 700 var moveToIndex=moveTo&&this.treeOutline?this.treeOutline.children.indexOf(moveT o):-1;var blankInput=/^\s*$/.test(userInput);var shouldCommitNewProperty=this._n ewProperty&&(isPropertySplitPaste||moveToOther||(!moveDirection&&!isEditingName) ||(isEditingName&&blankInput));var section=this.section();if(((userInput!==conte xt.previousContent||isDirtyViaPaste)&&!this._newProperty)||shouldCommitNewProper ty){section._afterUpdate=moveToNextCallback.bind(this,this._newProperty,!blankIn put,section);var propertyText;if(blankInput||(this._newProperty&&/^\s*$/.test(th is.valueElement.textContent)))
690 propertyText="";else{if(isEditingName) 701 propertyText="";else{if(isEditingName)
691 propertyText=userInput+": "+this.property.value;else 702 propertyText=userInput+": "+this.property.value;else
692 propertyText=this.property.name+": "+userInput;} 703 propertyText=this.property.name+": "+userInput;}
693 this.applyStyleText(propertyText,true,true,false);}else{if(isEditingName) 704 this.applyStyleText(propertyText,true,true,false);}else{if(isEditingName)
694 this.property.name=userInput;else 705 this.property.name=userInput;else
695 this.property.value=userInput;if(!isDataPasted&&!this._newProperty) 706 this.property.value=userInput;if(!isDataPasted&&!this._newProperty)
696 this.updateTitle();moveToNextCallback.call(this,this._newProperty,false,section) ;} 707 this.updateTitle();moveToNextCallback.call(this,this._newProperty,false,section) ;}
697 function moveToNextCallback(alreadyNew,valueChanged,section) 708 function moveToNextCallback(alreadyNew,valueChanged,section)
698 {if(!moveDirection) 709 {if(!moveDirection)
699 return;if(moveTo&&moveTo.parent){moveTo.startEditing(!isEditingName?moveTo.nameE lement:moveTo.valueElement);return;} 710 return;if(moveTo&&moveTo.parent){moveTo.startEditing(!isEditingName?moveTo.nameE lement:moveTo.valueElement);return;}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 WebInspector.TextPrompt.prototype.onMouseWheel.call(this,event);},tabKeyPressed: function() 753 WebInspector.TextPrompt.prototype.onMouseWheel.call(this,event);},tabKeyPressed: function()
743 {this.acceptAutoComplete();return false;},_handleNameOrValueUpDown:function(even t) 754 {this.acceptAutoComplete();return false;},_handleNameOrValueUpDown:function(even t)
744 {function finishHandler(originalValue,replacementString) 755 {function finishHandler(originalValue,replacementString)
745 {this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textContent+": " +this._sidebarPane.valueElement.textContent,false,false,false);} 756 {this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textContent+": " +this._sidebarPane.valueElement.textContent,false,false,false);}
746 if(!this._isEditingName&&WebInspector.handleElementValueModifications(event,this ._sidebarPane.valueElement,finishHandler.bind(this),this._isValueSuggestion.bind (this))) 757 if(!this._isEditingName&&WebInspector.handleElementValueModifications(event,this ._sidebarPane.valueElement,finishHandler.bind(this),this._isValueSuggestion.bind (this)))
747 return true;return false;},_isValueSuggestion:function(word) 758 return true;return false;},_isValueSuggestion:function(word)
748 {if(!word) 759 {if(!word)
749 return false;word=word.toLowerCase();return this._cssCompletions.keySet().hasOwn Property(word);},_buildPropertyCompletions:function(proxyElement,wordRange,force ,completionsReadyCallback) 760 return false;word=word.toLowerCase();return this._cssCompletions.keySet().hasOwn Property(word);},_buildPropertyCompletions:function(proxyElement,wordRange,force ,completionsReadyCallback)
750 {var prefix=wordRange.toString().toLowerCase();if(!prefix&&!force&&(this._isEdit ingName||proxyElement.textContent.length)){completionsReadyCallback([]);return;} 761 {var prefix=wordRange.toString().toLowerCase();if(!prefix&&!force&&(this._isEdit ingName||proxyElement.textContent.length)){completionsReadyCallback([]);return;}
751 var results=this._cssCompletions.startsWith(prefix);var selectedIndex=this._cssC ompletions.mostUsedOf(results);completionsReadyCallback(results,selectedIndex);} ,__proto__:WebInspector.TextPrompt.prototype};WebInspector.ElementsPanel=functio n() 762 var results=this._cssCompletions.startsWith(prefix);var selectedIndex=this._cssC ompletions.mostUsedOf(results);completionsReadyCallback(results,selectedIndex);} ,__proto__:WebInspector.TextPrompt.prototype};WebInspector.ElementsPanel=functio n()
752 {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.set SidebarElementConstraints(Preferences.minElementsSidebarWidth,Preferences.minEle mentsSidebarHeight);this.splitView.setMainElementConstraints(minimumContentWidth Percent,minimumContentHeightPercent);this.contentElement=this.splitView.mainElem ent;this.contentElement.id="elements-content";this.contentElement.addStyleClass( "outline-disclosure");this.contentElement.addStyleClass("source-code");if(!WebIn spector.settings.domWordWrap.get()) 763 {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.set SidebarElementConstraints(Preferences.minElementsSidebarWidth,Preferences.minEle mentsSidebarHeight);this.splitView.setMainElementConstraints(minimumContentWidth Percent,minimumContentHeightPercent);this.splitView.addEventListener(WebInspecto r.SidebarView.EventTypes.Resized,this._updateTreeOutlineVisibleWidth.bind(this)) ;this.contentElement=this.splitView.mainElement;this.contentElement.id="elements -content";this.contentElement.addStyleClass("outline-disclosure");this.contentEl ement.addStyleClass("source-code");if(!WebInspector.settings.domWordWrap.get())
753 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._sidebarContextMen uEventFired.bind(this),false);this.treeOutline=new WebInspector.ElementsTreeOutl ine(true,true,false,this._populateContextMenu.bind(this),this._setPseudoClassFor NodeId.bind(this));this.treeOutline.wireToDomAgent();this.treeOutline.addEventLi stener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,this._selecte dNodeChanged,this);this.crumbsElement=document.createElement("div");this.crumbsE lement.className="crumbs";this.crumbsElement.addEventListener("mousemove",this._ mouseMovedInCrumbs.bind(this),false);this.crumbsElement.addEventListener("mouseo ut",this._mouseMovedOutOfCrumbs.bind(this),false);this.sidebarPanes={};this.side barPanes.computedStyle=new WebInspector.ComputedStyleSidebarPane();this.sidebarP anes.styles=new WebInspector.StylesSidebarPane(this.sidebarPanes.computedStyle,t his._setPseudoClassForNodeId.bind(this));this.sidebarPanes.metrics=new WebInspec tor.MetricsSidebarPane();this.sidebarPanes.properties=new WebInspector.Propertie sSidebarPane();this.sidebarPanes.domBreakpoints=WebInspector.domBreakpointsSideb arPane.createProxy(this);this.sidebarPanes.eventListeners=new WebInspector.Event ListenersSidebarPane();this.sidebarPanes.styles.addEventListener(WebInspector.Si debarPane.EventTypes.wasShown,this.updateStyles.bind(this,false));this.sidebarPa nes.metrics.addEventListener(WebInspector.SidebarPane.EventTypes.wasShown,this.u pdateMetrics.bind(this));this.sidebarPanes.properties.addEventListener(WebInspec tor.SidebarPane.EventTypes.wasShown,this.updateProperties.bind(this));this.sideb arPanes.eventListeners.addEventListener(WebInspector.SidebarPane.EventTypes.wasS hown,this.updateEventListeners.bind(this));this.sidebarPanes.styles.addEventList ener("style edited",this._stylesPaneEdited,this);this.sidebarPanes.styles.addEve ntListener("style property toggled",this._stylesPaneEdited,this);this.sidebarPan es.metrics.addEventListener("metrics edited",this._metricsPaneEdited,this);WebIn spector.dockController.addEventListener(WebInspector.DockController.Events.DockS ideChanged,this._dockSideChanged.bind(this));WebInspector.settings.splitVertical lyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(this));this._do ckSideChanged();this._popoverHelper=new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this),this._showPopover.bind(this));this._popoverHel per.setTimeout(0);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.E vents.AttrModified,this._updateBreadcrumbIfNeeded,this);WebInspector.domAgent.ad dEventListener(WebInspector.DOMAgent.Events.AttrRemoved,this._updateBreadcrumbIf Needed,this);WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events .NodeRemoved,this._nodeRemoved,this);WebInspector.domAgent.addEventListener(WebI nspector.DOMAgent.Events.DocumentUpdated,this._documentUpdatedEvent,this);WebIns pector.settings.showShadowDOM.addChangeListener(this._showShadowDOMChanged.bind( this));if(WebInspector.domAgent.existingDocument()) 764 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._sidebarContextMen uEventFired.bind(this),false);this.treeOutline=new WebInspector.ElementsTreeOutl ine(true,true,this._populateContextMenu.bind(this),this._setPseudoClassForNodeId .bind(this));this.treeOutline.wireToDomAgent();this.treeOutline.addEventListener (WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged,this._selectedNodeC hanged,this);this.treeOutline.addEventListener(WebInspector.ElementsTreeOutline. Events.ElementsTreeUpdated,this._updateBreadcrumbIfNeeded,this);this.crumbsEleme nt=document.createElement("div");this.crumbsElement.className="crumbs";this.crum bsElement.addEventListener("mousemove",this._mouseMovedInCrumbs.bind(this),false );this.crumbsElement.addEventListener("mouseout",this._mouseMovedOutOfCrumbs.bin d(this),false);this.sidebarPanes={};this.sidebarPanes.platformFonts=new WebInspe ctor.PlatformFontsSidebarPane();this.sidebarPanes.computedStyle=new WebInspector .ComputedStyleSidebarPane();this.sidebarPanes.styles=new WebInspector.StylesSide barPane(this.sidebarPanes.computedStyle,this._setPseudoClassForNodeId.bind(this) );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);WebInspector.dockController.addEventListener(WebInspector.DockController. Events.DockSideChanged,this._dockSideChanged.bind(this));WebInspector.settings.s plitVerticallyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(thi s));this._dockSideChanged();this._popoverHelper=new WebInspector.PopoverHelper(t his.element,this._getPopoverAnchor.bind(this),this._showPopover.bind(this));this ._popoverHelper.setTimeout(0);WebInspector.domAgent.addEventListener(WebInspecto r.DOMAgent.Events.DocumentUpdated,this._documentUpdatedEvent,this);WebInspector. settings.showShadowDOM.addChangeListener(this._showShadowDOMChanged.bind(this)); if(WebInspector.domAgent.existingDocument())
754 this._documentUpdated(WebInspector.domAgent.existingDocument());} 765 this._documentUpdated(WebInspector.domAgent.existingDocument());WebInspector.css Model.addEventListener(WebInspector.CSSStyleModel.Events.ModelWasEnabled,this._u pdateSidebars,this);}
755 WebInspector.ElementsPanel.prototype={get statusBarItems() 766 WebInspector.ElementsPanel.prototype={_updateTreeOutlineVisibleWidth:function()
767 {if(!this.treeOutline)
768 return;var width=this.splitView.element.offsetWidth;if(this.splitView.isVertical ())
769 width-=this.splitView.sidebarWidth();this.treeOutline.setVisibleWidth(width);},g et statusBarItems()
756 {return[this.crumbsElement];},defaultFocusedElement:function() 770 {return[this.crumbsElement];},defaultFocusedElement:function()
757 {return this.treeOutline.element;},statusBarResized:function() 771 {return this.treeOutline.element;},statusBarResized:function()
758 {this.updateBreadcrumbSizes();},wasShown:function() 772 {this.updateBreadcrumbSizes();},wasShown:function()
759 {if(this.treeOutline.element.parentElement!==this.contentElement) 773 {if(this.treeOutline.element.parentElement!==this.contentElement)
760 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) 774 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)
761 WebInspector.domAgent.requestDocument();},willHide:function() 775 WebInspector.domAgent.requestDocument();},willHide:function()
762 {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() 776 {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()
763 {this.treeOutline.updateSelection();this.updateBreadcrumbSizes();},_setPseudoCla ssForNodeId:function(nodeId,pseudoClass,enable) 777 {this.treeOutline.updateSelection();this.updateBreadcrumbSizes();},_setPseudoCla ssForNodeId:function(nodeId,pseudoClass,enable)
764 {var node=WebInspector.domAgent.nodeForId(nodeId);if(!node) 778 {var node=WebInspector.domAgent.nodeForId(nodeId);if(!node)
765 return;var pseudoClasses=node.getUserProperty(WebInspector.ElementsTreeOutline.P seudoStateDecorator.PropertyName);if(enable){pseudoClasses=pseudoClasses||[];if( pseudoClasses.indexOf(pseudoClass)>=0) 779 return;var pseudoClasses=node.getUserProperty(WebInspector.ElementsTreeOutline.P seudoStateDecorator.PropertyName);if(enable){pseudoClasses=pseudoClasses||[];if( pseudoClasses.indexOf(pseudoClass)>=0)
766 return;pseudoClasses.push(pseudoClass);node.setUserProperty(WebInspector.Element sTreeOutline.PseudoStateDecorator.PropertyName,pseudoClasses);}else{if(!pseudoCl asses||pseudoClasses.indexOf(pseudoClass)<0) 780 return;pseudoClasses.push(pseudoClass);node.setUserProperty(WebInspector.Element sTreeOutline.PseudoStateDecorator.PropertyName,pseudoClasses);}else{if(!pseudoCl asses||pseudoClasses.indexOf(pseudoClass)<0)
767 return;pseudoClasses.remove(pseudoClass);if(!pseudoClasses.length) 781 return;pseudoClasses.remove(pseudoClass);if(!pseudoClasses.length)
768 node.removeUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecorator.Pr opertyName);} 782 node.removeUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDecorator.Pr opertyName);}
769 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:node .appropriateSelectorFor(false),enabled:enable,state:pseudoClass});},_selectedNod eChanged:function() 783 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:node .appropriateSelectorFor(false),enabled:enable,state:pseudoClass});},_selectedNod eChanged:function()
770 {var selectedNode=this.selectedDOMNode();if(!selectedNode&&this._lastValidSelect edNode) 784 {var selectedNode=this.selectedDOMNode();if(!selectedNode&&this._lastValidSelect edNode)
771 this._selectedPathOnReset=this._lastValidSelectedNode.path();this.updateBreadcru mb(false);this._updateSidebars();if(selectedNode){ConsoleAgent.addInspectedNode( selectedNode.id);this._lastValidSelectedNode=selectedNode;} 785 this._selectedPathOnReset=this._lastValidSelectedNode.path();this.updateBreadcru mb(false);this._updateSidebars();if(selectedNode){ConsoleAgent.addInspectedNode( selectedNode.id);this._lastValidSelectedNode=selectedNode;}
772 WebInspector.notifications.dispatchEventToListeners(WebInspector.ElementsTreeOut line.Events.SelectedNodeChanged);},_updateSidebars:function() 786 WebInspector.notifications.dispatchEventToListeners(WebInspector.ElementsTreeOut line.Events.SelectedNodeChanged);},_updateSidebars:function()
773 {for(var pane in this.sidebarPanes) 787 {for(var pane in this.sidebarPanes)
774 this.sidebarPanes[pane].needsUpdate=true;this.updateStyles(true);this.updateMetr ics();this.updateProperties();this.updateEventListeners();},_reset:function() 788 this.sidebarPanes[pane].needsUpdate=true;this.updateStyles(true);this.updateMetr ics();this.updatePlatformFonts();this.updateProperties();this.updateEventListene rs();},_reset:function()
775 {delete this.currentQuery;},_documentUpdatedEvent:function(event) 789 {delete this.currentQuery;},_documentUpdatedEvent:function(event)
776 {this._documentUpdated(event.data);},_documentUpdated:function(inspectedRootDocu ment) 790 {this._documentUpdated(event.data);},_documentUpdated:function(inspectedRootDocu ment)
777 {this._reset();this.searchCanceled();this.treeOutline.rootDOMNode=inspectedRootD ocument;if(!inspectedRootDocument){if(this.isShowing()) 791 {this._reset();this.searchCanceled();this.treeOutline.rootDOMNode=inspectedRootD ocument;if(!inspectedRootDocument){if(this.isShowing())
778 WebInspector.domAgent.requestDocument();return;} 792 WebInspector.domAgent.requestDocument();return;}
779 WebInspector.domBreakpointsSidebarPane.restoreBreakpoints();function selectNode( candidateFocusNode) 793 WebInspector.domBreakpointsSidebarPane.restoreBreakpoints();function selectNode( candidateFocusNode)
780 {if(!candidateFocusNode) 794 {if(!candidateFocusNode)
781 candidateFocusNode=inspectedRootDocument.body||inspectedRootDocument.documentEle ment;if(!candidateFocusNode) 795 candidateFocusNode=inspectedRootDocument.body||inspectedRootDocument.documentEle ment;if(!candidateFocusNode)
782 return;this.selectDOMNode(candidateFocusNode);if(this.treeOutline.selectedTreeEl ement) 796 return;this.selectDOMNode(candidateFocusNode);if(this.treeOutline.selectedTreeEl ement)
783 this.treeOutline.selectedTreeElement.expand();} 797 this.treeOutline.selectedTreeElement.expand();}
784 function selectLastSelectedNode(nodeId) 798 function selectLastSelectedNode(nodeId)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 if(typeof searchResult==="undefined"){function callback(node) 846 if(typeof searchResult==="undefined"){function callback(node)
833 {searchResults[index]=node||null;this._highlightCurrentSearchResult();} 847 {searchResults[index]=node||null;this._highlightCurrentSearchResult();}
834 WebInspector.domAgent.searchResult(index,callback.bind(this));return;} 848 WebInspector.domAgent.searchResult(index,callback.bind(this));return;}
835 WebInspector.searchController.updateCurrentMatchIndex(index,this);var treeElemen t=this.treeOutline.findTreeElement(searchResult);if(treeElement){treeElement.hig hlightSearchResults(this._searchQuery);treeElement.reveal();var matches=treeElem ent.listItemElement.getElementsByClassName("highlighted-search-result");if(match es.length) 849 WebInspector.searchController.updateCurrentMatchIndex(index,this);var treeElemen t=this.treeOutline.findTreeElement(searchResult);if(treeElement){treeElement.hig hlightSearchResults(this._searchQuery);treeElement.reveal();var matches=treeElem ent.listItemElement.getElementsByClassName("highlighted-search-result");if(match es.length)
836 matches[0].scrollIntoViewIfNeeded();}},_hideSearchHighlights:function() 850 matches[0].scrollIntoViewIfNeeded();}},_hideSearchHighlights:function()
837 {if(!this._searchResults) 851 {if(!this._searchResults)
838 return;var searchResult=this._searchResults[this._currentSearchResultIndex];if(! searchResult) 852 return;var searchResult=this._searchResults[this._currentSearchResultIndex];if(! searchResult)
839 return;var treeElement=this.treeOutline.findTreeElement(searchResult);if(treeEle ment) 853 return;var treeElement=this.treeOutline.findTreeElement(searchResult);if(treeEle ment)
840 treeElement.hideSearchHighlights();},selectedDOMNode:function() 854 treeElement.hideSearchHighlights();},selectedDOMNode:function()
841 {return this.treeOutline.selectedDOMNode();},selectDOMNode:function(node,focus) 855 {return this.treeOutline.selectedDOMNode();},selectDOMNode:function(node,focus)
842 {this.treeOutline.selectDOMNode(node,focus);},_nodeRemoved:function(event) 856 {this.treeOutline.selectDOMNode(node,focus);},_updateBreadcrumbIfNeeded:function (event)
843 {if(!this.isShowing()) 857 {var nodes=(event.data||[]);if(!nodes.length)
844 return;var crumbs=this.crumbsElement;for(var crumb=crumbs.firstChild;crumb;crumb =crumb.nextSibling){if(crumb.representedObject===event.data.node){this.updateBre adcrumb(true);return;}}},_stylesPaneEdited:function() 858 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()
845 {this.sidebarPanes.metrics.needsUpdate=true;this.updateMetrics();},_metricsPaneE dited:function() 859 {this.sidebarPanes.metrics.needsUpdate=true;this.updateMetrics();this.sidebarPan es.platformFonts.needsUpdate=true;this.updatePlatformFonts();},_metricsPaneEdite d:function()
846 {this.sidebarPanes.styles.needsUpdate=true;this.updateStyles(true);},_mouseMoved InCrumbs:function(event) 860 {this.sidebarPanes.styles.needsUpdate=true;this.updateStyles(true);},_mouseMoved InCrumbs:function(event)
847 {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) 861 {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)
848 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUn derMouse&&nodeUnderMouse.isDescendant(this.crumbsElement)) 862 {var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUn derMouse&&nodeUnderMouse.isDescendant(this.crumbsElement))
849 return;WebInspector.domAgent.hideDOMNodeHighlight();this._mouseOutOfCrumbsTimeou t=setTimeout(this.updateBreadcrumbSizes.bind(this),1000);},_updateBreadcrumbIfNe eded:function(event) 863 return;WebInspector.domAgent.hideDOMNodeHighlight();this._mouseOutOfCrumbsTimeou t=setTimeout(this.updateBreadcrumbSizes.bind(this),1000);},updateBreadcrumb:func tion(forceUpdate)
850 {var name=event.data.name;if(name!=="class"&&name!=="id")
851 return;var node=(event.data.node);var crumbs=this.crumbsElement;var crumb=crumbs .firstChild;while(crumb){if(crumb.representedObject===node){this.updateBreadcrum b(true);break;}
852 crumb=crumb.nextSibling;}},updateBreadcrumb:function(forceUpdate)
853 {if(!this.isShowing()) 864 {if(!this.isShowing())
854 return;var crumbs=this.crumbsElement;var handled=false;var crumb=crumbs.firstChi ld;while(crumb){if(crumb.representedObject===this.selectedDOMNode()){crumb.addSt yleClass("selected");handled=true;}else{crumb.removeStyleClass("selected");} 865 return;var crumbs=this.crumbsElement;var handled=false;var crumb=crumbs.firstChi ld;while(crumb){if(crumb.representedObject===this.selectedDOMNode()){crumb.addSt yleClass("selected");handled=true;}else{crumb.removeStyleClass("selected");}
855 crumb=crumb.nextSibling;} 866 crumb=crumb.nextSibling;}
856 if(handled&&!forceUpdate){this.updateBreadcrumbSizes();return;} 867 if(handled&&!forceUpdate){this.updateBreadcrumbSizes();return;}
857 crumbs.removeChildren();var panel=this;function selectCrumbFunction(event) 868 crumbs.removeChildren();var panel=this;function selectCrumbFunction(event)
858 {var crumb=event.currentTarget;if(crumb.hasStyleClass("collapsed")){if(crumb===p anel.crumbsElement.firstChild){var currentCrumb=crumb;while(currentCrumb){var hi dden=currentCrumb.hasStyleClass("hidden");var collapsed=currentCrumb.hasStyleCla ss("collapsed");if(!hidden&&!collapsed) 869 {var crumb=event.currentTarget;if(crumb.hasStyleClass("collapsed")){if(crumb===p anel.crumbsElement.firstChild){var currentCrumb=crumb;while(currentCrumb){var hi dden=currentCrumb.hasStyleClass("hidden");var collapsed=currentCrumb.hasStyleCla ss("collapsed");if(!hidden&&!collapsed)
859 break;crumb=currentCrumb;currentCrumb=currentCrumb.nextSibling;}} 870 break;crumb=currentCrumb;currentCrumb=currentCrumb.nextSibling;}}
860 panel.updateBreadcrumbSizes(crumb);}else 871 panel.updateBreadcrumbSizes(crumb);}else
861 panel.selectDOMNode(crumb.representedObject,true);event.preventDefault();} 872 panel.selectDOMNode(crumb.representedObject,true);event.preventDefault();}
862 for(var current=this.selectedDOMNode();current;current=current.parentNode){if(cu rrent.nodeType()===Node.DOCUMENT_NODE) 873 for(var current=this.selectedDOMNode();current;current=current.parentNode){if(cu rrent.nodeType()===Node.DOCUMENT_NODE)
863 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:WebInspecto r.DOMPresentationUtils.decorateNodeLabel(current,crumb);break;case Node.TEXT_NOD E:crumbTitle=WebInspector.UIString("(text)");break 874 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())
864 case Node.COMMENT_NODE:crumbTitle="<!-->";break;case Node.DOCUMENT_TYPE_NODE:cru mbTitle="<!DOCTYPE>";break;default:crumbTitle=current.nodeNameInCorrectCase();} 875 crumbTitle=":"+current.pseudoType();else
876 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;default:crumbTitle=current.nodeNameInCorrectCase();}
865 if(!crumb.childNodes.length){var nameElement=document.createElement("span");name Element.textContent=crumbTitle;crumb.appendChild(nameElement);crumb.title=crumbT itle;} 877 if(!crumb.childNodes.length){var nameElement=document.createElement("span");name Element.textContent=crumbTitle;crumb.appendChild(nameElement);crumb.title=crumbT itle;}
866 if(current===this.selectedDOMNode()) 878 if(current===this.selectedDOMNode())
867 crumb.addStyleClass("selected");if(!crumbs.childNodes.length) 879 crumb.addStyleClass("selected");if(!crumbs.childNodes.length)
868 crumb.addStyleClass("end");crumbs.appendChild(crumb);} 880 crumb.addStyleClass("end");crumbs.appendChild(crumb);}
869 if(crumbs.hasChildNodes()) 881 if(crumbs.hasChildNodes())
870 crumbs.lastChild.addStyleClass("start");this.updateBreadcrumbSizes();},updateBre adcrumbSizes:function(focusedCrumb) 882 crumbs.lastChild.addStyleClass("start");this.updateBreadcrumbSizes();},updateBre adcrumbSizes:function(focusedCrumb)
871 {if(!this.isShowing()) 883 {if(!this.isShowing())
872 return;if(document.body.offsetWidth<=0){return;} 884 return;if(document.body.offsetWidth<=0){return;}
873 var crumbs=this.crumbsElement;if(!crumbs.childNodes.length||crumbs.offsetWidth<= 0) 885 var crumbs=this.crumbsElement;if(!crumbs.childNodes.length||crumbs.offsetWidth<= 0)
874 return;var selectedIndex=0;var focusedIndex=0;var selectedCrumb;var i=0;var crum b=crumbs.firstChild;while(crumb){if(!selectedCrumb&&crumb.hasStyleClass("selecte d")){selectedCrumb=crumb;selectedIndex=i;} 886 return;var selectedIndex=0;var focusedIndex=0;var selectedCrumb;var i=0;var crum b=crumbs.firstChild;while(crumb){if(!selectedCrumb&&crumb.hasStyleClass("selecte d")){selectedCrumb=crumb;selectedIndex=i;}
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 return;crumb.addStyleClass("collapsed");crumb.removeStyleClass("compact");if(!do ntCoalesce) 924 return;crumb.addStyleClass("collapsed");crumb.removeStyleClass("compact");if(!do ntCoalesce)
913 coalesceCollapsedCrumbs();} 925 coalesceCollapsedCrumbs();}
914 if(!focusedCrumb){if(makeCrumbsSmaller(compact,ChildSide)) 926 if(!focusedCrumb){if(makeCrumbsSmaller(compact,ChildSide))
915 return;if(makeCrumbsSmaller(collapse,ChildSide)) 927 return;if(makeCrumbsSmaller(collapse,ChildSide))
916 return;} 928 return;}
917 if(makeCrumbsSmaller(compact,(focusedCrumb?BothSides:AncestorSide))) 929 if(makeCrumbsSmaller(compact,(focusedCrumb?BothSides:AncestorSide)))
918 return;if(makeCrumbsSmaller(collapse,(focusedCrumb?BothSides:AncestorSide))) 930 return;if(makeCrumbsSmaller(collapse,(focusedCrumb?BothSides:AncestorSide)))
919 return;if(!selectedCrumb) 931 return;if(!selectedCrumb)
920 return;compact(selectedCrumb);if(crumbsAreSmallerThanContainer()) 932 return;compact(selectedCrumb);if(crumbsAreSmallerThanContainer())
921 return;collapse(selectedCrumb,true);},updateStyles:function(forceUpdate) 933 return;collapse(selectedCrumb,true);},updateStyles:function(forceUpdate)
922 {var stylesSidebarPane=this.sidebarPanes.styles;var computedStylePane=this.sideb arPanes.computedStyle;if((!stylesSidebarPane.isShowing()&&!computedStylePane.isS howing())||!stylesSidebarPane.needsUpdate) 934 {if(!WebInspector.cssModel.isEnabled())
935 return;var stylesSidebarPane=this.sidebarPanes.styles;var computedStylePane=this .sidebarPanes.computedStyle;if((!stylesSidebarPane.isShowing()&&!computedStylePa ne.isShowing())||!stylesSidebarPane.needsUpdate)
923 return;stylesSidebarPane.update(this.selectedDOMNode(),forceUpdate);stylesSideba rPane.needsUpdate=false;},updateMetrics:function() 936 return;stylesSidebarPane.update(this.selectedDOMNode(),forceUpdate);stylesSideba rPane.needsUpdate=false;},updateMetrics:function()
924 {var metricsSidebarPane=this.sidebarPanes.metrics;if(!metricsSidebarPane.isShowi ng()||!metricsSidebarPane.needsUpdate) 937 {if(!WebInspector.cssModel.isEnabled())
925 return;metricsSidebarPane.update(this.selectedDOMNode());metricsSidebarPane.need sUpdate=false;},updateProperties:function() 938 return;var metricsSidebarPane=this.sidebarPanes.metrics;if(!metricsSidebarPane.i sShowing()||!metricsSidebarPane.needsUpdate)
939 return;metricsSidebarPane.update(this.selectedDOMNode());metricsSidebarPane.need sUpdate=false;},updatePlatformFonts:function()
940 {if(!WebInspector.cssModel.isEnabled())
941 return;var platformFontsSidebar=this.sidebarPanes.platformFonts;if(!platformFont sSidebar.isShowing()||!platformFontsSidebar.needsUpdate)
942 return;platformFontsSidebar.update(this.selectedDOMNode());platformFontsSidebar. needsUpdate=false;},updateProperties:function()
926 {var propertiesSidebarPane=this.sidebarPanes.properties;if(!propertiesSidebarPan e.isShowing()||!propertiesSidebarPane.needsUpdate) 943 {var propertiesSidebarPane=this.sidebarPanes.properties;if(!propertiesSidebarPan e.isShowing()||!propertiesSidebarPane.needsUpdate)
927 return;propertiesSidebarPane.update(this.selectedDOMNode());propertiesSidebarPan e.needsUpdate=false;},updateEventListeners:function() 944 return;propertiesSidebarPane.update(this.selectedDOMNode());propertiesSidebarPan e.needsUpdate=false;},updateEventListeners:function()
928 {var eventListenersSidebarPane=this.sidebarPanes.eventListeners;if(!eventListene rsSidebarPane.isShowing()||!eventListenersSidebarPane.needsUpdate) 945 {var eventListenersSidebarPane=this.sidebarPanes.eventListeners;if(!eventListene rsSidebarPane.isShowing()||!eventListenersSidebarPane.needsUpdate)
929 return;eventListenersSidebarPane.update(this.selectedDOMNode());eventListenersSi debarPane.needsUpdate=false;},handleShortcut:function(event) 946 return;eventListenersSidebarPane.update(this.selectedDOMNode());eventListenersSi debarPane.needsUpdate=false;},handleShortcut:function(event)
930 {function handleUndoRedo() 947 {function handleUndoRedo()
931 {if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&!event.shiftKey&&ev ent.keyIdentifier==="U+005A"){WebInspector.domAgent.undo(this._updateSidebars.bi nd(this));event.handled=true;return;} 948 {if(WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&!event.shiftKey&&ev ent.keyIdentifier==="U+005A"){WebInspector.domAgent.undo(this._updateSidebars.bi nd(this));event.handled=true;return;}
932 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;}} 949 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;}}
933 if(!this.treeOutline.editing()){handleUndoRedo.call(this);if(event.handled) 950 if(!this.treeOutline.editing()){handleUndoRedo.call(this);if(event.handled)
934 return;} 951 return;}
935 this.treeOutline.handleShortcut(event);},handleCopyEvent:function(event) 952 this.treeOutline.handleShortcut(event);},handleCopyEvent:function(event)
936 {var currentFocusElement=WebInspector.currentFocusElement();if(currentFocusEleme nt&&WebInspector.isBeingEdited(currentFocusElement)) 953 {var currentFocusElement=WebInspector.currentFocusElement();if(currentFocusEleme nt&&WebInspector.isBeingEdited(currentFocusElement))
937 return;if(!window.getSelection().isCollapsed) 954 return;if(!window.getSelection().isCollapsed)
938 return;event.clipboardData.clearData();event.preventDefault();this.selectedDOMNo de().copyNode();},sidebarResized:function(event) 955 return;event.clipboardData.clearData();event.preventDefault();this.selectedDOMNo de().copyNode();},sidebarResized:function(event)
939 {this.treeOutline.updateSelection();},revealAndSelectNode:function(nodeId) 956 {this.treeOutline.updateSelection();},revealAndSelectNode:function(nodeId)
940 {WebInspector.inspectorView.setCurrentPanel(this);var node=WebInspector.domAgent .nodeForId(nodeId);if(!node) 957 {WebInspector.inspectorView.setCurrentPanel(this);var node=WebInspector.domAgent .nodeForId(nodeId);if(!node)
941 return;while(!WebInspector.ElementsTreeOutline.showShadowDOM()&&node&&node.isInS hadowTree()) 958 return;while(!WebInspector.ElementsTreeOutline.showShadowDOM()&&node&&node.isInS hadowTree())
942 node=node.parentNode;WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId) ;this.selectDOMNode(node,true);},appendApplicableItems:function(event,contextMen u,target) 959 node=node.parentNode;WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId) ;this.selectDOMNode(node,true);},appendApplicableItems:function(event,contextMen u,target)
943 {if(!(target instanceof WebInspector.RemoteObject)) 960 {function selectNode(nodeId)
944 return;var remoteObject=(target);if(remoteObject.subtype!=="node")
945 return;function selectNode(nodeId)
946 {if(nodeId) 961 {if(nodeId)
947 WebInspector.domAgent.inspectElement(nodeId);} 962 WebInspector.domAgent.inspectElement(nodeId);}
948 function revealElement() 963 function revealElement(remoteObject)
949 {remoteObject.pushNodeToFrontend(selectNode);} 964 {remoteObject.pushNodeToFrontend(selectNode);}
950 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Reveal in Elements panel":"Reveal in Elements Panel"),revealElement.bind(thi s));},_sidebarContextMenuEventFired:function(event) 965 var commandCallback;if(target instanceof WebInspector.RemoteObject){var remoteOb ject=(target);if(remoteObject.subtype==="node")
966 commandCallback=revealElement.bind(this,remoteObject);}else if(target instanceof WebInspector.DOMNode){var domNode=(target);if(domNode.id)
967 commandCallback=WebInspector.domAgent.inspectElement.bind(WebInspector.domAgent, domNode.id);}
968 if(!commandCallback)
969 return;if(this.treeOutline.element.isAncestor(event.target))
970 return;contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles()?"Reveal in E lements panel":"Reveal in Elements Panel",commandCallback);},_sidebarContextMenu EventFired:function(event)
951 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.show();},_dockS ideChanged:function() 971 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.show();},_dockS ideChanged:function()
952 {var dockSide=WebInspector.dockController.dockSide();var vertically=dockSide===W ebInspector.DockController.State.DockedToRight&&WebInspector.settings.splitVerti callyWhenDockedToRight.get();this._splitVertically(vertically);},_showShadowDOMC hanged:function() 972 {var dockSide=WebInspector.dockController.dockSide();var vertically=dockSide===W ebInspector.DockController.State.DockedToRight&&WebInspector.settings.splitVerti callyWhenDockedToRight.get();this._splitVertically(vertically);},_showShadowDOMC hanged:function()
953 {this.treeOutline.update();},_splitVertically:function(vertically) 973 {this.treeOutline.update();},_splitVertically:function(vertically)
954 {if(this.sidebarPaneView&&vertically===!this.splitView.isVertical()) 974 {if(this.sidebarPaneView&&vertically===!this.splitView.isVertical())
955 return;if(this.sidebarPaneView) 975 return;if(this.sidebarPaneView)
956 this.sidebarPaneView.detach();this.splitView.setVertical(!vertically);var comput edPane=new WebInspector.SidebarPane(WebInspector.UIString("Computed"));computedP ane.element.addStyleClass("composite");computedPane.element.addStyleClass("fill" );var expandComputed=computedPane.expand.bind(computedPane);computedPane.bodyEle ment.appendChild(this.sidebarPanes.computedStyle.titleElement);computedPane.body Element.addStyleClass("metrics-and-computed");this.sidebarPanes.computedStyle.sh ow(computedPane.bodyElement);this.sidebarPanes.computedStyle.setExpandCallback(e xpandComputed);if(vertically){this.sidebarPanes.metrics.show(computedPane.bodyEl ement,this.sidebarPanes.computedStyle.element);this.sidebarPanes.metrics.setExpa ndCallback(expandComputed);this.sidebarPaneView=new WebInspector.SidebarTabbedPa ne();var compositePane=new WebInspector.SidebarPane(this.sidebarPanes.styles.tit le());compositePane.element.addStyleClass("composite");compositePane.element.add StyleClass("fill");var expandComposite=compositePane.expand.bind(compositePane); var splitView=new WebInspector.SplitView(true,"StylesPaneSplitRatio",0.5);splitV iew.show(compositePane.bodyElement);this.sidebarPanes.styles.show(splitView.firs tElement());splitView.firstElement().appendChild(this.sidebarPanes.styles.titleE lement);this.sidebarPanes.styles.setExpandCallback(expandComposite);computedPane .show(splitView.secondElement());computedPane.setExpandCallback(expandComposite) ;this.sidebarPaneView.addPane(compositePane);this.sidebarPaneView.addPane(this.s idebarPanes.properties);this.sidebarPaneView.addPane(this.sidebarPanes.domBreakp oints);this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);}else{this .sidebarPaneView=new WebInspector.SidebarTabbedPane();var stylesPane=new WebInsp ector.SidebarPane(this.sidebarPanes.styles.title());stylesPane.element.addStyleC lass("composite");stylesPane.element.addStyleClass("fill");var expandStyles=styl esPane.expand.bind(stylesPane);stylesPane.bodyElement.addStyleClass("metrics-and -styles");this.sidebarPanes.styles.show(stylesPane.bodyElement);this.sidebarPane s.styles.setExpandCallback(expandStyles);this.sidebarPanes.metrics.setExpandCall back(expandStyles);stylesPane.bodyElement.appendChild(this.sidebarPanes.styles.t itleElement);function showMetrics(pane,beforeElement) 976 this.sidebarPaneView.detach();this.splitView.setVertical(!vertically);var comput edPane=new WebInspector.SidebarPane(WebInspector.UIString("Computed"));computedP ane.element.addStyleClass("composite");computedPane.element.addStyleClass("fill" );var expandComputed=computedPane.expand.bind(computedPane);computedPane.bodyEle ment.appendChild(this.sidebarPanes.computedStyle.titleElement);computedPane.body Element.addStyleClass("metrics-and-computed");this.sidebarPanes.computedStyle.sh ow(computedPane.bodyElement);this.sidebarPanes.computedStyle.setExpandCallback(e xpandComputed);this.sidebarPanes.platformFonts.show(computedPane.bodyElement);if (vertically){this.sidebarPanes.metrics.show(computedPane.bodyElement,this.sideba rPanes.computedStyle.element);this.sidebarPanes.metrics.setExpandCallback(expand Computed);this.sidebarPaneView=new WebInspector.SidebarTabbedPane();var composit ePane=new WebInspector.SidebarPane(this.sidebarPanes.styles.title());compositePa ne.element.addStyleClass("composite");compositePane.element.addStyleClass("fill" );var expandComposite=compositePane.expand.bind(compositePane);var splitView=new WebInspector.SplitView(true,"StylesPaneSplitRatio",0.5);splitView.show(composit ePane.bodyElement);this.sidebarPanes.styles.show(splitView.firstElement());split View.firstElement().appendChild(this.sidebarPanes.styles.titleElement);this.side barPanes.styles.setExpandCallback(expandComposite);computedPane.show(splitView.s econdElement());computedPane.setExpandCallback(expandComposite);this.sidebarPane View.addPane(compositePane);this.sidebarPaneView.addPane(this.sidebarPanes.prope rties);this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints);this.sideb arPaneView.addPane(this.sidebarPanes.eventListeners);}else{this.sidebarPaneView= new WebInspector.SidebarTabbedPane();var stylesPane=new WebInspector.SidebarPane (this.sidebarPanes.styles.title());stylesPane.element.addStyleClass("composite") ;stylesPane.element.addStyleClass("fill");var expandStyles=stylesPane.expand.bin d(stylesPane);stylesPane.bodyElement.addStyleClass("metrics-and-styles");this.si debarPanes.styles.show(stylesPane.bodyElement);this.sidebarPanes.styles.setExpan dCallback(expandStyles);this.sidebarPanes.metrics.setExpandCallback(expandStyles );stylesPane.bodyElement.appendChild(this.sidebarPanes.styles.titleElement);func tion showMetrics(pane,beforeElement)
957 {this.sidebarPanes.metrics.show(pane.bodyElement,beforeElement);} 977 {this.sidebarPanes.metrics.show(pane.bodyElement,beforeElement);}
958 function tabSelected(event) 978 function tabSelected(event)
959 {var tabId=(event.data.tabId);if(tabId===computedPane.title()) 979 {var tabId=(event.data.tabId);if(tabId===computedPane.title())
960 showMetrics.call(this,computedPane,this.sidebarPanes.computedStyle.element);if(t abId===stylesPane.title()) 980 showMetrics.call(this,computedPane,this.sidebarPanes.computedStyle.element);if(t abId===stylesPane.title())
961 showMetrics.call(this,stylesPane);} 981 showMetrics.call(this,stylesPane);}
962 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted,tabSelected,this);showMetrics.call(this,stylesPane);this.sidebarPaneView.ad dPane(stylesPane);this.sidebarPaneView.addPane(computedPane);this.sidebarPaneVie w.addPane(this.sidebarPanes.eventListeners);this.sidebarPaneView.addPane(this.si debarPanes.domBreakpoints);this.sidebarPaneView.addPane(this.sidebarPanes.proper ties);} 982 this.sidebarPaneView.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted,tabSelected,this);showMetrics.call(this,stylesPane);this.sidebarPaneView.ad dPane(stylesPane);this.sidebarPaneView.addPane(computedPane);this.sidebarPaneVie w.addPane(this.sidebarPanes.eventListeners);this.sidebarPaneView.addPane(this.si debarPanes.domBreakpoints);this.sidebarPaneView.addPane(this.sidebarPanes.proper ties);}
963 this.sidebarPaneView.show(this.splitView.sidebarElement);this.sidebarPanes.style s.expand();},addExtensionSidebarPane:function(id,pane) 983 this.sidebarPaneView.show(this.splitView.sidebarElement);this.sidebarPanes.style s.expand();},addExtensionSidebarPane:function(id,pane)
964 {this.sidebarPanes[id]=pane;this.sidebarPaneView.addPane(pane);},__proto__:WebIn spector.Panel.prototype} 984 {this.sidebarPanes[id]=pane;this.sidebarPaneView.addPane(pane);},__proto__:WebIn spector.Panel.prototype}
OLDNEW
« no previous file with comments | « chrome_linux/resources/inspector/CodeMirrorTextEditor.js ('k') | chrome_linux/resources/inspector/HeapSnapshotWorker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698