| Index: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
|
| index c04bfa94989c0746a4badcbc4d676086254c0330..be81f73bad6690a9cd1c71e744143987657bb001 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
|
| @@ -29,58 +29,58 @@
|
| */
|
|
|
| /**
|
| - * @implements {WebInspector.TargetManager.Observer}
|
| + * @implements {SDK.TargetManager.Observer}
|
| * @unrestricted
|
| */
|
| -WebInspector.Linkifier = class {
|
| +Components.Linkifier = class {
|
| /**
|
| * @param {number=} maxLengthForDisplayedURLs
|
| * @param {boolean=} useLinkDecorator
|
| */
|
| constructor(maxLengthForDisplayedURLs, useLinkDecorator) {
|
| - this._maxLength = maxLengthForDisplayedURLs || WebInspector.Linkifier.MaxLengthForDisplayedURLs;
|
| - /** @type {!Map<!WebInspector.Target, !Array<!Element>>} */
|
| + this._maxLength = maxLengthForDisplayedURLs || Components.Linkifier.MaxLengthForDisplayedURLs;
|
| + /** @type {!Map<!SDK.Target, !Array<!Element>>} */
|
| this._anchorsByTarget = new Map();
|
| - /** @type {!Map<!WebInspector.Target, !WebInspector.LiveLocationPool>} */
|
| + /** @type {!Map<!SDK.Target, !Bindings.LiveLocationPool>} */
|
| this._locationPoolByTarget = new Map();
|
| this._useLinkDecorator = !!useLinkDecorator;
|
| - WebInspector.Linkifier._instances.add(this);
|
| - WebInspector.targetManager.observeTargets(this);
|
| + Components.Linkifier._instances.add(this);
|
| + SDK.targetManager.observeTargets(this);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.LinkDecorator} decorator
|
| + * @param {!Components.LinkDecorator} decorator
|
| */
|
| static setLinkDecorator(decorator) {
|
| - console.assert(!WebInspector.Linkifier._decorator, 'Cannot re-register link decorator.');
|
| - WebInspector.Linkifier._decorator = decorator;
|
| - decorator.addEventListener(WebInspector.LinkDecorator.Events.LinkIconChanged, onLinkIconChanged);
|
| - for (var linkifier of WebInspector.Linkifier._instances)
|
| + console.assert(!Components.Linkifier._decorator, 'Cannot re-register link decorator.');
|
| + Components.Linkifier._decorator = decorator;
|
| + decorator.addEventListener(Components.LinkDecorator.Events.LinkIconChanged, onLinkIconChanged);
|
| + for (var linkifier of Components.Linkifier._instances)
|
| linkifier._updateAllAnchorDecorations();
|
|
|
| /**
|
| - * @param {!WebInspector.Event} event
|
| + * @param {!Common.Event} event
|
| */
|
| function onLinkIconChanged(event) {
|
| - var uiSourceCode = /** @type {!WebInspector.UISourceCode} */(event.data);
|
| - var links = uiSourceCode[WebInspector.Linkifier._sourceCodeAnchors] || [];
|
| + var uiSourceCode = /** @type {!Workspace.UISourceCode} */(event.data);
|
| + var links = uiSourceCode[Components.Linkifier._sourceCodeAnchors] || [];
|
| for (var link of links)
|
| - WebInspector.Linkifier._updateLinkDecorations(link);
|
| + Components.Linkifier._updateLinkDecorations(link);
|
| }
|
| }
|
|
|
| _updateAllAnchorDecorations() {
|
| for (var anchors of this._anchorsByTarget.values()) {
|
| for (var anchor of anchors)
|
| - WebInspector.Linkifier._updateLinkDecorations(anchor);
|
| + Components.Linkifier._updateLinkDecorations(anchor);
|
| }
|
| }
|
|
|
| /**
|
| - * @param {?WebInspector.Linkifier.LinkHandler} handler
|
| + * @param {?Components.Linkifier.LinkHandler} handler
|
| */
|
| static setLinkHandler(handler) {
|
| - WebInspector.Linkifier._linkHandler = handler;
|
| + Components.Linkifier._linkHandler = handler;
|
| }
|
|
|
| /**
|
| @@ -89,9 +89,9 @@ WebInspector.Linkifier = class {
|
| * @return {boolean}
|
| */
|
| static handleLink(url, lineNumber) {
|
| - if (!WebInspector.Linkifier._linkHandler)
|
| + if (!Components.Linkifier._linkHandler)
|
| return false;
|
| - return WebInspector.Linkifier._linkHandler.handleLink(url, lineNumber);
|
| + return Components.Linkifier._linkHandler.handleLink(url, lineNumber);
|
| }
|
|
|
| /**
|
| @@ -106,7 +106,7 @@ WebInspector.Linkifier = class {
|
| static linkifyUsingRevealer(revealable, text, fallbackHref, fallbackLineNumber, title, classes) {
|
| var a = createElement('a');
|
| a.className = (classes || '') + ' webkit-html-resource-link';
|
| - a.textContent = text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);
|
| + a.textContent = text.trimMiddle(Components.Linkifier.MaxLengthForDisplayedURLs);
|
| a.title = title || text;
|
| if (fallbackHref) {
|
| a.href = fallbackHref;
|
| @@ -120,10 +120,10 @@ WebInspector.Linkifier = class {
|
| function clickHandler(event) {
|
| event.stopImmediatePropagation();
|
| event.preventDefault();
|
| - if (fallbackHref && WebInspector.Linkifier.handleLink(fallbackHref, fallbackLineNumber))
|
| + if (fallbackHref && Components.Linkifier.handleLink(fallbackHref, fallbackLineNumber))
|
| return;
|
|
|
| - WebInspector.Revealer.reveal(this);
|
| + Common.Revealer.reveal(this);
|
| }
|
| a.addEventListener('click', clickHandler.bind(revealable), false);
|
| return a;
|
| @@ -131,25 +131,25 @@ WebInspector.Linkifier = class {
|
|
|
| /**
|
| * @param {!Element} anchor
|
| - * @return {?WebInspector.UILocation} uiLocation
|
| + * @return {?Workspace.UILocation} uiLocation
|
| */
|
| static uiLocationByAnchor(anchor) {
|
| - return anchor[WebInspector.Linkifier._uiLocationSymbol];
|
| + return anchor[Components.Linkifier._uiLocationSymbol];
|
| }
|
|
|
| /**
|
| * @param {!Element} anchor
|
| - * @param {!WebInspector.UILocation} uiLocation
|
| + * @param {!Workspace.UILocation} uiLocation
|
| */
|
| static _bindUILocation(anchor, uiLocation) {
|
| - anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation;
|
| + anchor[Components.Linkifier._uiLocationSymbol] = uiLocation;
|
| if (!uiLocation)
|
| return;
|
| var uiSourceCode = uiLocation.uiSourceCode;
|
| - var sourceCodeAnchors = uiSourceCode[WebInspector.Linkifier._sourceCodeAnchors];
|
| + var sourceCodeAnchors = uiSourceCode[Components.Linkifier._sourceCodeAnchors];
|
| if (!sourceCodeAnchors) {
|
| sourceCodeAnchors = new Set();
|
| - uiSourceCode[WebInspector.Linkifier._sourceCodeAnchors] = sourceCodeAnchors;
|
| + uiSourceCode[Components.Linkifier._sourceCodeAnchors] = sourceCodeAnchors;
|
| }
|
| sourceCodeAnchors.add(anchor);
|
| }
|
| @@ -158,71 +158,71 @@ WebInspector.Linkifier = class {
|
| * @param {!Element} anchor
|
| */
|
| static _unbindUILocation(anchor) {
|
| - if (!anchor[WebInspector.Linkifier._uiLocationSymbol])
|
| + if (!anchor[Components.Linkifier._uiLocationSymbol])
|
| return;
|
|
|
| - var uiSourceCode = anchor[WebInspector.Linkifier._uiLocationSymbol].uiSourceCode;
|
| - anchor[WebInspector.Linkifier._uiLocationSymbol] = null;
|
| - var sourceCodeAnchors = uiSourceCode[WebInspector.Linkifier._sourceCodeAnchors];
|
| + var uiSourceCode = anchor[Components.Linkifier._uiLocationSymbol].uiSourceCode;
|
| + anchor[Components.Linkifier._uiLocationSymbol] = null;
|
| + var sourceCodeAnchors = uiSourceCode[Components.Linkifier._sourceCodeAnchors];
|
| if (sourceCodeAnchors)
|
| sourceCodeAnchors.delete(anchor);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Target} target
|
| + * @param {!SDK.Target} target
|
| * @param {string} scriptId
|
| * @param {number} lineNumber
|
| * @param {number=} columnNumber
|
| * @return {string}
|
| */
|
| static liveLocationText(target, scriptId, lineNumber, columnNumber) {
|
| - var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
|
| + var debuggerModel = SDK.DebuggerModel.fromTarget(target);
|
| if (!debuggerModel)
|
| return '';
|
| var script = debuggerModel.scriptForId(scriptId);
|
| if (!script)
|
| return '';
|
| - var location = /** @type {!WebInspector.DebuggerModel.Location} */ (
|
| + var location = /** @type {!SDK.DebuggerModel.Location} */ (
|
| debuggerModel.createRawLocation(script, lineNumber, columnNumber || 0));
|
| - var uiLocation = /** @type {!WebInspector.UILocation} */ (
|
| - WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(location));
|
| + var uiLocation = /** @type {!Workspace.UILocation} */ (
|
| + Bindings.debuggerWorkspaceBinding.rawLocationToUILocation(location));
|
| return uiLocation.linkText();
|
| }
|
|
|
| /**
|
| * @override
|
| - * @param {!WebInspector.Target} target
|
| + * @param {!SDK.Target} target
|
| */
|
| targetAdded(target) {
|
| this._anchorsByTarget.set(target, []);
|
| - this._locationPoolByTarget.set(target, new WebInspector.LiveLocationPool());
|
| + this._locationPoolByTarget.set(target, new Bindings.LiveLocationPool());
|
| }
|
|
|
| /**
|
| * @override
|
| - * @param {!WebInspector.Target} target
|
| + * @param {!SDK.Target} target
|
| */
|
| targetRemoved(target) {
|
| - var locationPool = /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarget.remove(target));
|
| + var locationPool = /** @type {!Bindings.LiveLocationPool} */ (this._locationPoolByTarget.remove(target));
|
| locationPool.disposeAll();
|
| var anchors = this._anchorsByTarget.remove(target);
|
| for (var anchor of anchors) {
|
| - delete anchor[WebInspector.Linkifier._liveLocationSymbol];
|
| - WebInspector.Linkifier._unbindUILocation(anchor);
|
| - var fallbackAnchor = anchor[WebInspector.Linkifier._fallbackAnchorSymbol];
|
| + delete anchor[Components.Linkifier._liveLocationSymbol];
|
| + Components.Linkifier._unbindUILocation(anchor);
|
| + var fallbackAnchor = anchor[Components.Linkifier._fallbackAnchorSymbol];
|
| if (fallbackAnchor) {
|
| anchor.href = fallbackAnchor.href;
|
| anchor.lineNumber = fallbackAnchor.lineNumber;
|
| anchor.title = fallbackAnchor.title;
|
| anchor.className = fallbackAnchor.className;
|
| anchor.textContent = fallbackAnchor.textContent;
|
| - delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol];
|
| + delete anchor[Components.Linkifier._fallbackAnchorSymbol];
|
| }
|
| }
|
| }
|
|
|
| /**
|
| - * @param {?WebInspector.Target} target
|
| + * @param {?SDK.Target} target
|
| * @param {?string} scriptId
|
| * @param {string} sourceURL
|
| * @param {number} lineNumber
|
| @@ -232,10 +232,10 @@ WebInspector.Linkifier = class {
|
| */
|
| maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumber, classes) {
|
| var fallbackAnchor =
|
| - sourceURL ? WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes) : null;
|
| + sourceURL ? Components.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes) : null;
|
| if (!target || target.isDisposed())
|
| return fallbackAnchor;
|
| - var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
|
| + var debuggerModel = SDK.DebuggerModel.fromTarget(target);
|
| if (!debuggerModel)
|
| return fallbackAnchor;
|
|
|
| @@ -246,18 +246,18 @@ WebInspector.Linkifier = class {
|
| return fallbackAnchor;
|
|
|
| var anchor = this._createAnchor(classes);
|
| - var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocation(
|
| + var liveLocation = Bindings.debuggerWorkspaceBinding.createLiveLocation(
|
| rawLocation, this._updateAnchor.bind(this, anchor),
|
| - /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarget.get(rawLocation.target())));
|
| + /** @type {!Bindings.LiveLocationPool} */ (this._locationPoolByTarget.get(rawLocation.target())));
|
| var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(rawLocation.target()));
|
| anchors.push(anchor);
|
| - anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation;
|
| - anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor;
|
| + anchor[Components.Linkifier._liveLocationSymbol] = liveLocation;
|
| + anchor[Components.Linkifier._fallbackAnchorSymbol] = fallbackAnchor;
|
| return anchor;
|
| }
|
|
|
| /**
|
| - * @param {?WebInspector.Target} target
|
| + * @param {?SDK.Target} target
|
| * @param {?string} scriptId
|
| * @param {string} sourceURL
|
| * @param {number} lineNumber
|
| @@ -267,11 +267,11 @@ WebInspector.Linkifier = class {
|
| */
|
| linkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumber, classes) {
|
| return this.maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumber, classes) ||
|
| - WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes);
|
| + Components.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes);
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.DebuggerModel.Location} rawLocation
|
| + * @param {!SDK.DebuggerModel.Location} rawLocation
|
| * @param {string} fallbackUrl
|
| * @param {string=} classes
|
| * @return {!Element}
|
| @@ -283,7 +283,7 @@ WebInspector.Linkifier = class {
|
| }
|
|
|
| /**
|
| - * @param {?WebInspector.Target} target
|
| + * @param {?SDK.Target} target
|
| * @param {!Protocol.Runtime.CallFrame} callFrame
|
| * @param {string=} classes
|
| * @return {?Element}
|
| @@ -294,7 +294,7 @@ WebInspector.Linkifier = class {
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Target} target
|
| + * @param {!SDK.Target} target
|
| * @param {!Protocol.Runtime.StackTrace} stackTrace
|
| * @param {string=} classes
|
| * @return {!Element}
|
| @@ -304,53 +304,53 @@ WebInspector.Linkifier = class {
|
|
|
| var topFrame = stackTrace.callFrames[0];
|
| var fallbackAnchor =
|
| - WebInspector.linkifyResourceAsNode(topFrame.url, topFrame.lineNumber, topFrame.columnNumber, classes);
|
| + Components.linkifyResourceAsNode(topFrame.url, topFrame.lineNumber, topFrame.columnNumber, classes);
|
| if (target.isDisposed())
|
| return fallbackAnchor;
|
|
|
| - var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
|
| + var debuggerModel = SDK.DebuggerModel.fromTarget(target);
|
| var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTrace);
|
| if (rawLocations.length === 0)
|
| return fallbackAnchor;
|
|
|
| var anchor = this._createAnchor(classes);
|
| - var liveLocation = WebInspector.debuggerWorkspaceBinding.createStackTraceTopFrameLiveLocation(
|
| + var liveLocation = Bindings.debuggerWorkspaceBinding.createStackTraceTopFrameLiveLocation(
|
| rawLocations, this._updateAnchor.bind(this, anchor),
|
| - /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarget.get(target)));
|
| + /** @type {!Bindings.LiveLocationPool} */ (this._locationPoolByTarget.get(target)));
|
| var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(target));
|
| anchors.push(anchor);
|
| - anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation;
|
| - anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor;
|
| + anchor[Components.Linkifier._liveLocationSymbol] = liveLocation;
|
| + anchor[Components.Linkifier._fallbackAnchorSymbol] = fallbackAnchor;
|
| return anchor;
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.CSSLocation} rawLocation
|
| + * @param {!SDK.CSSLocation} rawLocation
|
| * @param {string=} classes
|
| * @return {!Element}
|
| */
|
| linkifyCSSLocation(rawLocation, classes) {
|
| var anchor = this._createAnchor(classes);
|
| - var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation(
|
| + var liveLocation = Bindings.cssWorkspaceBinding.createLiveLocation(
|
| rawLocation, this._updateAnchor.bind(this, anchor),
|
| - /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarget.get(rawLocation.target())));
|
| + /** @type {!Bindings.LiveLocationPool} */ (this._locationPoolByTarget.get(rawLocation.target())));
|
| var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(rawLocation.target()));
|
| anchors.push(anchor);
|
| - anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation;
|
| + anchor[Components.Linkifier._liveLocationSymbol] = liveLocation;
|
| return anchor;
|
| }
|
|
|
| /**
|
| - * @param {!WebInspector.Target} target
|
| + * @param {!SDK.Target} target
|
| * @param {!Element} anchor
|
| */
|
| disposeAnchor(target, anchor) {
|
| - WebInspector.Linkifier._unbindUILocation(anchor);
|
| - delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol];
|
| - var liveLocation = anchor[WebInspector.Linkifier._liveLocationSymbol];
|
| + Components.Linkifier._unbindUILocation(anchor);
|
| + delete anchor[Components.Linkifier._fallbackAnchorSymbol];
|
| + var liveLocation = anchor[Components.Linkifier._liveLocationSymbol];
|
| if (liveLocation)
|
| liveLocation.dispose();
|
| - delete anchor[WebInspector.Linkifier._liveLocationSymbol];
|
| + delete anchor[Components.Linkifier._liveLocationSymbol];
|
| }
|
|
|
| /**
|
| @@ -360,21 +360,21 @@ WebInspector.Linkifier = class {
|
| _createAnchor(classes) {
|
| var anchor = createElement('a');
|
| if (this._useLinkDecorator)
|
| - anchor[WebInspector.Linkifier._enableDecoratorSymbol] = true;
|
| + anchor[Components.Linkifier._enableDecoratorSymbol] = true;
|
| anchor.className = (classes || '') + ' webkit-html-resource-link';
|
|
|
| /**
|
| * @param {!Event} event
|
| */
|
| function clickHandler(event) {
|
| - var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol];
|
| + var uiLocation = anchor[Components.Linkifier._uiLocationSymbol];
|
| if (!uiLocation)
|
| return;
|
|
|
| event.consume(true);
|
| - if (WebInspector.Linkifier.handleLink(uiLocation.uiSourceCode.url(), uiLocation.lineNumber))
|
| + if (Components.Linkifier.handleLink(uiLocation.uiSourceCode.url(), uiLocation.lineNumber))
|
| return;
|
| - WebInspector.Revealer.reveal(uiLocation);
|
| + Common.Revealer.reveal(uiLocation);
|
| }
|
| anchor.addEventListener('click', clickHandler, false);
|
| return anchor;
|
| @@ -390,21 +390,21 @@ WebInspector.Linkifier = class {
|
| dispose() {
|
| for (var target of this._anchorsByTarget.keysArray())
|
| this.targetRemoved(target);
|
| - WebInspector.targetManager.unobserveTargets(this);
|
| - WebInspector.Linkifier._instances.delete(this);
|
| + SDK.targetManager.unobserveTargets(this);
|
| + Components.Linkifier._instances.delete(this);
|
| }
|
|
|
| /**
|
| * @param {!Element} anchor
|
| - * @param {!WebInspector.LiveLocation} liveLocation
|
| + * @param {!Bindings.LiveLocation} liveLocation
|
| */
|
| _updateAnchor(anchor, liveLocation) {
|
| - WebInspector.Linkifier._unbindUILocation(anchor);
|
| + Components.Linkifier._unbindUILocation(anchor);
|
| var uiLocation = liveLocation.uiLocation();
|
| if (!uiLocation)
|
| return;
|
|
|
| - WebInspector.Linkifier._bindUILocation(anchor, uiLocation);
|
| + Components.Linkifier._bindUILocation(anchor, uiLocation);
|
| var text = uiLocation.linkText();
|
| text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, '$1\u2026');
|
| if (this._maxLength)
|
| @@ -416,62 +416,62 @@ WebInspector.Linkifier = class {
|
| titleText += ':' + (uiLocation.lineNumber + 1);
|
| anchor.title = titleText;
|
| anchor.classList.toggle('webkit-html-blackbox-link', liveLocation.isBlackboxed());
|
| - WebInspector.Linkifier._updateLinkDecorations(anchor);
|
| + Components.Linkifier._updateLinkDecorations(anchor);
|
| }
|
|
|
| /**
|
| * @param {!Element} anchor
|
| */
|
| static _updateLinkDecorations(anchor) {
|
| - if (!anchor[WebInspector.Linkifier._enableDecoratorSymbol])
|
| + if (!anchor[Components.Linkifier._enableDecoratorSymbol])
|
| return;
|
| - var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol];
|
| - if (!WebInspector.Linkifier._decorator || !uiLocation)
|
| + var uiLocation = anchor[Components.Linkifier._uiLocationSymbol];
|
| + if (!Components.Linkifier._decorator || !uiLocation)
|
| return;
|
| - var icon = anchor[WebInspector.Linkifier._iconSymbol];
|
| + var icon = anchor[Components.Linkifier._iconSymbol];
|
| if (icon)
|
| icon.remove();
|
| - icon = WebInspector.Linkifier._decorator.linkIcon(uiLocation.uiSourceCode);
|
| + icon = Components.Linkifier._decorator.linkIcon(uiLocation.uiSourceCode);
|
| if (icon) {
|
| icon.style.setProperty('margin-right', '2px');
|
| anchor.insertBefore(icon, anchor.firstChild);
|
| }
|
| - anchor[WebInspector.Linkifier._iconSymbol] = icon;
|
| + anchor[Components.Linkifier._iconSymbol] = icon;
|
| }
|
| };
|
|
|
| -/** @type {!Set<!WebInspector.Linkifier>} */
|
| -WebInspector.Linkifier._instances = new Set();
|
| -/** @type {?WebInspector.LinkDecorator} */
|
| -WebInspector.Linkifier._decorator = null;
|
| +/** @type {!Set<!Components.Linkifier>} */
|
| +Components.Linkifier._instances = new Set();
|
| +/** @type {?Components.LinkDecorator} */
|
| +Components.Linkifier._decorator = null;
|
|
|
| -WebInspector.Linkifier._iconSymbol = Symbol('Linkifier.iconSymbol');
|
| -WebInspector.Linkifier._enableDecoratorSymbol = Symbol('Linkifier.enableIconsSymbol');
|
| -WebInspector.Linkifier._sourceCodeAnchors = Symbol('Linkifier.anchors');
|
| -WebInspector.Linkifier._uiLocationSymbol = Symbol('uiLocation');
|
| -WebInspector.Linkifier._fallbackAnchorSymbol = Symbol('fallbackAnchor');
|
| -WebInspector.Linkifier._liveLocationSymbol = Symbol('liveLocation');
|
| +Components.Linkifier._iconSymbol = Symbol('Linkifier.iconSymbol');
|
| +Components.Linkifier._enableDecoratorSymbol = Symbol('Linkifier.enableIconsSymbol');
|
| +Components.Linkifier._sourceCodeAnchors = Symbol('Linkifier.anchors');
|
| +Components.Linkifier._uiLocationSymbol = Symbol('uiLocation');
|
| +Components.Linkifier._fallbackAnchorSymbol = Symbol('fallbackAnchor');
|
| +Components.Linkifier._liveLocationSymbol = Symbol('liveLocation');
|
|
|
| /**
|
| * The maximum number of characters to display in a URL.
|
| * @const
|
| * @type {number}
|
| */
|
| -WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150;
|
| +Components.Linkifier.MaxLengthForDisplayedURLs = 150;
|
|
|
| /**
|
| * The maximum length before strings are considered too long for finding URLs.
|
| * @const
|
| * @type {number}
|
| */
|
| -WebInspector.Linkifier.MaxLengthToIgnoreLinkifier = 10000;
|
| +Components.Linkifier.MaxLengthToIgnoreLinkifier = 10000;
|
|
|
| /**
|
| * @interface
|
| */
|
| -WebInspector.Linkifier.LinkHandler = function() {};
|
| +Components.Linkifier.LinkHandler = function() {};
|
|
|
| -WebInspector.Linkifier.LinkHandler.prototype = {
|
| +Components.Linkifier.LinkHandler.prototype = {
|
| /**
|
| * @param {string} url
|
| * @param {number=} lineNumber
|
| @@ -481,20 +481,20 @@ WebInspector.Linkifier.LinkHandler.prototype = {
|
| };
|
|
|
| /**
|
| - * @extends {WebInspector.EventTarget}
|
| + * @extends {Common.EventTarget}
|
| * @interface
|
| */
|
| -WebInspector.LinkDecorator = function() {};
|
| +Components.LinkDecorator = function() {};
|
|
|
| -WebInspector.LinkDecorator.prototype = {
|
| +Components.LinkDecorator.prototype = {
|
| /**
|
| - * @param {!WebInspector.UISourceCode} uiSourceCode
|
| - * @return {?WebInspector.Icon}
|
| + * @param {!Workspace.UISourceCode} uiSourceCode
|
| + * @return {?UI.Icon}
|
| */
|
| linkIcon: function(uiSourceCode) {}
|
| };
|
|
|
| -WebInspector.LinkDecorator.Events = {
|
| +Components.LinkDecorator.Events = {
|
| LinkIconChanged: Symbol('LinkIconChanged')
|
| };
|
|
|
| @@ -503,13 +503,13 @@ WebInspector.LinkDecorator.Events = {
|
| * @param {function(string,string,number=,number=):!Node} linkifier
|
| * @return {!DocumentFragment}
|
| */
|
| -WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linkifier) {
|
| +Components.linkifyStringAsFragmentWithCustomLinkifier = function(string, linkifier) {
|
| var container = createDocumentFragment();
|
| var linkStringRegEx =
|
| /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;
|
| var pathLineRegex = /(?:\/[\w\.-]*)+\:[\d]+/;
|
|
|
| - while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLinkifier) {
|
| + while (string && string.length < Components.Linkifier.MaxLengthToIgnoreLinkifier) {
|
| var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(string);
|
| if (!linkString)
|
| break;
|
| @@ -521,7 +521,7 @@ WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
|
|
|
| var title = linkString;
|
| var realURL = (linkString.startsWith('www.') ? 'http://' + linkString : linkString);
|
| - var splitResult = WebInspector.ParsedURL.splitLineAndColumn(realURL);
|
| + var splitResult = Common.ParsedURL.splitLineAndColumn(realURL);
|
| var linkNode;
|
| if (splitResult)
|
| linkNode = linkifier(title, splitResult.url, splitResult.lineNumber, splitResult.columnNumber);
|
| @@ -542,7 +542,7 @@ WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
|
| * @param {string} string
|
| * @return {!DocumentFragment}
|
| */
|
| -WebInspector.linkifyStringAsFragment = function(string) {
|
| +Components.linkifyStringAsFragment = function(string) {
|
| /**
|
| * @param {string} title
|
| * @param {string} url
|
| @@ -552,8 +552,8 @@ WebInspector.linkifyStringAsFragment = function(string) {
|
| */
|
| function linkifier(title, url, lineNumber, columnNumber) {
|
| var isExternal =
|
| - !WebInspector.resourceForURL(url) && !WebInspector.networkMapping.uiSourceCodeForURLForAnyTarget(url);
|
| - var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined, isExternal);
|
| + !Bindings.resourceForURL(url) && !Bindings.networkMapping.uiSourceCodeForURLForAnyTarget(url);
|
| + var urlNode = UI.linkifyURLAsNode(url, title, undefined, isExternal);
|
| if (typeof lineNumber !== 'undefined') {
|
| urlNode.lineNumber = lineNumber;
|
| if (typeof columnNumber !== 'undefined')
|
| @@ -563,7 +563,7 @@ WebInspector.linkifyStringAsFragment = function(string) {
|
| return urlNode;
|
| }
|
|
|
| - return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string, linkifier);
|
| + return Components.linkifyStringAsFragmentWithCustomLinkifier(string, linkifier);
|
| };
|
|
|
| /**
|
| @@ -575,27 +575,27 @@ WebInspector.linkifyStringAsFragment = function(string) {
|
| * @param {string=} urlDisplayName
|
| * @return {!Element}
|
| */
|
| -WebInspector.linkifyResourceAsNode = function(url, lineNumber, columnNumber, classes, tooltipText, urlDisplayName) {
|
| +Components.linkifyResourceAsNode = function(url, lineNumber, columnNumber, classes, tooltipText, urlDisplayName) {
|
| if (!url) {
|
| var element = createElementWithClass('span', classes);
|
| - element.textContent = urlDisplayName || WebInspector.UIString('(unknown)');
|
| + element.textContent = urlDisplayName || Common.UIString('(unknown)');
|
| return element;
|
| }
|
| - var linkText = urlDisplayName || WebInspector.displayNameForURL(url);
|
| + var linkText = urlDisplayName || Bindings.displayNameForURL(url);
|
| if (typeof lineNumber === 'number')
|
| linkText += ':' + (lineNumber + 1);
|
| - var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
|
| + var anchor = UI.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
|
| anchor.lineNumber = lineNumber;
|
| anchor.columnNumber = columnNumber;
|
| return anchor;
|
| };
|
|
|
| /**
|
| - * @param {!WebInspector.NetworkRequest} request
|
| + * @param {!SDK.NetworkRequest} request
|
| * @return {!Element}
|
| */
|
| -WebInspector.linkifyRequestAsNode = function(request) {
|
| - var anchor = WebInspector.linkifyURLAsNode(request.url);
|
| +Components.linkifyRequestAsNode = function(request) {
|
| + var anchor = UI.linkifyURLAsNode(request.url);
|
| anchor.requestId = request.requestId;
|
| return anchor;
|
| };
|
|
|