Changeset 141250 in webkit
- Timestamp:
- Jan 30, 2013 4:01:07 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r141249 r141250 1 2013-01-30 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [Canvas] support instrumenting canvases in iframes (frontend side) 4 https://bugs.webkit.org/show_bug.cgi?id=108319 5 6 Reviewed by Pavel Feldman. 7 8 Add a frame selector to choose between frames with canvases. Show this selector in the status 9 bar only if there are 2 or more frames with canvses. Otherwise, assume silently the only 10 frame with canvases (most common use case). 11 12 * English.lproj/localizedStrings.js: 13 * inspector/front-end/CanvasProfileView.js: 14 (WebInspector.CanvasProfileType): 15 (WebInspector.CanvasProfileType.prototype.get statusBarItems): 16 (WebInspector.CanvasProfileType.prototype._runSingleFrameCapturing): 17 (WebInspector.CanvasProfileType.prototype._startFrameCapturing): 18 (WebInspector.CanvasProfileType.prototype._frameAdded): 19 (WebInspector.CanvasProfileType.prototype._addFrame): 20 (WebInspector.CanvasProfileType.prototype._frameRemoved): 21 (WebInspector.CanvasProfileType.prototype._contextCreated): 22 (WebInspector.CanvasProfileType.prototype._selectedFrameId): 23 (WebInspector.CanvasProfileType.prototype._dispatchViewUpdatedEvent): 24 (WebInspector.CanvasDispatcher): 25 (WebInspector.CanvasDispatcher.prototype.contextCreated): 26 * inspector/front-end/ProfilesPanel.js: 27 (WebInspector.ProfileType.prototype.createProfile): 28 (WebInspector.ProfilesPanel.prototype._onProfileTypeSelected): 29 (WebInspector.ProfilesPanel.prototype._updateProfileTypeSpecificUI): 30 (WebInspector.ProfilesPanel.prototype._registerProfileType): 31 * inspector/front-end/StatusBarButton.js: 32 (WebInspector.StatusBarComboBox.prototype.size): 33 1 34 2013-01-30 Vladislav Kaznacheev <kaznacheev@chromium.org> 2 35 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r140813 r141250 779 779 localizedStrings["Stop capturing canvas frames."] = "Stop capturing canvas frames."; 780 780 localizedStrings["Start capturing canvas frames."] = "Start capturing canvas frames."; 781 localizedStrings["Canvas capture mode"] = "Canvas capture mode"; 782 localizedStrings["Single Frame"] = "Single Frame"; 783 localizedStrings["Capture a single canvas frame."] = "Capture a single canvas frame."; 784 localizedStrings["Consecutive Frames"] = "Consecutive Frames"; 785 localizedStrings["Capture consecutive canvas frames."] = "Capture consecutive canvas frames."; 786 localizedStrings["Frame containing the canvases to capture."] = "Frame containing the canvases to capture."; 781 787 localizedStrings["Trace Log %d"] = "Trace Log %d"; 782 788 localizedStrings["CANVAS PROFILE"] = "CANVAS PROFILE"; -
trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js
r140678 r141250 381 381 this._lastProfileHeader = null; 382 382 383 this._capturingModeSelector = new WebInspector.StatusBarComboBox( null);383 this._capturingModeSelector = new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this)); 384 384 this._capturingModeSelector.element.title = WebInspector.UIString("Canvas capture mode."); 385 385 this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"), WebInspector.UIString("Capture a single canvas frame."), ""); 386 386 this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"), WebInspector.UIString("Capture consecutive canvas frames."), "1"); 387 388 /** @type {!Object.<string, Element>} */ 389 this._frameOptions = {}; 390 391 /** @type {!Object.<string, boolean>} */ 392 this._framesWithCanvases = {}; 393 394 this._frameSelector = new WebInspector.StatusBarComboBox(this._dispatchViewUpdatedEvent.bind(this)); 395 this._frameSelector.element.title = WebInspector.UIString("Frame containing the canvases to capture."); 396 this._frameSelector.element.addStyleClass("hidden"); 397 WebInspector.runtimeModel.contextLists().forEach(this._addFrame, this); 398 WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListAdded, this._frameAdded, this); 399 WebInspector.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.FrameExecutionContextListRemoved, this._frameRemoved, this); 387 400 388 401 this._decorationElement = document.createElement("div"); … … 395 408 reloadPageButton.addEventListener("click", this._onReloadPageButtonClick.bind(this), false); 396 409 410 this._dispatcher = new WebInspector.CanvasDispatcher(this); 411 397 412 // FIXME: enable/disable by a UI action? 398 413 CanvasAgent.enable(this._updateDecorationElement.bind(this)); … … 405 420 get statusBarItems() 406 421 { 407 return [this._capturingModeSelector.element ];422 return [this._capturingModeSelector.element, this._frameSelector.element]; 408 423 }, 409 424 … … 442 457 _runSingleFrameCapturing: function(profilesPanel) 443 458 { 444 CanvasAgent.captureFrame(this._ didStartCapturingFrame.bind(this, profilesPanel));459 CanvasAgent.captureFrame(this._selectedFrameId(), this._didStartCapturingFrame.bind(this, profilesPanel)); 445 460 }, 446 461 … … 450 465 _startFrameCapturing: function(profilesPanel) 451 466 { 452 CanvasAgent.startCapturing(this._ didStartCapturingFrame.bind(this, profilesPanel));467 CanvasAgent.startCapturing(this._selectedFrameId(), this._didStartCapturingFrame.bind(this, profilesPanel)); 453 468 }, 454 469 … … 566 581 }, 567 582 583 /** 584 * @param {WebInspector.Event} event 585 */ 586 _frameAdded: function(event) 587 { 588 var contextList = /** @type {WebInspector.FrameExecutionContextList} */ (event.data); 589 this._addFrame(contextList); 590 }, 591 592 /** 593 * @param {WebInspector.FrameExecutionContextList} contextList 594 */ 595 _addFrame: function(contextList) 596 { 597 var frameId = contextList.frameId; 598 var option = document.createElement("option"); 599 option.text = contextList.displayName; 600 option.title = contextList.url; 601 option.value = frameId; 602 603 this._frameOptions[frameId] = option; 604 605 if (this._framesWithCanvases[frameId]) { 606 this._frameSelector.addOption(option); 607 this._dispatchViewUpdatedEvent(); 608 } 609 }, 610 611 /** 612 * @param {WebInspector.Event} event 613 */ 614 _frameRemoved: function(event) 615 { 616 var contextList = /** @type {WebInspector.FrameExecutionContextList} */ (event.data); 617 var frameId = contextList.frameId; 618 var option = this._frameOptions[frameId]; 619 if (option && this._framesWithCanvases[frameId]) { 620 this._frameSelector.removeOption(option); 621 this._dispatchViewUpdatedEvent(); 622 } 623 delete this._frameOptions[frameId]; 624 delete this._framesWithCanvases[frameId]; 625 }, 626 627 /** 628 * @param {string} frameId 629 */ 630 _contextCreated: function(frameId) 631 { 632 if (this._framesWithCanvases[frameId]) 633 return; 634 this._framesWithCanvases[frameId] = true; 635 var option = this._frameOptions[frameId]; 636 if (option) { 637 this._frameSelector.addOption(option); 638 this._dispatchViewUpdatedEvent(); 639 } 640 }, 641 642 /** 643 * @return {string|undefined} 644 */ 645 _selectedFrameId: function() 646 { 647 var option = this._frameSelector.selectedOption(); 648 return option ? option.value : undefined; 649 }, 650 651 _dispatchViewUpdatedEvent: function() 652 { 653 this._frameSelector.element.enableStyleClass("hidden", this._frameSelector.size() <= 1); 654 this.dispatchEventToListeners(WebInspector.ProfileType.Events.ViewUpdated); 655 }, 656 568 657 __proto__: WebInspector.ProfileType.prototype 658 } 659 660 /** 661 * @constructor 662 * @implements {CanvasAgent.Dispatcher} 663 * @param {WebInspector.CanvasProfileType} profileType 664 */ 665 WebInspector.CanvasDispatcher = function(profileType) 666 { 667 this._profileType = profileType; 668 InspectorBackend.registerCanvasDispatcher(this); 669 } 670 671 WebInspector.CanvasDispatcher.prototype = { 672 /** 673 * @param {string} frameId 674 */ 675 contextCreated: function(frameId) 676 { 677 this._profileType._contextCreated(frameId); 678 } 569 679 } 570 680 -
trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js
r140678 r141250 28 28 /** 29 29 * @constructor 30 * @extends {WebInspector.Object} 30 31 * @param {string} id 31 32 * @param {string} name … … 41 42 } 42 43 44 WebInspector.ProfileType.Events = { 45 ViewUpdated: "view-updated", 46 } 47 43 48 WebInspector.ProfileType.prototype = { 44 49 get statusBarItems() … … 110 115 { 111 116 throw new Error("Not supported for " + this._name + " profiles."); 112 } 117 }, 118 119 __proto__: WebInspector.Object.prototype 113 120 } 114 121 … … 367 374 { 368 375 this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (event.data); 376 this._updateProfileTypeSpecificUI(); 377 }, 378 379 _updateProfileTypeSpecificUI: function() 380 { 369 381 this.recordButton.title = this._selectedProfileType.buttonTooltip; 370 382 … … 455 467 this.sidebarTree.appendChild(profileType.treeElement); 456 468 profileType.treeElement.childrenListElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); 469 profileType.addEventListener(WebInspector.ProfileType.Events.ViewUpdated, this._updateProfileTypeSpecificUI, this); 457 470 }, 458 471 -
trunk/Source/WebCore/inspector/front-end/StatusBarButton.js
r139972 r141250 290 290 WebInspector.StatusBarComboBox.prototype = { 291 291 /** 292 * @return {number} 293 */ 294 size: function() 295 { 296 return this._selectElement.childElementCount; 297 }, 298 299 /** 292 300 * @param {!Element} option 293 301 */
Note: See TracChangeset
for help on using the changeset viewer.