[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:35:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c248d6f178207f5397529bfcd67ffe7b10f53846
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 21 20:43:50 2004 +0000

            Reviewed by Hyatt
    
            A small collection of fixups.
    
            * khtml/editing/htmlediting_impl.cpp:
            (DeleteSelectionCommandImpl::doApply): Do not shift ending selection downstream
            when at position zero of a BR. That's just wrong. Simplify code that does
            "onlyWhitespace" delete. No need to handle multiple characters here; we can
            only ever have one thanks to the delete-collapsible-whitespace code.
            (TypingCommandImpl::issueCommandForDeleteKey): Don't do anything if at the
            start of a root editable block. This is a no-op....not an opportunity to crash.
            * khtml/rendering/render_block.cpp:
            (khtml::RenderBlock::positionForRenderer): Return this renderer's element position
            if the passed-in renderer is nil. This helps to make clicking in empty blocks work.
            * khtml/rendering/render_container.cpp:
            (RenderContainer::positionForCoordinates): Fixed typo in comment.
            * khtml/xml/dom_position.cpp:
            (DOM::Position::equivalentLeafPosition): Do not attempt to find a leaf if the
            position's node does not have a renderer, if the renderer has no kids.
            * layout-tests/editing/deleting/delete-br-001-expected.txt: Update expected results for BR fix.
            * layout-tests/editing/deleting/delete-br-003-expected.txt: Ditto.
            * layout-tests/editing/deleting/delete-br-006-expected.txt: Ditto.
            * layout-tests/editing/deleting/delete-br-007.html: Added. New BR test.
            * layout-tests/editing/deleting/delete-br-007-expected.txt: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/editing/deleting/delete-br-001-expected.txt b/LayoutTests/editing/deleting/delete-br-001-expected.txt
index 12001c6..8719e79 100644
--- a/LayoutTests/editing/deleting/delete-br-001-expected.txt
+++ b/LayoutTests/editing/deleting/delete-br-001-expected.txt
@@ -13,6 +13,6 @@ layer at (0,0) size 800x72
             text run at (218,14) width 92: "years ago"
         RenderText {TEXT} at (0,0) size 0x0
 selection is CARET:
-start:      position 0 of child 2 {TEXT} of child 2 {SPAN} of root {DIV}
+start:      position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 upstream:   position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 downstream: position 0 of child 2 {TEXT} of child 2 {SPAN} of root {DIV}
diff --git a/LayoutTests/editing/deleting/delete-br-003-expected.txt b/LayoutTests/editing/deleting/delete-br-003-expected.txt
index c65dd53..beb1176 100644
--- a/LayoutTests/editing/deleting/delete-br-003-expected.txt
+++ b/LayoutTests/editing/deleting/delete-br-003-expected.txt
@@ -15,6 +15,6 @@ layer at (0,0) size 800x128
             text run at (14,70) width 92: "years ago"
         RenderText {TEXT} at (0,0) size 0x0
 selection is CARET:
-start:      position 0 of child 2 {BR} of child 2 {SPAN} of root {DIV}
+start:      position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 upstream:   position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 downstream: position 0 of child 2 {BR} of child 2 {SPAN} of root {DIV}
diff --git a/LayoutTests/editing/deleting/delete-br-006-expected.txt b/LayoutTests/editing/deleting/delete-br-006-expected.txt
index 8a40cca..bc34542 100644
--- a/LayoutTests/editing/deleting/delete-br-006-expected.txt
+++ b/LayoutTests/editing/deleting/delete-br-006-expected.txt
@@ -13,6 +13,6 @@ layer at (0,0) size 800x72
             text run at (218,14) width 92: "years ago"
         RenderText {TEXT} at (0,0) size 0x0
 selection is CARET:
-start:      position 0 of child 2 {TEXT} of child 2 {SPAN} of root {DIV}
+start:      position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 upstream:   position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 downstream: position 0 of child 2 {TEXT} of child 2 {SPAN} of root {DIV}
diff --git a/LayoutTests/editing/deleting/delete-br-001-expected.txt b/LayoutTests/editing/deleting/delete-br-007-expected.txt
similarity index 56%
copy from LayoutTests/editing/deleting/delete-br-001-expected.txt
copy to LayoutTests/editing/deleting/delete-br-007-expected.txt
index 12001c6..8f371de 100644
--- a/LayoutTests/editing/deleting/delete-br-001-expected.txt
+++ b/LayoutTests/editing/deleting/delete-br-007-expected.txt
@@ -4,15 +4,15 @@ layer at (0,0) size 800x72
   RenderBlock {HTML} at (0,0) size 800x72
     RenderBody {BODY} at (8,8) size 784x56
       RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
-        RenderInline {SPAN} at (0,0) size 296x28
-          RenderText {TEXT} at (14,14) size 204x28
+        RenderInline {SPAN} at (0,0) size 290x28
+          RenderText {TEXT} at (14,14) size 198x28
             text run at (14,14) width 102: "Fourscore "
             text run at (116,14) width 41: "and "
-            text run at (157,14) width 61: "seven "
-          RenderText {TEXT} at (218,14) size 92x28
-            text run at (218,14) width 92: "years ago"
+            text run at (157,14) width 55: "seven"
+          RenderText {TEXT} at (212,14) size 92x28
+            text run at (212,14) width 92: "years ago"
         RenderText {TEXT} at (0,0) size 0x0
 selection is CARET:
-start:      position 0 of child 2 {TEXT} of child 2 {SPAN} of root {DIV}
-upstream:   position 23 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
+start:      position 22 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
+upstream:   position 22 of child 1 {TEXT} of child 2 {SPAN} of root {DIV}
 downstream: position 0 of child 2 {TEXT} of child 2 {SPAN} of root {DIV}
diff --git a/LayoutTests/editing/deleting/delete-br-001.html b/LayoutTests/editing/deleting/delete-br-007.html
similarity index 96%
copy from LayoutTests/editing/deleting/delete-br-001.html
copy to LayoutTests/editing/deleting/delete-br-007.html
index f29d5aa..77fec7c 100644
--- a/LayoutTests/editing/deleting/delete-br-001.html
+++ b/LayoutTests/editing/deleting/delete-br-007.html
@@ -17,6 +17,7 @@ function editingTest() {
         moveSelectionForwardByCharacterCommand();
     }
     deleteCommand();
+    deleteCommand();
 }
 
 </script>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5035a86..03c4d5e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,6 +1,33 @@
 2004-04-21  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Hyatt
+        
+        A small collection of fixups.
+
+        * khtml/editing/htmlediting_impl.cpp:
+        (DeleteSelectionCommandImpl::doApply): Do not shift ending selection downstream
+        when at position zero of a BR. That's just wrong. Simplify code that does
+        "onlyWhitespace" delete. No need to handle multiple characters here; we can
+        only ever have one thanks to the delete-collapsible-whitespace code.
+        (TypingCommandImpl::issueCommandForDeleteKey): Don't do anything if at the
+        start of a root editable block. This is a no-op....not an opportunity to crash.
+        * khtml/rendering/render_block.cpp:
+        (khtml::RenderBlock::positionForRenderer): Return this renderer's element position
+        if the passed-in renderer is nil. This helps to make clicking in empty blocks work.
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::positionForCoordinates): Fixed typo in comment.
+        * khtml/xml/dom_position.cpp:
+        (DOM::Position::equivalentLeafPosition): Do not attempt to find a leaf if the
+        position's node does not have a renderer, if the renderer has no kids.
+        * layout-tests/editing/deleting/delete-br-001-expected.txt: Update expected results for BR fix.
+        * layout-tests/editing/deleting/delete-br-003-expected.txt: Ditto.
+        * layout-tests/editing/deleting/delete-br-006-expected.txt: Ditto.
+        * layout-tests/editing/deleting/delete-br-007.html: Added. New BR test.
+        * layout-tests/editing/deleting/delete-br-007-expected.txt: Added.
+
+2004-04-21  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Hyatt
 
         * khtml/css/css_computedstyle.cpp:
         (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue): Added implementations for
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index 86ff634..1b80262 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -893,8 +893,6 @@ void DeleteSelectionCommandImpl::doApply()
     else if (upstreamStart != downstreamStart) {
         LOG(Editing,  "ending position case 3");
         endingPosition = upstreamStart;
-        if (downstreamStart.node()->id() == ID_BR && downstreamStart.offset() == 0)
-            adjustEndingPositionDownstream = true;
         if (upstreamStart.node()->id() == ID_BR && upstreamStart.offset() == 1)
             adjustEndingPositionDownstream = true;
     }
@@ -951,10 +949,12 @@ void DeleteSelectionCommandImpl::doApply()
         LOG(Editing,  "start node delete case 2");
         ASSERT(upstreamStart.node()->isTextNode());
         TextImpl *text = static_cast<TextImpl *>(upstreamStart.node());
-        int length = downstreamStart.node() == upstreamStart.node() ? 
-            kMax(downstreamStart.offset() - upstreamStart.offset(), 1L) : 
-            text->length() - upstreamStart.offset();
-        deleteText(text, upstreamStart.offset(), length);
+        int offset = upstreamStart.offset();
+        // EDIT FIXME: Signed/unsigned mismatch
+        int length = text->length();
+        if (length == upstreamStart.offset())
+            offset--;
+        deleteText(text, offset, 1);
     }
     else if (downstreamStart.node()->isTextNode()) {
         LOG(Editing,  "start node delete case 3");
@@ -1754,8 +1754,14 @@ void TypingCommandImpl::issueCommandForDeleteKey()
     Selection selectionToDelete = endingSelection();
     ASSERT(selectionToDelete.state() != Selection::NONE);
     
-    if (selectionToDelete.state() == Selection::CARET)
-        selectionToDelete = Selection(selectionToDelete.start().previousCharacterPosition(), selectionToDelete.start());
+    if (selectionToDelete.state() == Selection::CARET) {
+        Position pos(selectionToDelete.start());
+        if (pos.inFirstEditableInRootEditableBlock() && pos.offset() <= pos.node()->caretMinOffset()) {
+            // we're at the start of a root editable block...do nothing
+            return;
+        }
+        selectionToDelete = Selection(pos.previousCharacterPosition(), pos);
+    }
     deleteSelection(selectionToDelete);
 }
 
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index 0334057..fe830b8 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -2037,7 +2037,7 @@ Position RenderBlock::positionForBox(InlineBox *box, bool start) const
 Position RenderBlock::positionForRenderer(RenderObject *renderer, bool start) const
 {
     if (!renderer)
-        return Position();
+        return Position(element(), 0);
 
     NodeImpl *node = renderer->element() ? renderer->element() : element();
     long offset = start ? node->caretMinOffset() : node->caretMaxOffset();
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index 08fea5c..f1d6d94 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -477,7 +477,7 @@ void RenderContainer::removeLeftoverAnonymousBoxes()
 
 Position RenderContainer::positionForCoordinates(int _x, int _y)
 {
-    // no children...return this render object's element, if there isn't one, and offset 0
+    // no children...return this render object's element, if there is one, and offset 0
     if (!firstChild())
         return Position(element(), 0);
 
diff --git a/WebCore/khtml/xml/dom_position.cpp b/WebCore/khtml/xml/dom_position.cpp
index 45a7935..7685b7c 100644
--- a/WebCore/khtml/xml/dom_position.cpp
+++ b/WebCore/khtml/xml/dom_position.cpp
@@ -188,14 +188,17 @@ long Position::renderedOffset() const
 
 Position Position::equivalentLeafPosition() const
 {
-    if (node()->hasChildNodes() == false)
+    if (isEmpty())
+        return Position();
+
+    if (!node()->renderer() || !node()->renderer()->firstChild())
         return *this;
     
     NodeImpl *n = node();
     int count = 0;
     while (1) {
         n = n->nextLeafNode();
-        if (!n)
+        if (!n || !n->inSameContainingEditableBlock(node()))
             return *this;
         if (count + n->maxOffset() >= offset()) {
             count = offset() - count;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list