Title: [142234] trunk
- Revision
- 142234
- Author
- [email protected]
- Date
- 2013-02-07 23:18:05 -0800 (Thu, 07 Feb 2013)
Log Message
document.activeElement should not return a non-focusable element
https://bugs.webkit.org/show_bug.cgi?id=86707
Reviewed by Hajime Morita.
Source/WebCore:
This is based on a patch by Arpita Bahuguna.
Test: fast/dom/HTMLDocument/set-focus-on-valid-element.html
* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
Added check for verifying that the node to be focused is
focusable. However, this check should be skipped for HTMLPlugInElement
because it has special behavior.
LayoutTests:
* fast/dom/HTMLDocument/set-focus-on-valid-element-expected.txt: Added.
* fast/dom/HTMLDocument/set-focus-on-valid-element.html: Added.
This test verifies that document.activeElement does not return an
invalid or non-focusable element.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (142233 => 142234)
--- trunk/LayoutTests/ChangeLog 2013-02-08 07:08:52 UTC (rev 142233)
+++ trunk/LayoutTests/ChangeLog 2013-02-08 07:18:05 UTC (rev 142234)
@@ -1,3 +1,15 @@
+2013-02-07 Kent Tamura <[email protected]>
+
+ document.activeElement should not return a non-focusable element
+ https://bugs.webkit.org/show_bug.cgi?id=86707
+
+ Reviewed by Hajime Morita.
+
+ * fast/dom/HTMLDocument/set-focus-on-valid-element-expected.txt: Added.
+ * fast/dom/HTMLDocument/set-focus-on-valid-element.html: Added.
+ This test verifies that document.activeElement does not return an
+ invalid or non-focusable element.
+
2013-02-07 Matt Falkenhagen <[email protected]>
[chromium] Unreviewed gardening. Two webgl/conformance/context tests are timing out.
Added: trunk/LayoutTests/fast/dom/HTMLDocument/set-focus-on-valid-element-expected.txt (0 => 142234)
--- trunk/LayoutTests/fast/dom/HTMLDocument/set-focus-on-valid-element-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/set-focus-on-valid-element-expected.txt 2013-02-08 07:18:05 UTC (rev 142234)
@@ -0,0 +1,11 @@
+document.activeElement should return a valid and focusable element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.activeElement is not willBeDisabled
+PASS document.activeElement.id is "body"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/HTMLDocument/set-focus-on-valid-element.html (0 => 142234)
--- trunk/LayoutTests/fast/dom/HTMLDocument/set-focus-on-valid-element.html (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/set-focus-on-valid-element.html 2013-02-08 07:18:05 UTC (rev 142234)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<script src=""
+<script>
+document.addEventListener("DOMFocusOut", function() {
+ holder.removeChild(willBeRemoved);
+ willBeDisabled.disabled = true;
+}, false);
+
+function test() {
+ description("document.activeElement should return a valid and focusable element.");
+ shouldNotBe("document.activeElement", "willBeDisabled");
+ shouldBeEqualToString("document.activeElement.id", "body");
+ holder.removeChild(willBeDisabled);
+ isSuccessfullyParsed();
+}
+</script>
+<body id=body _onload_="test()">
+<div id=holder>
+<input autofocus id=willBeRemoved>
+<input autofocus id=willBeDisabled>
+</div>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (142233 => 142234)
--- trunk/Source/WebCore/ChangeLog 2013-02-08 07:08:52 UTC (rev 142233)
+++ trunk/Source/WebCore/ChangeLog 2013-02-08 07:18:05 UTC (rev 142234)
@@ -1,3 +1,20 @@
+2013-02-07 Kent Tamura <[email protected]>
+
+ document.activeElement should not return a non-focusable element
+ https://bugs.webkit.org/show_bug.cgi?id=86707
+
+ Reviewed by Hajime Morita.
+
+ This is based on a patch by Arpita Bahuguna.
+
+ Test: fast/dom/HTMLDocument/set-focus-on-valid-element.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::setFocusedNode):
+ Added check for verifying that the node to be focused is
+ focusable. However, this check should be skipped for HTMLPlugInElement
+ because it has special behavior.
+
2013-02-07 Vladislav Kaznacheev <[email protected]>
Web Inspector: Fix front-end compilation warnings related to WebInspector.SidebarPane
Modified: trunk/Source/WebCore/dom/Document.cpp (142233 => 142234)
--- trunk/Source/WebCore/dom/Document.cpp 2013-02-08 07:08:52 UTC (rev 142233)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-02-08 07:18:05 UTC (rev 142234)
@@ -3351,7 +3351,7 @@
}
}
- if (newFocusedNode) {
+ if (newFocusedNode && (newFocusedNode->isPluginElement() || newFocusedNode->isFocusable())) {
if (newFocusedNode->isRootEditableElement() && !acceptsEditingFocus(newFocusedNode.get())) {
// delegate blocks focus change
focusChangeBlocked = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes