LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2006 00:42:44 +0000 (00:42 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2006 00:42:44 +0000 (00:42 +0000)
        Reviewed by darin

        <rdar://problem/4652788>
        REGRESSION: Can't change size or style of any text in message body

        * editing/style/designmode-expected.checksum: Added.
        * editing/style/designmode-expected.png: Added.
        * editing/style/designmode-expected.txt: Added.
        * editing/style/designmode.html: Added.

WebCore:

        Reviewed by darin

        <rdar://problem/4652788>
        REGRESSION: Can't change size or style of any text in message body

        * dom/Node.cpp:
        (WebCore::Node::isContentRichlyEditable): Mimic Node::isContentEditable.
        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::isContentRichlyEditable): First check
        the frame for editability, then userModify, like what
        HTMLElement::isContentEditable() does.
        * html/HTMLElement.h:

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

LayoutTests/ChangeLog
LayoutTests/editing/style/designmode-expected.checksum [new file with mode: 0644]
LayoutTests/editing/style/designmode-expected.png [new file with mode: 0644]
LayoutTests/editing/style/designmode-expected.txt [new file with mode: 0644]
LayoutTests/editing/style/designmode.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/Node.cpp
WebCore/html/HTMLElement.cpp
WebCore/html/HTMLElement.h

index 1f59166ac8e10957fa8e8aa9d84624560356f4c8..4bb4bbee4a9513ed30806e7148387824e628988b 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-26  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+        
+        <rdar://problem/4652788>
+        REGRESSION: Can't change size or style of any text in message body
+
+        * editing/style/designmode-expected.checksum: Added.
+        * editing/style/designmode-expected.png: Added.
+        * editing/style/designmode-expected.txt: Added.
+        * editing/style/designmode.html: Added.
+
 2006-07-25  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by adele
diff --git a/LayoutTests/editing/style/designmode-expected.checksum b/LayoutTests/editing/style/designmode-expected.checksum
new file mode 100644 (file)
index 0000000..7ba5a70
--- /dev/null
@@ -0,0 +1 @@
+16ede59e59bd5bfe47377bace0a02169
\ No newline at end of file
diff --git a/LayoutTests/editing/style/designmode-expected.png b/LayoutTests/editing/style/designmode-expected.png
new file mode 100644 (file)
index 0000000..10c2dfb
Binary files /dev/null and b/LayoutTests/editing/style/designmode-expected.png differ
diff --git a/LayoutTests/editing/style/designmode-expected.txt b/LayoutTests/editing/style/designmode-expected.txt
new file mode 100644 (file)
index 0000000..48ab2d5
--- /dev/null
@@ -0,0 +1,20 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of HTML > #document to 1 of HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > B > DIV > BODY > HTML > #document to 25 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 737x18
+          text run at (0,0) width 737: "This tests to make sure that rich editing commands like Bold can be performed on text in a document in design mode."
+      RenderBlock {DIV} at (0,34) size 784x18
+        RenderInline {B} at (0,0) size 166x18
+          RenderText {#text} at (0,0) size 166x18
+            text run at (0,0) width 166: "This text should be bold."
+selection start: position 0 of child 0 {#text} of child 0 {B} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 25 of child 0 {#text} of child 0 {B} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/style/designmode.html b/LayoutTests/editing/style/designmode.html
new file mode 100644 (file)
index 0000000..4532f0b
--- /dev/null
@@ -0,0 +1,10 @@
+<p>This tests to make sure that rich editing commands like Bold can be performed on text in a document in design mode.</p>
+<div id="test">This text should be bold.</div>
+
+<script>
+document.designMode = "on";
+var s = window.getSelection();
+var e = document.getElementById("test");
+s.setBaseAndExtent(e, 0, e, e.childNodes.length);
+document.execCommand("Bold");
+</script>
\ No newline at end of file
index 53f9ed246a904443fb399221f264856e654696de..8f4d88eff92ba02af156036f0462e94adc768e8d 100644 (file)
@@ -1,3 +1,18 @@
+2006-07-26  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+        
+        <rdar://problem/4652788>
+        REGRESSION: Can't change size or style of any text in message body
+
+        * dom/Node.cpp:
+        (WebCore::Node::isContentRichlyEditable): Mimic Node::isContentEditable.
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::isContentRichlyEditable): First check
+        the frame for editability, then userModify, like what
+        HTMLElement::isContentEditable() does.
+        * html/HTMLElement.h:
+
 2006-07-26  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by ap.
index ff8d936d193459d0dd7d2e69e38f24af8cbfd0f4..59b1c8b7547a7f2a9645e865adeaeca4bf44a53e 100644 (file)
@@ -330,7 +330,7 @@ bool Node::isContentEditable() const
 
 bool Node::isContentRichlyEditable() const
 {
-    return renderer() && renderer()->style()->userModify() == READ_WRITE;
+    return parent() && parent()->isContentRichlyEditable();
 }
 
 IntRect Node::getRect() const
index 967b4e667ea281da23f2a022d1579e13e778637e..8dae0ea8cea14ebf436c574a2e73ede9ae863cda 100644 (file)
@@ -511,6 +511,23 @@ bool HTMLElement::isContentEditable() const
     return renderer()->style()->userModify() == READ_WRITE || renderer()->style()->userModify() == READ_WRITE_PLAINTEXT_ONLY;
 }
 
+bool HTMLElement::isContentRichlyEditable() const
+{
+    if (document()->frame() && document()->frame()->isContentEditable())
+        return true;
+
+    document()->updateRendering();
+
+    if (!renderer()) {
+        if (parentNode())
+            return parentNode()->isContentEditable();
+        else
+            return false;
+    }
+    
+    return renderer()->style()->userModify() == READ_WRITE;
+}
+
 String HTMLElement::contentEditable() const 
 {
     document()->updateRendering();
index 45a94e172808821ed4aee4e5e8bdd035b21492bd..5827f8dd3a3adb80dd533a0e7e80df69261a0a9a 100644 (file)
@@ -75,6 +75,7 @@ public:
     
     virtual bool isFocusable() const;
     virtual bool isContentEditable() const;
+    virtual bool isContentRichlyEditable() const;
     virtual String contentEditable() const;
     virtual void setContentEditable(MappedAttribute*);
     virtual void setContentEditable(const String&);