Reviewed by darin
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jul 2006 21:06:25 +0000 (21:06 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jul 2006 21:06:25 +0000 (21:06 +0000)
        <rdar://problem/4468458> Incoming HTML message is editable <body contenteditable="true">

        * dom/Document.cpp:
        (WebCore::Document::inDesignMode): Removed some spaces.
        * page/Frame.cpp:
        (WebCore::Frame::applyEditingStyleToElement): Just add CSS properties needed for editing.
        (WebCore::Frame::removeEditingStyleFromElement): Made this a no-op, we'll remove
        it eventually.

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

WebCore/ChangeLog
WebCore/dom/Document.cpp
WebCore/page/Frame.cpp

index 46feb047bfd031d669c0b0bd213bd354fab31370..e74fbb8191cec329fc68a71aa1deaea635c2dce0 100644 (file)
@@ -1,3 +1,16 @@
+2006-07-25  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+        
+        <rdar://problem/4468458> Incoming HTML message is editable <body contenteditable="true">
+
+        * dom/Document.cpp:
+        (WebCore::Document::inDesignMode): Removed some spaces.
+        * page/Frame.cpp:
+        (WebCore::Frame::applyEditingStyleToElement): Just add CSS properties needed for editing.
+        (WebCore::Frame::removeEditingStyleFromElement): Made this a no-op, we'll remove
+        it eventually.
+
 2006-07-25  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by Darin.
index 234180bd4de72ebabcb8c4fe8ffdb0f2a14f0678..7c98c2d83769b937080398d9ab5c627febb5dea7 100644 (file)
@@ -3098,7 +3098,7 @@ bool Document::inDesignMode() const
 {
     for (const Document* d = this; d; d = d->parentDocument()) {
         if (d->m_designMode != inherit)
-            return d->m_designMode;      
+            return d->m_designMode;
     }
     return false;
 }
index 94ddb7d43c38835575b57bd576e516e7c5cfc5d3..1f00b0e89938c95e786c852f394ef12ae33c3591 100644 (file)
@@ -2449,23 +2449,27 @@ void Frame::removeEditingStyleFromBodyElement() const
     }
 }
 
-void Frame::applyEditingStyleToElement(Element *element) const
+void Frame::applyEditingStyleToElement(Elementelement) const
 {
-    if (!element || !element->isHTMLElement())
+    if (!element)
         return;
-    
-    static_cast<HTMLElement*>(element)->setContentEditable("true");
+
+    CSSStyleDeclaration* style = element->style();
+    ASSERT(style);
+
+    ExceptionCode ec = 0;
+    style->setProperty(CSS_PROP_WORD_WRAP, "break-word", false, ec);
+    ASSERT(ec == 0);
+    style->setProperty(CSS_PROP__WEBKIT_NBSP_MODE, "space", false, ec);
+    ASSERT(ec == 0);
+    style->setProperty(CSS_PROP__WEBKIT_LINE_BREAK, "after-white-space", false, ec);
+    ASSERT(ec == 0);
 }
 
-void Frame::removeEditingStyleFromElement(Element *element) const
+void Frame::removeEditingStyleFromElement(Element*) const
 {
-    if (!element || !element->isHTMLElement())
-        return;
-        
-    static_cast<HTMLElement*>(element)->setContentEditable("false");        
 }
 
-
 bool Frame::isCharacterSmartReplaceExempt(const DeprecatedChar&, bool)
 {
     // no smart replace