Title: [109284] trunk/Source/WebKit/blackberry
Revision
109284
Author
[email protected]
Date
2012-02-29 16:33:56 -0800 (Wed, 29 Feb 2012)

Log Message

Autocomplete attribute should apply to textarea's.
https://bugs.webkit.org/show_bug.cgi?id=79929

Patch by Mike Fenton <[email protected]> on 2012-02-29
Reviewed by Antonio Gomes.

Allow the autocomplete attribute to bubble back to the form setting.

Expand support to include checking autocorrect, autocomplete and
name/id matching to text areas.

Reviewed internally by Nima Ghanavatian and Gen Mak.

* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::elementSupportsAutocorrect):
(BlackBerry::WebKit::DOMSupport::elementSupportsAutocomplete):
(BlackBerry::WebKit::DOMSupport::elementAttributeState):
* WebKitSupport/DOMSupport.h:
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::inputStyle):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (109283 => 109284)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-01 00:33:46 UTC (rev 109283)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-01 00:33:56 UTC (rev 109284)
@@ -1,3 +1,25 @@
+2012-02-29  Mike Fenton  <[email protected]>
+
+        Autocomplete attribute should apply to textarea's.
+        https://bugs.webkit.org/show_bug.cgi?id=79929
+
+        Reviewed by Antonio Gomes.
+
+        Allow the autocomplete attribute to bubble back to the form setting.
+
+        Expand support to include checking autocorrect, autocomplete and
+        name/id matching to text areas.
+
+        Reviewed internally by Nima Ghanavatian and Gen Mak.
+
+        * WebKitSupport/DOMSupport.cpp:
+        (BlackBerry::WebKit::DOMSupport::elementSupportsAutocorrect):
+        (BlackBerry::WebKit::DOMSupport::elementSupportsAutocomplete):
+        (BlackBerry::WebKit::DOMSupport::elementAttributeState):
+        * WebKitSupport/DOMSupport.h:
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::inputStyle):
+
 2012-02-29  Max Feil  <[email protected]>
 
         [BlackBerry] Add support for FLAC audio and OGG/Vorbis audio

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp (109283 => 109284)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2012-03-01 00:33:46 UTC (rev 109283)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2012-03-01 00:33:56 UTC (rev 109284)
@@ -173,13 +173,27 @@
     return false;
 }
 
+// This is a Tristate return to allow us to override name matching when
+// the attribute is expressly requested for a field. Default indicates
+// that the setting is On which is the default but not expressly requested
+// for the element being checked. On indicates that it is directly added
+// to the element.
 AttributeState elementSupportsAutocorrect(const Element* element)
 {
+    return elementAttributeState(element, QualifiedName(nullAtom, "autocorrect", nullAtom));
+}
+
+AttributeState elementSupportsAutocomplete(const Element* element)
+{
+    return elementAttributeState(element, HTMLNames::autocompleteAttr);
+}
+
+AttributeState elementAttributeState(const Element* element, const QualifiedName& attributeName)
+{
     // First we check the input item itself. If the attribute is not defined,
     // we check its parent form.
-    QualifiedName autocorrectAttr = QualifiedName(nullAtom, "autocorrect", nullAtom);
-    if (element->fastHasAttribute(autocorrectAttr)) {
-        AtomicString attributeString = element->fastGetAttribute(autocorrectAttr);
+    if (element->fastHasAttribute(attributeName)) {
+        AtomicString attributeString = element->fastGetAttribute(attributeName);
         if (equalIgnoringCase(attributeString, "off"))
             return Off;
         if (equalIgnoringCase(attributeString, "on"))
@@ -189,8 +203,8 @@
     }
     if (element->isFormControlElement()) {
         const HTMLFormControlElement* formElement = static_cast<const HTMLFormControlElement*>(element);
-        if (formElement->form() && formElement->form()->fastHasAttribute(autocorrectAttr)) {
-            AtomicString attributeString = formElement->form()->fastGetAttribute(autocorrectAttr);
+        if (formElement->form() && formElement->form()->fastHasAttribute(attributeName)) {
+            AtomicString attributeString = formElement->form()->fastGetAttribute(attributeName);
             if (equalIgnoringCase(attributeString, "off"))
                 return Off;
             if (equalIgnoringCase(attributeString, "on"))
@@ -285,25 +299,6 @@
     return rangeForNode->isPointInRange(domNodeAtPos, offset, ec);
 }
 
-// This is a Tristate return to allow us to override name matching when
-// autocomplete is expressly requested for a field. Default indicates
-// that the setting is On which is the default but not expressly requested
-// for the element being checked. On indicates that it is directly added
-// to the element.
-AttributeState elementSupportsAutocomplete(const Element* element)
-{
-    if (!element->hasTagName(HTMLNames::inputTag))
-        return Default;
-
-    const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element);
-    if (inputElement->fastHasAttribute(HTMLNames::autocompleteAttr)) {
-        if (equalIgnoringCase(inputElement->fastGetAttribute(HTMLNames::autocompleteAttr), "on"))
-            return On;
-    }
-
-    return inputElement->shouldAutocomplete() ? Default : Off;
-}
-
 bool matchesReservedStringPreventingAutocomplete(AtomicString& string)
 {
     if (string.contains("email", false /* caseSensitive */)

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h (109283 => 109284)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2012-03-01 00:33:46 UTC (rev 109283)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2012-03-01 00:33:56 UTC (rev 109284)
@@ -35,6 +35,7 @@
 class HTMLTextFormControlElement;
 class Node;
 class Position;
+class QualifiedName;
 class Range;
 class VisibleSelection;
 }
@@ -54,7 +55,10 @@
 bool isPopupInputField(const WebCore::Element*);
 bool isDateTimeInputField(const WebCore::Element*);
 bool isColorInputField(const WebCore::Element*);
+
+AttributeState elementAttributeState(const WebCore::Element*, const WebCore::QualifiedName&);
 AttributeState elementSupportsAutocorrect(const WebCore::Element*);
+AttributeState elementSupportsAutocomplete(const WebCore::Element*);
 
 WTF::String inputElementText(WebCore::Element*);
 
@@ -69,7 +73,6 @@
 WebCore::Node* DOMContainerNodeForPosition(const WebCore::Position&);
 bool isPositionInNode(WebCore::Node*, const WebCore::Position&);
 
-AttributeState elementSupportsAutocomplete(const WebCore::Element*);
 bool elementIdOrNameIndicatesNoAutocomplete(const WebCore::Element*);
 
 WebCore::IntPoint convertPointToFrame(const WebCore::Frame* sourceFrame, const WebCore::Frame* targetFrame, const WebCore::IntPoint& sourcePoint, const bool clampToTargetFrame = false);

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (109283 => 109284)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-03-01 00:33:46 UTC (rev 109283)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-03-01 00:33:56 UTC (rev 109284)
@@ -162,6 +162,7 @@
     switch (type) {
     case InputTypeText:
     case InputTypeSearch:
+    case InputTypeTextArea:
         {
             // Regular input mode, disable help if autocomplete is off.
             int imfMask = 0;
@@ -189,7 +190,6 @@
     case InputTypeURL:
         // Disable special handling.
         return NO_AUTO_TEXT | NO_PREDICTION | NO_AUTO_CORRECTION;
-    case InputTypeTextArea:
     default:
         break;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to