[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:49:32 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 1f09d67347516e8761a7563ff5ee817adb11e710
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 12 21:51:02 2004 +0000

            Reviewed by Hyatt
    
            Fixes for these bugs:
    
            <rdar://problem/3723359> Extending then "unextending" selection with arrow keys should draw caret but doesn't
            <rdar://problem/3724626> White-space deletion code deletes wrong character when space follows span
    
            * khtml/editing/htmlediting_impl.cpp:
            (khtml::DeleteSelectionCommandImpl::doApply): Modify special-case white-space deletion code so it runs
            only in the special case. It was throwing its net too widely, catching the case described in 3724626.
            By tightening up the special-case white-space deletion, and allowing the more general-purpose code to run,
            the bug is fixed.
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::updateSelection): Use recently-added closestRenderedPosition helper in Position class
            to figure out the start and end positions for selection drawing.
            * khtml/xml/dom_position.cpp:
            (DOM::Position::equivalentUpstreamPosition): Added code to handle white-space that causes line breaks.
            (DOM::Position::equivalentDownstreamPosition): Ditto.
            (DOM::Position::closestRenderedPosition): Trap empty selections at function entry, return *this.
            (DOM::Position::isFirstRenderedPositionOnLine): Can't be first rendered position on line if not rendered.
            Add check for this.
            (DOM::Position::isLastRenderedPositionOnLine): Ditto, but s/first/last/
            * khtml/xml/dom_selection.cpp:
            (DOM::Selection::validate): A selection is in caret state if the start and end are equal *or* equivalent.
            The equivalence case is new, and fixes 3723359.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7003 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8a11211..18d3d85 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,31 @@
+2004-07-12  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Hyatt
+
+        Fixes for these bugs:
+        
+        <rdar://problem/3723359> Extending then "unextending" selection with arrow keys should draw caret but doesn't
+        <rdar://problem/3724626> White-space deletion code deletes wrong character when space follows span
+        
+        * khtml/editing/htmlediting_impl.cpp:
+        (khtml::DeleteSelectionCommandImpl::doApply): Modify special-case white-space deletion code so it runs
+        only in the special case. It was throwing its net too widely, catching the case described in 3724626.
+        By tightening up the special-case white-space deletion, and allowing the more general-purpose code to run,
+        the bug is fixed.
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::updateSelection): Use recently-added closestRenderedPosition helper in Position class
+        to figure out the start and end positions for selection drawing.
+        * khtml/xml/dom_position.cpp:
+        (DOM::Position::equivalentUpstreamPosition): Added code to handle white-space that causes line breaks.
+        (DOM::Position::equivalentDownstreamPosition): Ditto.
+        (DOM::Position::closestRenderedPosition): Trap empty selections at function entry, return *this.
+        (DOM::Position::isFirstRenderedPositionOnLine): Can't be first rendered position on line if not rendered.
+        Add check for this.
+        (DOM::Position::isLastRenderedPositionOnLine): Ditto, but s/first/last/
+        * khtml/xml/dom_selection.cpp:
+        (DOM::Selection::validate): A selection is in caret state if the start and end are equal *or* equivalent.
+        The equivalence case is new, and fixes 3723359.
+
 
 2004-07-09  Kevin Decker  <kdecker at apple.com>
 
@@ -9,7 +37,6 @@
         * khtml/css/cssstyleselector.cpp:
         (khtml::CSSStyleSelector::applyProperty):
 
-=======
 2004-07-09  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by me
diff --git a/WebCore/khtml/editing/SelectionController.cpp b/WebCore/khtml/editing/SelectionController.cpp
index ef99b2d..f199eda 100644
--- a/WebCore/khtml/editing/SelectionController.cpp
+++ b/WebCore/khtml/editing/SelectionController.cpp
@@ -655,7 +655,7 @@ void Selection::validate(ETextGranularity granularity)
     // adjust the state
     if (start().isEmpty() && end().isEmpty())
         m_state = NONE;
-    else if (start() == end())
+    else if (start() == end() || start().equivalentUpstreamPosition() == end().equivalentUpstreamPosition())
         m_state = CARET;
     else
         m_state = RANGE;
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index cf06e4c..94760db 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -1287,7 +1287,7 @@ void DeleteSelectionCommandImpl::doApply()
         LOG(Editing,  "start node delete case 1");
         removeNodeAndPrune(downstreamStart.node(), startBlock);
     }
-    else if (onlyWhitespace) {
+    else if (onlyWhitespace && isWS(upstreamStart)) {
         // Selection only contains whitespace. This is really a special-case to 
         // handle significant whitespace that is collapsed at the end of a line,
         // but also handles deleting a space in mid-line.
diff --git a/WebCore/khtml/editing/selection.cpp b/WebCore/khtml/editing/selection.cpp
index ef99b2d..f199eda 100644
--- a/WebCore/khtml/editing/selection.cpp
+++ b/WebCore/khtml/editing/selection.cpp
@@ -655,7 +655,7 @@ void Selection::validate(ETextGranularity granularity)
     // adjust the state
     if (start().isEmpty() && end().isEmpty())
         m_state = NONE;
-    else if (start() == end())
+    else if (start() == end() || start().equivalentUpstreamPosition() == end().equivalentUpstreamPosition())
         m_state = CARET;
     else
         m_state = RANGE;
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index a313762..7105dd7 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -1236,9 +1236,13 @@ void DocumentImpl::updateSelection()
         canvas->clearSelection();
     }
     else {
-        RenderObject *startRenderer = s.start().node() ? s.start().node()->renderer() : 0;
-        RenderObject *endRenderer = s.end().node() ? s.end().node()->renderer() : 0;
-        static_cast<RenderCanvas*>(m_render)->setSelection(startRenderer, s.start().offset(), endRenderer, s.end().offset());
+        Position startPos(s.start().closestRenderedPosition(s.affinity()));
+        Position endPos(s.end().closestRenderedPosition(s.affinity()));
+        if (startPos.notEmpty() && endPos.notEmpty()) {
+            RenderObject *startRenderer = startPos.node()->renderer();
+            RenderObject *endRenderer = endPos.node()->renderer();
+            static_cast<RenderCanvas*>(m_render)->setSelection(startRenderer, startPos.offset(), endRenderer, endPos.offset());
+        }
     }
 }
 
diff --git a/WebCore/khtml/xml/dom_position.cpp b/WebCore/khtml/xml/dom_position.cpp
index 00962fd..0b6fe0d 100644
--- a/WebCore/khtml/xml/dom_position.cpp
+++ b/WebCore/khtml/xml/dom_position.cpp
@@ -473,6 +473,10 @@ Position Position::equivalentUpstreamPosition() const
             for (InlineTextBox *box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
                 if (textOffset > box->start() && textOffset <= box->start() + box->len())
                     return it.current();
+                else if (box != textRenderer->lastTextBox() && 
+                         !box->nextOnLine() && 
+                         textOffset == box->start() + box->len() + 1)
+                    return it.current();
             }
         }
     }
@@ -519,6 +523,10 @@ Position Position::equivalentDownstreamPosition() const
             for (InlineTextBox *box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
                 if (textOffset >= box->start() && textOffset <= box->end())
                     return it.current();
+                else if (box != textRenderer->lastTextBox() && 
+                         !box->nextOnLine() && 
+                         textOffset == box->start() + box->len())
+                    return it.current();
             }
         }
     }
@@ -562,7 +570,7 @@ Position Position::equivalentShallowPosition() const
 
 Position Position::closestRenderedPosition(EAffinity affinity) const
 {
-    if (inRenderedContent())
+    if (isEmpty() || inRenderedContent())
         return *this;
 
     Position pos;
@@ -791,6 +799,9 @@ bool Position::isFirstRenderedPositionOnLine() const
     if (renderer->style()->visibility() != khtml::VISIBLE)
         return false;
     
+    if (!inRenderedContent())
+        return false;
+    
     Position pos(node(), offset());
     PositionIterator it(pos);
     while (!it.atStart()) {
@@ -814,6 +825,9 @@ bool Position::isLastRenderedPositionOnLine() const
     if (renderer->style()->visibility() != khtml::VISIBLE)
         return false;
     
+    if (!inRenderedContent())
+        return false;
+    
     if (node()->id() == ID_BR)
         return true;
     
diff --git a/WebCore/khtml/xml/dom_selection.cpp b/WebCore/khtml/xml/dom_selection.cpp
index ef99b2d..f199eda 100644
--- a/WebCore/khtml/xml/dom_selection.cpp
+++ b/WebCore/khtml/xml/dom_selection.cpp
@@ -655,7 +655,7 @@ void Selection::validate(ETextGranularity granularity)
     // adjust the state
     if (start().isEmpty() && end().isEmpty())
         m_state = NONE;
-    else if (start() == end())
+    else if (start() == end() || start().equivalentUpstreamPosition() == end().equivalentUpstreamPosition())
         m_state = CARET;
     else
         m_state = RANGE;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list