Changeset 55575 in webkit


Ignore:
Timestamp:
Mar 5, 2010 2:09:11 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-03-05 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Do not show link helper in popovers and/or for external resources.

https://bugs.webkit.org/show_bug.cgi?id=35785

  • English.lproj/localizedStrings.js:
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourcesPanel.prototype.canShowSourceLine):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype._scriptOrResourceForURLAndLine):
  • inspector/front-end/TimelinePanel.js: (WebInspector.TimelinePanel.prototype.hide):
  • inspector/front-end/inspector.js: (WebInspector.documentMouseOver): (WebInspector.documentClick.followLink): (WebInspector.documentClick): (WebInspector.addMainEventListeners):
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55573 r55575  
     12010-03-05  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Do not show link helper in popovers and/or for external resources.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=35785
     8
     9        * English.lproj/localizedStrings.js:
     10        * inspector/front-end/ResourcesPanel.js:
     11        (WebInspector.ResourcesPanel.prototype.canShowSourceLine):
     12        * inspector/front-end/ScriptsPanel.js:
     13        (WebInspector.ScriptsPanel.prototype._scriptOrResourceForURLAndLine):
     14        * inspector/front-end/TimelinePanel.js:
     15        (WebInspector.TimelinePanel.prototype.hide):
     16        * inspector/front-end/inspector.js:
     17        (WebInspector.documentMouseOver):
     18        (WebInspector.documentClick.followLink):
     19        (WebInspector.documentClick):
     20        (WebInspector.addMainEventListeners):
     21
    1222010-03-05  Fumitoshi Ukai  <ukai@chromium.org>
    223
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r55536 r55575  
    468468    canShowSourceLine: function(url, line)
    469469    {
    470         return !!WebInspector.resourceForURL(url) && InspectorBackend.resourceTrackingEnabled();
     470        return this._resourceTrackingEnabled && !!WebInspector.resourceForURL(url);
    471471    },
    472472
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r55537 r55575  
    518518    _scriptOrResourceForURLAndLine: function(url, line)
    519519    {
     520        var scriptWithMatchingUrl = null;
    520521        for (var sourceID in this._sourceIDMap) {
    521522            var scriptOrResource = this._sourceIDMap[sourceID];
    522523            if (scriptOrResource instanceof WebInspector.Script) {
    523                 var script = scriptOrResource;
    524                 if (script.startingLine <= line && script.startingLine + script.linesCount > line)
    525                     return script;
     524                if (scriptOrResource.sourceURL !== url)
     525                    continue;
     526                scriptWithMatchingUrl = scriptOrResource;
     527                if (scriptWithMatchingUrl.startingLine <= line && scriptWithMatchingUrl.startingLine + scriptWithMatchingUrl.linesCount > line)
     528                    return scriptWithMatchingUrl;
    526529            } else {
    527530                var resource = scriptOrResource;
     
    530533            }
    531534        }
    532         return null;
     535        return scriptWithMatchingUrl;
    533536    },
    534537
     
    691694        option.url = displayName;
    692695        option.startingLine = script.startingLine;
    693         option.text = script.resource ? displayName : String.sprintf("%s:%d", displayName, script.startingLine);
     696        option.text = script.resource || script.startingLine === 1 ? displayName : String.sprintf("%s:%d", displayName, script.startingLine);
    694697
    695698        function optionCompare(a, b)
  • trunk/WebCore/inspector/front-end/TimelinePanel.js

    r55530 r55575  
    240240    },
    241241
     242    hide: function()
     243    {
     244        WebInspector.Panel.prototype.hide.call(this);
     245        this._closeRecordDetails();
     246    },
     247
    242248    _onScroll: function(event)
    243249    {
  • trunk/WebCore/inspector/front-end/inspector.js

    r55537 r55575  
    618618
    619619    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     }
     620    if (!anchor.hasStyleClass("webkit-html-resource-link"))
     621        return;
     622    if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel) || WebInspector.ProfileType.URLRegExp.exec(anchor.href)) {
     623        if (event.target.originalTitle)
     624            event.target.title = event.target.originalTitle;
     625        return;
     626    }
     627
     628    if (!event.target.originalTitle)
     629        event.target.originalTitle = event.target.title;
     630    event.target.title = WebInspector.UIString("Cannot open this link. Make sure that resource tracking is enabled in the Resources panel.");
    651631}
    652632
     
    688668            return;
    689669        }
    690 
    691         WebInspector.showBadLinkPopup(anchor);
    692670    }
    693671
     
    704682
    705683    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;
    761684}
    762685
     
    17221645    doc.addEventListener("click", this.documentClick.bind(this), true);
    17231646    doc.addEventListener("mouseover", this.documentMouseOver.bind(this), true);
    1724     doc.addEventListener("mouseout", this.documentMouseOut.bind(this), true);
    17251647}
    17261648
  • trunk/WebKit/chromium/ChangeLog

    r55572 r55575  
     12010-03-05  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Do not show link helper in popovers and/or for external resources.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=35785
     8
     9        * src/js/DebuggerAgent.js:
     10        (devtools.DebuggerAgent.prototype.initUI):
     11        (devtools.DebuggerAgent.prototype.addScriptInfo_):
     12
    1132010-03-04  Garret Kelly  <gdk@chromium.org>
    214
  • trunk/WebKit/chromium/src/js/DebuggerAgent.js

    r55077 r55575  
    182182        for (var scriptId in this.parsedScripts_) {
    183183          var script = this.parsedScripts_[scriptId];
    184           WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset());
     184          WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1);
    185185        }
    186186        return;
     
    927927    if (this.scriptsPanelInitialized_) {
    928928        // Only report script as parsed after scripts panel has been shown.
    929         WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset);
     929        WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1);
    930930    }
    931931};
Note: See TracChangeset for help on using the changeset viewer.