Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorDOMSnapshotAgent.cpp

Issue 2971133002: Add input element values to DOMSnapshot command (Closed)
Patch Set: add separate tests for input value Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorDOMSnapshotAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMSnapshotAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMSnapshotAgent.cpp
index 4395577864592aabfa38b4379b1469be409b09a1..9a1cfd482784183616f47b9d91387ca3c338f204 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDOMSnapshotAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorDOMSnapshotAgent.cpp
@@ -4,6 +4,7 @@
#include "core/inspector/InspectorDOMSnapshotAgent.h"
+#include "core/InputTypeNames.h"
#include "core/css/CSSComputedStyleDeclaration.h"
#include "core/dom/Attribute.h"
#include "core/dom/AttributeCollection.h"
@@ -16,8 +17,11 @@
#include "core/dom/QualifiedName.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLFrameOwnerElement.h"
+#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLinkElement.h"
+#include "core/html/HTMLOptionElement.h"
#include "core/html/HTMLTemplateElement.h"
+#include "core/html/HTMLTextAreaElement.h"
#include "core/inspector/IdentifiersFactory.h"
#include "core/inspector/InspectedFrames.h"
#include "core/inspector/InspectorDOMAgent.h"
@@ -174,7 +178,7 @@ int InspectorDOMSnapshotAgent::VisitNode(Node* node) {
value->setAttributes(BuildArrayForElementAttributes(element));
if (node->IsFrameOwnerElement()) {
- HTMLFrameOwnerElement* frame_owner = ToHTMLFrameOwnerElement(node);
+ const HTMLFrameOwnerElement* frame_owner = ToHTMLFrameOwnerElement(node);
if (LocalFrame* frame =
frame_owner->ContentFrame() &&
frame_owner->ContentFrame()->IsLocalFrame()
@@ -194,7 +198,7 @@ int InspectorDOMSnapshotAgent::VisitNode(Node* node) {
}
if (isHTMLLinkElement(*element)) {
- HTMLLinkElement& link_element = toHTMLLinkElement(*element);
+ const HTMLLinkElement& link_element = toHTMLLinkElement(*element);
if (link_element.IsImport() && link_element.import() &&
InspectorDOMAgent::InnerParentNode(link_element.import()) ==
link_element) {
@@ -207,6 +211,26 @@ int InspectorDOMSnapshotAgent::VisitNode(Node* node) {
VisitNode(toHTMLTemplateElement(*element).content()));
}
+ if (isHTMLTextAreaElement(*element)) {
+ const HTMLTextAreaElement& text_area_element =
+ toHTMLTextAreaElement(*element);
+ value->setTextValue(text_area_element.value());
+ }
+
+ if (isHTMLInputElement(*element)) {
+ const HTMLInputElement& input_element = toHTMLInputElement(*element);
+ value->setInputValue(input_element.value());
+ if ((input_element.type() == InputTypeNames::radio) ||
+ (input_element.type() == InputTypeNames::checkbox)) {
+ value->setInputChecked(input_element.checked());
+ }
+ }
+
+ if (isHTMLOptionElement(*element)) {
+ const HTMLOptionElement& option_element = toHTMLOptionElement(*element);
+ value->setOptionSelected(option_element.Selected());
+ }
+
if (element->GetPseudoId()) {
protocol::DOM::PseudoType pseudo_type;
if (InspectorDOMAgent::GetPseudoElementType(element->GetPseudoId(),

Powered by Google App Engine
This is Rietveld 408576698