Changeset 147224 in webkit
- Timestamp:
- Mar 29, 2013 9:47:27 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147222 r147224 1 2013-03-29 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: Flame Chart. Remove hopping ancorElement and use anchorBox instead. 4 https://bugs.webkit.org/show_bug.cgi?id=113579 5 6 Reviewed by Pavel Feldman. 7 8 Initially I made a fake anchor element and moved it according to the highlighted element position. 9 It was a hack and after http://trac.webkit.org/changeset/147209 I'm able to remove it. 10 11 Drive by fix: the code was moved from onMouseMove to getPopoverAnchor. 12 13 * inspector/front-end/FlameChart.js: 14 (WebInspector.FlameChart): 15 (WebInspector.FlameChart.prototype._getPopoverAnchor): 16 -(WebInspector.FlameChart.prototype._onMouseMove) 17 * inspector/front-end/flameChart.css: 18 1 19 2013-03-29 Kondapally Kalyan <kalyan.kondapally@intel.com> 2 20 -
trunk/Source/WebCore/inspector/front-end/FlameChart.js
r147213 r147224 62 62 this._minWidth = 1; 63 63 this._paddingLeft = 15; 64 this._canvas.addEventListener("mousemove", this._onMouseMove.bind(this), false);65 64 this._canvas.addEventListener("mousewheel", this._onMouseWheel.bind(this), false); 66 65 this.element.addEventListener("click", this._onClick.bind(this), false); 67 66 this._popoverHelper = new WebInspector.PopoverHelper(this._chartContainer, this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); 68 67 this._popoverHelper.setTimeout(250); 69 this._anchorElement = this._chartContainer.createChild("span"); 70 this._anchorElement.className = "item-anchor"; 68 this._anchorBox = new AnchorBox(0, 0, 0, 0); 71 69 this._linkifier = new WebInspector.Linkifier(); 72 70 this._highlightedNodeIndex = -1; … … 394 392 }, 395 393 396 _getPopoverAnchor: function( )397 { 398 if (this._ highlightedNodeIndex === -1 || this._isDragging)394 _getPopoverAnchor: function(element, event) 395 { 396 if (this._isDragging) 399 397 return null; 400 return this._anchorElement; 398 399 var nodeIndex = this._coordinatesToNodeIndex(event.offsetX, event.offsetY); 400 401 this._highlightedNodeIndex = nodeIndex; 402 this.update(); 403 404 if (nodeIndex === -1) 405 return null; 406 407 var timelineEntries = this._timelineData.entries; 408 409 var anchorLeft = Math.floor(timelineEntries[nodeIndex].startTime * this._timeToPixel - this._pixelWindowLeft + this._paddingLeft); 410 var anchorTop = Math.floor(this._canvas.height - (timelineEntries[nodeIndex].depth + 1) * this._barHeight); 411 412 var anchorWidth = Math.floor(timelineEntries[nodeIndex].duration * this._timeToPixel); 413 if (anchorLeft < 0) { 414 anchorWidth += anchorLeft; 415 anchorLeft = 0; 416 } 417 418 anchorLeft = Number.constrain(anchorLeft, 0, this._canvas.width); 419 anchorWidth = Number.constrain(anchorWidth, 0, this._canvas.width - anchorLeft); 420 421 var canvasOffsetLeft = event.pageX - event.offsetX; 422 var canvasOffsetTop = event.pageY - event.offsetY; 423 return new AnchorBox(anchorLeft + canvasOffsetLeft, anchorTop + canvasOffsetTop, anchorWidth, this._barHeight); 401 424 }, 402 425 … … 433 456 var node = this._timelineData.entries[this._highlightedNodeIndex].node; 434 457 this.dispatchEventToListeners(WebInspector.FlameChart.Events.SelectedNode, node); 435 },436 437 _onMouseMove: function(e)438 {439 if (this._isDragging)440 return;441 var nodeIndex = this._coordinatesToNodeIndex(e.offsetX, e.offsetY);442 if (nodeIndex === this._highlightedNodeIndex)443 return;444 this._highlightedNodeIndex = nodeIndex;445 this.update();446 447 if (nodeIndex === -1)448 return;449 450 var timelineEntries = this._timelineData.entries;451 452 var anchorLeft = Math.floor(timelineEntries[nodeIndex].startTime * this._timeToPixel - this._pixelWindowLeft);453 anchorLeft = Number.constrain(anchorLeft, 0, this._canvas.width);454 455 var anchorWidth = Math.floor(timelineEntries[nodeIndex].duration * this._timeToPixel);456 457 anchorWidth = Number.constrain(anchorWidth, 0, this._canvas.width - anchorLeft);458 459 var style = this._anchorElement.style;460 style.width = anchorWidth + "px";461 style.height = this._barHeight + "px";462 style.left = anchorLeft + "px";463 style.top = Math.floor(this._canvas.height - (timelineEntries[nodeIndex].depth + 1) * this._barHeight) + "px";464 458 }, 465 459 -
trunk/Source/WebCore/inspector/front-end/flameChart.css
r146591 r147224 1 .chart-container .item-anchor {2 position: absolute;3 z-index: -100;4 }5 6 1 .overview-container { 7 2 overflow: hidden;
Note: See TracChangeset
for help on using the changeset viewer.