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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 this._spectrumHelper = new WebInspector.SpectrumPopupHelper(); | 96 this._spectrumHelper = new WebInspector.SpectrumPopupHelper(); |
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.settings.showUserAgentStyles.addChangeListener(this._showUserAg
entStylesSettingChanged.bind(this)); | 105 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg
entStylesSettingChanged.bind(this)); |
| 106 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.FrameResized, this._frameResized, this); |
106 this.element.addStyleClass("styles-pane"); | 107 this.element.addStyleClass("styles-pane"); |
107 this.element.enableStyleClass("show-user-styles", WebInspector.settings.show
UserAgentStyles.get()); | 108 this.element.enableStyleClass("show-user-styles", WebInspector.settings.show
UserAgentStyles.get()); |
108 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); | 109 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); |
109 document.body.addEventListener("keydown", this._keyDown.bind(this), false); | 110 document.body.addEventListener("keydown", this._keyDown.bind(this), false); |
110 document.body.addEventListener("keyup", this._keyUp.bind(this), false); | 111 document.body.addEventListener("keyup", this._keyUp.bind(this), false); |
111 } | 112 } |
112 | 113 |
113 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains
pseudo id names for corresponding enum indexes. | 114 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains
pseudo id names for corresponding enum indexes. |
114 // First item is empty due to its artificial NOPSEUDO nature in the enum. | 115 // First item is empty due to its artificial NOPSEUDO nature in the enum. |
115 // FIXME: find a way of generating this mapping or getting it from combination o
f RenderStyleConstants and CSSSelector.cpp at | 116 // 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... |
390 }, | 391 }, |
391 | 392 |
392 _styleSheetOrMediaQueryResultChanged: function() | 393 _styleSheetOrMediaQueryResultChanged: function() |
393 { | 394 { |
394 if (this._userOperation || this._isEditingStyle) | 395 if (this._userOperation || this._isEditingStyle) |
395 return; | 396 return; |
396 | 397 |
397 this._rebuildUpdate(); | 398 this._rebuildUpdate(); |
398 }, | 399 }, |
399 | 400 |
| 401 _frameResized: function() |
| 402 { |
| 403 function refreshContents() |
| 404 { |
| 405 this._rebuildUpdate(); |
| 406 } |
| 407 |
| 408 setTimeout(refreshContents.bind(this), 0); |
| 409 }, |
| 410 |
400 _attributeChanged: function(event) | 411 _attributeChanged: function(event) |
401 { | 412 { |
402 // Any attribute removal or modification can affect the styles of "relat
ed" nodes. | 413 // Any attribute removal or modification can affect the styles of "relat
ed" nodes. |
403 // Do not touch the styles if they are being edited. | 414 // Do not touch the styles if they are being edited. |
404 if (this._isEditingStyle || this._userOperation) | 415 if (this._isEditingStyle || this._userOperation) |
405 return; | 416 return; |
406 | 417 |
407 if (!this._canAffectCurrentStyles(event.data.node)) | 418 if (!this._canAffectCurrentStyles(event.data.node)) |
408 return; | 419 return; |
409 | 420 |
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 return; | 2907 return; |
2897 } | 2908 } |
2898 | 2909 |
2899 var results = this._cssCompletions.startsWith(prefix); | 2910 var results = this._cssCompletions.startsWith(prefix); |
2900 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 2911 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
2901 completionsReadyCallback(results, selectedIndex); | 2912 completionsReadyCallback(results, selectedIndex); |
2902 }, | 2913 }, |
2903 | 2914 |
2904 __proto__: WebInspector.TextPrompt.prototype | 2915 __proto__: WebInspector.TextPrompt.prototype |
2905 } | 2916 } |
OLD | NEW |