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

Side by Side Diff: Source/devtools/front_end/sdk/CSSStyleModel.js

Issue 940373004: [DevTools] Teach MediaQueryInspector about disabling models while profiling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more cleanup Created 5 years, 10 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (!matchArray) 63 if (!matchArray)
64 return []; 64 return [];
65 65
66 var result = []; 66 var result = [];
67 for (var i = 0; i < matchArray.length; ++i) 67 for (var i = 0; i < matchArray.length; ++i)
68 result.push(WebInspector.CSSRule.parsePayload(cssModel, matchArray[i].ru le, matchArray[i].matchingSelectors)); 68 result.push(WebInspector.CSSRule.parsePayload(cssModel, matchArray[i].ru le, matchArray[i].matchingSelectors));
69 return result; 69 return result;
70 } 70 }
71 71
72 WebInspector.CSSStyleModel.Events = { 72 WebInspector.CSSStyleModel.Events = {
73 ModelWasDisabled: "ModelWasDisabled",
73 ModelWasEnabled: "ModelWasEnabled", 74 ModelWasEnabled: "ModelWasEnabled",
74 StyleSheetAdded: "StyleSheetAdded", 75 StyleSheetAdded: "StyleSheetAdded",
75 StyleSheetChanged: "StyleSheetChanged", 76 StyleSheetChanged: "StyleSheetChanged",
76 StyleSheetRemoved: "StyleSheetRemoved", 77 StyleSheetRemoved: "StyleSheetRemoved",
77 MediaQueryResultChanged: "MediaQueryResultChanged", 78 MediaQueryResultChanged: "MediaQueryResultChanged",
78 } 79 }
79 80
80 WebInspector.CSSStyleModel.MediaTypes = ["all", "braille", "embossed", "handheld ", "print", "projection", "screen", "speech", "tty", "tv"]; 81 WebInspector.CSSStyleModel.MediaTypes = ["all", "braille", "embossed", "handheld ", "print", "projection", "screen", "speech", "tty", "tv"];
81 82
82 WebInspector.CSSStyleModel.prototype = { 83 WebInspector.CSSStyleModel.prototype = {
83 suspendModel: function() 84 suspendModel: function()
84 { 85 {
85 this._agent.disable(); 86 this._agent.disable();
86 this._isEnabled = false; 87 this._isEnabled = false;
87 this._resetStyleSheets(); 88 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.ModelWas Disabled);
88 }, 89 },
89 90
90 resumeModel: function() 91 resumeModel: function()
91 { 92 {
93 this._resetStyleSheets();
lushnikov 2015/02/25 15:23:55 why this change?
dgozman 2015/02/25 15:51:55 So we don't immediately clear UI because of disapp
92 this._agent.enable(this._wasEnabled.bind(this)); 94 this._agent.enable(this._wasEnabled.bind(this));
93 }, 95 },
94 96
95 /** 97 /**
96 * @param {function(!Array.<!WebInspector.CSSMedia>)} userCallback 98 * @param {function(!Array.<!WebInspector.CSSMedia>)} userCallback
97 */ 99 */
98 getMediaQueries: function(userCallback) 100 getMediaQueries: function(userCallback)
99 { 101 {
100 /** 102 /**
101 * @param {?Protocol.Error} error 103 * @param {?Protocol.Error} error
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 // The loader has been reset. 1822 // The loader has been reset.
1821 if (!callbacks) 1823 if (!callbacks)
1822 return; 1824 return;
1823 1825
1824 delete this._nodeIdToCallbackData[nodeId]; 1826 delete this._nodeIdToCallbackData[nodeId];
1825 for (var i = 0; i < callbacks.length; ++i) 1827 for (var i = 0; i < callbacks.length; ++i)
1826 callbacks[i](computedStyle); 1828 callbacks[i](computedStyle);
1827 } 1829 }
1828 } 1830 }
1829 } 1831 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698