[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ojan at chromium.org ojan at chromium.org
Wed Dec 22 11:39:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7e1c219a5b44c42715e8353f534122ba04afd71e
Author: ojan at chromium.org <ojan at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 2 20:50:36 2010 +0000

    2010-07-20  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Eric Seidel.
    
            focusing the body of a contentEditable iframe resets the selection
            https://bugs.webkit.org/show_bug.cgi?id=42645
    
            * editing/selection/focus-contenteditable-iframe-expected.txt: Added.
            * editing/selection/focus-contenteditable-iframe.html: Added.
    2010-07-20  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Eric Seidel.
    
            focusing the body of a contentEditable iframe resets the selection
            https://bugs.webkit.org/show_bug.cgi?id=42645
    
            The selection shouldn't be reset to the beginning of the rootEditableElement
            if it is already inside the rootEditableElement.
    
            Test: editing/selection/focus-contenteditable-iframe.html
    
            * dom/Element.cpp:
            (WebCore::Element::updateFocusAppearance):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64489 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3d026a1..fee0702 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -2,6 +2,16 @@
 
         Reviewed by Eric Seidel.
 
+        focusing the body of a contentEditable iframe resets the selection
+        https://bugs.webkit.org/show_bug.cgi?id=42645
+
+        * editing/selection/focus-contenteditable-iframe-expected.txt: Added.
+        * editing/selection/focus-contenteditable-iframe.html: Added.
+
+2010-07-20  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Eric Seidel.
+
         focusing an unfocused contentEditable element should place the cursor at the beginning
         https://bugs.webkit.org/show_bug.cgi?id=42646
 
diff --git a/LayoutTests/editing/selection/focus-contenteditable-iframe-expected.txt b/LayoutTests/editing/selection/focus-contenteditable-iframe-expected.txt
new file mode 100644
index 0000000..1c44012
--- /dev/null
+++ b/LayoutTests/editing/selection/focus-contenteditable-iframe-expected.txt
@@ -0,0 +1,8 @@
+This tests focusing the body element in a contentEditable iframe. The whole body contents should be selected. Focus should only place the cursor at the beginning of the body if there isn't an existing selection.
+
+Dump of markup 1:
+| <html>
+|   <head>
+|   <body>
+|     contenteditable="true"
+|     "<#selection-caret>asdf"
diff --git a/LayoutTests/editing/selection/focus-contenteditable-iframe.html b/LayoutTests/editing/selection/focus-contenteditable-iframe.html
new file mode 100644
index 0000000..bd87cf4
--- /dev/null
+++ b/LayoutTests/editing/selection/focus-contenteditable-iframe.html
@@ -0,0 +1,20 @@
+<html>
+<body>
+<script src="../../resources/dump-as-markup.js"></script>
+<script>
+Markup.description("This tests focusing the body element in a contentEditable iframe. The whole body contents should be selected. Focus should only place the cursor at the beginning of the body if there isn't an existing selection.");
+
+function handleLoad() {
+    var win = document.querySelector('iframe').contentWindow;
+    var body = win.document.body;
+    body.innerHTML = "asdf";
+    body.contentEditable = true;
+    win.getSelection().selectAllChildren(body);
+    body.focus();
+    Markup.dump(win.document);
+};
+</script>
+<iframe onload="handleLoad()"></iframe>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index efacc69..54a2768 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,21 @@
 
         Reviewed by Eric Seidel.
 
+        focusing the body of a contentEditable iframe resets the selection
+        https://bugs.webkit.org/show_bug.cgi?id=42645
+        
+        The selection shouldn't be reset to the beginning of the rootEditableElement
+        if it is already inside the rootEditableElement.
+
+        Test: editing/selection/focus-contenteditable-iframe.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::updateFocusAppearance):
+
+2010-07-20  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Eric Seidel.
+
         focusing an unfocused contentEditable element should place the cursor at the beginning
         https://bugs.webkit.org/show_bug.cgi?id=42646
 
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index d90ae3c..2fa75ce 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -1330,6 +1330,10 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/)
         Frame* frame = document()->frame();
         if (!frame)
             return;
+        
+        // When focusing an editable element in an iframe, don't reset the selection if it already contains a selection.
+        if (this == frame->selection()->rootEditableElement())
+            return;
 
         // FIXME: We should restore the previous selection if there is one.
         VisibleSelection newSelection = VisibleSelection(Position(this, 0), DOWNSTREAM);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list