Skip to content
Permalink
Browse files
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):


Canonical link: https://commits.webkit.org/46872@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pavelfeldman committed Mar 5, 2010
1 parent 918a1d9 commit b79100a228e1374c7fbba4305d26c4a026d14b3e
Showing 8 changed files with 58 additions and 94 deletions.
@@ -1,3 +1,24 @@
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):

2010-03-05 Fumitoshi Ukai <ukai@chromium.org>

Reviewed by Alexey Proskuryakov.
Binary file not shown.
@@ -467,7 +467,7 @@ WebInspector.ResourcesPanel.prototype = {

canShowSourceLine: function(url, line)
{
return !!WebInspector.resourceForURL(url) && InspectorBackend.resourceTrackingEnabled();
return this._resourceTrackingEnabled && !!WebInspector.resourceForURL(url);
},

showSourceLine: function(url, line)
@@ -517,19 +517,22 @@ WebInspector.ScriptsPanel.prototype = {

_scriptOrResourceForURLAndLine: function(url, line)
{
var scriptWithMatchingUrl = null;
for (var sourceID in this._sourceIDMap) {
var scriptOrResource = this._sourceIDMap[sourceID];
if (scriptOrResource instanceof WebInspector.Script) {
var script = scriptOrResource;
if (script.startingLine <= line && script.startingLine + script.linesCount > line)
return script;
if (scriptOrResource.sourceURL !== url)
continue;
scriptWithMatchingUrl = scriptOrResource;
if (scriptWithMatchingUrl.startingLine <= line && scriptWithMatchingUrl.startingLine + scriptWithMatchingUrl.linesCount > line)
return scriptWithMatchingUrl;
} else {
var resource = scriptOrResource;
if (resource.url === url)
return resource;
}
}
return null;
return scriptWithMatchingUrl;
},

showView: function(view)
@@ -690,7 +693,7 @@ WebInspector.ScriptsPanel.prototype = {
option.representedObject = script.resource || script;
option.url = displayName;
option.startingLine = script.startingLine;
option.text = script.resource ? displayName : String.sprintf("%s:%d", displayName, script.startingLine);
option.text = script.resource || script.startingLine === 1 ? displayName : String.sprintf("%s:%d", displayName, script.startingLine);

function optionCompare(a, b)
{
@@ -239,6 +239,12 @@ WebInspector.TimelinePanel.prototype = {
this._refresh();
},

hide: function()
{
WebInspector.Panel.prototype.hide.call(this);
this._closeRecordDetails();
},

_onScroll: function(event)
{
this._closeRecordDetails();
@@ -617,37 +617,17 @@ WebInspector.documentMouseOver = function(event)
return;

const anchor = event.target;
if (!anchor.hasStyleClass("webkit-html-external-link") && !anchor.hasStyleClass("webkit-html-resource-link"))
if (!anchor.hasStyleClass("webkit-html-resource-link"))
return;

if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel) || WebInspector.ProfileType.URLRegExp.exec(anchor.href))
return;

WebInspector._showPopupTimer = setTimeout(WebInspector.showBadLinkPopup.bind(WebInspector, anchor), 250);
}

WebInspector.documentMouseOut = function(event)
{
if (event.target.tagName !== "A")
if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel) || WebInspector.ProfileType.URLRegExp.exec(anchor.href)) {
if (event.target.originalTitle)
event.target.title = event.target.originalTitle;
return;

if (WebInspector._showPopupTimer) {
clearTimeout(WebInspector._showPopupTimer);
delete WebInspector._showPopupTimer;
} else if (WebInspector._badLinkPopup && !this._mouseOverPopup)
WebInspector._hidePopupTimer = setTimeout(WebInspector.hideBadLinkPopupIfNecessary.bind(WebInspector), 750);
}

WebInspector.hideBadLinkPopupIfNecessary = function()
{
if (!this._badLinkPopup)
return;
this._badLinkPopup.hide();
delete this._badLinkPopup;
if (this._hidePopupTimer) {
clearTimeout(this._hidePopupTimer);
delete this._hidePopupTimer;
}

if (!event.target.originalTitle)
event.target.originalTitle = event.target.title;
event.target.title = WebInspector.UIString("Cannot open this link. Make sure that resource tracking is enabled in the Resources panel.");
}

WebInspector.documentClick = function(event)
@@ -687,8 +667,6 @@ WebInspector.documentClick = function(event)
}
return;
}

WebInspector.showBadLinkPopup(anchor);
}

if (WebInspector.followLinkTimeout)
@@ -705,61 +683,6 @@ WebInspector.documentClick = function(event)
followLink();
}

WebInspector.showBadLinkPopup = function(anchor)
{
this.hideBadLinkPopupIfNecessary();

// Show an info popup for a link that cannot be opened right away.
var popupContentElement = document.createElement("span");
popupContentElement.className = "monospace";

var message = WebInspector.UIString(
"Cannot open this link. Make sure that resource tracking is enabled in the %s panel.");
var anchorIndex = message.indexOf("%s");
if (anchorIndex < 0) {
var leftPart = message;
var rightPart = "";
} else {
var leftPart = message.substring(0, anchorIndex);
var panelAnchorElement = document.createElement("a");
panelAnchorElement.href = "webkit-link-action://show-panel/resources";
panelAnchorElement.textContent = WebInspector.UIString("Resources");
var rightPart = message.substring(anchorIndex + 2);
}
popupContentElement.appendChild(document.createTextNode(leftPart));
if (panelAnchorElement)
popupContentElement.appendChild(panelAnchorElement);
popupContentElement.appendChild(document.createTextNode(rightPart));
var popup = new WebInspector.Popover(popupContentElement);

if (panelAnchorElement)
panelAnchorElement.addEventListener("click", this.hideBadLinkPopupIfNecessary.bind(this));

function popupOverOut(event)
{
if (event.type === "mouseover") {
if (this._mouseOverPopup)
return; // Entered from child.
clearTimeout(this._hidePopupTimer);
delete this._hidePopupTimer;
this._mouseOverPopup = true;
} else {
const relTarget = event.relatedTarget;
if (relTarget && relTarget.enclosingNodeOrSelfWithClass("popover"))
return; // Leaving to child.
delete this._mouseOverPopup;
this.hideBadLinkPopupIfNecessary();
}
}
const boundHandler = popupOverOut.bind(this);
popupContentElement.addEventListener("mouseover", boundHandler, true);
popupContentElement.addEventListener("mouseout", boundHandler, true);

popup.show(anchor);
this._badLinkPopup = popup;
delete this._showPopupTimer;
}

WebInspector.documentKeyDown = function(event)
{
if (this.currentFocusElement && this.currentFocusElement.handleKeyEvent) {
@@ -1721,7 +1644,6 @@ WebInspector.addMainEventListeners = function(doc)
doc.defaultView.addEventListener("blur", this.windowBlurred.bind(this), false);
doc.addEventListener("click", this.documentClick.bind(this), true);
doc.addEventListener("mouseover", this.documentMouseOver.bind(this), true);
doc.addEventListener("mouseout", this.documentMouseOut.bind(this), true);
}

WebInspector._searchFieldManualFocus = function(event)
@@ -1,3 +1,15 @@
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

* src/js/DebuggerAgent.js:
(devtools.DebuggerAgent.prototype.initUI):
(devtools.DebuggerAgent.prototype.addScriptInfo_):

2010-03-04 Garret Kelly <gdk@chromium.org>

Reviewed by Darin Fisher.
@@ -181,7 +181,7 @@ devtools.DebuggerAgent.prototype.initUI = function()
// pending addition into the UI.
for (var scriptId in this.parsedScripts_) {
var script = this.parsedScripts_[scriptId];
WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset());
WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1);
}
return;
}
@@ -926,7 +926,7 @@ devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg)
this.parsedScripts_[script.id] = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType);
if (this.scriptsPanelInitialized_) {
// Only report script as parsed after scripts panel has been shown.
WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset);
WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1);
}
};

0 comments on commit b79100a

Please sign in to comment.