[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:52:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 29c0b9fc3c6412165ca703be3a46171bb06eb197
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 23 16:16:27 2004 +0000

            Reviewed by John
    
            * khtml/xml/dom_selection.cpp:
            (DOM::Selection::validate): Not exactly a fix of anything per se, but more of a refinement
            of how selection validation works. The idea is to let the selection validation process
            end up with an empty selection given real DOM position inputs if the validation code
            cannot find a rendered position. Since selection is all about display, this makes sense.
            Currently, the code will allow the selection to be placed in a location that is not
            rendered, and this does nobody any good, as it can lead to bugs like accepting key input
            in a div that is set to display:none.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7110 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 4e3f917..80e2d5b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,18 @@
 2004-07-23  Ken Kocienda  <kocienda at apple.com>
 
+        Reviewed by John
+
+        * khtml/xml/dom_selection.cpp:
+        (DOM::Selection::validate): Not exactly a fix of anything per se, but more of a refinement
+        of how selection validation works. The idea is to let the selection validation process
+        end up with an empty selection given real DOM position inputs if the validation code
+        cannot find a rendered position. Since selection is all about display, this makes sense.
+        Currently, the code will allow the selection to be placed in a location that is not
+        rendered, and this does nobody any good, as it can lead to bugs like accepting key input
+        in a div that is set to display:none.
+
+2004-07-23  Ken Kocienda  <kocienda at apple.com>
+
         Reviewed by me
 
         Updated layout tests with new expected results.
diff --git a/WebCore/khtml/editing/SelectionController.cpp b/WebCore/khtml/editing/SelectionController.cpp
index a5d186c..2235aba 100644
--- a/WebCore/khtml/editing/SelectionController.cpp
+++ b/WebCore/khtml/editing/SelectionController.cpp
@@ -572,26 +572,25 @@ void Selection::paintCaret(QPainter *p, const QRect &rect)
 
 void Selection::validate(ETextGranularity granularity)
 {
-    // move the base and extent nodes to their equivalent leaf positions
+    // Move the selection to rendered positions, if possible. This process
+    // might wind up setting the selection to "empty" (meaning no selection) if
+    // rendered positions cannot be found. Since selection is all about giving
+    // cues to users in displayed content, and this position is used to
+    // determine where user input (like typing) will be accepted, it makes no
+    // sense to put the selection in a place that is not rendered.
     bool baseAndExtentEqual = base() == extent();
     bool updatedLayout = false;
     if (base().notEmpty()) {
         base().node()->getDocument()->updateLayout();
         updatedLayout = true;
-        Position pos = base().equivalentDeepPosition();
-        Position renderedPos(pos.closestRenderedPosition(affinity()));
-        if (renderedPos.notEmpty())
-            pos = renderedPos;
-        assignBase(pos);
+        assignBase(base().equivalentDeepPosition().closestRenderedPosition(affinity()));
         if (baseAndExtentEqual)
-            assignExtent(pos);
+            assignExtent(base());
     }
     if (extent().notEmpty() && !baseAndExtentEqual) {
         if (!updatedLayout)
             extent().node()->getDocument()->updateLayout();
-        Position pos(extent().equivalentDeepPosition());
-        Position renderedPos(pos.closestRenderedPosition(affinity()));
-        assignExtent(renderedPos.notEmpty() ? renderedPos : pos);
+        assignExtent(extent().equivalentDeepPosition().closestRenderedPosition(affinity()));
     }
 
     // make sure we do not have a dangling start or end
diff --git a/WebCore/khtml/editing/selection.cpp b/WebCore/khtml/editing/selection.cpp
index a5d186c..2235aba 100644
--- a/WebCore/khtml/editing/selection.cpp
+++ b/WebCore/khtml/editing/selection.cpp
@@ -572,26 +572,25 @@ void Selection::paintCaret(QPainter *p, const QRect &rect)
 
 void Selection::validate(ETextGranularity granularity)
 {
-    // move the base and extent nodes to their equivalent leaf positions
+    // Move the selection to rendered positions, if possible. This process
+    // might wind up setting the selection to "empty" (meaning no selection) if
+    // rendered positions cannot be found. Since selection is all about giving
+    // cues to users in displayed content, and this position is used to
+    // determine where user input (like typing) will be accepted, it makes no
+    // sense to put the selection in a place that is not rendered.
     bool baseAndExtentEqual = base() == extent();
     bool updatedLayout = false;
     if (base().notEmpty()) {
         base().node()->getDocument()->updateLayout();
         updatedLayout = true;
-        Position pos = base().equivalentDeepPosition();
-        Position renderedPos(pos.closestRenderedPosition(affinity()));
-        if (renderedPos.notEmpty())
-            pos = renderedPos;
-        assignBase(pos);
+        assignBase(base().equivalentDeepPosition().closestRenderedPosition(affinity()));
         if (baseAndExtentEqual)
-            assignExtent(pos);
+            assignExtent(base());
     }
     if (extent().notEmpty() && !baseAndExtentEqual) {
         if (!updatedLayout)
             extent().node()->getDocument()->updateLayout();
-        Position pos(extent().equivalentDeepPosition());
-        Position renderedPos(pos.closestRenderedPosition(affinity()));
-        assignExtent(renderedPos.notEmpty() ? renderedPos : pos);
+        assignExtent(extent().equivalentDeepPosition().closestRenderedPosition(affinity()));
     }
 
     // make sure we do not have a dangling start or end
diff --git a/WebCore/khtml/xml/dom_selection.cpp b/WebCore/khtml/xml/dom_selection.cpp
index a5d186c..2235aba 100644
--- a/WebCore/khtml/xml/dom_selection.cpp
+++ b/WebCore/khtml/xml/dom_selection.cpp
@@ -572,26 +572,25 @@ void Selection::paintCaret(QPainter *p, const QRect &rect)
 
 void Selection::validate(ETextGranularity granularity)
 {
-    // move the base and extent nodes to their equivalent leaf positions
+    // Move the selection to rendered positions, if possible. This process
+    // might wind up setting the selection to "empty" (meaning no selection) if
+    // rendered positions cannot be found. Since selection is all about giving
+    // cues to users in displayed content, and this position is used to
+    // determine where user input (like typing) will be accepted, it makes no
+    // sense to put the selection in a place that is not rendered.
     bool baseAndExtentEqual = base() == extent();
     bool updatedLayout = false;
     if (base().notEmpty()) {
         base().node()->getDocument()->updateLayout();
         updatedLayout = true;
-        Position pos = base().equivalentDeepPosition();
-        Position renderedPos(pos.closestRenderedPosition(affinity()));
-        if (renderedPos.notEmpty())
-            pos = renderedPos;
-        assignBase(pos);
+        assignBase(base().equivalentDeepPosition().closestRenderedPosition(affinity()));
         if (baseAndExtentEqual)
-            assignExtent(pos);
+            assignExtent(base());
     }
     if (extent().notEmpty() && !baseAndExtentEqual) {
         if (!updatedLayout)
             extent().node()->getDocument()->updateLayout();
-        Position pos(extent().equivalentDeepPosition());
-        Position renderedPos(pos.closestRenderedPosition(affinity()));
-        assignExtent(renderedPos.notEmpty() ? renderedPos : pos);
+        assignExtent(extent().equivalentDeepPosition().closestRenderedPosition(affinity()));
     }
 
     // make sure we do not have a dangling start or end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list