OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); | 97 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); |
98 | 98 |
99 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetAdded, this._styleSheetOrMediaQueryResultChanged, this); | 99 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetAdded, this._styleSheetOrMediaQueryResultChanged, this); |
100 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, this._styleSheetOrMediaQueryResultChanged, this); | 100 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, this._styleSheetOrMediaQueryResultChanged, this); |
101 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetChanged, this._styleSheetOrMediaQueryResultChanged, this); | 101 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetChanged, this._styleSheetOrMediaQueryResultChanged, this); |
102 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Med iaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this); | 102 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Med iaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this); |
103 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModi fied, this._attributeChanged, this); | 103 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModi fied, this._attributeChanged, this); |
104 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemo ved, this._attributeChanged, this); | 104 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemo ved, this._attributeChanged, this); |
105 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.PseudoSt ateChanged, this._pseudoStateChanged, this); | 105 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.PseudoSt ateChanged, this._pseudoStateChanged, this); |
106 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg entStylesSettingChanged.bind(this)); | 106 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg entStylesSettingChanged.bind(this)); |
107 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.FrameResized, this._frameResized, this); | |
107 this.element.addStyleClass("styles-pane"); | 108 this.element.addStyleClass("styles-pane"); |
108 this.element.enableStyleClass("show-user-styles", WebInspector.settings.show UserAgentStyles.get()); | 109 this.element.enableStyleClass("show-user-styles", WebInspector.settings.show UserAgentStyles.get()); |
109 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind( this), false); | 110 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind( this), false); |
110 document.body.addEventListener("keydown", this._keyDown.bind(this), false); | 111 document.body.addEventListener("keydown", this._keyDown.bind(this), false); |
111 document.body.addEventListener("keyup", this._keyUp.bind(this), false); | 112 document.body.addEventListener("keyup", this._keyUp.bind(this), false); |
112 } | 113 } |
113 | 114 |
114 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains pseudo id names for corresponding enum indexes. | 115 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains pseudo id names for corresponding enum indexes. |
115 // First item is empty due to its artificial NOPSEUDO nature in the enum. | 116 // First item is empty due to its artificial NOPSEUDO nature in the enum. |
116 // FIXME: find a way of generating this mapping or getting it from combination o f RenderStyleConstants and CSSSelector.cpp at | 117 // FIXME: find a way of generating this mapping or getting it from combination o f RenderStyleConstants and CSSSelector.cpp at |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 }, | 392 }, |
392 | 393 |
393 _styleSheetOrMediaQueryResultChanged: function() | 394 _styleSheetOrMediaQueryResultChanged: function() |
394 { | 395 { |
395 if (this._userOperation || this._isEditingStyle) | 396 if (this._userOperation || this._isEditingStyle) |
396 return; | 397 return; |
397 | 398 |
398 this._rebuildUpdate(); | 399 this._rebuildUpdate(); |
399 }, | 400 }, |
400 | 401 |
402 _frameResized: function() | |
403 { | |
404 function refreshContents() | |
405 { | |
406 this._rebuildUpdate(); | |
407 delete this._activeTimer; | |
408 } | |
409 | |
410 if (this._activeTimer) | |
411 clearTimeout(this._activeTimer); | |
412 | |
413 this._activeTimer = setTimeout(refreshContents.bind(this), 100); | |
pfeldman
2013/12/02 12:28:26
I'd rather throttle it once in the resource tree m
| |
414 }, | |
415 | |
401 _attributeChanged: function(event) | 416 _attributeChanged: function(event) |
402 { | 417 { |
403 // Any attribute removal or modification can affect the styles of "relat ed" nodes. | 418 // Any attribute removal or modification can affect the styles of "relat ed" nodes. |
404 // Do not touch the styles if they are being edited. | 419 // Do not touch the styles if they are being edited. |
405 if (this._isEditingStyle || this._userOperation) | 420 if (this._isEditingStyle || this._userOperation) |
406 return; | 421 return; |
407 | 422 |
408 if (!this._canAffectCurrentStyles(event.data.node)) | 423 if (!this._canAffectCurrentStyles(event.data.node)) |
409 return; | 424 return; |
410 | 425 |
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2909 return; | 2924 return; |
2910 } | 2925 } |
2911 | 2926 |
2912 var results = this._cssCompletions.startsWith(prefix); | 2927 var results = this._cssCompletions.startsWith(prefix); |
2913 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 2928 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
2914 completionsReadyCallback(results, selectedIndex); | 2929 completionsReadyCallback(results, selectedIndex); |
2915 }, | 2930 }, |
2916 | 2931 |
2917 __proto__: WebInspector.TextPrompt.prototype | 2932 __proto__: WebInspector.TextPrompt.prototype |
2918 } | 2933 } |
OLD | NEW |