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

Side by Side Diff: Source/devtools/front_end/CSSParser.js

Issue 208593002: DevTools: fix CSS parser to properly report last parsed chunk (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/devtools/front_end/ScriptFormatterWorker.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @extends {WebInspector.Object} 9 * @extends {WebInspector.Object}
10 */ 10 */
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 /** 81 /**
82 * @param {!MessageEvent} event 82 * @param {!MessageEvent} event
83 */ 83 */
84 _onRuleChunk: function(event) 84 _onRuleChunk: function(event)
85 { 85 {
86 var data = /** @type {!WebInspector.CSSParser.DataChunk} */ (event.data) ; 86 var data = /** @type {!WebInspector.CSSParser.DataChunk} */ (event.data) ;
87 var chunk = data.chunk; 87 var chunk = data.chunk;
88 for (var i = 0; i < chunk.length; ++i) 88 for (var i = 0; i < chunk.length; ++i)
89 this._rules.push(chunk[i]); 89 this._rules.push(chunk[i]);
90 90
91 if (data.index === data.total - 1) 91 if (data.isLastChunk)
92 this._onFinishedParsing(); 92 this._onFinishedParsing();
93 this.dispatchEventToListeners(WebInspector.CSSParser.Events.RulesParsed) ; 93 this.dispatchEventToListeners(WebInspector.CSSParser.Events.RulesParsed) ;
94 }, 94 },
95 95
96 _onFinishedParsing: function() 96 _onFinishedParsing: function()
97 { 97 {
98 this._unlock(); 98 this._unlock();
99 if (this._finishedCallback) 99 if (this._finishedCallback)
100 this._finishedCallback(this._rules); 100 this._finishedCallback(this._rules);
101 }, 101 },
102 102
103 __proto__: WebInspector.Object.prototype, 103 __proto__: WebInspector.Object.prototype,
104 } 104 }
105 105
106 /** 106 /**
107 * @typedef {{index: number, total: number, chunk: !Array.<!WebInspector.CSSPars er.Rule>}} 107 * @typedef {{isLastChunk: boolean, chunk: !Array.<!WebInspector.CSSParser.Rule> }}
108 */ 108 */
109 WebInspector.CSSParser.DataChunk; 109 WebInspector.CSSParser.DataChunk;
110 110
111 /** 111 /**
112 * @typedef {{selectorText: string, lineNumber: number, columnNumber: number, pr operties: !Array.<!WebInspector.CSSParser.Property>}} 112 * @typedef {{selectorText: string, lineNumber: number, columnNumber: number, pr operties: !Array.<!WebInspector.CSSParser.Property>}}
113 */ 113 */
114 WebInspector.CSSParser.StyleRule; 114 WebInspector.CSSParser.StyleRule;
115 115
116 /** 116 /**
117 * @typedef {{atRule: string, lineNumber: number, columnNumber: number}} 117 * @typedef {{atRule: string, lineNumber: number, columnNumber: number}}
118 */ 118 */
119 WebInspector.CSSParser.AtRule; 119 WebInspector.CSSParser.AtRule;
120 120
121 /** 121 /**
122 * @typedef {(WebInspector.CSSParser.StyleRule|WebInspector.CSSParser.AtRule)} 122 * @typedef {(WebInspector.CSSParser.StyleRule|WebInspector.CSSParser.AtRule)}
123 */ 123 */
124 WebInspector.CSSParser.Rule; 124 WebInspector.CSSParser.Rule;
125 125
126 /** 126 /**
127 * @typedef {{name: string, value: string}} 127 * @typedef {{name: string, value: string}}
128 */ 128 */
129 WebInspector.CSSParser.Property; 129 WebInspector.CSSParser.Property;
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ScriptFormatterWorker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698