OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.View} | 7 * @extends {WebInspector.View} |
8 */ | 8 */ |
9 WebInspector.DocumentationView = function() | 9 WebInspector.DocumentationView = function() |
10 { | 10 { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return; | 161 return; |
162 var section = this._element.createChild("div", "documentation-section"); | 162 var section = this._element.createChild("div", "documentation-section"); |
163 var title = section.createChild("div", "documentation-section-title"); | 163 var title = section.createChild("div", "documentation-section-title"); |
164 title.textContent = "Parameters"; | 164 title.textContent = "Parameters"; |
165 for (var i = 0; i < parameters.length; ++i) { | 165 for (var i = 0; i < parameters.length; ++i) { |
166 var parameter = section.createChild("div", "documentation-parameter"
); | 166 var parameter = section.createChild("div", "documentation-parameter"
); |
167 var header = parameter.createChild("div", "documentation-parameter-h
eader"); | 167 var header = parameter.createChild("div", "documentation-parameter-h
eader"); |
168 var name = header.createChild("span", "documentation-parameter-name"
); | 168 var name = header.createChild("span", "documentation-parameter-name"
); |
169 name.textContent = parameters[i].name; | 169 name.textContent = parameters[i].name; |
170 var dataTypeValue = header.createChild("span", "documentation-parame
ter-data-type-value"); | 170 var dataTypeValue = header.createChild("span", "documentation-parame
ter-data-type-value"); |
| 171 dataTypeValue.classList.add("documentation-box"); |
171 dataTypeValue.textContent = parameters[i].dataType; | 172 dataTypeValue.textContent = parameters[i].dataType; |
172 if (parameters[i].optional) { | 173 if (parameters[i].optional) { |
173 var optional = header.createChild("span", "documentation-paramet
er-optional"); | 174 var optional = header.createChild("span", "documentation-paramet
er-optional"); |
| 175 optional.classList.add("documentation-box"); |
174 optional.textContent = WebInspector.UIString("Optional"); | 176 optional.textContent = WebInspector.UIString("Optional"); |
175 } | 177 } |
176 parameter.appendChild(this._renderBlock(parameters[i].description)); | 178 parameter.appendChild(this._renderBlock(parameters[i].description)); |
177 } | 179 } |
178 }, | 180 }, |
179 | 181 |
180 /** | 182 /** |
181 * @param {?WebInspector.JSArticle.Method} method | 183 * @param {?WebInspector.JSArticle.Method} method |
182 */ | 184 */ |
183 _createReturnValueSection: function(method) | 185 _createReturnValueSection: function(method) |
(...skipping 20 matching lines...) Expand all Loading... |
204 | 206 |
205 var section = this._element.createChild("div", "documentation-section"); | 207 var section = this._element.createChild("div", "documentation-section"); |
206 var title = section.createChild("div", "documentation-section-title"); | 208 var title = section.createChild("div", "documentation-section-title"); |
207 title.textContent = "Examples"; | 209 title.textContent = "Examples"; |
208 | 210 |
209 for (var i = 0; i < examples.length; ++i) { | 211 for (var i = 0; i < examples.length; ++i) { |
210 var example = section.createChild("div", "documentation-example"); | 212 var example = section.createChild("div", "documentation-example"); |
211 var exampleDescription = example.createChild("div", "documentation-e
xample-description-section"); | 213 var exampleDescription = example.createChild("div", "documentation-e
xample-description-section"); |
212 if (examples[i].liveUrl) { | 214 if (examples[i].liveUrl) { |
213 var liveUrl = exampleDescription.createChild("a", "documentation
-example-link"); | 215 var liveUrl = exampleDescription.createChild("a", "documentation
-example-link"); |
| 216 liveUrl.classList.add("documentation-box"); |
214 liveUrl.href = examples[i].liveUrl; | 217 liveUrl.href = examples[i].liveUrl; |
215 liveUrl.textContent = WebInspector.UIString("Example"); | 218 liveUrl.textContent = WebInspector.UIString("Example"); |
216 } | 219 } |
217 exampleDescription.appendChild(this._renderBlock(examples[i].descrip
tion)); | 220 exampleDescription.appendChild(this._renderBlock(examples[i].descrip
tion)); |
218 var code = example.createChild("div", "documentation-example-code"); | 221 var code = example.createChild("div", "documentation-code"); |
219 code.classList.add("source-code"); | 222 code.classList.add("source-code"); |
220 code.textContent = examples[i].code; | 223 code.textContent = examples[i].code; |
221 if (!examples[i].language) | 224 if (!examples[i].language) |
222 continue; | 225 continue; |
223 var syntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(WebIns
pector.DocumentationView._languageToMimeType[examples[i].language.toLowerCase()]
, true); | 226 var syntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(WebIns
pector.DocumentationView._languageToMimeType[examples[i].language.toLowerCase()]
, true); |
224 syntaxHighlighter.syntaxHighlightNode(code); | 227 syntaxHighlighter.syntaxHighlightNode(code); |
225 } | 228 } |
226 }, | 229 }, |
227 | 230 |
228 /** | 231 /** |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 function computeDescriptors(column) | 340 function computeDescriptors(column) |
338 { | 341 { |
339 var token = textEditor.tokenAtTextPosition(textSelection.startLine,
column); | 342 var token = textEditor.tokenAtTextPosition(textSelection.startLine,
column); |
340 if (!token) | 343 if (!token) |
341 return []; | 344 return []; |
342 var tokenText = textEditor.line(textSelection.startLine).substring(t
oken.startColumn, token.endColumn); | 345 var tokenText = textEditor.line(textSelection.startLine).substring(t
oken.startColumn, token.endColumn); |
343 return urlProvider.itemDescriptors(tokenText); | 346 return urlProvider.itemDescriptors(tokenText); |
344 } | 347 } |
345 } | 348 } |
346 } | 349 } |
OLD | NEW |