- Revision
- 141414
- Author
- [email protected]
- Date
- 2013-01-31 06:10:36 -0800 (Thu, 31 Jan 2013)
Log Message
Web Inspector: do not set any textContent in overlay highlight spans
https://bugs.webkit.org/show_bug.cgi?id=108460
Patch by Andrey Lushnikov <[email protected]> on 2013-01-31
Reviewed by Pavel Feldman.
Source/WebCore:
Do not set any text content for overlay highlight spans to implicitly
set its height. Instead, measure its height in the same manner as its
done for "width" and "left" and set it explicitly.
No new tests: no change in behaviour.
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.prototype._appendOverlayHighlight):
(WebInspector.TextEditorMainPanel.ElementMetrics):
* inspector/front-end/textEditor.css:
(.text-editor-token-highlight): Update highlight to correspond to
slightly different elements height.
LayoutTests:
Replace "height" pixel value with "<number>" to avoid difference in
test expectations on varioius platforms and correct test expectations.
* inspector/editor/editor-test.js:
(initialize_EditorTests.InspectorTest.dumpEditorHTML):
* inspector/editor/text-editor-highlight-api-expected.txt:
* inspector/editor/text-editor-highlight-token-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (141413 => 141414)
--- trunk/LayoutTests/ChangeLog 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/LayoutTests/ChangeLog 2013-01-31 14:10:36 UTC (rev 141414)
@@ -1,3 +1,18 @@
+2013-01-31 Andrey Lushnikov <[email protected]>
+
+ Web Inspector: do not set any textContent in overlay highlight spans
+ https://bugs.webkit.org/show_bug.cgi?id=108460
+
+ Reviewed by Pavel Feldman.
+
+ Replace "height" pixel value with "<number>" to avoid difference in
+ test expectations on varioius platforms and correct test expectations.
+
+ * inspector/editor/editor-test.js:
+ (initialize_EditorTests.InspectorTest.dumpEditorHTML):
+ * inspector/editor/text-editor-highlight-api-expected.txt:
+ * inspector/editor/text-editor-highlight-token-expected.txt:
+
2013-01-31 Florin Malita <[email protected]>
[Chromium] Unreviewed gardening.
Modified: trunk/LayoutTests/inspector/editor/editor-test.js (141413 => 141414)
--- trunk/LayoutTests/inspector/editor/editor-test.js 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/LayoutTests/inspector/editor/editor-test.js 2013-01-31 14:10:36 UTC (rev 141414)
@@ -73,6 +73,7 @@
{
var element = mainPanelOnly ? textEditor._mainPanel.element : textEditor.element;
var dumpedHTML = element.innerHTML.replace(/<div/g, "\n<div");
+ var dumpedHTML = dumpedHTML.replace(/height: [0-9]+/g, "height: <number>");
InspectorTest.addResult(dumpedHTML);
};
Modified: trunk/LayoutTests/inspector/editor/text-editor-highlight-api-expected.txt (141413 => 141414)
--- trunk/LayoutTests/inspector/editor/text-editor-highlight-api-expected.txt 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/LayoutTests/inspector/editor/text-editor-highlight-api-expected.txt 2013-01-31 14:10:36 UTC (rev 141414)
@@ -18,11 +18,11 @@
<div class="inner-container" tabindex="0">
<div class="webkit-line-content">foo();</div>
-<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-css-class text-editor-overlay-highlight" style="left: -1px; width: 37px;"> </span><span class="some-css-class text-editor-overlay-highlight" style="left: 90px; width: 37px;"> </span></div>
+<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-css-class text-editor-overlay-highlight" style="left: -1px; width: 37px; height: <number>px;"></span><span class="some-css-class text-editor-overlay-highlight" style="left: 90px; width: 37px; height: <number>px;"></span></div>
<div class="webkit-line-content">foo_</div>
<div class="webkit-line-content">global_foo</div>
<div class="webkit-line-content">global_foo2</div>
-<div class="webkit-line-content">some_other_foo_X<span class="some-css-class text-editor-overlay-highlight" style="left: 76px; width: 37px;"> </span></div></div>
+<div class="webkit-line-content">some_other_foo_X<span class="some-css-class text-editor-overlay-highlight" style="left: 76px; width: 37px; height: <number>px;"></span></div></div>
Running: testHighlightRange
@@ -31,11 +31,11 @@
<div class="inner-container" tabindex="0">
<div class="webkit-line-content">foo();</div>
-<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-css-class text-editor-overlay-highlight" style="left: -1px; width: 37px;"> </span><span class="some-css-class text-editor-overlay-highlight" style="left: 90px; width: 37px;"> </span><span class="some-other-class text-editor-overlay-highlight" style="left: 90px; width: 37px;"> </span></div>
-<div class="webkit-line-content">foo_<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 30px;"> </span></div>
-<div class="webkit-line-content">global_foo<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 72px;"> </span></div>
+<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-css-class text-editor-overlay-highlight" style="left: -1px; width: 37px; height: <number>px;"></span><span class="some-css-class text-editor-overlay-highlight" style="left: 90px; width: 37px; height: <number>px;"></span><span class="some-other-class text-editor-overlay-highlight" style="left: 90px; width: 37px; height: <number>px;"></span></div>
+<div class="webkit-line-content">foo_<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 30px; height: <number>px;"></span></div>
+<div class="webkit-line-content">global_foo<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 72px; height: <number>px;"></span></div>
<div class="webkit-line-content">global_foo2</div>
-<div class="webkit-line-content">some_other_foo_X<span class="some-css-class text-editor-overlay-highlight" style="left: 76px; width: 37px;"> </span></div></div>
+<div class="webkit-line-content">some_other_foo_X<span class="some-css-class text-editor-overlay-highlight" style="left: 76px; width: 37px; height: <number>px;"></span></div></div>
Running: testRemoveRegexHighlight
@@ -44,9 +44,9 @@
<div class="inner-container" tabindex="0">
<div class="webkit-line-content">foo();</div>
-<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-other-class text-editor-overlay-highlight" style="left: 90px; width: 37px;"> </span></div>
-<div class="webkit-line-content">foo_<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 30px;"> </span></div>
-<div class="webkit-line-content">global_foo<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 72px;"> </span></div>
+<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-other-class text-editor-overlay-highlight" style="left: 90px; width: 37px; height: <number>px;"></span></div>
+<div class="webkit-line-content">foo_<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 30px; height: <number>px;"></span></div>
+<div class="webkit-line-content">global_foo<span class="some-other-class text-editor-overlay-highlight" style="left: -1px; width: 72px; height: <number>px;"></span></div>
<div class="webkit-line-content">global_foo2</div>
<div class="webkit-line-content">some_other_foo_X</div></div>
Modified: trunk/LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt (141413 => 141414)
--- trunk/LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt 2013-01-31 14:10:36 UTC (rev 141414)
@@ -21,20 +21,20 @@
=========== After selecting 'collection' ===========
<div class="inner-container text-editor-editable" tabindex="0">
-<div class="webkit-line-content">function findElement(collection, elem) {<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 146px; width: 72px;"> </span></div>
+<div class="webkit-line-content">function findElement(collection, elem) {<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 146px; width: 72px; height: <number>px;"></span></div>
<div class="webkit-line-content"> // length</div>
-<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 188px; width: 72px;"> </span></div>
-<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 111px; width: 72px;"> </span></div>
+<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 188px; width: 72px; height: <number>px;"></span></div>
+<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 111px; width: 72px; height: <number>px;"></span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">null;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">}</span></div></div>
=========== After selecting 'elem' ===========
<div class="inner-container text-editor-editable" tabindex="0">
-<div class="webkit-line-content">function findElement(collection, elem) {<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 230px; width: 30px;"> </span></div>
+<div class="webkit-line-content">function findElement(collection, elem) {<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 230px; width: 30px; height: <number>px;"></span></div>
<div class="webkit-line-content"> // length</div>
<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span></div>
-<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 237px; width: 30px;"> </span></div>
+<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 237px; width: 30px; height: <number>px;"></span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">null;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">}</span></div></div>
@@ -42,8 +42,8 @@
<div class="inner-container text-editor-editable" tabindex="0">
<div class="webkit-line-content">function findElement(collection, elem) {</div>
-<div class="webkit-line-content"> // length<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 76px; width: 44px;"> </span></div>
-<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 265px; width: 44px;"> </span></div>
+<div class="webkit-line-content"> // length<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 76px; width: 44px; height: <number>px;"></span></div>
+<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 265px; width: 44px; height: <number>px;"></span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">null;</span></div>
Modified: trunk/Source/WebCore/ChangeLog (141413 => 141414)
--- trunk/Source/WebCore/ChangeLog 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/Source/WebCore/ChangeLog 2013-01-31 14:10:36 UTC (rev 141414)
@@ -1,3 +1,23 @@
+2013-01-31 Andrey Lushnikov <[email protected]>
+
+ Web Inspector: do not set any textContent in overlay highlight spans
+ https://bugs.webkit.org/show_bug.cgi?id=108460
+
+ Reviewed by Pavel Feldman.
+
+ Do not set any text content for overlay highlight spans to implicitly
+ set its height. Instead, measure its height in the same manner as its
+ done for "width" and "left" and set it explicitly.
+
+ No new tests: no change in behaviour.
+
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.TextEditorMainPanel.prototype._appendOverlayHighlight):
+ (WebInspector.TextEditorMainPanel.ElementMetrics):
+ * inspector/front-end/textEditor.css:
+ (.text-editor-token-highlight): Update highlight to correspond to
+ slightly different elements height.
+
2013-01-31 Allan Sandfeld Jensen <[email protected]>
[Qt] Box shadows on a transparency layer is very slow
Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (141413 => 141414)
--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2013-01-31 14:10:36 UTC (rev 141414)
@@ -1933,7 +1933,7 @@
highlightSpan.addStyleClass(cssClass);
highlightSpan.style.left = (metrics[i].left - extraWidth) + "px";
highlightSpan.style.width = (metrics[i].width + extraWidth * 2) + "px";
- highlightSpan.textContent = " ";
+ highlightSpan.style.height = metrics[i].height + "px";
highlightSpan.addStyleClass("text-editor-overlay-highlight");
lineRow.insertBefore(highlightSpan, lineRow.decorationsElement);
}
@@ -2830,6 +2830,7 @@
WebInspector.TextEditorMainPanel.ElementMetrics = function(element)
{
this.width = element.offsetWidth;
+ this.height = element.offsetHeight;
this.left = element.offsetLeft;
}
Modified: trunk/Source/WebCore/inspector/front-end/textEditor.css (141413 => 141414)
--- trunk/Source/WebCore/inspector/front-end/textEditor.css 2013-01-31 14:07:58 UTC (rev 141413)
+++ trunk/Source/WebCore/inspector/front-end/textEditor.css 2013-01-31 14:10:36 UTC (rev 141414)
@@ -38,7 +38,8 @@
}
.text-editor-token-highlight {
- outline: 1px solid gray;
+ border: 1px solid gray;
+ border-radius: 3px;
}
.text-editor-contents .inner-container {