Title: [95380] trunk/Source/WebKit/chromium
- Revision
- 95380
- Author
- [email protected]
- Date
- 2011-09-17 02:49:26 -0700 (Sat, 17 Sep 2011)
Log Message
[chromium]The focus of an input field inside an Iframe doesn't get cleared even though clearFocusedNode is called.
https://bugs.webkit.org/show_bug.cgi?id=68162
Add a unit-test to check whether the focus of node is get cleared when clearFocusNode called.
This test check for focus of input node inside a frame after clear focus get called.
Patch by chandra shekar vallala <[email protected]> on 2011-09-17
Reviewed by Adam Barth.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::clearFocusedNode):
* tests/WebFrameTest.cpp:
(WebKit::TEST_F): Added a unit test to make sure that focus of the node is get cleared.
* tests/data/autofocus_input_field_iframe.html: Added.
* tests/data/iframe_clear_focused_node_test.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (95379 => 95380)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-09-17 09:28:13 UTC (rev 95379)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-09-17 09:49:26 UTC (rev 95380)
@@ -1,3 +1,19 @@
+2011-09-17 chandra shekar vallala <[email protected]>
+
+ [chromium]The focus of an input field inside an Iframe doesn't get cleared even though clearFocusedNode is called.
+ https://bugs.webkit.org/show_bug.cgi?id=68162
+
+ Add a unit-test to check whether the focus of node is get cleared when clearFocusNode called.
+ This test check for focus of input node inside a frame after clear focus get called.
+ Reviewed by Adam Barth.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::clearFocusedNode):
+ * tests/WebFrameTest.cpp:
+ (WebKit::TEST_F): Added a unit test to make sure that focus of the node is get cleared.
+ * tests/data/autofocus_input_field_iframe.html: Added.
+ * tests/data/iframe_clear_focused_node_test.html: Added.
+
2011-09-16 Adam Barth <[email protected]>
Rename ENABLE(LEVELDB) to USE(LEVELDB)
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (95379 => 95380)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-09-17 09:28:13 UTC (rev 95379)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-09-17 09:49:26 UTC (rev 95380)
@@ -1782,10 +1782,7 @@
void WebViewImpl::clearFocusedNode()
{
- if (!m_page.get())
- return;
-
- RefPtr<Frame> frame = m_page->mainFrame();
+ RefPtr<Frame> frame = focusedWebCoreFrame();
if (!frame.get())
return;
Modified: trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp (95379 => 95380)
--- trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp 2011-09-17 09:28:13 UTC (rev 95379)
+++ trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp 2011-09-17 09:49:26 UTC (rev 95380)
@@ -42,7 +42,8 @@
#include "WebURL.h"
#include "WebURLRequest.h"
#include "WebURLResponse.h"
-#include "WebView.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
#include "v8.h"
#include <googleurl/src/gurl.h>
#include <gtest/gtest.h>
@@ -119,6 +120,9 @@
class TestWebFrameClient : public WebFrameClient {
};
+class TestWebViewClient : public WebViewClient {
+};
+
TEST_F(WebFrameTest, ContentText)
{
registerMockedHttpURLLoad("iframes_test.html");
@@ -255,4 +259,28 @@
serveRequests();
}
+TEST_F(WebFrameTest, ClearFocusedNodeTest)
+{
+ registerMockedHttpURLLoad("iframe_clear_focused_node_test.html");
+ registerMockedHttpURLLoad("autofocus_input_field_iframe.html");
+
+ // Create and initialize the WebView.
+ TestWebFrameClient webFrameClient;
+ TestWebViewClient webviewClient;
+ WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(WebView::create(&webviewClient));
+ webViewImpl->settings()->setJavaScriptEnabled(true);
+ webViewImpl->initializeMainFrame(&webFrameClient);
+
+ loadHttpFrame(webViewImpl->mainFrame(), "iframe_clear_focused_node_test.html");
+ serveRequests();
+
+ // Clear the focused node.
+ webViewImpl->clearFocusedNode();
+
+ // Now retrieve the FocusedNode and test it should be null.
+ EXPECT_EQ(0, webViewImpl->focusedWebCoreNode());
+
+ webViewImpl->close();
+}
+
} // namespace
Added: trunk/Source/WebKit/chromium/tests/data/autofocus_input_field_iframe.html (0 => 95380)
--- trunk/Source/WebKit/chromium/tests/data/autofocus_input_field_iframe.html (rev 0)
+++ trunk/Source/WebKit/chromium/tests/data/autofocus_input_field_iframe.html 2011-09-17 09:49:26 UTC (rev 95380)
@@ -0,0 +1,12 @@
+<html>
+ <script type="text/_javascript_">
+ function autofocus() {
+ document.getElementById('inputfield').focus();
+ }
+ window._onload_ = autofocus;
+ </script>
+ <body>
+ <p>This page has a auto focused input field.</p>
+ <input type="text" id="inputfield" />
+ </body>
+</html>
Added: trunk/Source/WebKit/chromium/tests/data/iframe_clear_focused_node_test.html (0 => 95380)
--- trunk/Source/WebKit/chromium/tests/data/iframe_clear_focused_node_test.html (rev 0)
+++ trunk/Source/WebKit/chromium/tests/data/iframe_clear_focused_node_test.html 2011-09-17 09:49:26 UTC (rev 95380)
@@ -0,0 +1,7 @@
+<html>
+ <body>
+ This is a test case to clear the focused node inside of iframe.
+ <iframe width=400 height=200 id="iframe" src=""
+ </body>
+</html>
+
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes