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

joepeck at webkit.org joepeck at webkit.org
Wed Dec 22 12:44:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3d4af3610c876929c4c3d0b49f8e7c877de384a4
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Aug 28 00:23:27 2010 +0000

    2010-08-27  Joseph Pecoraro  <joepeck at webkit.org>
    
    Reviewed by Alexey Proskuryakov.
    
    LayoutTests:
    
        2010-08-27  Joseph Pecoraro  <joepeck at webkit.org>
    
                Extra Events triggered by <input> on focus
                https://bugs.webkit.org/show_bug.cgi?id=44731
    
                * fast/events/input-focus-no-duplicate-events-expected.txt: Added.
                * fast/events/input-focus-no-duplicate-events.html: Added.
                * fast/events/input-tab-focus-no-duplicate-events-expected.txt: Added.
                * fast/events/input-tab-focus-no-duplicate-events.html: Added.
    
    WebCore:
    
        2010-08-27  Joseph Pecoraro  <joepeck at webkit.org>
    
                Extra Events triggered by <input> on focus
                https://bugs.webkit.org/show_bug.cgi?id=44731
    
                Tests: fast/events/input-focus-no-duplicate-events.html
                       fast/events/input-tab-focus-no-duplicate-events.html
    
                * dom/Element.cpp:
                (WebCore::Element::focus): do not continue and update the appearance of the element if it was not focused.
                * page/FocusController.cpp:
                (WebCore::FocusController::setFocusedNode): respect the return value of Document::setFocusedNode.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66284 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2dd9d12..d3334f8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-27  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Extra Events triggered by <input> on focus
+        https://bugs.webkit.org/show_bug.cgi?id=44731
+
+        * fast/events/input-focus-no-duplicate-events-expected.txt: Added.
+        * fast/events/input-focus-no-duplicate-events.html: Added.
+        * fast/events/input-tab-focus-no-duplicate-events-expected.txt: Added.
+        * fast/events/input-tab-focus-no-duplicate-events.html: Added.
+
 2010-08-27  Eric Carlson  <eric.carlson at apple.com>
 
         Unreviewed, build fix.
diff --git a/LayoutTests/fast/events/input-focus-no-duplicate-events-expected.txt b/LayoutTests/fast/events/input-focus-no-duplicate-events-expected.txt
new file mode 100644
index 0000000..d012f92
--- /dev/null
+++ b/LayoutTests/fast/events/input-focus-no-duplicate-events-expected.txt
@@ -0,0 +1,12 @@
+Focusing on the bottom input should not trigger duplicate focus events for both inputs.
+
+
+
+Expected:
+Bottom Input: Focus Event #1
+Top Input: Focus Event #1
+
+Actual:
+Bottom Input: Focus Event #1
+Top Input: Focus Event #1
+
diff --git a/LayoutTests/fast/events/input-focus-no-duplicate-events.html b/LayoutTests/fast/events/input-focus-no-duplicate-events.html
new file mode 100644
index 0000000..f1cb6d8
--- /dev/null
+++ b/LayoutTests/fast/events/input-focus-no-duplicate-events.html
@@ -0,0 +1,37 @@
+<p>Focusing on the bottom input should not trigger duplicate focus events for both inputs.</p>
+<input type="text" id="x"><br>
+<input type="text" id="y">
+<pre id="log">
+Expected:
+Bottom Input: Focus Event #1
+Top Input: Focus Event #1
+
+Actual:
+</pre>
+
+<script>
+if (window.layoutTestController)
+    window.layoutTestController.dumpAsText();
+
+function log(s) {
+    document.getElementById('log').appendChild(document.createTextNode(s+"\n"));
+}
+
+var topInput = document.getElementById('x');
+var topCounter = 0;
+var bottomInput = document.getElementById('y');
+var bottomCounter = 0;
+
+topInput.addEventListener('focus', function() {
+    ++topCounter;
+    log("Top Input: Focus Event #" + topCounter);
+}, false);
+
+bottomInput.addEventListener('focus', function() {
+    ++bottomCounter;
+    log("Bottom Input: Focus Event #" + bottomCounter);
+    topInput.focus();
+}, false);
+
+bottomInput.focus();
+</script>
diff --git a/LayoutTests/fast/events/input-tab-focus-no-duplicate-events-expected.txt b/LayoutTests/fast/events/input-tab-focus-no-duplicate-events-expected.txt
new file mode 100644
index 0000000..9a73aee
--- /dev/null
+++ b/LayoutTests/fast/events/input-tab-focus-no-duplicate-events-expected.txt
@@ -0,0 +1,14 @@
+Tabbing focus into the bottom input should not trigger duplicate focus events for both inputs.
+
+
+
+Expected:
+Top Input: Focus Event #1
+Bottom Input: Focus Event #1
+Top Input: Focus Event #2
+
+Actual:
+Top Input: Focus Event #1
+Bottom Input: Focus Event #1
+Top Input: Focus Event #2
+
diff --git a/LayoutTests/fast/events/input-tab-focus-no-duplicate-events.html b/LayoutTests/fast/events/input-tab-focus-no-duplicate-events.html
new file mode 100644
index 0000000..d8cd2f2
--- /dev/null
+++ b/LayoutTests/fast/events/input-tab-focus-no-duplicate-events.html
@@ -0,0 +1,40 @@
+<p>Tabbing focus into the bottom input should not trigger duplicate focus events for both inputs.</p>
+<input type="text" id="x"><br>
+<input type="text" id="y">
+<pre id="log">
+Expected:
+Top Input: Focus Event #1
+Bottom Input: Focus Event #1
+Top Input: Focus Event #2
+
+Actual:
+</pre>
+
+<script>
+if (window.layoutTestController)
+    window.layoutTestController.dumpAsText();
+
+function log(s) {
+    document.getElementById('log').appendChild(document.createTextNode(s+"\n"));
+}
+
+var topInput = document.getElementById('x');
+var topCounter = 0;
+var bottomInput = document.getElementById('y');
+var bottomCounter = 0;
+
+topInput.addEventListener('focus', function() {
+    ++topCounter;
+    log("Top Input: Focus Event #" + topCounter);
+}, false);
+
+bottomInput.addEventListener('focus', function() {
+    ++bottomCounter;
+    log("Bottom Input: Focus Event #" + bottomCounter);
+    topInput.focus();
+}, false);
+
+topInput.focus();
+if (window.eventSender)
+    eventSender.keyDown('\t');
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f9fd20a..30476d3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-27  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Extra Events triggered by <input> on focus
+        https://bugs.webkit.org/show_bug.cgi?id=44731
+
+        Tests: fast/events/input-focus-no-duplicate-events.html
+               fast/events/input-tab-focus-no-duplicate-events.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::focus): do not continue and update the appearance of the element if it was not focused.
+        * page/FocusController.cpp:
+        (WebCore::FocusController::setFocusedNode): respect the return value of Document::setFocusedNode.
+
 2010-08-26  Joseph Pecoraro  <joepeck at webkit.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 7502864..39bf393 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -1313,8 +1313,11 @@ void Element::focus(bool restorePreviousSelection)
     RefPtr<Node> protect;
     if (Page* page = doc->page()) {
         // Focus and change event handlers can cause us to lose our last ref.
+        // If a focus event handler changes the focus to a different node it
+        // does not make sense to continue and update appearence.
         protect = this;
-        page->focusController()->setFocusedNode(this, doc->frame());
+        if (!page->focusController()->setFocusedNode(this, doc->frame()))
+            return;
     }
 
     // Setting the focused node above might have invalidated the layout due to scripts.
diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp
index 2c2c447..84942ce 100644
--- a/WebCore/page/FocusController.cpp
+++ b/WebCore/page/FocusController.cpp
@@ -623,8 +623,11 @@ bool FocusController::setFocusedNode(Node* node, PassRefPtr<Frame> newFocusedFra
 
     // Setting the focused node can result in losing our last reft to node when JS event handlers fire.
     RefPtr<Node> protect = node;
-    if (newDocument)
-        newDocument->setFocusedNode(node);
+    if (newDocument) {
+        bool successfullyFocused = newDocument->setFocusedNode(node);
+        if (!successfullyFocused)
+            return false;
+    }
 
     if (newDocument->focusedNode() == node)
         m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod());

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list