CSSStyleDeclaration.cssText should not contain extraneous whitespace in final delimiter

https://bugs.webkit.org/show_bug.cgi?id=94633

Patch by Glenn Adams <glenn@skynav.com> on 2012-08-24
Reviewed by Benjamin Poulain.

Ensure cssText final delimiter does not contain extraneous space character after semicolon.

Source/WebCore:

Test: cssom/cssstyledeclaration-csstext-final-delimiter.html

* css/CSSFontFaceRule.cpp:
(WebCore::CSSFontFaceRule::cssText):
Conditionally add SPACE in serialized rule since asText() no longer
contains extra space.
Construct result using StringBuilder.

* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::cssText):
Conditionally add SPACE in serialized rule since asText() no longer
contains extra space.
Construct result using StringBuilder.

* css/CSSProperty.cpp:
(WebCore::CSSProperty::cssText):
Ensure serialized property does longer contains extra space in cssText.
Construct result using StringBuilder.

* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::cssText):
Conditionally add SPACE in serialized rule since asText() no longer
contains extra space.
Construct result using StringBuilder.

* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::addRule):
Conditionally add SPACE in reserialized rule in case passed style no
longer contains extra space.  Note that if it does already contain an
extra space that inserting an extra space here is harmless (i.e., is
effectively normalized during parse).
Construct result using StringBuilder.

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::asText):
Ensure serialized property set does longer contains extra space in final
delimiter.
Construct result using StringBuilder.

* css/WebKitCSSKeyframeRule.cpp:
(WebCore::StyleKeyframe::cssText):
Conditionally add SPACE in serialized rule since asText() no longer
contains extra space.
Construct result using StringBuilder.

* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::addBlockStyle):
Conditionally add SPACE in block style since cssText no longer contains
extra space.
Construct result using StringBuilder.
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
Conditionally add SPACE in pre-existing inline style since cssText no
longer contains extra space.
Construct result using StringBuilder.

LayoutTests:

* cssom/README.txt: Added.
* cssom/cssstyledeclaration-csstext-final-delimiter-expected.txt: Added.
* cssom/cssstyledeclaration-csstext-final-delimiter.html: Added.
* editing/deleting/delete-line-break-before-underlined-content-expected.txt: Remove extraneous space.
* editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt: ditto
* editing/deleting/deleting-line-break-preserves-underline-color-expected.txt: ditto
* editing/deleting/merge-paragraph-from-h6-with-style-2-expected.txt: ditto
* editing/deleting/merge-paragraph-from-h6-with-style-expected.txt: ditto
* editing/deleting/merge-paragraph-from-p-with-style-3-expected.txt: ditto
* editing/deleting/merge-paragraph-from-p-with-style-expected.txt: ditto
* editing/deleting/paste-with-transparent-background-color-expected.txt: ditto
* editing/execCommand/insert-list-with-noneditable-content-expected.txt: ditto
* editing/execCommand/script-tests/toggle-link.js: ditto
* editing/execCommand/script-tests/toggle-unlink.js: ditto
* editing/execCommand/toggle-link-expected.txt: ditto
* editing/execCommand/toggle-unlink-expected.txt: ditto
* editing/inserting/page-zoom-font-size-expected.txt: ditto
* editing/pasteboard/19644-2-expected.txt: ditto
* editing/pasteboard/5761530-1-expected.txt: ditto
* editing/pasteboard/5780697-2-expected.txt: ditto
* editing/pasteboard/copy-null-characters-expected.txt: ditto
* editing/pasteboard/copy-paste-bidi-expected.txt: ditto
* editing/pasteboard/copy-text-with-backgroundcolor-expected.txt: ditto
* editing/pasteboard/data-transfer-items-expected.txt: ditto
* editing/pasteboard/display-block-on-spans-expected.txt: ditto
* editing/pasteboard/do-not-copy-unnecessary-styles-2-expected.txt: ditto
* editing/pasteboard/do-not-copy-unnecessary-styles-expected.txt: ditto
* editing/pasteboard/drag-drop-url-with-style-expected.txt: ditto
* editing/pasteboard/onpaste-text-html-expected.txt: ditto
* editing/pasteboard/paste-4039777-fix-expected.txt: ditto
* editing/pasteboard/paste-and-sanitize-expected.txt: ditto
* editing/pasteboard/paste-and-sanitize.html: ditto
* editing/pasteboard/paste-list-003-expected.txt: ditto
* editing/pasteboard/paste-noscript-expected.txt: ditto
* editing/pasteboard/paste-noscript-xhtml-expected.txt: ditto
* editing/pasteboard/paste-table-002-expected.txt: ditto
* editing/pasteboard/paste-text-with-style-4-expected.txt: ditto
* editing/pasteboard/paste-text-with-style-5-expected.txt: ditto
* editing/pasteboard/paste-with-redundant-style-expected.txt: ditto
* editing/pasteboard/preserve-underline-color-expected.txt: ditto
* editing/pasteboard/style-from-rules-expected.txt: ditto
* editing/pasteboard/testcase-9507-expected.txt: ditto
* editing/style/non-inheritable-styles-expected.txt: ditto
* editing/style/push-down-font-styles-expected.txt: ditto
* editing/style/push-down-implicit-styles-around-list-expected.txt: ditto
* editing/style/push-down-implicit-styles-expected.txt: ditto
* editing/style/push-down-inline-styles-expected.txt: ditto
* editing/style/script-tests/push-down-font-styles.js: ditto
* editing/style/script-tests/push-down-implicit-styles-around-list.js: ditto
* editing/style/script-tests/push-down-implicit-styles.js: ditto
* editing/style/script-tests/push-down-inline-styles.js: ditto
* editing/undo/remove-css-property-and-remove-style-expected.txt: ditto
* editing/undo/replace-by-span-then-remove-expected.txt: ditto
* editing/undo/replace-by-span-then-remove.html: ditto
* fast/css/background-position-serialize.html: ditto
* fast/css/counters/counter-cssText-expected.txt: ditto
* fast/css/counters/counter-cssText.html: ditto
* fast/css/parse-border-image-repeat-null-crash-expected.txt: ditto
* fast/css/remove-shorthand.html: ditto
* fast/dom/Element/scrollWidth.html: ditto
* fast/dom/HTMLMeterElement/meter-element-markup-expected.txt: ditto
* fast/dom/HTMLProgressElement/progress-element-markup-expected.txt: ditto
* fast/dom/attr-style-too-lazy-expected.txt: ditto
* fast/dom/attr-style-too-lazy.html: ditto
* fast/dom/css-set-property-exception-expected.txt: ditto
* fast/fast/events/ondrop-text-html-expected.txt: ditto
* fast/mutation/observe-attributes-expected.txt: ditto
* fast/mutation/observe-attributes.html: ditto
* inspector/elements/insert-node-expected.txt: ditto
* inspector/styles/styles-update-from-js-expected.txt: ditto
* platform/chromium-win/editing/pasteboard/5780697-2-expected.txt: ditto
* platform/efl/fast/dom/HTMLMeterElement/meter-element-markup-expected.txt: ditto
* platform/mac/editing/pasteboard/5761530-1-expected.txt: ditto
* platform/qt/editing/pasteboard/5761530-1-expected.txt: ditto
* platform/qt/editing/pasteboard/5780697-2-expected.txt: ditto
* svg/webarchive/svg-script-subresouces-expected.webarchive: ditto
* webarchive/test-link-rel-icon-beforeload-expected.webarchive: ditto

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 32428064
2012-08-24 Glenn Adams <glenn@skynav.com>
CSSStyleDeclaration.cssText should not contain extraneous whitespace in final delimiter
https://bugs.webkit.org/show_bug.cgi?id=94633
Reviewed by Benjamin Poulain.
Ensure cssText final delimiter does not contain extraneous space character after semicolon.
* cssom/README.txt: Added.
* cssom/cssstyledeclaration-csstext-final-delimiter-expected.txt: Added.
* cssom/cssstyledeclaration-csstext-final-delimiter.html: Added.
* editing/deleting/delete-line-break-before-underlined-content-expected.txt: Remove extraneous space.
* editing/deleting/delete-line-break-between-paragraphs-with-same-style-expected.txt: ditto
* editing/deleting/deleting-line-break-preserves-underline-color-expected.txt: ditto
* editing/deleting/merge-paragraph-from-h6-with-style-2-expected.txt: ditto
* editing/deleting/merge-paragraph-from-h6-with-style-expected.txt: ditto
* editing/deleting/merge-paragraph-from-p-with-style-3-expected.txt: ditto
* editing/deleting/merge-paragraph-from-p-with-style-expected.txt: ditto
* editing/deleting/paste-with-transparent-background-color-expected.txt: ditto
* editing/execCommand/insert-list-with-noneditable-content-expected.txt: ditto
* editing/execCommand/script-tests/toggle-link.js: ditto
* editing/execCommand/script-tests/toggle-unlink.js: ditto
* editing/execCommand/toggle-link-expected.txt: ditto
* editing/execCommand/toggle-unlink-expected.txt: ditto
* editing/inserting/page-zoom-font-size-expected.txt: ditto
* editing/pasteboard/19644-2-expected.txt: ditto
* editing/pasteboard/5761530-1-expected.txt: ditto
* editing/pasteboard/5780697-2-expected.txt: ditto
* editing/pasteboard/copy-null-characters-expected.txt: ditto
* editing/pasteboard/copy-paste-bidi-expected.txt: ditto
* editing/pasteboard/copy-text-with-backgroundcolor-expected.txt: ditto
* editing/pasteboard/data-transfer-items-expected.txt: ditto
* editing/pasteboard/display-block-on-spans-expected.txt: ditto
* editing/pasteboard/do-not-copy-unnecessary-styles-2-expected.txt: ditto
* editing/pasteboard/do-not-copy-unnecessary-styles-expected.txt: ditto
* editing/pasteboard/drag-drop-url-with-style-expected.txt: ditto
* editing/pasteboard/onpaste-text-html-expected.txt: ditto
* editing/pasteboard/paste-4039777-fix-expected.txt: ditto
* editing/pasteboard/paste-and-sanitize-expected.txt: ditto
* editing/pasteboard/paste-and-sanitize.html: ditto
* editing/pasteboard/paste-list-003-expected.txt: ditto
* editing/pasteboard/paste-noscript-expected.txt: ditto
* editing/pasteboard/paste-noscript-xhtml-expected.txt: ditto
* editing/pasteboard/paste-table-002-expected.txt: ditto
* editing/pasteboard/paste-text-with-style-4-expected.txt: ditto
* editing/pasteboard/paste-text-with-style-5-expected.txt: ditto
* editing/pasteboard/paste-with-redundant-style-expected.txt: ditto
* editing/pasteboard/preserve-underline-color-expected.txt: ditto
* editing/pasteboard/style-from-rules-expected.txt: ditto
* editing/pasteboard/testcase-9507-expected.txt: ditto
* editing/style/non-inheritable-styles-expected.txt: ditto
* editing/style/push-down-font-styles-expected.txt: ditto
* editing/style/push-down-implicit-styles-around-list-expected.txt: ditto
* editing/style/push-down-implicit-styles-expected.txt: ditto
* editing/style/push-down-inline-styles-expected.txt: ditto
* editing/style/script-tests/push-down-font-styles.js: ditto
* editing/style/script-tests/push-down-implicit-styles-around-list.js: ditto
* editing/style/script-tests/push-down-implicit-styles.js: ditto
* editing/style/script-tests/push-down-inline-styles.js: ditto
* editing/undo/remove-css-property-and-remove-style-expected.txt: ditto
* editing/undo/replace-by-span-then-remove-expected.txt: ditto
* editing/undo/replace-by-span-then-remove.html: ditto
* fast/css/background-position-serialize.html: ditto
* fast/css/counters/counter-cssText-expected.txt: ditto
* fast/css/counters/counter-cssText.html: ditto
* fast/css/parse-border-image-repeat-null-crash-expected.txt: ditto
* fast/css/remove-shorthand.html: ditto
* fast/dom/Element/scrollWidth.html: ditto
* fast/dom/HTMLMeterElement/meter-element-markup-expected.txt: ditto
* fast/dom/HTMLProgressElement/progress-element-markup-expected.txt: ditto
* fast/dom/attr-style-too-lazy-expected.txt: ditto
* fast/dom/attr-style-too-lazy.html: ditto
* fast/dom/css-set-property-exception-expected.txt: ditto
* fast/fast/events/ondrop-text-html-expected.txt: ditto
* fast/mutation/observe-attributes-expected.txt: ditto
* fast/mutation/observe-attributes.html: ditto
* inspector/elements/insert-node-expected.txt: ditto
* inspector/styles/styles-update-from-js-expected.txt: ditto
* platform/chromium-win/editing/pasteboard/5780697-2-expected.txt: ditto
* platform/efl/fast/dom/HTMLMeterElement/meter-element-markup-expected.txt: ditto
* platform/mac/editing/pasteboard/5761530-1-expected.txt: ditto
* platform/qt/editing/pasteboard/5761530-1-expected.txt: ditto
* platform/qt/editing/pasteboard/5780697-2-expected.txt: ditto
* svg/webarchive/svg-script-subresouces-expected.webarchive: ditto
* webarchive/test-link-rel-icon-beforeload-expected.webarchive: ditto
2012-08-24 Julien Chaffraix <jchaffraix@webkit.org>
More unreviewed Chromium rebaselining.
This directory will contain a copy of W3C's CSSOM test suite [1] when it
is completed. In the mean time the tests found here are snapshots of specific,
preliminary tests being prepared by the editors of CSSOM [2] or having been
submitted and accepted for adoption in the CSSOM test suite.
[1] http://hg.csswg.org/test/file/tip/approved/cssom
[2] http://hg.csswg.org/test/file/tip/contributors/gadams/incoming/cssom
Until the CSSWG has concluded work on the CSSOM test suite, it is expected
that the files in this directory will be modified as needed.
PASS inline style - text - delimiters - zero declarations
PASS inline style - text - delimiters - one declaration
PASS inline style - text - delimiters - two declarations
<!DOCTYPE html>
<html>
<head>
<title>CSSOM - CSSStyleDeclaration - Text - Serialization - Delimiters</title>
<link rel="author" title="Glenn Adams" href="mailto:glenn@skynav.com"/>
<link rel="help" href="http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface"/>
<meta name="flags" content="dom"/>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<div id="box"></div>
<script>
var style = document.getElementById('box').style;
var delim = new RegExp ( /(\s*\;\s*)/ );
function countDelimiters(s) {
var k = ( s.split(delim).length - 1 ) / 2;
return k;
}
function getNthDelimiter(s,n) {
if ( n > 0 ) {
var sa = s.split(delim);
var k = 1;
for ( var i in sa ) {
var s = sa[i];
var m = delim.exec(s);
if ( m && ( m.length > 1 ) ) {
if ( k++ == n ) {
return s;
}
}
}
}
return '';
}
test(function(){
style.cssText = "";
assert_equals(countDelimiters(style.cssText), 0);
assert_equals(getNthDelimiter(style.cssText,0), "");
assert_equals(style.cssText, "");
}, 'inline style - text - delimiters - zero declarations');
test(function(){
style.cssText = "left: 10px";
assert_equals(countDelimiters(style.cssText), 1);
assert_equals(getNthDelimiter(style.cssText,1), ";");
assert_equals(style.cssText, "left: 10px;");
}, 'inline style - text - delimiters - one declaration');
test(function(){
style.cssText = "left: 10px; right: 20px";
assert_equals(countDelimiters(style.cssText), 2);
assert_equals(getNthDelimiter(style.cssText,1), "; ");
assert_equals(getNthDelimiter(style.cssText,2), ";");
assert_equals(style.cssText, "left: 10px; right: 20px;");
}, 'inline style - text - delimiters - two declarations');
</script>
</body>
</html>
This tests for a bug where underlined content would lose its underliningwhen deleting the line break before the paragraph that contained it.
| "This shouldn't be underlined.<#selection-caret>"
| <span>
| style="text-decoration: underline; "
| style="text-decoration: underline;"
| "This should be underlined."
......@@ -7,7 +7,7 @@ This tests deleting a line break between paragraphs with the same inline style.
| face="monospace"
| "hello world<#selection-caret>"
| <span>
| style="font-family: monospace; "
| style="font-family: monospace;"
| "WebKit"
| "
"
......@@ -13,5 +13,5 @@ After:
| <div>
| "This should not be underlined.<#selection-caret>"
| <span>
| style="color: red; text-decoration: underline; "
| style="color: red; text-decoration: underline;"
| "This should be underlined."
......@@ -14,7 +14,7 @@ WebKit should not cancel styles added by h6 by those of document's default style
| <em>
| "hello<#selection-caret>"
| <span>
| style="color: red; "
| style="color: red;"
| "world"
| "
"
......@@ -14,7 +14,7 @@ WebKit should not cancel styles added by h6 by those of document's default style
| <em>
| "hello<#selection-caret>"
| <span>
| style="color: red; "
| style="color: red;"
| "world"
| "
"
......@@ -14,7 +14,7 @@ WebKit preserves the inline style of the merged paragraph, and "world" should be
| <h1>
| "hello<#selection-caret>"
| <span>
| style="color: green; "
| style="color: green;"
| "world"
| <font>
| color="red"
......
......@@ -12,7 +12,7 @@ This tests deleting line break before p.
| "
hello<#selection-caret>"
| <span>
| style="font-style: italic; "
| style="font-style: italic;"
| "world"
| "
"
......@@ -14,7 +14,7 @@ After cut and paste:
| " "
| <span>
| class="test"
| style="background-color: transparent; "
| style="background-color: transparent;"
| "world"
| " "
| "WebKit<#selection-caret>"
......
......@@ -3,7 +3,7 @@ This tests list creation in an editable context but across non-editable content.
| <li>
| "Editabl<#selection-anchor>e paragraph containing a "
| <span>
| style="background-color: rgb(211, 211, 211); "
| style="background-color: rgb(211, 211, 211);"
| "non-editable"
| " in the middle"
| <br>
......
......@@ -43,15 +43,15 @@ testSingleToggle("createLink", '<a href="http://trac.webkit.org/">hello <b>world
testSingleToggle("createLink", '<a href="http://trac.webkit.org/" style="font-style: italic;">hello world</a> WebKit', selectFirstTwoWords, '<i><a href="http://webkit.org/">hello world</a></i> WebKit');
testSingleToggle("createLink", 'hello <a href="http://trac.webkit.org/"><b>world</b> WebKit</a>', selectFirstTwoWords, '<a href="http://webkit.org/">hello <b>world</b></a><a href="http://trac.webkit.org/"> WebKit</a>');
testSingleToggle("createLink", 'hello <a href="http://trac.webkit.org/" style="font-style: italic;"><b>world</b> WebKit</a>', selectFirstTwoWords,
'<a href="http://webkit.org/">hello <b style="font-style: italic; ">world</b></a><a href="http://trac.webkit.org/"><i> WebKit</i></a>');
'<a href="http://webkit.org/">hello <b style="font-style: italic;">world</b></a><a href="http://trac.webkit.org/"><i> WebKit</i></a>');
testSingleToggle("createLink", 'hello <b>world</b> WebKit', selectLastWord, 'hello <b>world</b> <a href="http://webkit.org/">WebKit</a>');
testSingleToggle("createLink", '<u>hello <b>world</b> WebKit</u>', selectLastWord, '<u>hello <b>world</b> <a href="http://webkit.org/">WebKit</a></u>');
testSingleToggle("createLink", '<a href="http://trac.webkit.org/"><div>hello</div><div>world</div></a>', selectLastWord,
'<a href="http://trac.webkit.org/"><div>hello</div></a><div><a href="http://webkit.org/">world</a></div>');
testSingleToggle("createLink", '<a href="http://trac.webkit.org/" style="font-weight: bold;"><div>hello</div><div>world</div></a>', selectLastWord,
'<a href="http://trac.webkit.org/"><div style="font-weight: bold; ">hello</div></a><div style="font-weight: bold; "><a href="http://webkit.org/">world</a></div>');
'<a href="http://trac.webkit.org/"><div style="font-weight: bold;">hello</div></a><div style="font-weight: bold;"><a href="http://webkit.org/">world</a></div>');
testSingleToggle("createLink", '<a href="http://trac.webkit.org/" style="font-weight: bold;"><div style="font-weight: normal;">hello</div><div>world</div></a>', selectLastWord,
'<a href="http://trac.webkit.org/"><div style="font-weight: normal; ">hello</div></a><div style="font-weight: bold; "><a href="http://webkit.org/">world</a></div>');
'<a href="http://trac.webkit.org/"><div style="font-weight: normal;">hello</div></a><div style="font-weight: bold;"><a href="http://webkit.org/">world</a></div>');
document.body.removeChild(testContainer);
......
......@@ -50,19 +50,19 @@ testSingleToggle("unlink", 'hello <a href="http://webkit.org/" style="color: blu
selectAll, 'hello <font color="#0000ff"><span style="display: block;">world</span></font> WebKit');
testSingleToggle("unlink", '<a href="http://webkit.org/" style="font-size: large;">hello world</a> WebKit',
selectLastTwoWords, '<a href="http://webkit.org/" style="font-size: large;">hello </a><font size="4">world</font> WebKit');
testSingleToggle("unlink", 'hello <a href="http://webkit.org/" style="font-size: large;">world <span style="font-size: small; ">WebKit</span> rocks</a>',
selectLastTwoWords, 'hello <a href="http://webkit.org/"><font size="4">world </font></a><span style="font-size: small; ">WebKit</span><font size="4"> rocks</font>');
testSingleToggle("unlink", 'hello <a href="http://webkit.org/" style="font-size: large;">world <span style="font-size: small;">WebKit</span> rocks</a>',
selectLastTwoWords, 'hello <a href="http://webkit.org/"><font size="4">world </font></a><span style="font-size: small;">WebKit</span><font size="4"> rocks</font>');
testSingleToggle("unlink", 'hello <a href="http://webkit.org/" style="font-style: italic;"><b>world</b> WebKit</a>',
selectFirstTwoWords, 'hello <b style="font-style: italic; ">world</b><a href="http://webkit.org/"><i> WebKit</i></a>');
selectFirstTwoWords, 'hello <b style="font-style: italic;">world</b><a href="http://webkit.org/"><i> WebKit</i></a>');
testSingleToggle("unlink", '<a href="http://webkit.org/" style="background-color: yellow;"><div>hello</div><div>world</div></a>',
selectAll, '<div style="background-color: yellow; ">hello</div><div style="background-color: yellow; ">world</div>');
selectAll, '<div style="background-color: yellow;">hello</div><div style="background-color: yellow;">world</div>');
testSingleToggle("unlink", 'hello<a href="http://webkit.org/" style="background-color: yellow;"><div>world</div></a>WebKit',
selectAll, 'hello<div style="background-color: yellow; ">world</div><span style="background-color: yellow;">WebKit</span>');
selectAll, 'hello<div style="background-color: yellow;">world</div><span style="background-color: yellow;">WebKit</span>');
testSingleToggle("unlink", '<a href="http://webkit.org/" style="font-weight: bold;"><div>hello</div><div>world WebKit</div></a>',
selectLastTwoWords, '<a href="http://webkit.org/"><div style="font-weight: bold; ">hello</div></a><div style="font-weight: bold; ">world WebKit</div>');
selectLastTwoWords, '<a href="http://webkit.org/"><div style="font-weight: bold;">hello</div></a><div style="font-weight: bold;">world WebKit</div>');
testSingleToggle("unlink", '<a href="http://webkit.org/" style="font-weight: bold;"><div style="font-weight: normal;">hello</div><div>world</div></a>',
selectLastWord, '<a href="http://webkit.org/"><div style="font-weight: normal; ">hello</div></a><div style="font-weight: bold; ">world</div>');
selectLastWord, '<a href="http://webkit.org/"><div style="font-weight: normal;">hello</div></a><div style="font-weight: bold;">world</div>');
document.body.removeChild(testContainer);
......
......@@ -11,12 +11,12 @@ PASS select first two words of "hello <b>world</b> WebKit" and createLink (http:
PASS select first two words of "<a href="http://trac.webkit.org/">hello <b>world</b></a> WebKit" and createLink (http://webkit.org/) yields "<a href="http://webkit.org/">hello <b>world</b></a> WebKit"
PASS select first two words of "<a href="http://trac.webkit.org/" style="font-style: italic;">hello world</a> WebKit" and createLink (http://webkit.org/) yields "<i><a href="http://webkit.org/">hello world</a></i> WebKit"
PASS select first two words of "hello <a href="http://trac.webkit.org/"><b>world</b> WebKit</a>" and createLink (http://webkit.org/) yields "<a href="http://webkit.org/">hello <b>world</b></a><a href="http://trac.webkit.org/"> WebKit</a>"
PASS select first two words of "hello <a href="http://trac.webkit.org/" style="font-style: italic;"><b>world</b> WebKit</a>" and createLink (http://webkit.org/) yields "<a href="http://webkit.org/">hello <b style="font-style: italic; ">world</b></a><a href="http://trac.webkit.org/"><i> WebKit</i></a>"
PASS select first two words of "hello <a href="http://trac.webkit.org/" style="font-style: italic;"><b>world</b> WebKit</a>" and createLink (http://webkit.org/) yields "<a href="http://webkit.org/">hello <b style="font-style: italic;">world</b></a><a href="http://trac.webkit.org/"><i> WebKit</i></a>"
PASS select last word of "hello <b>world</b> WebKit" and createLink (http://webkit.org/) yields "hello <b>world</b> <a href="http://webkit.org/">WebKit</a>"
PASS select last word of "<u>hello <b>world</b> WebKit</u>" and createLink (http://webkit.org/) yields "<u>hello <b>world</b> <a href="http://webkit.org/">WebKit</a></u>"
PASS select last word of "<a href="http://trac.webkit.org/"><div>hello</div><div>world</div></a>" and createLink (http://webkit.org/) yields "<a href="http://trac.webkit.org/"><div>hello</div></a><div><a href="http://webkit.org/">world</a></div>"
PASS select last word of "<a href="http://trac.webkit.org/" style="font-weight: bold;"><div>hello</div><div>world</div></a>" and createLink (http://webkit.org/) yields "<a href="http://trac.webkit.org/"><div style="font-weight: bold; ">hello</div></a><div style="font-weight: bold; "><a href="http://webkit.org/">world</a></div>"
PASS select last word of "<a href="http://trac.webkit.org/" style="font-weight: bold;"><div style="font-weight: normal;">hello</div><div>world</div></a>" and createLink (http://webkit.org/) yields "<a href="http://trac.webkit.org/"><div style="font-weight: normal; ">hello</div></a><div style="font-weight: bold; "><a href="http://webkit.org/">world</a></div>"
PASS select last word of "<a href="http://trac.webkit.org/" style="font-weight: bold;"><div>hello</div><div>world</div></a>" and createLink (http://webkit.org/) yields "<a href="http://trac.webkit.org/"><div style="font-weight: bold;">hello</div></a><div style="font-weight: bold;"><a href="http://webkit.org/">world</a></div>"
PASS select last word of "<a href="http://trac.webkit.org/" style="font-weight: bold;"><div style="font-weight: normal;">hello</div><div>world</div></a>" and createLink (http://webkit.org/) yields "<a href="http://trac.webkit.org/"><div style="font-weight: normal;">hello</div></a><div style="font-weight: bold;"><a href="http://webkit.org/">world</a></div>"
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -10,12 +10,12 @@ PASS unlink on all of "hello <a href="http://webkit.org/" style="font-weight: bo
PASS unlink on all of "hello <a href="http://webkit.org/" style="color: blue;">world</a> WebKit" yields "hello <font color="#0000ff">world</font> WebKit"
PASS unlink on all of "hello <a href="http://webkit.org/" style="color: blue; display: block;">world</a> WebKit" yields "hello <font color="#0000ff"><span style="display: block;">world</span></font> WebKit"
PASS unlink on last two words of "<a href="http://webkit.org/" style="font-size: large;">hello world</a> WebKit" yields "<a href="http://webkit.org/" style="font-size: large;">hello </a><font size="4">world</font> WebKit"
PASS unlink on last two words of "hello <a href="http://webkit.org/" style="font-size: large;">world <span style="font-size: small; ">WebKit</span> rocks</a>" yields "hello <a href="http://webkit.org/"><font size="4">world </font></a><span style="font-size: small; ">WebKit</span><font size="4"> rocks</font>"
PASS unlink on first two words of "hello <a href="http://webkit.org/" style="font-style: italic;"><b>world</b> WebKit</a>" yields "hello <b style="font-style: italic; ">world</b><a href="http://webkit.org/"><i> WebKit</i></a>"
PASS unlink on all of "<a href="http://webkit.org/" style="background-color: yellow;"><div>hello</div><div>world</div></a>" yields "<div style="background-color: yellow; ">hello</div><div style="background-color: yellow; ">world</div>"
PASS unlink on all of "hello<a href="http://webkit.org/" style="background-color: yellow;"><div>world</div></a>WebKit" yields "hello<div style="background-color: yellow; ">world</div><span style="background-color: yellow;">WebKit</span>"
PASS unlink on last two words of "<a href="http://webkit.org/" style="font-weight: bold;"><div>hello</div><div>world WebKit</div></a>" yields "<a href="http://webkit.org/"><div style="font-weight: bold; ">hello</div></a><div style="font-weight: bold; ">world WebKit</div>"
PASS unlink on last word of "<a href="http://webkit.org/" style="font-weight: bold;"><div style="font-weight: normal;">hello</div><div>world</div></a>" yields "<a href="http://webkit.org/"><div style="font-weight: normal; ">hello</div></a><div style="font-weight: bold; ">world</div>"
PASS unlink on last two words of "hello <a href="http://webkit.org/" style="font-size: large;">world <span style="font-size: small;">WebKit</span> rocks</a>" yields "hello <a href="http://webkit.org/"><font size="4">world </font></a><span style="font-size: small;">WebKit</span><font size="4"> rocks</font>"
PASS unlink on first two words of "hello <a href="http://webkit.org/" style="font-style: italic;"><b>world</b> WebKit</a>" yields "hello <b style="font-style: italic;">world</b><a href="http://webkit.org/"><i> WebKit</i></a>"
PASS unlink on all of "<a href="http://webkit.org/" style="background-color: yellow;"><div>hello</div><div>world</div></a>" yields "<div style="background-color: yellow;">hello</div><div style="background-color: yellow;">world</div>"
PASS unlink on all of "hello<a href="http://webkit.org/" style="background-color: yellow;"><div>world</div></a>WebKit" yields "hello<div style="background-color: yellow;">world</div><span style="background-color: yellow;">WebKit</span>"
PASS unlink on last two words of "<a href="http://webkit.org/" style="font-weight: bold;"><div>hello</div><div>world WebKit</div></a>" yields "<a href="http://webkit.org/"><div style="font-weight: bold;">hello</div></a><div style="font-weight: bold;">world WebKit</div>"
PASS unlink on last word of "<a href="http://webkit.org/" style="font-weight: bold;"><div style="font-weight: normal;">hello</div><div>world</div></a>" yields "<a href="http://webkit.org/"><div style="font-weight: normal;">hello</div></a><div style="font-weight: bold;">world</div>"
PASS successfullyParsed is true
TEST COMPLETE
......
Test to make sure that pasting text with a font size into a quirks mode document that is zoomed does not alter the font size.
Paste Here:This font is size 16px.
Paste Here:<span style="font-size: 16px; " class="Apple-style-span">This font is size 16px.</span>
Paste Here:<span style="font-size: 16px;" class="Apple-style-span">This font is size 16px.</span>
document.compatMode: BackCompat
PASS
<span style="background-color: rgb(187, 187, 187); ">This tests to make sure that we wrap copied markup in a div to hold a fully selected body's attributes and style when the that body has a background-color. If you copy and paste this text into Mail, it should have a grey background.</span>
<span style="background-color: rgb(187, 187, 187);">This tests to make sure that we wrap copied markup in a div to hold a fully selected body's attributes and style when the that body has a background-color. If you copy and paste this text into Mail, it should have a grey background.</span>
This tests to see that tabs are put into tab spans when they are copied individually. The pasted tab should be inside of a tab span, not a style span. To run the test manually, paste and then inspect the editable region, and ensure that there is a tab span at the beginning of the editable div.
<span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx
<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx
This tests for a bug where copying content from a document in quirksmode and pasting it would produce overlapping text because of a height: 1%; overflow: visible; rule. To run manually, paste into a document not in quirksmode. The paragraphs should not overlap. When you inspect the source, the paragraphs should have pixel values for the height property.
<p style="height: 54px; ">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum lacus id lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque pulvinar, libero eu tincidunt adipiscing, quam arcu pharetra libero, sed aliquet leo eros vitae sapien.</p><p style="height: 54px; ">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum lacus id lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque pulvinar, libero eu tincidunt adipiscing, quam arcu pharetra libero, sed aliquet leo eros vitae sapien.</p><p style="height: 54px; ">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum lacus id lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque pulvinar, libero eu tincidunt adipiscing, quam arcu pharetra libero, sed aliquet leo eros vitae sapien.</p>
<p style="height: 54px;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum lacus id lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque pulvinar, libero eu tincidunt adipiscing, quam arcu pharetra libero, sed aliquet leo eros vitae sapien.</p><p style="height: 54px;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum lacus id lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque pulvinar, libero eu tincidunt adipiscing, quam arcu pharetra libero, sed aliquet leo eros vitae sapien.</p><p style="height: 54px;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum lacus id lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque pulvinar, libero eu tincidunt adipiscing, quam arcu pharetra libero, sed aliquet leo eros vitae sapien.</p>
......@@ -27,7 +27,7 @@ If there are NULL characters in text nodes, they should not be copied to the cli
| id="source"
| "Copy paste me"
| <span>
| style="color: green; "
| style="color: green;"
| "green"
| "Copy paste me"
| "
......
......@@ -26,7 +26,7 @@ second test - after:
| <div>
| "1234שדגכ:"
| <div>
| style="direction: rtl; "
| style="direction: rtl;"
| "1234שדגכ:<#selection-caret>"
| "
"
......@@ -56,7 +56,7 @@ Markup after:
| style="background-color: rgb(255, 0, 0);"
| "Red background"
| <span>
| style="background-color: rgb(255, 0, 0); "
| style="background-color: rgb(255, 0, 0);"
| "Red background"
| <div>
| id="test2"
......@@ -64,7 +64,7 @@ Markup after:
| style="background-color: green;"
| "Green background"
| <span>
| style="background-color: rgb(0, 128, 0); "
| style="background-color: rgb(0, 128, 0);"
| "Green background"
| "
"
......
......@@ -20,6 +20,6 @@ Testing if DataTransferItems can be accessed outside an event handler...
DataTransferItem accessed outside event handler!
copy: items[0] value: Hello World!
copy: items[1] value: <b>Hello World!
paste: items[0] value: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.</span>
paste: items[0] value: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.</span>
paste: items[1] value: This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.
......@@ -23,7 +23,7 @@ after:
| "
"
| <span>
| style="display: block; "
| style="display: block;"
| <b>
| "This is a paragraph."
| <span>
......
......@@ -3,5 +3,5 @@ This test verifies that WebKit does not erroneously clone nodes hierarchy when c
You should not see any borders:
| <span>
| style="color: rgb(0, 0, 255); background-color: rgb(255, 255, 0); "
| style="color: rgb(0, 0, 255); background-color: rgb(255, 255, 0);"
| "Hello<#selection-caret>"
......@@ -3,7 +3,7 @@
This test verifies that WebKit does not erroneously clone nodes hierarchy when copying text with background color.
To manually this test, select the text inside the div with the border, cut and paste it back. You should not see an additional red border.
<div style="border: 2px solid red">
<div id="test"><span style="background-color: rgb(187, 187, 187); ">Select this text</span><br></div>
<div id="test"><span style="background-color: rgb(187, 187, 187);">Select this text</span><br></div>
</div>
</div>
......
......@@ -11,7 +11,7 @@ before:
after:
| <a>
| href="http://webkit.org/"
| style="color: orange; "
| style="color: orange;"
| target="_blank"
| title="some title"
| "<#selection-anchor>drag me<#selection-focus>"
......
CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the clipboard during an onpaste event.
CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space"> </span></span>
CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space"> </span></span>
This test verifies that we can get text/html from the clipboard during an onpaste event. This test requires DRT.
Paste content in this div.This test verifies that we can get text/html from the clipboard during an onpaste event. 
PASS
......
......@@ -13,7 +13,7 @@ function removeFontName(text)
{
if (!text)
return text;
return text.replace(/font-family: [^;]+;/g, "");
return text.replace(/font-family: [^;]+;\s*/g, "");
}
function paste(ev)
......
......@@ -52,7 +52,7 @@ Actual result:
| <li>
| "A"
| <div>
| style="text-align: start; "
| style="text-align: start;"
| <ul>
| <li>
| <a>
......
......@@ -7,10 +7,10 @@ PASS confirmedMarkup is 'Hello'
PASS confirmedMarkup is '<b><i>Hello</i></b>'
PASS confirmedMarkup is '<div style="text-align: center;"><b>Hello</b></div>'
PASS confirmedMarkup is '<div><b><i>hello</i></b></div><div><b><i>world</i></b></div>'
PASS confirmedMarkup is '<b><i><span style="font-weight: normal; "><b><i>hello1</i></b><b><i>&nbsp;hello2</i></b></span></i></b>'
FAIL confirmedMarkup should be <i style="margin: 10px; ">hello</i></b></i>. Was <i style="margin: 10px; "><b><i style="margin: 10px; ">hello</i></b></i>.
PASS confirmedMarkup is '<b><i><span style="font-weight: normal;"><b><i>hello1</i></b><b><i>&nbsp;hello2</i></b></span></i></b>'
FAIL confirmedMarkup should be <i style="margin: 10px;">hello</i></b></i>. Was <i style="margin: 10px;"><b><i style="margin: 10px;">hello</i></b></i>.
PASS confirmedMarkup is '<b><i>Hello&nbsp;world</i></b>'
PASS confirmedMarkup is '<b><i><span style="font-weight: normal; ">plain text<b><i>bold italic text</i></b></span></i></b>'
PASS confirmedMarkup is '<b><i><span style="font-weight: normal;">plain text<b><i>bold italic text</i></b></span></i></b>'
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -42,11 +42,11 @@ testPaste("div", "<div><b><div><i>Hello</i></div></b></div>", "<b><i>Hello</i></
testPaste("div", "<div><div style=\"text-align: center;\"><b>Hello</b></div></div>", "<div style=\"text-align: center;\"><b>Hello</b></div>");
testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>hello</i></b></span></i></b></div><div><b><i><span style=\"font-weight: normal\"><b><i>world</i></b></span></i></b></div>",
"<div><b><i>hello</i></b></div><div><b><i>world</i></b></div>");
testPaste("div", "<div><b><i><span style=\"font-weight: normal; \"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal; \"><b><i>hello1</i></b><b><i>&nbsp;hello2</i></b></span></i></b>");
testPaste("div", "<div><b><i><span style=\"font-weight: normal;\"><b><i>hello1</i></b><b><i> hello2</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal;\"><b><i>hello1</i></b><b><i>&nbsp;hello2</i></b></span></i></b>");
testPaste("div", "<i style=\"margin: 10px;\"><b><i style=\"margin: 10px;\">hello</i></b></i>",
"<i style=\"margin: 10px; \">hello</i></b></i>");
"<i style=\"margin: 10px;\">hello</i></b></i>");
testPaste("div", "<div><b><i><span style=\"font-weight: normal\"><b><i>Hello <!-- comment -->world</i></b></span></i></b></div>", "<b><i>Hello&nbsp;world</i></b>");
testPaste("div", "<div><b><i><span style=\"font-weight: normal\">plain text<b><i>bold italic text</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal; \">plain text<b><i>bold italic text</i></b></span></i></b>");
testPaste("div", "<div><b><i><span style=\"font-weight: normal\">plain text<b><i>bold italic text</i></b></span></i></b></div>", "<b><i><span style=\"font-weight: normal;\">plain text<b><i>bold italic text</i></b></span></i></b>");
root.style.display = "none";
......
......@@ -6,6 +6,6 @@ one: <b>one</b>
two: <span style="background-color: green">two</span>
three: three
one: <b>one</b>
two: <span style="background-color: green; ">two</span>
two: <span style="background-color: green;">two</span>
four: <span style="background-color: orange"><i>four</i></span>
i love counting, counting to the number four: i love counting, counting to the number four
......@@ -8,12 +8,12 @@ CNN Hello 
This is a form
<button id="button1" onclick="sayHello()" ondblclick="sayHello()" style="width: 100px;">Hello</button>
<button id="button1" style="width: 100px; ">Hello</button>
<button id="button1" style="width: 100px;">Hello</button>
<a id="anchor1" href="http://www.cnn.com/">CNN</a>
<a id="anchor1" href="http://www.cnn.com/">CNN</a>
<a id="anchor2" href="javascript:sayHello()">Hello</a>
<a id="anchor2" href="">Hello</a>
<iframe id="iframe1" src="javascript:var x = 1;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
<iframe id="iframe1" src="" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238); "></iframe>
<iframe id="iframe1" src="" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
<form id="form1" action="javascript:sayHello()" formaction="javascript:sayHello()" style="width: 200px; height: 150px; background-color:#cee;">This is a form<br><img src="../resources/abe.png"></form>
<form id="form1" action="" formaction="" style="width: 200px; height: 150px; background-color: rgb(204, 238, 238); ">This is a form<br><img src="../resources/abe.png"></form>
<form id="form1" action="" formaction="" style="width: 200px; height: 150px; background-color: rgb(204, 238, 238);">This is a form<br><img src="../resources/abe.png"></form>
......@@ -57,7 +57,7 @@ FRAME 0:
Pasted content:
| <button>
| id="button1"
| style="width: 100px; "
| style="width: 100px;"
| "Hello"
| <a>
| href="http://www.bing.com/search?q=cnn"
......@@ -70,12 +70,12 @@ Pasted content:
| <iframe>
| id="iframe1"
| src=""
| style="width: 200px; height: 100px; background-color: rgb(204, 238, 238); "
| style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"
| <form>
| action=""
| formaction=""
| id="form1"
| style="width: 200px; height: 150px; background-color: rgb(204, 238, 238); "
| style="width: 200px; height: 150px; background-color: rgb(204, 238, 238);"
| "This is a form<#selection-caret>"
FRAME 0:
......
......@@ -15,4 +15,4 @@ Problem: copy/pasting some HTML including tables can give rise to a <div> elemen
abcdef
foo bar
ghijk
<div id="test" class="editing"> <div>abcdef<div style="text-align: center; "><table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>ghijk</div> </div> </div>
<div id="test" class="editing"> <div>abcdef<div style="text-align: center;"><table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>ghijk</div> </div> </div>
......@@ -10,6 +10,6 @@ After paste:
| <b>
| style="border: solid 5px blue;padding: 5px;"
| <i>
| style="font-weight: normal; "
| style="font-weight: normal;"
| "hello<#selection-caret>"
| <br>
......@@ -8,6 +8,6 @@ Before copy-paste:
After copy-paste:
| <b>
| style="font-weight: normal; "
| style="font-weight: normal;"
| "hello world<#selection-caret>"
| <br>
This tests pasting content with redundant inline style.
You should not see any inline styles other than font-weight: bold and there should be exactly one span around WebKit.
| <em>
| style="font-weight: bold; "
| style="font-weight: bold;"
| "hello world"
| <br>
| <span>
......
This test for a bug copy/pasting underlined text. The color of the underline should be the color of the element that has the text-decoration property.
| <span>
| style="color: rgb(255, 0, 0); text-decoration: underline; "
| style="color: rgb(255, 0, 0); text-decoration: underline;"
| "This should be underlined.<#selection-caret>"
| <br>
......@@ -30,11 +30,11 @@ Pasted:
| title="none"
| <span>
| class="red"
| style="font-size: 1em; font-weight: bold; "
| style="font-size: 1em; font-weight: bold;"
| title="font-size: 1em; font-weight: bold;"
| "world"
| " "
| <em>
| style="font-style: normal; font-weight: bold; color: blue; "
| style="font-style: normal; font-weight: bold; color: blue;"
| title="font-style: normal; font-weight: bold; color: blue;"