Reviewed by darin
[WebKit-https.git] / WebCore / page / Frame.cpp
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