[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:50:57 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 8d3c4b8149f4bc1fed2057beb173e5934b93b3d8
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 20 01:09:49 2009 +0000

    2009-11-19  Yaar Schnitman  <yaar at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Make chromium/webkit/glue/FormFieldValues use the WebKit API
    
            https://bugs.webkit.org/show_bug.cgi?id=31650
    
            * public/WebElement.h:
            * public/WebFormElement.h:
            * public/WebInputElement.h:
            (WebKit::WebInputElement::):
            * public/WebNode.h:
            * src/AssertMatchingEnums.cpp:
            * src/DOMUtilitiesPrivate.cpp:
            (WebKit::nameOfInputElement):
            * src/DOMUtilitiesPrivate.h:
            * src/EditorClientImpl.cpp:
            (WebKit::EditorClientImpl::autofill):
            (WebKit::EditorClientImpl::doAutofill):
            * src/WebFormElement.cpp:
            (WebKit::WebFormElement::name):
            (WebKit::WebFormElement::method):
            (WebKit::WebFormElement::getNamedElements):
            (WebKit::WebFormElement::getInputElements):
            * src/WebInputElement.cpp:
            (WebKit::WebInputElement::isEnabledFormControl):
            (WebKit::WebInputElement::inputType):
            (WebKit::WebInputElement::formControlType):
            (WebKit::WebInputElement::value):
            (WebKit::WebInputElement::dispatchFormControlChangeEvent):
            (WebKit::WebInputElement::setSelectionRange):
            (WebKit::WebInputElement::name):
            (WebKit::WebInputElement::nameForAutofill):
            * src/WebNode.cpp:
            (WebKit::WebNode::frame):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51224 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 9045b2a..9202ed0 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,40 @@
+2009-11-19  Yaar Schnitman  <yaar at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Make chromium/webkit/glue/FormFieldValues use the WebKit API
+
+        https://bugs.webkit.org/show_bug.cgi?id=31650
+
+        * public/WebElement.h:
+        * public/WebFormElement.h:
+        * public/WebInputElement.h:
+        (WebKit::WebInputElement::):
+        * public/WebNode.h:
+        * src/AssertMatchingEnums.cpp:
+        * src/DOMUtilitiesPrivate.cpp:
+        (WebKit::nameOfInputElement):
+        * src/DOMUtilitiesPrivate.h:
+        * src/EditorClientImpl.cpp:
+        (WebKit::EditorClientImpl::autofill):
+        (WebKit::EditorClientImpl::doAutofill):
+        * src/WebFormElement.cpp:
+        (WebKit::WebFormElement::name):
+        (WebKit::WebFormElement::method):
+        (WebKit::WebFormElement::getNamedElements):
+        (WebKit::WebFormElement::getInputElements):
+        * src/WebInputElement.cpp:
+        (WebKit::WebInputElement::isEnabledFormControl):
+        (WebKit::WebInputElement::inputType):
+        (WebKit::WebInputElement::formControlType):
+        (WebKit::WebInputElement::value):
+        (WebKit::WebInputElement::dispatchFormControlChangeEvent):
+        (WebKit::WebInputElement::setSelectionRange):
+        (WebKit::WebInputElement::name):
+        (WebKit::WebInputElement::nameForAutofill):
+        * src/WebNode.cpp:
+        (WebKit::WebNode::frame):
+
 2009-11-18  Michelangelo De Simone  <micdesim at gmail.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/chromium/public/WebElement.h b/WebKit/chromium/public/WebElement.h
index bfdc081..d7a2cbf 100644
--- a/WebKit/chromium/public/WebElement.h
+++ b/WebKit/chromium/public/WebElement.h
@@ -54,7 +54,6 @@ namespace WebKit {
         WebElement& operator=(const WTF::PassRefPtr<WebCore::Element>&);
         operator WTF::PassRefPtr<WebCore::Element>() const;
 #endif
-
     };
 
 } // namespace WebKit
diff --git a/WebKit/chromium/public/WebFormElement.h b/WebKit/chromium/public/WebFormElement.h
index 9923bb9..27a1edb 100644
--- a/WebKit/chromium/public/WebFormElement.h
+++ b/WebKit/chromium/public/WebFormElement.h
@@ -32,6 +32,7 @@
 #define WebFormElement_h
 
 #include "WebElement.h"
+#include "WebInputElement.h"
 #include "WebVector.h"
 
 #if WEBKIT_IMPLEMENTATION
@@ -60,8 +61,12 @@ namespace WebKit {
 
         WEBKIT_API bool autoComplete() const;
         WEBKIT_API WebString action() const;
+        WEBKIT_API WebString name() const;
+        WEBKIT_API WebString method() const;
         WEBKIT_API void submit();
+        // FIXME: Deprecate and replace with WebVector<WebElement>.
         WEBKIT_API void getNamedElements(const WebString&, WebVector<WebNode>&);
+        WEBKIT_API void getInputElements(WebVector<WebInputElement>&) const;
     };
 
 } // namespace WebKit
diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h
index 5d86a39..75e44b9 100644
--- a/WebKit/chromium/public/WebInputElement.h
+++ b/WebKit/chromium/public/WebInputElement.h
@@ -55,12 +55,48 @@ namespace WebKit {
         operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const;
 #endif
 
-        void setActivatedSubmit(bool);
-        void setValue(const WebString& value);
-        WebString value();
-        void setAutofilled(bool);
-        void dispatchFormControlChangeEvent();
-        void setSelectionRange(size_t, size_t);
+        enum InputType {
+            Text = 0,
+            Password,
+            IsIndex,
+            CheckBox,
+            Radio,
+            Submit,
+            Reset,
+            File,
+            Hidden,
+            Image,
+            Button,
+            Search,
+            Range,
+            Email,
+            Number,
+            Telephone,
+            URL,
+            Color,
+            Date,
+            DateTime,
+            DateTimeLocal,
+            Month,
+            Time,
+            Week
+        };
+        
+        WEBKIT_API bool isEnabledFormControl() const;
+        WEBKIT_API InputType inputType() const;
+        WEBKIT_API WebString formControlType() const;
+        WEBKIT_API void setActivatedSubmit(bool);
+        WEBKIT_API void setValue(const WebString& value);
+        WEBKIT_API WebString value() const;
+        WEBKIT_API void setAutofilled(bool);
+        WEBKIT_API void dispatchFormControlChangeEvent();
+        WEBKIT_API void setSelectionRange(int, int);
+        WEBKIT_API WebString name() const;
+        // Returns the name that should be used for the specified |element| when
+        // storing autofill data.  This is either the field name or its id, an empty
+        // string if it has no name and no id.
+        WEBKIT_API WebString nameForAutofill() const;
+        
     };
 
 } // namespace WebKit
diff --git a/WebKit/chromium/public/WebNode.h b/WebKit/chromium/public/WebNode.h
index a312c9f..03afa90 100644
--- a/WebKit/chromium/public/WebNode.h
+++ b/WebKit/chromium/public/WebNode.h
@@ -68,7 +68,7 @@ public:
 
     WEBKIT_API WebNode parentNode() const;
     WEBKIT_API WebString nodeName() const;
-    WEBKIT_API WebFrame* frame();
+    WEBKIT_API WebFrame* frame() const;
 
     template<typename T> T toElement()
     {
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp
index dae8b7a..43e6b3a 100644
--- a/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -36,6 +36,7 @@
 #include "AccessibilityObject.h"
 #include "ApplicationCacheHost.h"
 #include "EditorInsertAction.h"
+#include "HTMLInputElement.h"
 #include "MediaPlayer.h"
 #include "NotificationPresenter.h"
 #include "PasteboardPrivate.h"
@@ -46,6 +47,7 @@
 #include "WebClipboard.h"
 #include "WebCursorInfo.h"
 #include "WebEditingAction.h"
+#include "WebInputElement.h"
 #include "WebMediaPlayer.h"
 #include "WebNotificationPresenter.h"
 #include "WebTextAffinity.h"
@@ -215,6 +217,31 @@ COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionTyped, EditorInsertActionTyped);
 COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionPasted, EditorInsertActionPasted);
 COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped);
 
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Text, HTMLInputElement::TEXT);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Password, HTMLInputElement::PASSWORD);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::IsIndex, HTMLInputElement::ISINDEX);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::CheckBox, HTMLInputElement::CHECKBOX);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Radio, HTMLInputElement::RADIO);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Submit, HTMLInputElement::SUBMIT);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Reset, HTMLInputElement::RESET);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::File, HTMLInputElement::FILE);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Hidden, HTMLInputElement::HIDDEN);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Image, HTMLInputElement::IMAGE);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Button, HTMLInputElement::BUTTON);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Search, HTMLInputElement::SEARCH);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Range, HTMLInputElement::RANGE);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Email, HTMLInputElement::EMAIL);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Number, HTMLInputElement::NUMBER);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Telephone, HTMLInputElement::TELEPHONE);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::URL, HTMLInputElement::URL);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Color, HTMLInputElement::COLOR);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Date, HTMLInputElement::DATE);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::DateTime, HTMLInputElement::DATETIME);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::DateTimeLocal, HTMLInputElement::DATETIMELOCAL);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Month, HTMLInputElement::MONTH);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Time, HTMLInputElement::TIME);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Week, HTMLInputElement::WEEK);
+
 #if ENABLE(VIDEO)
 COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Empty, MediaPlayer::Empty);
 COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Idle, MediaPlayer::Idle);
diff --git a/WebKit/chromium/src/DOMUtilitiesPrivate.cpp b/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
index e84d4fb..ffdd85d 100644
--- a/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
+++ b/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
@@ -39,6 +39,8 @@
 #include "HTMLOptionElement.h"
 #include "Node.h"
 
+#include "WebInputElement.h"
+
 using namespace WebCore;
 
 namespace {
@@ -79,17 +81,7 @@ HTMLOptionElement* toHTMLOptionElement(Node* node)
 
 String nameOfInputElement(HTMLInputElement* element)
 {
-    String name = element->name();
-    String trimmedName = name.stripWhiteSpace();
-    if (!trimmedName.isEmpty())
-        return trimmedName;
-
-    name = element->getAttribute(HTMLNames::idAttr);
-    trimmedName = name.stripWhiteSpace();
-    if (!trimmedName.isEmpty())
-        return trimmedName;
-
-    return String();
+    return WebInputElement(element).nameForAutofill();
 }
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/DOMUtilitiesPrivate.h b/WebKit/chromium/src/DOMUtilitiesPrivate.h
index c701d0a..c02bf84 100644
--- a/WebKit/chromium/src/DOMUtilitiesPrivate.h
+++ b/WebKit/chromium/src/DOMUtilitiesPrivate.h
@@ -50,9 +50,7 @@ WebCore::HTMLLinkElement* toHTMLLinkElement(WebCore::Node*);
 WebCore::HTMLMetaElement* toHTMLMetaElement(WebCore::Node*);
 WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node*);
 
-// Returns the name that should be used for the specified |element| when
-// storing autofill data.  This is either the field name or its id, an empty
-// string if it has no name and no id.
+// FIXME: Deprecate. Use WebInputElement::nameForAutofill instead.
 WebCore::String nameOfInputElement(WebCore::HTMLInputElement*);
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/EditorClientImpl.cpp b/WebKit/chromium/src/EditorClientImpl.cpp
index d84ce12..5db8ff7 100644
--- a/WebKit/chromium/src/EditorClientImpl.cpp
+++ b/WebKit/chromium/src/EditorClientImpl.cpp
@@ -45,6 +45,7 @@
 #include "WebEditingAction.h"
 #include "WebFrameImpl.h"
 #include "WebKit.h"
+#include "WebInputElement.h"
 #include "WebNode.h"
 #include "WebPasswordAutocompleteListener.h"
 #include "WebRange.h"
@@ -706,7 +707,7 @@ bool EditorClientImpl::autofill(HTMLInputElement* inputElement,
         || !inputElement->autoComplete())
         return false;
 
-    WebString name = WebKit::nameOfInputElement(inputElement);
+    WebString name = WebInputElement(inputElement).nameForAutofill();
     if (name.isEmpty()) // If the field has no name, then we won't have values.
         return false;
 
@@ -769,7 +770,7 @@ void EditorClientImpl::doAutofill(Timer<EditorClientImpl>* timer)
     }
 
     // Then trigger form autofill.
-    WebString name = WebKit::nameOfInputElement(inputElement);
+    WebString name = WebInputElement(inputElement).nameForAutofill();
     ASSERT(static_cast<int>(name.length()) > 0);
 
     if (m_webView->client())
diff --git a/WebKit/chromium/src/WebFormElement.cpp b/WebKit/chromium/src/WebFormElement.cpp
index 47fe760..5471608 100644
--- a/WebKit/chromium/src/WebFormElement.cpp
+++ b/WebKit/chromium/src/WebFormElement.cpp
@@ -31,7 +31,10 @@
 #include "config.h"
 #include "WebFormElement.h"
 
+#include "HTMLFormControlElement.h"
 #include "HTMLFormElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLNames.h"
 #include "WebString.h"
 #include "WebURL.h"
 #include <wtf/PassRefPtr.h>
@@ -69,6 +72,16 @@ WebString WebFormElement::action() const
     return constUnwrap<HTMLFormElement>()->action();
 }
 
+WebString WebFormElement::name() const 
+{
+    return constUnwrap<HTMLFormElement>()->name();
+}
+
+WebString WebFormElement::method() const 
+{
+    return constUnwrap<HTMLFormElement>()->method();
+}
+    
 void WebFormElement::submit()
 {
     unwrap<HTMLFormElement>()->submit();
@@ -77,9 +90,21 @@ void WebFormElement::submit()
 void WebFormElement::getNamedElements(const WebString& name,
                                       WebVector<WebNode>& result)
 {
-    Vector<RefPtr<Node> > temp_vector;
-    unwrap<HTMLFormElement>()->getNamedElements(name, temp_vector);
-    result.assign(temp_vector);
+    Vector<RefPtr<Node> > tempVector;
+    unwrap<HTMLFormElement>()->getNamedElements(name, tempVector);
+    result.assign(tempVector);
+}
+    
+void WebFormElement::getInputElements(WebVector<WebInputElement>& result) const
+{
+    const HTMLFormElement* form = constUnwrap<HTMLFormElement>();
+    Vector<RefPtr<HTMLInputElement> > tempVector;
+    for (size_t i = 0; i < form->formElements.size(); i++) {
+        if (form->formElements[i]->hasLocalName(HTMLNames::inputTag))
+            tempVector.append(static_cast<HTMLInputElement*>(
+                form->formElements[i]));
+    }
+    result.assign(tempVector);
 }
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/WebInputElement.cpp b/WebKit/chromium/src/WebInputElement.cpp
index 947e4cc..d403120 100644
--- a/WebKit/chromium/src/WebInputElement.cpp
+++ b/WebKit/chromium/src/WebInputElement.cpp
@@ -32,6 +32,7 @@
 #include "WebInputElement.h"
 
 #include "HTMLInputElement.h"
+#include "HTMLNames.h"
 #include "WebString.h"
 #include <wtf/PassRefPtr.h>
 
@@ -55,23 +56,36 @@ WebInputElement::operator WTF::PassRefPtr<HTMLInputElement>() const
     return PassRefPtr<HTMLInputElement>(static_cast<HTMLInputElement*>(m_private));
 }
 
+bool WebInputElement::isEnabledFormControl() const
+{
+    return constUnwrap<HTMLInputElement>()->isEnabledFormControl();
+}
+
+WebInputElement::InputType WebInputElement::inputType() const
+{
+    return static_cast<InputType>(constUnwrap<HTMLInputElement>()->inputType());
+}
+
+WebString WebInputElement::formControlType() const
+{
+    return constUnwrap<HTMLInputElement>()->formControlType();
+}
+    
 void WebInputElement::setActivatedSubmit(bool activated)
 {
     unwrap<HTMLInputElement>()->setActivatedSubmit(activated);
 }
 
-
 void WebInputElement::setValue(const WebString& value)
 {
     unwrap<HTMLInputElement>()->setValue(value);
 }
 
-WebString WebInputElement::value()
+WebString WebInputElement::value() const
 {
-    return unwrap<HTMLInputElement>()->value();
+    return constUnwrap<HTMLInputElement>()->value();
 }
 
-
 void WebInputElement::setAutofilled(bool autoFilled)
 {
     unwrap<HTMLInputElement>()->setAutofilled(autoFilled);
@@ -80,10 +94,29 @@ void WebInputElement::setAutofilled(bool autoFilled)
 void WebInputElement::dispatchFormControlChangeEvent()
 {
     unwrap<HTMLInputElement>()->dispatchFormControlChangeEvent();
-} // namespace WebKit
+}
 
-void WebInputElement::setSelectionRange(size_t start, size_t end)
+void WebInputElement::setSelectionRange(int start, int end)
 {
     unwrap<HTMLInputElement>()->setSelectionRange(start, end);
 }
+    
+WebString WebInputElement::name() const
+{
+    return constUnwrap<HTMLInputElement>()->name();
+}
+    
+WebString WebInputElement::nameForAutofill() const
+{
+    String name = constUnwrap<HTMLInputElement>()->name();
+    String trimmedName = name.stripWhiteSpace();
+    if (!trimmedName.isEmpty())
+        return trimmedName;
+    name = constUnwrap<HTMLInputElement>()->getAttribute(HTMLNames::idAttr);
+    trimmedName = name.stripWhiteSpace();
+    if (!trimmedName.isEmpty())
+        return trimmedName;
+    return String();
+}
+
 } // namespace WebKit
diff --git a/WebKit/chromium/src/WebNode.cpp b/WebKit/chromium/src/WebNode.cpp
index 07ec9b6..965c412 100644
--- a/WebKit/chromium/src/WebNode.cpp
+++ b/WebKit/chromium/src/WebNode.cpp
@@ -95,7 +95,7 @@ void WebNode::assign(WebNodePrivate* p)
     m_private = p;
 }
 
-WebFrame* WebNode::frame()
+WebFrame* WebNode::frame() const
 {
     return WebFrameImpl::fromFrame(m_private->document()->frame());
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list