Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: LayoutTests/resources/dump-as-markup.js

Issue 9477008: REGRESSION(r99076): WebKit pastes the trailing newline into a single-line text field (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/resources/dump-as-markup.js
===================================================================
--- LayoutTests/resources/dump-as-markup.js (revision 109010)
+++ LayoutTests/resources/dump-as-markup.js (working copy)
@@ -126,14 +126,16 @@
Markup.get = function(node)
{
+ var markup = Markup._getShadowHostIfPossible(node, 0);
+ if (markup)
+ return markup.substring(1);
+
if (!node.firstChild)
return '| ';
// Don't print any markup for the root node.
- var markup = '';
- for (var i = 0, len = node.childNodes.length; i < len; i++) {
+ for (var i = 0, len = node.childNodes.length; i < len; i++)
markup += Markup._get(node.childNodes[i], 0);
- }
return markup.substring(1);
}
@@ -227,11 +229,7 @@
str += Markup._get(node.childNodes[i], depth + 1);
}
- if (!Markup._useHTML5libOutputFormat && node.nodeType == Node.ELEMENT_NODE && window.internals) {
- var root = window.internals.shadowRoot(node);
- if (root)
- str += Markup._get(root, depth + 1);
- }
+ str += Markup._getShadowHostIfPossible(node, depth);
var selection = Markup._getSelectionMarker(node, i);
if (selection)
@@ -240,6 +238,16 @@
return str;
}
+Markup._getShadowHostIfPossible = function (node, depth)
+{
+ if (!Markup._useHTML5libOutputFormat && node.nodeType == Node.ELEMENT_NODE && window.internals) {
+ var root = window.internals.shadowRoot(node);
+ if (root)
+ return Markup._get(root, depth + 1);
+ }
+ return '';
+}
+
Markup._namespace = function(node)
{
if (Markup._NAMESPACE_URI_MAP[node.namespaceURI])

Powered by Google App Engine
This is Rietveld 408576698