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

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

Issue 2971133002: Add input element values to DOMSnapshot command (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fd5643eda2154f2e580a03d4d713c80c51444bb5 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"
@@ -207,6 +211,33 @@ int InspectorDOMSnapshotAgent::VisitNode(Node* node) {
VisitNode(toHTMLTemplateElement(*element).content()));
}
+ if (isHTMLTextAreaElement(*element)) {
+ HTMLTextAreaElement& text_area_element = toHTMLTextAreaElement(*element);
alex clarke (OOO till 29th) 2017/07/06 07:48:18 Lets make all these references const.
dvallet 2017/07/07 04:51:39 Done
+ if (!text_area_element.value().IsEmpty())
+ value->setNodeValue(text_area_element.value());
+ }
+
+ if (isHTMLInputElement(*element)) {
+ HTMLInputElement& input_element = toHTMLInputElement(*element);
+ String input_value = input_element.value();
alex clarke (OOO till 29th) 2017/07/06 07:48:18 You can probably use std::move here
dvallet 2017/07/07 04:51:39 I think it already does copy elision, If I add std
+ if ((input_element.type() == InputTypeNames::radio) ||
+ (input_element.type() == InputTypeNames::checkbox)) {
+ if (input_element.checked())
+ input_value = "checked";
alex clarke (OOO till 29th) 2017/07/06 07:48:18 I believe the style guide wants us to use brackets
dvallet 2017/07/07 04:51:39 Done
+ else
+ input_value = "";
+ }
+ if (!input_value.IsEmpty())
+ value->setNodeValue(input_value);
+ }
+
+ if (isHTMLOptionElement(*element)) {
+ HTMLOptionElement& option_element = toHTMLOptionElement(*element);
+ if (option_element.Selected()) {
+ value->setNodeValue("selected");
Eric Seckler 2017/07/06 07:41:39 Nit: no need for {}.
dvallet 2017/07/07 04:51:39 Done
+ }
+ }
+
if (element->GetPseudoId()) {
protocol::DOM::PseudoType pseudo_type;
if (InspectorDOMAgent::GetPseudoElementType(element->GetPseudoId(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698