2007-03-19 Mitz Pettel <mitz@webkit.org>
[WebKit-https.git] / WebCore / editing / markup.cpp
index 897168c3ac2d608c73a909a7796db0df95e55747..5bb92364c1ca588c785fe822f7dc81cc38aac5bb 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;
             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();
                 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();
             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 = "";
                 }
                     value += "; " + additionalStyle;
                     additionalStyle = "";
                 }
@@ -213,7 +213,7 @@ static DeprecatedString startMarkup(const Node *node, const Range *range, EAnnot
                 markup += "=\"" + escapeTextForMarkup(value.deprecatedString(), true) + "\"";
             }
             
                 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() + "\"";
             
                 // FIXME: Handle case where additionalStyle has illegal characters in it, like "
                 markup += " " +  styleAttr.localName().deprecatedString() + "=\"" + additionalStyle.deprecatedString() + "\"";