Title: [147548] trunk
Revision
147548
Author
k...@webkit.org
Date
2013-04-03 06:20:29 -0700 (Wed, 03 Apr 2013)

Log Message

Should close select popup when the element loses focus
https://bugs.webkit.org/show_bug.cgi?id=113220

Patch by Gustavo Noronha Silva <gustavo.noro...@collabora.com> on 2013-04-03
Reviewed by Kent Tamura.

Source/WebCore:

Test: fast/forms/select-popup-closes-on-blur.html

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::menuListDefaultEventHandler): handle the blur event, closing
the popup menu if any.
* testing/Internals.cpp:
(WebCore::Internals::isSelectPopupVisible): utility to query the select node renderer to
find out whether the popup is open or closed.
(WebCore):
* testing/Internals.h: add the new method definition.
* testing/Internals.idl: ditto.

Source/WebKit/win:

* WebKit.vcproj/WebKitExports.def.in: export WebCore::HTMLNames::selectTag for Internals

LayoutTests:

* fast/forms/select/popup-closes-on-blur-expected.txt: Added.
* fast/forms/select/popup-closes-on-blur.html: Added.
* platform/mac/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147547 => 147548)


--- trunk/LayoutTests/ChangeLog	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/LayoutTests/ChangeLog	2013-04-03 13:20:29 UTC (rev 147548)
@@ -1,3 +1,15 @@
+2013-04-03  Gustavo Noronha Silva  <gustavo.noro...@collabora.com>
+
+        Should close select popup when the element loses focus
+        https://bugs.webkit.org/show_bug.cgi?id=113220
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/select/popup-closes-on-blur-expected.txt: Added.
+        * fast/forms/select/popup-closes-on-blur.html: Added.
+        * platform/mac/TestExpectations:
+        * platform/win/TestExpectations:
+
 2013-04-03  Antoine Quint  <grao...@apple.com>
 
         Web Inspector: crash in WebCore::InspectorLayerTreeAgent::buildObjectForLayer if a layer is created for an anonymous RenderObject (:first-letter)

Added: trunk/LayoutTests/fast/forms/select/popup-closes-on-blur-expected.txt (0 => 147548)


--- trunk/LayoutTests/fast/forms/select/popup-closes-on-blur-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select/popup-closes-on-blur-expected.txt	2013-04-03 13:20:29 UTC (rev 147548)
@@ -0,0 +1,11 @@
+Test for http://bugs.webkit.org/show_bug.cgi?id=113220: ensures select popup closes when focus changes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.isSelectPopupVisible(popup) is true
+PASS internals.isSelectPopupVisible(popup) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/forms/select/popup-closes-on-blur.html (0 => 147548)


--- trunk/LayoutTests/fast/forms/select/popup-closes-on-blur.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select/popup-closes-on-blur.html	2013-04-03 13:20:29 UTC (rev 147548)
@@ -0,0 +1,41 @@
+<html>
+    <head>
+        <title></title>
+        <script src=""
+    </head>
+    <body>
+        <p id="description"></p>
+        <div id="console"></div>
+        <select name="switcher" id="switcher">
+            <option value="one">One</option>
+            <option value="two">Two</option>
+        </select>
+        <input id="text"></input>
+
+        <script>
+            function test()
+            {
+                if (!window.testRunner || !window.internals)
+                    return;
+
+                testRunner.dumpAsText();
+
+                description('Test for <i><a href="" ensures select popup closes when focus changes</i>.');
+
+                popup = document.getElementById("switcher");
+                popup.focus();
+
+                eventSender.keyDown(" ", null);
+
+                shouldBeTrue("internals.isSelectPopupVisible(popup)");
+
+                var text = document.getElementById("text");
+                text.focus();
+
+                shouldBeFalse("internals.isSelectPopupVisible(popup)");
+            }
+            test();
+        </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (147547 => 147548)


--- trunk/LayoutTests/platform/mac/TestExpectations	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2013-04-03 13:20:29 UTC (rev 147548)
@@ -186,6 +186,11 @@
 # Color input is not yet enabled.
 fast/forms/color
 
+# Times out only in non-wk2 Mac, possibly because of platform-specific behaviour
+# interfering with how the test is executed.
+# https://bugs.webkit.org/show_bug.cgi?id=113220
+fast/forms/select/popup-closes-on-blur.html [ Timeout Pass ]
+
 # ENABLE_INPUT_TYPE_* are not enabled.
 # https://bugs.webkit.org/show_bug.cgi?id=29359
 fast/forms/date

Modified: trunk/LayoutTests/platform/win/TestExpectations (147547 => 147548)


--- trunk/LayoutTests/platform/win/TestExpectations	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/LayoutTests/platform/win/TestExpectations	2013-04-03 13:20:29 UTC (rev 147548)
@@ -208,6 +208,10 @@
 fast/events/option-tab.html
 fast/forms/focus2.html
 
+# Unidentified crash, possibly related to linking issues?
+# https://bugs.webkit.org/show_bug.cgi?id=113220
+fast/forms/select/popup-closes-on-blur.html [ Crash ]
+
 # fast/html/keygen.html is failing on boomer <rdar://problem/5133799>
 fast/html/keygen.html
 fast/invalid/residual-style.html

Modified: trunk/Source/WebCore/ChangeLog (147547 => 147548)


--- trunk/Source/WebCore/ChangeLog	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebCore/ChangeLog	2013-04-03 13:20:29 UTC (rev 147548)
@@ -1,3 +1,22 @@
+2013-04-03  Gustavo Noronha Silva  <gustavo.noro...@collabora.com>
+
+        Should close select popup when the element loses focus
+        https://bugs.webkit.org/show_bug.cgi?id=113220
+
+        Reviewed by Kent Tamura.
+
+        Test: fast/forms/select-popup-closes-on-blur.html
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::menuListDefaultEventHandler): handle the blur event, closing
+        the popup menu if any.
+        * testing/Internals.cpp:
+        (WebCore::Internals::isSelectPopupVisible): utility to query the select node renderer to
+        find out whether the popup is open or closed.
+        (WebCore):
+        * testing/Internals.h: add the new method definition.
+        * testing/Internals.idl: ditto.
+
 2013-03-28  Jesus Sanchez-Palencia  <jesus.palen...@openbossa.org>
 
         [Qt] Switch ContextMenu implementation to CROSS_PLATFORM_CONTEXT_MENU

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (147547 => 147548)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2013-04-03 13:20:29 UTC (rev 147548)
@@ -1225,6 +1225,13 @@
         }
         event->setDefaultHandled();
     }
+
+    if (event->type() == eventNames().blurEvent) {
+        if (RenderMenuList* menuList = toRenderMenuList(renderer())) {
+            if (menuList->popupIsVisible())
+                menuList->hidePopup();
+        }
+    }
 }
 
 void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shift)

Modified: trunk/Source/WebCore/testing/Internals.cpp (147547 => 147548)


--- trunk/Source/WebCore/testing/Internals.cpp	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebCore/testing/Internals.cpp	2013-04-03 13:20:29 UTC (rev 147548)
@@ -55,6 +55,7 @@
 #include "HTMLMediaElement.h"
 #endif
 #include "HTMLNames.h"
+#include "HTMLSelectElement.h"
 #include "HTMLTextAreaElement.h"
 #include "HistoryItem.h"
 #include "InspectorClient.h"
@@ -77,6 +78,7 @@
 #include "PrintContext.h"
 #include "PseudoElement.h"
 #include "Range.h"
+#include "RenderMenuList.h"
 #include "RenderObject.h"
 #include "RenderTreeAsText.h"
 #include "RuntimeEnabledFeatures.h"
@@ -2102,4 +2104,19 @@
 }
 #endif
 
+bool Internals::isSelectPopupVisible(Node* node)
+{
+    if (!isHTMLSelectElement(node))
+        return false;
+
+    HTMLSelectElement* select = toHTMLSelectElement(node);
+
+    RenderObject* renderer = select->renderer();
+    if (!renderer->isMenuList())
+        return false;
+
+    RenderMenuList* menuList = toRenderMenuList(renderer);
+    return menuList->popupIsVisible();
 }
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (147547 => 147548)


--- trunk/Source/WebCore/testing/Internals.h	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebCore/testing/Internals.h	2013-04-03 13:20:29 UTC (rev 147548)
@@ -309,6 +309,8 @@
     void simulateAudioInterruption(Node*);
 #endif
 
+    bool isSelectPopupVisible(Node*);
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (147547 => 147548)


--- trunk/Source/WebCore/testing/Internals.idl	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebCore/testing/Internals.idl	2013-04-03 13:20:29 UTC (rev 147548)
@@ -271,4 +271,6 @@
     [Conditional=SPEECH_SYNTHESIS] void enableMockSpeechSynthesizer();
 
     DOMString getImageSourceURL(in Element element) raises(DOMException);
+
+    boolean isSelectPopupVisible(in Node node);
 };

Modified: trunk/Source/WebKit/win/ChangeLog (147547 => 147548)


--- trunk/Source/WebKit/win/ChangeLog	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebKit/win/ChangeLog	2013-04-03 13:20:29 UTC (rev 147548)
@@ -1,3 +1,12 @@
+2013-04-03  Gustavo Noronha Silva  <gustavo.noro...@collabora.com>
+
+        Should close select popup when the element loses focus
+        https://bugs.webkit.org/show_bug.cgi?id=113220
+
+        Reviewed by Kent Tamura.
+
+        * WebKit.vcproj/WebKitExports.def.in: export WebCore::HTMLNames::selectTag for Internals
+
 2013-04-02  Timothy Hatcher  <timo...@apple.com>
 
         Provide a user default that can be used to disable docking of the Web Inspector.

Modified: trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in (147547 => 147548)


--- trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in	2013-04-03 13:20:29 UTC (rev 147548)
@@ -196,6 +196,7 @@
         ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVNode@2@PBVRange@2@AAI2@Z
         ?getReferencedFilePaths@FormController@WebCore@@SA?AV?$Vector@VString@WTF@@$0A@@WTF@@ABV34@@Z
         ?inputTag@HTMLNames@WebCore@@3VQualifiedName@2@B
+        ?selectTag@HTMLNames@WebCore@@3VQualifiedName@2@B
 #if ENABLE(INSPECTOR)
         ?getHighlight@InspectorController@WebCore@@QBEXPAUHighlight@2@@Z
         ?instrumentingAgentsForPage@InspectorInstrumentation@WebCore@@CAPAVInstrumentingAgents@2@PAVPage@2@@Z

Modified: trunk/Source/autotools/symbols.filter (147547 => 147548)


--- trunk/Source/autotools/symbols.filter	2013-04-03 13:20:28 UTC (rev 147547)
+++ trunk/Source/autotools/symbols.filter	2013-04-03 13:20:29 UTC (rev 147548)
@@ -51,6 +51,7 @@
 _ZN7WebCore8Settings22setMinDOMTimerIntervalEd;
 _ZN7WebCore8toUInt64EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE;
 _ZN7WebCore9HTMLNames8inputTagE;
+_ZN7WebCore9HTMLNames9selectTagE;
 _ZN7WebCore9HTMLNames11textareaTagE;
 _ZN7WebCore10JSDocument10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE;
 _ZN7WebCore10JSDocument6s_infoE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to