LayoutTests:
[WebKit-https.git] / WebCore / editing / markup.cpp
index 2b364c4ca930c6fa0bd2647c3a57e3b74620a495..db1f394990f94c05a124d356e6dd6c29d71f210f 100644 (file)
@@ -171,25 +171,26 @@ static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnot
             }
             NamedAttrMap *attrs = el->attributes();
             unsigned length = attrs->length();
             }
             NamedAttrMap *attrs = el->attributes();
             unsigned length = attrs->length();
-            if (length == 0 && additionalStyle.length() > 0) {
-                // FIXME: Handle case where additionalStyle has illegal characters in it, like "
-                markup += " " +  styleAttr.localName().deprecatedString() + "=\"" + additionalStyle.deprecatedString() + "\"";
-            }
-            else {
-                for (unsigned int i=0; i<length; i++) {
-                    Attribute *attr = attrs->attributeItem(i);
-                    String value = attr->value();
-                    if (attr->name() == styleAttr && additionalStyle.length() > 0)
-                        value += "; " + additionalStyle;
-                    // FIXME: Handle case where value has illegal characters in it, like "
-                    if (documentIsHTML)
-                        markup += " " + attr->name().localName().deprecatedString();
-                    else
-                        markup += " " + attr->name().toString().deprecatedString();
-                    markup += "=\"" + escapeTextForMarkup(value.deprecatedString()) + "\"";
+
+            for (unsigned int i = 0; i < length; i++) {
+                Attribute *attr = attrs->attributeItem(i);
+                String value = attr->value();
+                if (attr->name() == styleAttr && additionalStyle.length() > 0) {
+                    value += "; " + additionalStyle;
+                    additionalStyle = "";
                 }
                 }
+                // FIXME: Handle case where value has illegal characters in it, like "
+                if (documentIsHTML)
+                    markup += " " + attr->name().localName().deprecatedString();
+                else
+                    markup += " " + attr->name().toString().deprecatedString();
+                markup += "=\"" + escapeTextForMarkup(value.deprecatedString()) + "\"";
             }
             
             }
             
+            if (additionalStyle.length() > 0)
+                // FIXME: Handle case where additionalStyle has illegal characters in it, like "
+                markup += " " +  styleAttr.localName().deprecatedString() + "=\"" + additionalStyle.deprecatedString() + "\"";
+            
             if (shouldSelfClose(el)) {
                 if (el->isHTMLElement())
                     markup += " "; // XHTML 1.0 <-> HTML compatibility.
             if (shouldSelfClose(el)) {
                 if (el->isHTMLElement())
                     markup += " "; // XHTML 1.0 <-> HTML compatibility.