Changeset 55517 in webkit
- Timestamp:
- Mar 4, 2010 4:21:10 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55514 r55517 1 2010-03-04 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: Nothing happens on navigation to resource via a link if resource tracking is disabled 6 https://bugs.webkit.org/show_bug.cgi?id=35574 7 8 * English.lproj/localizedStrings.js: 9 * inspector/front-end/ResourcesPanel.js: 10 (WebInspector.ResourcesPanel.prototype.canShowSourceLine): 11 (WebInspector.ResourcesPanel.prototype._toggleResourceTracking): 12 * inspector/front-end/inspector.js: 13 (WebInspector.documentMouseOver): 14 (WebInspector.documentMouseOut): 15 (WebInspector.hideBadLinkPopupIfNecessary): 16 (WebInspector.documentClick.followLink): 17 (WebInspector.documentClick): 18 (WebInspector.showBadLinkPopup.popupOverOut): 19 (WebInspector.showBadLinkPopup): 20 (WebInspector.addMainEventListeners): 21 1 22 2010-03-04 Vangelis Kokkevis <vangelis@chromium.org> 2 23 -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r55466 r55517 460 460 canShowSourceLine: function(url, line) 461 461 { 462 return !!WebInspector.resourceForURL(url) ;462 return !!WebInspector.resourceForURL(url) && InspectorBackend.resourceTrackingEnabled(); 463 463 }, 464 464 … … 701 701 this.largerResourcesButton.visible = false; 702 702 this.sortingSelectElement.visible = false; 703 WebInspector.resources = {}; 704 WebInspector.resourceURLMap = {}; 703 705 InspectorBackend.disableResourceTracking(true); 704 706 } else { -
trunk/WebCore/inspector/front-end/inspector.js
r55466 r55517 64 64 // 5 - ?fragment 65 65 URLRegExp: /^(http[s]?|file):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i, 66 GenericURLRegExp: /^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i, 66 67 67 68 get platform() … … 611 612 } 612 613 614 WebInspector.documentMouseOver = function(event) 615 { 616 if (event.target.tagName !== "A") 617 return; 618 619 const anchor = event.target; 620 if (!anchor.hasStyleClass("webkit-html-external-link") && !anchor.hasStyleClass("webkit-html-resource-link")) 621 return; 622 623 if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel) || WebInspector.ProfileType.URLRegExp.exec(anchor.href)) 624 return; 625 626 WebInspector._showPopupTimer = setTimeout(WebInspector.showBadLinkPopup.bind(WebInspector, anchor), 250); 627 } 628 629 WebInspector.documentMouseOut = function(event) 630 { 631 if (event.target.tagName !== "A") 632 return; 633 634 if (WebInspector._showPopupTimer) { 635 clearTimeout(WebInspector._showPopupTimer); 636 delete WebInspector._showPopupTimer; 637 } else if (WebInspector._badLinkPopup && !this._mouseOverPopup) 638 WebInspector._hidePopupTimer = setTimeout(WebInspector.hideBadLinkPopupIfNecessary.bind(WebInspector), 750); 639 } 640 641 WebInspector.hideBadLinkPopupIfNecessary = function() 642 { 643 if (!this._badLinkPopup) 644 return; 645 this._badLinkPopup.hide(); 646 delete this._badLinkPopup; 647 if (this._hidePopupTimer) { 648 clearTimeout(this._hidePopupTimer); 649 delete this._hidePopupTimer; 650 } 651 } 652 613 653 WebInspector.documentClick = function(event) 614 654 { … … 630 670 631 671 WebInspector.showSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel); 632 } else { 633 var profileString = WebInspector.ProfileType.URLRegExp.exec(anchor.href); 634 if (profileString) 635 WebInspector.showProfileForURL(anchor.href); 636 } 672 return; 673 } 674 675 const profileMatch = WebInspector.ProfileType.URLRegExp.exec(anchor.href); 676 if (profileMatch) { 677 WebInspector.showProfileForURL(anchor.href); 678 return; 679 } 680 681 const urlMatch = WebInspector.GenericURLRegExp.exec(anchor.href); 682 if (urlMatch && urlMatch[1] === "webkit-link-action") { 683 if (urlMatch[2] === "show-panel") { 684 const panel = urlMatch[4].substring(1); 685 if (WebInspector.panels[panel]) 686 WebInspector.currentPanel = WebInspector.panels[panel]; 687 } 688 return; 689 } 690 691 WebInspector.showBadLinkPopup(anchor); 637 692 } 638 693 … … 649 704 650 705 followLink(); 706 } 707 708 WebInspector.showBadLinkPopup = function(anchor) 709 { 710 this.hideBadLinkPopupIfNecessary(); 711 712 // Show an info popup for a link that cannot be opened right away. 713 var popupContentElement = document.createElement("span"); 714 popupContentElement.className = "monospace"; 715 716 var message = WebInspector.UIString( 717 "Cannot open this link. Make sure that resource tracking is enabled in the %s panel."); 718 var anchorIndex = message.indexOf("%s"); 719 if (anchorIndex < 0) { 720 var leftPart = message; 721 var rightPart = ""; 722 } else { 723 var leftPart = message.substring(0, anchorIndex); 724 var panelAnchorElement = document.createElement("a"); 725 panelAnchorElement.href = "webkit-link-action://show-panel/resources"; 726 panelAnchorElement.textContent = WebInspector.UIString("Resources"); 727 var rightPart = message.substring(anchorIndex + 2); 728 } 729 popupContentElement.appendChild(document.createTextNode(leftPart)); 730 if (panelAnchorElement) 731 popupContentElement.appendChild(panelAnchorElement); 732 popupContentElement.appendChild(document.createTextNode(rightPart)); 733 var popup = new WebInspector.Popover(popupContentElement); 734 735 if (panelAnchorElement) 736 panelAnchorElement.addEventListener("click", this.hideBadLinkPopupIfNecessary.bind(this)); 737 738 function popupOverOut(event) 739 { 740 if (event.type === "mouseover") { 741 if (this._mouseOverPopup) 742 return; // Entered from child. 743 clearTimeout(this._hidePopupTimer); 744 delete this._hidePopupTimer; 745 this._mouseOverPopup = true; 746 } else { 747 const relTarget = event.relatedTarget; 748 if (relTarget && relTarget.enclosingNodeOrSelfWithClass("popover")) 749 return; // Leaving to child. 750 delete this._mouseOverPopup; 751 this.hideBadLinkPopupIfNecessary(); 752 } 753 } 754 const boundHandler = popupOverOut.bind(this); 755 popupContentElement.addEventListener("mouseover", boundHandler, true); 756 popupContentElement.addEventListener("mouseout", boundHandler, true); 757 758 popup.show(anchor); 759 this._badLinkPopup = popup; 760 delete this._showPopupTimer; 651 761 } 652 762 … … 1595 1705 doc.defaultView.addEventListener("blur", this.windowBlurred.bind(this), false); 1596 1706 doc.addEventListener("click", this.documentClick.bind(this), true); 1707 doc.addEventListener("mouseover", this.documentMouseOver.bind(this), true); 1708 doc.addEventListener("mouseout", this.documentMouseOut.bind(this), true); 1597 1709 } 1598 1710
Note: See TracChangeset
for help on using the changeset viewer.