Changeset 51224 in webkit
- Timestamp:
- Nov 19, 2009 5:09:49 PM (14 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r51172 r51224 1 2009-11-19 Yaar Schnitman <yaar@chromium.org> 2 3 Reviewed by Darin Fisher. 4 5 Make chromium/webkit/glue/FormFieldValues use the WebKit API 6 7 https://bugs.webkit.org/show_bug.cgi?id=31650 8 9 * public/WebElement.h: 10 * public/WebFormElement.h: 11 * public/WebInputElement.h: 12 (WebKit::WebInputElement::): 13 * public/WebNode.h: 14 * src/AssertMatchingEnums.cpp: 15 * src/DOMUtilitiesPrivate.cpp: 16 (WebKit::nameOfInputElement): 17 * src/DOMUtilitiesPrivate.h: 18 * src/EditorClientImpl.cpp: 19 (WebKit::EditorClientImpl::autofill): 20 (WebKit::EditorClientImpl::doAutofill): 21 * src/WebFormElement.cpp: 22 (WebKit::WebFormElement::name): 23 (WebKit::WebFormElement::method): 24 (WebKit::WebFormElement::getNamedElements): 25 (WebKit::WebFormElement::getInputElements): 26 * src/WebInputElement.cpp: 27 (WebKit::WebInputElement::isEnabledFormControl): 28 (WebKit::WebInputElement::inputType): 29 (WebKit::WebInputElement::formControlType): 30 (WebKit::WebInputElement::value): 31 (WebKit::WebInputElement::dispatchFormControlChangeEvent): 32 (WebKit::WebInputElement::setSelectionRange): 33 (WebKit::WebInputElement::name): 34 (WebKit::WebInputElement::nameForAutofill): 35 * src/WebNode.cpp: 36 (WebKit::WebNode::frame): 37 1 38 2009-11-18 Michelangelo De Simone <micdesim@gmail.com> 2 39 -
trunk/WebKit/chromium/public/WebElement.h
r50669 r51224 55 55 operator WTF::PassRefPtr<WebCore::Element>() const; 56 56 #endif 57 58 57 }; 59 58 -
trunk/WebKit/chromium/public/WebFormElement.h
r51130 r51224 33 33 34 34 #include "WebElement.h" 35 #include "WebInputElement.h" 35 36 #include "WebVector.h" 36 37 … … 61 62 WEBKIT_API bool autoComplete() const; 62 63 WEBKIT_API WebString action() const; 64 WEBKIT_API WebString name() const; 65 WEBKIT_API WebString method() const; 63 66 WEBKIT_API void submit(); 67 // FIXME: Deprecate and replace with WebVector<WebElement>. 64 68 WEBKIT_API void getNamedElements(const WebString&, WebVector<WebNode>&); 69 WEBKIT_API void getInputElements(WebVector<WebInputElement>&) const; 65 70 }; 66 71 -
trunk/WebKit/chromium/public/WebInputElement.h
r50669 r51224 56 56 #endif 57 57 58 void setActivatedSubmit(bool); 59 void setValue(const WebString& value); 60 WebString value(); 61 void setAutofilled(bool); 62 void dispatchFormControlChangeEvent(); 63 void setSelectionRange(size_t, size_t); 58 enum InputType { 59 Text = 0, 60 Password, 61 IsIndex, 62 CheckBox, 63 Radio, 64 Submit, 65 Reset, 66 File, 67 Hidden, 68 Image, 69 Button, 70 Search, 71 Range, 72 Email, 73 Number, 74 Telephone, 75 URL, 76 Color, 77 Date, 78 DateTime, 79 DateTimeLocal, 80 Month, 81 Time, 82 Week 83 }; 84 85 WEBKIT_API bool isEnabledFormControl() const; 86 WEBKIT_API InputType inputType() const; 87 WEBKIT_API WebString formControlType() const; 88 WEBKIT_API void setActivatedSubmit(bool); 89 WEBKIT_API void setValue(const WebString& value); 90 WEBKIT_API WebString value() const; 91 WEBKIT_API void setAutofilled(bool); 92 WEBKIT_API void dispatchFormControlChangeEvent(); 93 WEBKIT_API void setSelectionRange(int, int); 94 WEBKIT_API WebString name() const; 95 // Returns the name that should be used for the specified |element| when 96 // storing autofill data. This is either the field name or its id, an empty 97 // string if it has no name and no id. 98 WEBKIT_API WebString nameForAutofill() const; 99 64 100 }; 65 101 -
trunk/WebKit/chromium/public/WebNode.h
r51130 r51224 69 69 WEBKIT_API WebNode parentNode() const; 70 70 WEBKIT_API WebString nodeName() const; 71 WEBKIT_API WebFrame* frame() ;71 WEBKIT_API WebFrame* frame() const; 72 72 73 73 template<typename T> T toElement() -
trunk/WebKit/chromium/src/AssertMatchingEnums.cpp
r51008 r51224 37 37 #include "ApplicationCacheHost.h" 38 38 #include "EditorInsertAction.h" 39 #include "HTMLInputElement.h" 39 40 #include "MediaPlayer.h" 40 41 #include "NotificationPresenter.h" … … 47 48 #include "WebCursorInfo.h" 48 49 #include "WebEditingAction.h" 50 #include "WebInputElement.h" 49 51 #include "WebMediaPlayer.h" 50 52 #include "WebNotificationPresenter.h" … … 216 218 COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped); 217 219 220 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Text, HTMLInputElement::TEXT); 221 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Password, HTMLInputElement::PASSWORD); 222 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::IsIndex, HTMLInputElement::ISINDEX); 223 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::CheckBox, HTMLInputElement::CHECKBOX); 224 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Radio, HTMLInputElement::RADIO); 225 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Submit, HTMLInputElement::SUBMIT); 226 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Reset, HTMLInputElement::RESET); 227 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::File, HTMLInputElement::FILE); 228 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Hidden, HTMLInputElement::HIDDEN); 229 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Image, HTMLInputElement::IMAGE); 230 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Button, HTMLInputElement::BUTTON); 231 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Search, HTMLInputElement::SEARCH); 232 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Range, HTMLInputElement::RANGE); 233 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Email, HTMLInputElement::EMAIL); 234 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Number, HTMLInputElement::NUMBER); 235 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Telephone, HTMLInputElement::TELEPHONE); 236 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::URL, HTMLInputElement::URL); 237 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Color, HTMLInputElement::COLOR); 238 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Date, HTMLInputElement::DATE); 239 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::DateTime, HTMLInputElement::DATETIME); 240 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::DateTimeLocal, HTMLInputElement::DATETIMELOCAL); 241 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Month, HTMLInputElement::MONTH); 242 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Time, HTMLInputElement::TIME); 243 COMPILE_ASSERT_MATCHING_ENUM(WebInputElement::Week, HTMLInputElement::WEEK); 244 218 245 #if ENABLE(VIDEO) 219 246 COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::Empty, MediaPlayer::Empty); -
trunk/WebKit/chromium/src/DOMUtilitiesPrivate.cpp
r50742 r51224 40 40 #include "Node.h" 41 41 42 #include "WebInputElement.h" 43 42 44 using namespace WebCore; 43 45 … … 80 82 String nameOfInputElement(HTMLInputElement* element) 81 83 { 82 String name = element->name(); 83 String trimmedName = name.stripWhiteSpace(); 84 if (!trimmedName.isEmpty()) 85 return trimmedName; 86 87 name = element->getAttribute(HTMLNames::idAttr); 88 trimmedName = name.stripWhiteSpace(); 89 if (!trimmedName.isEmpty()) 90 return trimmedName; 91 92 return String(); 84 return WebInputElement(element).nameForAutofill(); 93 85 } 94 86 -
trunk/WebKit/chromium/src/DOMUtilitiesPrivate.h
r50742 r51224 51 51 WebCore::HTMLOptionElement* toHTMLOptionElement(WebCore::Node*); 52 52 53 // Returns the name that should be used for the specified |element| when 54 // storing autofill data. This is either the field name or its id, an empty 55 // string if it has no name and no id. 53 // FIXME: Deprecate. Use WebInputElement::nameForAutofill instead. 56 54 WebCore::String nameOfInputElement(WebCore::HTMLInputElement*); 57 55 -
trunk/WebKit/chromium/src/EditorClientImpl.cpp
r50742 r51224 46 46 #include "WebFrameImpl.h" 47 47 #include "WebKit.h" 48 #include "WebInputElement.h" 48 49 #include "WebNode.h" 49 50 #include "WebPasswordAutocompleteListener.h" … … 707 708 return false; 708 709 709 WebString name = Web Kit::nameOfInputElement(inputElement);710 WebString name = WebInputElement(inputElement).nameForAutofill(); 710 711 if (name.isEmpty()) // If the field has no name, then we won't have values. 711 712 return false; … … 770 771 771 772 // Then trigger form autofill. 772 WebString name = Web Kit::nameOfInputElement(inputElement);773 WebString name = WebInputElement(inputElement).nameForAutofill(); 773 774 ASSERT(static_cast<int>(name.length()) > 0); 774 775 -
trunk/WebKit/chromium/src/WebFormElement.cpp
r51130 r51224 32 32 #include "WebFormElement.h" 33 33 34 #include "HTMLFormControlElement.h" 34 35 #include "HTMLFormElement.h" 36 #include "HTMLInputElement.h" 37 #include "HTMLNames.h" 35 38 #include "WebString.h" 36 39 #include "WebURL.h" … … 70 73 } 71 74 75 WebString WebFormElement::name() const 76 { 77 return constUnwrap<HTMLFormElement>()->name(); 78 } 79 80 WebString WebFormElement::method() const 81 { 82 return constUnwrap<HTMLFormElement>()->method(); 83 } 84 72 85 void WebFormElement::submit() 73 86 { … … 78 91 WebVector<WebNode>& result) 79 92 { 80 Vector<RefPtr<Node> > temp_vector; 81 unwrap<HTMLFormElement>()->getNamedElements(name, temp_vector); 82 result.assign(temp_vector); 93 Vector<RefPtr<Node> > tempVector; 94 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); 95 result.assign(tempVector); 96 } 97 98 void WebFormElement::getInputElements(WebVector<WebInputElement>& result) const 99 { 100 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); 101 Vector<RefPtr<HTMLInputElement> > tempVector; 102 for (size_t i = 0; i < form->formElements.size(); i++) { 103 if (form->formElements[i]->hasLocalName(HTMLNames::inputTag)) 104 tempVector.append(static_cast<HTMLInputElement*>( 105 form->formElements[i])); 106 } 107 result.assign(tempVector); 83 108 } 84 109 -
trunk/WebKit/chromium/src/WebInputElement.cpp
r50721 r51224 33 33 34 34 #include "HTMLInputElement.h" 35 #include "HTMLNames.h" 35 36 #include "WebString.h" 36 37 #include <wtf/PassRefPtr.h> … … 56 57 } 57 58 59 bool WebInputElement::isEnabledFormControl() const 60 { 61 return constUnwrap<HTMLInputElement>()->isEnabledFormControl(); 62 } 63 64 WebInputElement::InputType WebInputElement::inputType() const 65 { 66 return static_cast<InputType>(constUnwrap<HTMLInputElement>()->inputType()); 67 } 68 69 WebString WebInputElement::formControlType() const 70 { 71 return constUnwrap<HTMLInputElement>()->formControlType(); 72 } 73 58 74 void WebInputElement::setActivatedSubmit(bool activated) 59 75 { 60 76 unwrap<HTMLInputElement>()->setActivatedSubmit(activated); 61 77 } 62 63 78 64 79 void WebInputElement::setValue(const WebString& value) … … 67 82 } 68 83 69 WebString WebInputElement::value() 84 WebString WebInputElement::value() const 70 85 { 71 return unwrap<HTMLInputElement>()->value();86 return constUnwrap<HTMLInputElement>()->value(); 72 87 } 73 74 88 75 89 void WebInputElement::setAutofilled(bool autoFilled) … … 81 95 { 82 96 unwrap<HTMLInputElement>()->dispatchFormControlChangeEvent(); 83 } // namespace WebKit97 } 84 98 85 void WebInputElement::setSelectionRange( size_t start, size_t end)99 void WebInputElement::setSelectionRange(int start, int end) 86 100 { 87 101 unwrap<HTMLInputElement>()->setSelectionRange(start, end); 88 102 } 103 104 WebString WebInputElement::name() const 105 { 106 return constUnwrap<HTMLInputElement>()->name(); 107 } 108 109 WebString WebInputElement::nameForAutofill() const 110 { 111 String name = constUnwrap<HTMLInputElement>()->name(); 112 String trimmedName = name.stripWhiteSpace(); 113 if (!trimmedName.isEmpty()) 114 return trimmedName; 115 name = constUnwrap<HTMLInputElement>()->getAttribute(HTMLNames::idAttr); 116 trimmedName = name.stripWhiteSpace(); 117 if (!trimmedName.isEmpty()) 118 return trimmedName; 119 return String(); 120 } 121 89 122 } // namespace WebKit -
trunk/WebKit/chromium/src/WebNode.cpp
r51130 r51224 96 96 } 97 97 98 WebFrame* WebNode::frame() 98 WebFrame* WebNode::frame() const 99 99 { 100 100 return WebFrameImpl::fromFrame(m_private->document()->frame());
Note: See TracChangeset
for help on using the changeset viewer.