LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2007 00:02:06 +0000 (00:02 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2007 00:02:06 +0000 (00:02 +0000)
        Reviewed by John.

        <rdar://problem/5237074> REGRESSION: editing/unsupported-content/table-delete-003 is failing (13931)

        Corrected the description and added a FIXME:
        * editing/unsupported-content/table-delete-003-expected.checksum:
        * editing/unsupported-content/table-delete-003-expected.png:
        * editing/unsupported-content/table-delete-003-expected.txt:
        * editing/unsupported-content/table-delete-003.html:

WebCore:

        Reviewed by John.

        <rdar://problem/5237074> REGRESSION: editing/unsupported-content/table-delete-003 is failing (13931)

        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::initializeStartEnd):
        We wouldn't expand the selection to include a special element
        at the start of the selection unless the end of the selection
        was at the end of a special element. Avoid a special
        element at the start as long as it's fully selected. Ditto for
        the end.
        * editing/htmlediting.cpp:
        (WebCore::positionBeforeContainingSpecialElement):
        (WebCore::positionAfterContainingSpecialElement):

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

LayoutTests/ChangeLog
LayoutTests/editing/unsupported-content/table-delete-003-expected.checksum
LayoutTests/editing/unsupported-content/table-delete-003-expected.png
LayoutTests/editing/unsupported-content/table-delete-003-expected.txt
LayoutTests/editing/unsupported-content/table-delete-003.html
WebCore/ChangeLog
WebCore/editing/DeleteSelectionCommand.cpp
WebCore/editing/htmlediting.cpp

index 2eef6ca3ac103cf0ab89f6aa38196f2698f91811..3892cd0ac74bebcb7c0429d483853830eea7e08a 100644 (file)
@@ -1,3 +1,15 @@
+2007-06-07  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by John.
+
+        <rdar://problem/5237074> REGRESSION: editing/unsupported-content/table-delete-003 is failing (13931)
+        
+        Corrected the description and added a FIXME:
+        * editing/unsupported-content/table-delete-003-expected.checksum:
+        * editing/unsupported-content/table-delete-003-expected.png:
+        * editing/unsupported-content/table-delete-003-expected.txt:
+        * editing/unsupported-content/table-delete-003.html:
+
 2007-06-07  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Anders.
index b334c72792ae0bc26d63aa5a0e36a0c16cc8b942..0e6c0939a198a0a855199bfdfdc5395d9328e911 100644 (file)
@@ -1 +1 @@
-1fea699f4127bca59620604527f7ec5e
\ No newline at end of file
+1a13c33b7764a8fcdc6fa2a0dc639765
\ No newline at end of file
index 5267423135ba480bdcd382925dc9511d93310b15..9b17faf7dc3e3d7aa7a9079087011acf56154209 100644 (file)
Binary files a/LayoutTests/editing/unsupported-content/table-delete-003-expected.png and b/LayoutTests/editing/unsupported-content/table-delete-003-expected.png differ
index 97cc390c6817c961b93764832d5c6fb7fcde9864..2eb7244c3be9c9cf4d043ab774e31ad8d8706f9a 100644 (file)
@@ -1,4 +1,4 @@
-EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > B > BODY > HTML > #document to 3 of DIV > B > BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
@@ -11,9 +11,9 @@ EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotificatio
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldDeleteDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > TD > TR > TBODY > TABLE > DIV > DIV > BODY > HTML > #document
+EDITING DELEGATE: shouldDeleteDOMRange:range from 1 of #text > DIV > DIV > B > BODY > HTML > #document to 1 of #text > TD > TR > TBODY > TABLE > DIV > DIV > B > BODY > HTML > #document
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of DIV > DIV > B > BODY > HTML > #document to 1 of DIV > DIV > B > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 layer at (0,0) size 800x600
@@ -21,7 +21,7 @@ layer 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 {DIV} at (0,0) size 784x250 [border: (4px solid #0000FF)]
+      RenderBlock {DIV} at (0,0) size 784x272 [border: (4px solid #0000FF)]
         RenderBlock {DIV} at (20,20) size 744x72
           RenderText {#text} at (0,0) size 67x28
             text run at (0,0) width 67: "Tests: "
@@ -36,7 +36,7 @@ layer at (0,0) size 800x600
             text run at (99,50) width 392: "Select and delete a list and some surrounding content."
         RenderBlock (anonymous) at (20,92) size 744x22
           RenderBR {BR} at (0,0) size 0x22
-        RenderBlock {DIV} at (20,114) size 744x116
+        RenderBlock {DIV} at (20,114) size 744x138
           RenderText {#text} at (0,0) size 189x28
             text run at (0,0) width 189: "Expected Results: "
           RenderBR {BR} at (189,22) size 0x0
@@ -50,13 +50,27 @@ layer at (0,0) size 800x600
           RenderText {#text} at (99,72) size 744x44
             text run at (99,72) width 304: "Only selected content should get deleted. "
             text run at (403,72) width 341: "Surrounding content that is not selected should"
-            text run at (0,94) width 201: "(obviously) not be affected."
-      RenderBlock {DIV} at (0,260) size 784x32 [border: (2px solid #008000)]
-        RenderText {#text} at (2,2) size 45x28
-          text run at (2,2) width 45: "after"
-      RenderBlock {DIV} at (0,302) size 784x60
-        RenderBlock {DIV} at (0,0) size 784x60 [border: (2px solid #FF0000)]
+            text run at (0,94) width 206: "(obviously) not be affected. "
+          RenderBR {BR} at (206,111) size 0x0
+          RenderInline {B} at (0,0) size 718x22
+            RenderText {#text} at (0,116) size 718x22
+              text run at (0,116) width 718: "There is a bug: the caret ends up in the wrong position, it should be in the empty paragraph."
+        RenderBlock (anonymous) at (20,252) size 744x0
+          RenderInline {B} at (0,0) size 0x0
+            RenderText {#text} at (0,0) size 0x0
+      RenderBlock (anonymous) at (0,282) size 784x0
+        RenderInline {B} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+      RenderBlock (anonymous) at (0,282) size 784x130
+        RenderBlock {DIV} at (0,0) size 784x60 [border: (2px solid #008000)]
           RenderBR {BR} at (2,2) size 0x28
-          RenderText {#text} at (2,30) size 45x28
-            text run at (2,30) width 45: "after"
-caret: position 0 of child 0 {BR} of child 1 {DIV} of child 5 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+          RenderText {#text} at (2,30) size 50x28
+            text run at (2,30) width 50: "after"
+        RenderBlock {DIV} at (0,70) size 784x60
+          RenderBlock {DIV} at (0,0) size 784x60 [border: (2px solid #FF0000)]
+            RenderBR {BR} at (2,2) size 0x28
+            RenderText {#text} at (2,30) size 50x28
+              text run at (2,30) width 50: "after"
+      RenderBlock (anonymous) at (0,412) size 784x0
+        RenderInline {B} at (0,0) size 0x0
+caret: position 0 of child 1 {#text} of child 1 {DIV} of child 3 {DIV} of child 2 {B} of child 1 {BODY} of child 0 {HTML} of document
index 33aef4f34a1a7a24f7c1d1c132af5b38cc985970..00e6cf0bc6aea4a1c56aabd294a391f3ebc82fc4 100644 (file)
@@ -47,10 +47,12 @@ Expected Results:
 The content in the red box must exactly match the content in the green box (except for the border color).
 <br><i>For this test: </i>Only selected content should get deleted. 
 Surrounding content that is not selected should (obviously) not be affected.
+<br><b>There is a bug: the caret ends up in the wrong position, it should be in the empty paragraph.
 </div>
 </div>
 
 <div class="results">
+<br>
 after
 </div>
 
index 75026bdc6bc6a47402e2e0560a2c127c57c78661..3f21e850ee470236bbf74defd01d90e24834536a 100644 (file)
@@ -1,3 +1,20 @@
+2007-06-07  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by John.
+        
+        <rdar://problem/5237074> REGRESSION: editing/unsupported-content/table-delete-003 is failing (13931)
+        
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::initializeStartEnd):
+        We wouldn't expand the selection to include a special element 
+        at the start of the selection unless the end of the selection 
+        was at the end of a special element. Avoid a special 
+        element at the start as long as it's fully selected. Ditto for 
+        the end.
+        * editing/htmlediting.cpp:
+        (WebCore::positionBeforeContainingSpecialElement):
+        (WebCore::positionAfterContainingSpecialElement):
+
 2007-06-07  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Anders.
index db327b47e0caf607d778a77f901dfcb1aa8d9cfc..c0dac7e19fb0ff55656c3556f15453f88a170793 100644 (file)
@@ -98,17 +98,25 @@ void DeleteSelectionCommand::initializeStartEnd(Position& start, Position& end)
         startSpecialContainer = 0;
         endSpecialContainer = 0;
     
-        Position s = positionOutsideContainingSpecialElement(start, &startSpecialContainer);
-        Position e = positionOutsideContainingSpecialElement(end, &endSpecialContainer);
+        Position s = positionBeforeContainingSpecialElement(start, &startSpecialContainer);
+        Position e = positionAfterContainingSpecialElement(end, &endSpecialContainer);
         
-        if (!startSpecialContainer || !endSpecialContainer)
+        if (!startSpecialContainer && !endSpecialContainer)
             break;
         
-        if (startSpecialContainer->isDescendantOf(endSpecialContainer))
+        // If we're going to expand to include the startSpecialContainer, it must be fully selected.
+        if (startSpecialContainer && !endSpecialContainer && Range::compareBoundaryPoints(positionAfterNode(startSpecialContainer), end) > -1)
+            break;
+
+        // If we're going to expand to include the endSpecialContainer, it must be fully selected.         
+        if (endSpecialContainer && !startSpecialContainer && Range::compareBoundaryPoints(start, positionBeforeNode(endSpecialContainer)) > -1)
+            break;
+        
+        if (startSpecialContainer && startSpecialContainer->isDescendantOf(endSpecialContainer))
             // Don't adjust the end yet, it is the end of a special element that contains the start
             // special element (which may or may not be fully selected).
             start = s;
-        else if (endSpecialContainer->isDescendantOf(startSpecialContainer))
+        else if (endSpecialContainer && endSpecialContainer->isDescendantOf(startSpecialContainer))
             // Don't adjust the start yet, it is the start of a special element that contains the end
             // special element (which may or may not be fully selected).
             end = e;
index 9f7087d2cfab37b904221d22015a2fab4a9a818d..f296085ae83818d084ae14656f100fc8351fef4e 100644 (file)
@@ -486,7 +486,6 @@ bool isFirstVisiblePositionInSpecialElement(const Position& pos)
 Position positionBeforeContainingSpecialElement(const Position& pos, Node** containingSpecialElement)
 {
     Node* n = firstInSpecialElement(pos);
-    ASSERT(n);
     if (!n)
         return pos;
     Position result = positionBeforeNode(n);
@@ -505,7 +504,6 @@ bool isLastVisiblePositionInSpecialElement(const Position& pos)
 Position positionAfterContainingSpecialElement(const Position& pos, Node **containingSpecialElement)
 {
     Node* n = lastInSpecialElement(pos);
-    ASSERT(n);
     if (!n)
         return pos;
     Position result = positionAfterNode(n);