Diff
Modified: trunk/Source/WebCore/ChangeLog (123487 => 123488)
--- trunk/Source/WebCore/ChangeLog 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/ChangeLog 2012-07-24 17:09:07 UTC (rev 123488)
@@ -1,3 +1,29 @@
+2012-07-24 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: introduce UISourceCodeFrame.
+ https://bugs.webkit.org/show_bug.cgi?id=92124
+
+ Reviewed by Vsevolod Vlasov.
+
+ Generic implementation of SourceFrame over UISourceCode added.
+
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * inspector/compile-front-end.py:
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._createSourceFrame):
+ * inspector/front-end/StylesPanel.js:
+ * inspector/front-end/UISourceCodeFrame.js: Added.
+ (WebInspector.UISourceCodeFrame):
+ (WebInspector.UISourceCodeFrame.prototype.canEditSource):
+ (WebInspector.UISourceCodeFrame.prototype.commitEditing):
+ (WebInspector.UISourceCodeFrame.prototype.afterTextChanged):
+ (WebInspector.UISourceCodeFrame.prototype._didEditContent):
+ (WebInspector.UISourceCodeFrame.prototype._onContentChanged):
+ (WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu):
+ * inspector/front-end/WebKit.qrc:
+ * inspector/front-end/inspector.html:
+
2012-07-24 Dan Bernstein <m...@apple.com>
<rdar://problem/11945102> REGRESSION (r109451): Overlay scrollbars always use the default style, regardless of background color
Modified: trunk/Source/WebCore/WebCore.gypi (123487 => 123488)
--- trunk/Source/WebCore/WebCore.gypi 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/WebCore.gypi 2012-07-24 17:09:07 UTC (rev 123488)
@@ -6429,6 +6429,7 @@
'inspector/front-end/TopDownProfileDataGridTree.js',
'inspector/front-end/treeoutline.js',
'inspector/front-end/UISourceCode.js',
+ 'inspector/front-end/UISourceCodeFrame.js',
'inspector/front-end/UIUtils.js',
'inspector/front-end/UserAgentSupport.js',
'inspector/front-end/UserMetrics.js',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (123487 => 123488)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-07-24 17:09:07 UTC (rev 123488)
@@ -75934,6 +75934,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\UISourceCodeFrame.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\UIUtils.js"
>
</File>
Modified: trunk/Source/WebCore/inspector/compile-front-end.py (123487 => 123488)
--- trunk/Source/WebCore/inspector/compile-front-end.py 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/inspector/compile-front-end.py 2012-07-24 17:09:07 UTC (rev 123488)
@@ -171,6 +171,7 @@
"PropertiesSidebarPane.js",
"SourceFrame.js",
"TimelineGrid.js",
+ "UISourceCodeFrame.js",
]
},
{
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (123487 => 123488)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-07-24 17:09:07 UTC (rev 123488)
@@ -464,14 +464,9 @@
if (uiSourceCode instanceof WebInspector._javascript_Source) {
var _javascript_Source = /** @type {WebInspector._javascript_Source} */ uiSourceCode;
sourceFrame = new WebInspector._javascript_SourceFrame(this, _javascript_Source);
- } else if (uiSourceCode instanceof WebInspector.StyleSource) {
- var styleSource = /** @type {WebInspector.StyleSource} */ uiSourceCode;
- sourceFrame = new WebInspector.StyleSourceFrame(styleSource);
- } else {
- console.assert(false, "Unknown UISourceCode type");
- sourceFrame = new WebInspector.SourceFrame(uiSourceCode);
- }
-
+ } else
+ sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode);
+
this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame);
return sourceFrame;
},
Modified: trunk/Source/WebCore/inspector/front-end/StylesPanel.js (123487 => 123488)
--- trunk/Source/WebCore/inspector/front-end/StylesPanel.js 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/inspector/front-end/StylesPanel.js 2012-07-24 17:09:07 UTC (rev 123488)
@@ -168,73 +168,6 @@
/**
* @constructor
- * @extends {WebInspector.SourceFrame}
- * @param {WebInspector.StyleSource} styleSource
- */
-WebInspector.StyleSourceFrame = function(styleSource)
-{
- this._styleSource = styleSource;
- WebInspector.SourceFrame.call(this, this._styleSource);
- this._styleSource.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this);
-}
-
-WebInspector.StyleSourceFrame.prototype = {
- /**
- * @return {boolean}
- */
- canEditSource: function()
- {
- return true;
- },
-
- /**
- * @param {string} text
- */
- commitEditing: function(text)
- {
- if (!this._styleSource.isDirty())
- return;
-
- this._isCommittingEditing = true;
- this._styleSource.commitWorkingCopy(this._didEditContent.bind(this));
- },
-
- afterTextChanged: function(oldRange, newRange)
- {
- this._styleSource.setWorkingCopy(this.textModel.text());
- },
-
- _didEditContent: function(error)
- {
- if (error) {
- WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
- return;
- }
- delete this._isCommittingEditing;
- },
-
- /**
- * @param {WebInspector.Event} event
- */
- _onContentChanged: function(event)
- {
- if (!this._isCommittingEditing)
- this.setContent(this._styleSource.content() || "", false, "text/css");
- },
-
- populateTextAreaContextMenu: function(contextMenu, lineNumber)
- {
- WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
- var scriptsPanel = WebInspector.panels.scripts;
- contextMenu.appendApplicableItems(this._styleSource);
- contextMenu.appendSeparator();
- }
-}
-
-WebInspector.StyleSourceFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype;
-
-/**
- * @constructor
* @implements {WebInspector.SelectionDialogContentProvider}
* @param {WebInspector.View} view
* @param {WebInspector.StyleSource} styleSource
Added: trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js (0 => 123488)
--- trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js 2012-07-24 17:09:07 UTC (rev 123488)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.SourceFrame}
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ */
+WebInspector.UISourceCodeFrame = function(uiSourceCode)
+{
+ this._uiSourceCode = uiSourceCode;
+ WebInspector.SourceFrame.call(this, this._uiSourceCode);
+ this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this);
+}
+
+WebInspector.UISourceCodeFrame.prototype = {
+ /**
+ * @return {boolean}
+ */
+ canEditSource: function()
+ {
+ return true;
+ },
+
+ /**
+ * @param {string} text
+ */
+ commitEditing: function(text)
+ {
+ if (!this._uiSourceCode.isDirty())
+ return;
+
+ this._isCommittingEditing = true;
+ this._uiSourceCode.commitWorkingCopy(this._didEditContent.bind(this));
+ },
+
+ afterTextChanged: function(oldRange, newRange)
+ {
+ this._uiSourceCode.setWorkingCopy(this.textModel.text());
+ },
+
+ _didEditContent: function(error)
+ {
+ if (error) {
+ WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
+ return;
+ }
+ delete this._isCommittingEditing;
+ },
+
+ /**
+ * @param {WebInspector.Event} event
+ */
+ _onContentChanged: function(event)
+ {
+ if (!this._isCommittingEditing)
+ this.setContent(this._uiSourceCode.content() || "", false, this._uiSourceCode.contentType().canonicalMimeType());
+ },
+
+ populateTextAreaContextMenu: function(contextMenu, lineNumber)
+ {
+ WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber);
+ contextMenu.appendApplicableItems(this._uiSourceCode);
+ contextMenu.appendSeparator();
+ }
+}
+
+WebInspector.UISourceCodeFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype;
Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (123487 => 123488)
--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2012-07-24 17:09:07 UTC (rev 123488)
@@ -181,6 +181,7 @@
<file>TopDownProfileDataGridTree.js</file>
<file>treeoutline.js</file>
<file>UISourceCode.js</file>
+ <file>UISourceCodeFrame.js</file>
<file>UIUtils.js</file>
<file>UserAgentSupport.js</file>
<file>UserMetrics.js</file>
Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (123487 => 123488)
--- trunk/Source/WebCore/inspector/front-end/inspector.html 2012-07-24 17:05:44 UTC (rev 123487)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html 2012-07-24 17:09:07 UTC (rev 123488)
@@ -121,6 +121,7 @@
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
+ <script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""
<script type="text/_javascript_" src=""