Diff
Modified: trunk/Source/WebCore/ChangeLog (139407 => 139408)
--- trunk/Source/WebCore/ChangeLog 2013-01-11 06:22:49 UTC (rev 139407)
+++ trunk/Source/WebCore/ChangeLog 2013-01-11 06:57:14 UTC (rev 139408)
@@ -1,3 +1,22 @@
+2012-12-28 Andrey Adaikin <aand...@chromium.org>
+
+ Web Inspector: [Canvas] add an option to reload the page if there is an uninstrumented canvas
+ https://bugs.webkit.org/show_bug.cgi?id=105822
+
+ Reviewed by Pavel Feldman.
+
+ Show in the front-end an option to reload the page if there is an uninstrumented canvas.
+
+ * inspector/front-end/CanvasProfileView.js:
+ (WebInspector.CanvasProfileType):
+ (WebInspector.CanvasProfileType.prototype.decorationElement):
+ (WebInspector.CanvasProfileType.prototype._updateDecorationElement):
+ (WebInspector.CanvasProfileType.prototype._onReloadPageButtonClick):
+ * inspector/front-end/ProfileLauncherView.js:
+ (WebInspector.ProfileLauncherView.prototype.addProfileType):
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfileType.prototype.decorationElement):
+
2013-01-10 Dimitri Glazkov <dglaz...@chromium.org>
The word "selector" is somewhat redundant redundantly used in SelectorChecker.
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (139407 => 139408)
--- trunk/Source/WebCore/English.lproj/localizedStrings.js 2013-01-11 06:22:49 UTC (rev 139407)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js 2013-01-11 06:57:14 UTC (rev 139408)
@@ -776,6 +776,8 @@
localizedStrings["CANVAS PROFILE"] = "CANVAS PROFILE";
localizedStrings["Canvas calls instrumentation"] = "Canvas calls instrumentation";
localizedStrings["Capturing\u2026"] = "Capturing\u2026";
+localizedStrings["There is an uninstrumented canvas on the page. Reload the page to instrument it."] = "There is an uninstrumented canvas on the page. Reload the page to instrument it.";
+localizedStrings["Reload"] = "Reload";
localizedStrings["Binary File"] = "Binary File";
localizedStrings["Modification Time"] = "Modification Time";
localizedStrings["Directory"] = "Directory";
Modified: trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js (139407 => 139408)
--- trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js 2013-01-11 06:22:49 UTC (rev 139407)
+++ trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js 2013-01-11 06:57:14 UTC (rev 139408)
@@ -199,8 +199,19 @@
{
WebInspector.ProfileType.call(this, WebInspector.CanvasProfileType.TypeId, WebInspector.UIString("Capture Canvas Frame"));
this._nextProfileUid = 1;
+
+ this._decorationElement = document.createElement("div");
+ this._decorationElement.addStyleClass("profile-canvas-decoration");
+ this._decorationElement.addStyleClass("hidden");
+ this._decorationElement.textContent = WebInspector.UIString("There is an uninstrumented canvas on the page. Reload the page to instrument it.");
+ var reloadPageButton = this._decorationElement.createChild("button");
+ reloadPageButton.type = "button";
+ reloadPageButton.textContent = WebInspector.UIString("Reload");
+ reloadPageButton.addEventListener("click", this._onReloadPageButtonClick.bind(this), false);
+
// FIXME: enable/disable by a UI action?
- CanvasAgent.enable();
+ CanvasAgent.enable(this._updateDecorationElement.bind(this));
+ WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._updateDecorationElement, this);
}
WebInspector.CanvasProfileType.TypeId = "CANVAS_PROFILE";
@@ -243,7 +254,16 @@
/**
* @override
+ * @return {Element}
*/
+ decorationElement: function()
+ {
+ return this._decorationElement;
+ },
+
+ /**
+ * @override
+ */
reset: function()
{
this._nextProfileUid = 1;
@@ -270,6 +290,27 @@
return new WebInspector.CanvasProfileHeader(this, profile.title, -1);
},
+ _updateDecorationElement: function()
+ {
+ function callback(error, result)
+ {
+ var showWarning = (!error && result);
+ if (showWarning)
+ this._decorationElement.removeStyleClass("hidden");
+ else
+ this._decorationElement.addStyleClass("hidden");
+ }
+ CanvasAgent.hasUninstrumentedCanvases(callback.bind(this));
+ },
+
+ /**
+ * @param {MouseEvent} event
+ */
+ _onReloadPageButtonClick: function(event)
+ {
+ PageAgent.reload(event.shiftKey);
+ },
+
__proto__: WebInspector.ProfileType.prototype
}
Modified: trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js (139407 => 139408)
--- trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js 2013-01-11 06:22:49 UTC (rev 139407)
+++ trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js 2013-01-11 06:57:14 UTC (rev 139408)
@@ -89,6 +89,9 @@
optionElement.addEventListener("change", this._profileTypeChanged.bind(this, profileType), false);
var descriptionElement = labelElement.createChild("p");
descriptionElement.textContent = profileType.description;
+ var decorationElement = profileType.decorationElement();
+ if (decorationElement)
+ labelElement.appendChild(decorationElement);
},
_controlButtonClicked: function()
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (139407 => 139408)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-01-11 06:22:49 UTC (rev 139407)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-01-11 06:57:14 UTC (rev 139408)
@@ -79,6 +79,14 @@
return "";
},
+ /**
+ * @return {Element}
+ */
+ decorationElement: function()
+ {
+ return null;
+ },
+
// Must be implemented by subclasses.
/**
* @param {string=} title
Modified: trunk/Source/WebCore/inspector/front-end/profilesPanel.css (139407 => 139408)
--- trunk/Source/WebCore/inspector/front-end/profilesPanel.css 2013-01-11 06:22:49 UTC (rev 139407)
+++ trunk/Source/WebCore/inspector/front-end/profilesPanel.css 2013-01-11 06:57:14 UTC (rev 139408)
@@ -199,3 +199,14 @@
from {background-color: rgba(255, 255, 120, 1); }
to { background-color: rgba(255, 255, 120, 0); }
}
+
+.profile-canvas-decoration {
+ color: red;
+ margin: -14px 0 13px 22px;
+ padding-left: 14px;
+ background: 0 7px url(Images/warningIcon.png) no-repeat;
+}
+
+.profile-canvas-decoration button {
+ margin: 0 0 0 10px !important;
+}