Title: [99918] trunk
Revision
99918
Author
[email protected]
Date
2011-11-10 17:26:32 -0800 (Thu, 10 Nov 2011)

Log Message

ASSERT when outdenting styled line break.
https://bugs.webkit.org/show_bug.cgi?id=72069
<rdar://problem/10429739>

Reviewed by Ryosuke Niwa.

Source/WebCore: 

When outdenting a line break that has some inline style, we don't consider
the enclosing elements that provide the style.
This causes the splitting to occur in the wrong position,
triggering the assert.
         
Test: editing/execCommand/outdent-break-with-style.html

* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::outdentParagraph): The fix consists
in choosing the highest inline ancestor as splitting point.
* editing/htmlediting.cpp:
(WebCore::isInline): Added.
* editing/htmlediting.h: Added isInline.

LayoutTests: 

* editing/execCommand/outdent-break-with-style-expected.txt: Added.
* editing/execCommand/outdent-break-with-style.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99917 => 99918)


--- trunk/LayoutTests/ChangeLog	2011-11-11 01:07:44 UTC (rev 99917)
+++ trunk/LayoutTests/ChangeLog	2011-11-11 01:26:32 UTC (rev 99918)
@@ -1,3 +1,14 @@
+2011-11-10  Enrica Casucci  <[email protected]>
+
+        ASSERT when outdenting styled line break.
+        https://bugs.webkit.org/show_bug.cgi?id=72069
+        <rdar://problem/10429739>
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/execCommand/outdent-break-with-style-expected.txt: Added.
+        * editing/execCommand/outdent-break-with-style.html: Added.
+
 2011-11-10  Filip Pizlo  <[email protected]>
 
         DFG byte array support sometimes clamps values incorrectly

Added: trunk/LayoutTests/editing/execCommand/outdent-break-with-style-expected.txt (0 => 99918)


--- trunk/LayoutTests/editing/execCommand/outdent-break-with-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/outdent-break-with-style-expected.txt	2011-11-11 01:26:32 UTC (rev 99918)
@@ -0,0 +1,8 @@
+This test outdents an empty paragraph with inline style.
+| <blockquote>
+|   style="margin: 0 0 0 40px; border: none; padding: 0px;"
+|   <img>
+|   <br>
+| <b>
+|   <#selection-caret>
+|   <br>

Added: trunk/LayoutTests/editing/execCommand/outdent-break-with-style.html (0 => 99918)


--- trunk/LayoutTests/editing/execCommand/outdent-break-with-style.html	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/outdent-break-with-style.html	2011-11-11 01:26:32 UTC (rev 99918)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body contenteditable></body>
+<script src=""
+<script>
+            
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+while (script = document.querySelector('script'))
+    script.parentNode.removeChild(script);
+
+getSelection().setPosition(document.body, 0);
+document.execCommand("InsertImage",false);
+document.execCommand("Indent");
+document.execCommand("Bold");
+document.execCommand("InsertLineBreak");
+document.execCommand("Outdent");
+
+Markup.description('This test outdents an empty paragraph with inline style.');
+Markup.dump(document.body);
+            
+</script>
+
+</html>

Modified: trunk/Source/WebCore/ChangeLog (99917 => 99918)


--- trunk/Source/WebCore/ChangeLog	2011-11-11 01:07:44 UTC (rev 99917)
+++ trunk/Source/WebCore/ChangeLog	2011-11-11 01:26:32 UTC (rev 99918)
@@ -1,3 +1,25 @@
+2011-11-10  Enrica Casucci  <[email protected]>
+
+        ASSERT when outdenting styled line break.
+        https://bugs.webkit.org/show_bug.cgi?id=72069
+        <rdar://problem/10429739>
+
+        Reviewed by Ryosuke Niwa.
+
+        When outdenting a line break that has some inline style, we don't consider
+        the enclosing elements that provide the style.
+        This causes the splitting to occur in the wrong position,
+        triggering the assert.
+         
+        Test: editing/execCommand/outdent-break-with-style.html
+
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::outdentParagraph): The fix consists
+        in choosing the highest inline ancestor as splitting point.
+        * editing/htmlediting.cpp:
+        (WebCore::isInline): Added.
+        * editing/htmlediting.h: Added isInline.
+
 2011-11-10  Dean Jackson  <[email protected]>
 
         Remove effectBoundingBoxMode from CSS Filters

Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.cpp (99917 => 99918)


--- trunk/Source/WebCore/editing/IndentOutdentCommand.cpp	2011-11-11 01:07:44 UTC (rev 99917)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.cpp	2011-11-11 01:26:32 UTC (rev 99918)
@@ -178,7 +178,8 @@
         splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingNode, true);
     else {
         // We split the blockquote at where we start outdenting.
-        splitElement(static_cast<Element*>(enclosingNode), visibleStartOfParagraph.deepEquivalent().deprecatedNode());
+        Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockFlow);
+        splitElement(static_cast<Element*>(enclosingNode), (highestInlineNode) ? highestInlineNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode());
     }
     RefPtr<Node> placeholder = createBreakElement(document());
     insertNodeBefore(placeholder, splitBlockquoteNode);

Modified: trunk/Source/WebCore/editing/htmlediting.cpp (99917 => 99918)


--- trunk/Source/WebCore/editing/htmlediting.cpp	2011-11-11 01:07:44 UTC (rev 99917)
+++ trunk/Source/WebCore/editing/htmlediting.cpp	2011-11-11 01:26:32 UTC (rev 99918)
@@ -296,6 +296,11 @@
     return node && node->renderer() && !node->renderer()->isInline();
 }
 
+bool isInline(const Node* node)
+{
+    return node && node->renderer() && node->renderer()->isInline();
+}
+
 // FIXME: Deploy this in all of the places where enclosingBlockFlow/enclosingBlockFlowOrTableElement are used.
 // FIXME: Pass a position to this function.  The enclosing block of [table, x] for example, should be the 
 // block that contains the table and not the table, and this function should be the only one responsible for 

Modified: trunk/Source/WebCore/editing/htmlediting.h (99917 => 99918)


--- trunk/Source/WebCore/editing/htmlediting.h	2011-11-11 01:07:44 UTC (rev 99917)
+++ trunk/Source/WebCore/editing/htmlediting.h	2011-11-11 01:26:32 UTC (rev 99918)
@@ -96,6 +96,7 @@
 
 bool isAtomicNode(const Node*);
 bool isBlock(const Node*);
+bool isInline(const Node*);
 bool isSpecialElement(const Node*);
 bool isTabSpanNode(const Node*);
 bool isTabSpanTextNode(const Node*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to