2007-03-19 Mitz Pettel <mitz@webkit.org>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2007 12:46:58 +0000 (12:46 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2007 12:46:58 +0000 (12:46 +0000)
        Reviewed by Tim Hatcher.

        - fix http://bugs.webkit.org/show_bug.cgi?id=13091
          REGRESSION (r20075): Wrong text style and pixel break in Apple Store Locator HUD

        Test: fast/innerHTML/additional-inline-style.html

        * editing/markup.cpp:
        (WebCore::startMarkup): Changed to add inline style based on CSS rules only
        in AnnotateForInterchange mode.

2007-03-19  Mitz Pettel  <mitz@webkit.org>

        Reviewed by Tim Hatcher.

        - test and updated result for http://bugs.webkit.org/show_bug.cgi?id=13091
          REGRESSION (r20075): Wrong text style and pixel break in Apple Store Locator HUD

        * editing/pasteboard/paste-table-002-expected.txt:
        * fast/innerHTML/additional-inline-style-expected.txt: Added.
        * fast/innerHTML/additional-inline-style.html: Added.
        * webarchive/test-duplicate-resources-expected.txt:
        * webarchive/test-frameset-expected.txt:
        * webarchive/test-link-href-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/paste-table-002-expected.txt
LayoutTests/fast/innerHTML/additional-inline-style-expected.txt [new file with mode: 0644]
LayoutTests/fast/innerHTML/additional-inline-style.html [new file with mode: 0644]
LayoutTests/webarchive/test-duplicate-resources-expected.txt
LayoutTests/webarchive/test-frameset-expected.txt
LayoutTests/webarchive/test-link-href-expected.txt
WebCore/ChangeLog
WebCore/editing/markup.cpp

index a0f2261..aaf9557 100644 (file)
@@ -1,3 +1,17 @@
+2007-03-19  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Tim Hatcher.
+
+        - test and updated result for http://bugs.webkit.org/show_bug.cgi?id=13091
+          REGRESSION (r20075): Wrong text style and pixel break in Apple Store Locator HUD
+
+        * editing/pasteboard/paste-table-002-expected.txt:
+        * fast/innerHTML/additional-inline-style-expected.txt: Added.
+        * fast/innerHTML/additional-inline-style.html: Added.
+        * webarchive/test-duplicate-resources-expected.txt:
+        * webarchive/test-frameset-expected.txt:
+        * webarchive/test-link-href-expected.txt:
+
 2007-03-18  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Mark.
index 1ae9200..953fbea 100644 (file)
@@ -16,5 +16,5 @@ Problem: copy/pasting some HTML including tables can give rise to a <div> elemen
 abcdef
 foo    bar
 ghijk
-<div id="test" class="editing" style="border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: red; border-right-color: red; border-bottom-color: red; border-left-color: red; font-size: 24px; "> <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>
 
diff --git a/LayoutTests/fast/innerHTML/additional-inline-style-expected.txt b/LayoutTests/fast/innerHTML/additional-inline-style-expected.txt
new file mode 100644 (file)
index 0000000..5848259
--- /dev/null
@@ -0,0 +1,8 @@
+Test for http://bugs.webkit.org/show_bug.cgi?id=13091 REGRESSION (r20075): Wrong text style and pixel break in Apple Store Locator HUD.
+
+This tests that .innerHTML does not introduce additional inline style.
+
+The following markup should not include a style attribute:
+
+<span></span>
+
diff --git a/LayoutTests/fast/innerHTML/additional-inline-style.html b/LayoutTests/fast/innerHTML/additional-inline-style.html
new file mode 100644 (file)
index 0000000..6e7fdf6
--- /dev/null
@@ -0,0 +1,35 @@
+<html>
+<head>
+    <title></title>
+    <style>
+        span { color: blue; }
+    </style>
+    <script>
+        function test()
+        {
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+
+            var result = document.getElementById("result");
+            var target = document.getElementById("target");
+            
+            document.body.offsetTop;
+            result.appendChild(document.createTextNode(target.innerHTML));
+        }
+    </script>
+</head>
+<body onload="test()">
+    <p>
+        Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=13091">http://bugs.webkit.org/show_bug.cgi?id=13091</a>
+        REGRESSION (r20075): Wrong text style and pixel break in Apple Store Locator HUD</i>.
+    </p>
+    <p>
+        This tests that <tt>.innerHTML</tt> does not introduce additional inline style.
+    </p>
+    <p>
+        The following markup should not include a <tt>style</tt> attribute:
+    </p>
+    <div id="target"><span></span></div>
+    <pre id="result"></pre>
+</body>
+</html>
index 2780e9e..8def5ff 100644 (file)
 &lt;script src="resources/dump-webarchive.js" language="javascript" type="text/javascript"&gt;&lt;/script&gt;
 &lt;link rel="stylesheet" href="resources/test-style.css" type="text/css"&gt;
 &lt;/head&gt;&lt;body&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   &lt;img src="resources/apple.gif"&gt;
 &lt;/div&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   This is not a frameset.  This text should be red sans-serif.
 &lt;/div&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   &lt;img src="resources/apple.gif"&gt;
 &lt;/div&gt;
 &lt;iframe src="resources/test-frame.html"&gt;&lt;/iframe&gt;
                                <string>&lt;html&gt;&lt;head&gt;
 &lt;link rel="stylesheet" href="test-style.css" type="text/css"&gt;
 &lt;/head&gt;&lt;body&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   &lt;img src="apple.gif"&gt;
 &lt;/div&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   This is a subframe.  This text should be red sans-serif.
 &lt;/div&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   &lt;img src="apple.gif"&gt;
 &lt;/div&gt;
 
index 937b24f..f886ea7 100644 (file)
                                <string>&lt;html&gt;&lt;head&gt;
 &lt;link rel="stylesheet" href="test-style.css" type="text/css"&gt;
 &lt;/head&gt;&lt;body&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   &lt;img src="apple.gif"&gt;
 &lt;/div&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   This is a subframe.  This text should be red sans-serif.
 &lt;/div&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
   &lt;img src="apple.gif"&gt;
 &lt;/div&gt;
 
index ee51bd0..ee1b3de 100644 (file)
@@ -12,7 +12,7 @@
 &lt;/script&gt;
 &lt;link rel="stylesheet" href="resources/test-style.css" type="text/css"&gt;
 &lt;/head&gt;&lt;body&gt;
-&lt;div style="font-family: Arial, Helvetica, sans-serif; color: red; "&gt;
+&lt;div&gt;
 This text should be red sans-serif.
 &lt;/div&gt;
 
index 9d8db92..2bed51a 100644 (file)
@@ -1,3 +1,16 @@
+2007-03-19  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Tim Hatcher.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=13091
+          REGRESSION (r20075): Wrong text style and pixel break in Apple Store Locator HUD
+
+        Test: fast/innerHTML/additional-inline-style.html
+
+        * editing/markup.cpp:
+        (WebCore::startMarkup): Changed to add inline style based on CSS rules only
+        in AnnotateForInterchange mode.
+
 2007-03-19  Zack Rusin  <zrusin@trolltech.com>
 
         Compile fix.
index 897168c..5bb9236 100644 (file)
@@ -190,7 +190,7 @@ static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnot
             const Element* el = static_cast<const Element*>(node);
             markup += el->nodeNamePreservingCase().deprecatedString();
             String additionalStyle;
-            if (el->isHTMLElement()) {
+            if (annotate && el->isHTMLElement()) {
                 RefPtr<CSSMutableStyleDeclaration> style = styleFromMatchedRulesForElement(const_cast<Element*>(el));
                 if (style->length() > 0)
                     additionalStyle = style->cssText();
@@ -201,7 +201,7 @@ static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnot
             for (unsigned int i = 0; i < length; i++) {
                 Attribute *attr = attrs->attributeItem(i);
                 String value = attr->value();
-                if (attr->name() == styleAttr && additionalStyle.length() > 0) {
+                if (annotate && attr->name() == styleAttr && additionalStyle.length()) {
                     value += "; " + additionalStyle;
                     additionalStyle = "";
                 }
@@ -213,7 +213,7 @@ static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnot
                 markup += "=\"" + escapeTextForMarkup(value.deprecatedString(), true) + "\"";
             }
             
-            if (additionalStyle.length() > 0)
+            if (annotate && additionalStyle.length())
                 // FIXME: Handle case where additionalStyle has illegal characters in it, like "
                 markup += " " +  styleAttr.localName().deprecatedString() + "=\"" + additionalStyle.deprecatedString() + "\"";