Add support for retrieving values from DOM form elements.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@207 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
9bd6ea0c0a
commit
658c53e87c
|
@ -16,9 +16,11 @@
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEventListener.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEventListener.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||||
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
||||||
|
#include "webkit/glue/form_field.h"
|
||||||
|
|
||||||
using WebKit::WebAttribute;
|
using WebKit::WebAttribute;
|
||||||
using WebKit::WebDocument;
|
using WebKit::WebDocument;
|
||||||
|
@ -26,6 +28,7 @@ using WebKit::WebDOMEvent;
|
||||||
using WebKit::WebDOMEventListener;
|
using WebKit::WebDOMEventListener;
|
||||||
using WebKit::WebElement;
|
using WebKit::WebElement;
|
||||||
using WebKit::WebFrame;
|
using WebKit::WebFrame;
|
||||||
|
using WebKit::WebFormControlElement;
|
||||||
using WebKit::WebNamedNodeMap;
|
using WebKit::WebNamedNodeMap;
|
||||||
using WebKit::WebNode;
|
using WebKit::WebNode;
|
||||||
using WebKit::WebString;
|
using WebKit::WebString;
|
||||||
|
@ -170,9 +173,23 @@ CefString CefDOMNodeImpl::GetValue()
|
||||||
if (!VerifyContext())
|
if (!VerifyContext())
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
const WebString& value = node_.nodeValue();
|
if (node_.isElementNode()) {
|
||||||
if (!value.isNull())
|
const WebElement& element = node_.to<WebKit::WebElement>();
|
||||||
str = value;
|
if (element.isFormControlElement()) {
|
||||||
|
// Retrieve the value from the form control element.
|
||||||
|
const WebFormControlElement& formElement =
|
||||||
|
node_.to<WebKit::WebFormControlElement>();
|
||||||
|
|
||||||
|
webkit_glue::FormField formField(formElement);
|
||||||
|
str = formField.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str.empty()) {
|
||||||
|
const WebString& value = node_.nodeValue();
|
||||||
|
if (!value.isNull())
|
||||||
|
str = value;
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue