Title: [149675] trunk/Source/WebKit/blackberry
Revision
149675
Author
[email protected]
Date
2013-05-07 09:24:19 -0700 (Tue, 07 May 2013)

Log Message

[BlackBerry] Read-only fields should not get keyboard focus
https://bugs.webkit.org/show_bug.cgi?id=115725

Patch by Nima Ghanavatian <[email protected]> on 2013-05-07
Reviewed by Rob Buis.

Internally reviewed by Mike Fenton.

PR332887
Prevent keyboard focus and FCC from displaying when the user taps on a
read-only field. Further, ensure form controls skip over these fields
with the next/previous buttons.

* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::elementIsReadOnly):
(DOMSupport):
* WebKitSupport/DOMSupport.h:
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::focusedNodeChanged):
(BlackBerry::WebKit::InputHandler::setInputModeEnabled):
(BlackBerry::WebKit::InputHandler::notifyClientOfKeyboardVisibilityChange):
(BlackBerry::WebKit::InputHandler::isActiveTextEdit):
(WebKit):
* WebKitSupport/InputHandler.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (149674 => 149675)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-05-07 16:18:09 UTC (rev 149674)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-05-07 16:24:19 UTC (rev 149675)
@@ -1,5 +1,31 @@
 2013-05-07  Nima Ghanavatian  <[email protected]>
 
+        [BlackBerry] Read-only fields should not get keyboard focus
+        https://bugs.webkit.org/show_bug.cgi?id=115725
+
+        Reviewed by Rob Buis.
+
+        Internally reviewed by Mike Fenton.
+
+        PR332887
+        Prevent keyboard focus and FCC from displaying when the user taps on a
+        read-only field. Further, ensure form controls skip over these fields
+        with the next/previous buttons.
+
+        * WebKitSupport/DOMSupport.cpp:
+        (BlackBerry::WebKit::DOMSupport::elementIsReadOnly):
+        (DOMSupport):
+        * WebKitSupport/DOMSupport.h:
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::focusedNodeChanged):
+        (BlackBerry::WebKit::InputHandler::setInputModeEnabled):
+        (BlackBerry::WebKit::InputHandler::notifyClientOfKeyboardVisibilityChange):
+        (BlackBerry::WebKit::InputHandler::isActiveTextEdit):
+        (WebKit):
+        * WebKitSupport/InputHandler.h:
+
+2013-05-07  Nima Ghanavatian  <[email protected]>
+
         [BlackBerry] Expand spellcheck logging
         https://bugs.webkit.org/show_bug.cgi?id=115482
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp (149674 => 149675)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2013-05-07 16:18:09 UTC (rev 149674)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2013-05-07 16:24:19 UTC (rev 149675)
@@ -232,6 +232,11 @@
     return elementAttributeState(element, HTMLNames::spellcheckAttr);
 }
 
+bool isElementReadOnly(const Element* element)
+{
+    return element->fastHasAttribute(HTMLNames::readonlyAttr);
+}
+
 AttributeState elementAttributeState(const Element* element, const QualifiedName& attributeName)
 {
     // First we check the input item itself. If the attribute is not defined,

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h (149674 => 149675)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2013-05-07 16:18:09 UTC (rev 149674)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2013-05-07 16:24:19 UTC (rev 149675)
@@ -65,6 +65,7 @@
 AttributeState elementSupportsAutocorrect(const WebCore::Element*);
 AttributeState elementSupportsAutocomplete(const WebCore::Element*);
 AttributeState elementSupportsSpellCheck(const WebCore::Element*);
+bool isElementReadOnly(const WebCore::Element*);
 
 bool elementHasContinuousSpellCheckingEnabled(const PassRefPtr<WebCore::Element>);
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (149674 => 149675)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-05-07 16:18:09 UTC (rev 149674)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-05-07 16:24:19 UTC (rev 149675)
@@ -441,12 +441,12 @@
             return;
         }
 
-        if (DOMSupport::isTextBasedContentEditableElement(element)) {
+        if (DOMSupport::isTextBasedContentEditableElement(element) && !DOMSupport::isElementReadOnly(element)) {
             // Focused node is a text based input field, textarea or content editable field.
             setElementFocused(element);
             return;
         }
-    } else if (node && DOMSupport::isTextBasedContentEditableElement(node->parentElement())) {
+    } else if (node && DOMSupport::isTextBasedContentEditableElement(node->parentElement()) && !DOMSupport::isElementReadOnly(node->parentElement())) {
         setElementFocused(node->parentElement());
         return;
     }
@@ -959,7 +959,7 @@
         // Previous
         for (int previousElementId = focusElementId - 1; previousElementId >= 0; previousElementId--) {
             Element* element = const_cast<HTMLElement*>(toHTMLElement(formElementList[previousElementId]));
-            if (DOMSupport::isTextBasedContentEditableElement(element)) {
+            if (DOMSupport::isTextBasedContentEditableElement(element) && !DOMSupport::isElementReadOnly(element)) {
                 m_previousFocusableTextElement = element;
                 InputLog(Platform::LogLevelInfo, "InputHandler::updateFormState found previous element");
                 break;
@@ -968,7 +968,7 @@
         // Next
         for (int nextElementId = focusElementId + 1; nextElementId < formElementCount; nextElementId++) {
             Element* element = const_cast<HTMLElement*>(toHTMLElement(formElementList[nextElementId]));
-            if (DOMSupport::isTextBasedContentEditableElement(element)) {
+            if (DOMSupport::isTextBasedContentEditableElement(element) && !DOMSupport::isElementReadOnly(element)) {
                 m_nextFocusableTextElement = element;
                 InputLog(Platform::LogLevelInfo, "InputHandler::updateFormState found next element");
                 break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to