OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/inspector/InspectorDOMSnapshotAgent.h" | 5 #include "core/inspector/InspectorDOMSnapshotAgent.h" |
6 | 6 |
7 #include "core/InputTypeNames.h" | |
7 #include "core/css/CSSComputedStyleDeclaration.h" | 8 #include "core/css/CSSComputedStyleDeclaration.h" |
8 #include "core/dom/Attribute.h" | 9 #include "core/dom/Attribute.h" |
9 #include "core/dom/AttributeCollection.h" | 10 #include "core/dom/AttributeCollection.h" |
10 #include "core/dom/DOMNodeIds.h" | 11 #include "core/dom/DOMNodeIds.h" |
11 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
12 #include "core/dom/DocumentType.h" | 13 #include "core/dom/DocumentType.h" |
13 #include "core/dom/Element.h" | 14 #include "core/dom/Element.h" |
14 #include "core/dom/Node.h" | 15 #include "core/dom/Node.h" |
15 #include "core/dom/PseudoElement.h" | 16 #include "core/dom/PseudoElement.h" |
16 #include "core/dom/QualifiedName.h" | 17 #include "core/dom/QualifiedName.h" |
17 #include "core/frame/LocalFrame.h" | 18 #include "core/frame/LocalFrame.h" |
18 #include "core/html/HTMLFrameOwnerElement.h" | 19 #include "core/html/HTMLFrameOwnerElement.h" |
20 #include "core/html/HTMLInputElement.h" | |
19 #include "core/html/HTMLLinkElement.h" | 21 #include "core/html/HTMLLinkElement.h" |
22 #include "core/html/HTMLOptionElement.h" | |
20 #include "core/html/HTMLTemplateElement.h" | 23 #include "core/html/HTMLTemplateElement.h" |
24 #include "core/html/HTMLTextAreaElement.h" | |
21 #include "core/inspector/IdentifiersFactory.h" | 25 #include "core/inspector/IdentifiersFactory.h" |
22 #include "core/inspector/InspectedFrames.h" | 26 #include "core/inspector/InspectedFrames.h" |
23 #include "core/inspector/InspectorDOMAgent.h" | 27 #include "core/inspector/InspectorDOMAgent.h" |
24 #include "core/layout/LayoutObject.h" | 28 #include "core/layout/LayoutObject.h" |
25 #include "core/layout/LayoutText.h" | 29 #include "core/layout/LayoutText.h" |
26 #include "core/layout/line/InlineTextBox.h" | 30 #include "core/layout/line/InlineTextBox.h" |
27 #include "platform/wtf/PtrUtil.h" | 31 #include "platform/wtf/PtrUtil.h" |
28 | 32 |
29 namespace blink { | 33 namespace blink { |
30 | 34 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 link_element) { | 204 link_element) { |
201 value->setImportedDocumentIndex(VisitNode(link_element.import())); | 205 value->setImportedDocumentIndex(VisitNode(link_element.import())); |
202 } | 206 } |
203 } | 207 } |
204 | 208 |
205 if (isHTMLTemplateElement(*element)) { | 209 if (isHTMLTemplateElement(*element)) { |
206 value->setTemplateContentIndex( | 210 value->setTemplateContentIndex( |
207 VisitNode(toHTMLTemplateElement(*element).content())); | 211 VisitNode(toHTMLTemplateElement(*element).content())); |
208 } | 212 } |
209 | 213 |
214 if (isHTMLTextAreaElement(*element)) { | |
215 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
| |
216 if (!text_area_element.value().IsEmpty()) | |
217 value->setNodeValue(text_area_element.value()); | |
218 } | |
219 | |
220 if (isHTMLInputElement(*element)) { | |
221 HTMLInputElement& input_element = toHTMLInputElement(*element); | |
222 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
| |
223 if ((input_element.type() == InputTypeNames::radio) || | |
224 (input_element.type() == InputTypeNames::checkbox)) { | |
225 if (input_element.checked()) | |
226 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
| |
227 else | |
228 input_value = ""; | |
229 } | |
230 if (!input_value.IsEmpty()) | |
231 value->setNodeValue(input_value); | |
232 } | |
233 | |
234 if (isHTMLOptionElement(*element)) { | |
235 HTMLOptionElement& option_element = toHTMLOptionElement(*element); | |
236 if (option_element.Selected()) { | |
237 value->setNodeValue("selected"); | |
Eric Seckler
2017/07/06 07:41:39
Nit: no need for {}.
dvallet
2017/07/07 04:51:39
Done
| |
238 } | |
239 } | |
240 | |
210 if (element->GetPseudoId()) { | 241 if (element->GetPseudoId()) { |
211 protocol::DOM::PseudoType pseudo_type; | 242 protocol::DOM::PseudoType pseudo_type; |
212 if (InspectorDOMAgent::GetPseudoElementType(element->GetPseudoId(), | 243 if (InspectorDOMAgent::GetPseudoElementType(element->GetPseudoId(), |
213 &pseudo_type)) { | 244 &pseudo_type)) { |
214 value->setPseudoType(pseudo_type); | 245 value->setPseudoType(pseudo_type); |
215 } | 246 } |
216 } else { | 247 } else { |
217 value->setPseudoElementIndexes(VisitPseudoElements(element)); | 248 value->setPseudoElementIndexes(VisitPseudoElements(element)); |
218 } | 249 } |
219 } else if (node->IsDocumentNode()) { | 250 } else if (node->IsDocumentNode()) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 computed_styles_map_->insert(std::move(style), index); | 407 computed_styles_map_->insert(std::move(style), index); |
377 return index; | 408 return index; |
378 } | 409 } |
379 | 410 |
380 DEFINE_TRACE(InspectorDOMSnapshotAgent) { | 411 DEFINE_TRACE(InspectorDOMSnapshotAgent) { |
381 visitor->Trace(inspected_frames_); | 412 visitor->Trace(inspected_frames_); |
382 InspectorBaseAgent::Trace(visitor); | 413 InspectorBaseAgent::Trace(visitor); |
383 } | 414 } |
384 | 415 |
385 } // namespace blink | 416 } // namespace blink |
OLD | NEW |