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

Side by Side Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 123013002: Make calls to AtomicString(const String&) explicit in inspector/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
« no previous file with comments | « Source/core/inspector/DOMEditor.cpp ('k') | Source/core/inspector/InspectorResourceAgent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 555 }
556 556
557 void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons t String& selectors, int* elementId) 557 void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons t String& selectors, int* elementId)
558 { 558 {
559 *elementId = 0; 559 *elementId = 0;
560 Node* node = assertNode(errorString, nodeId); 560 Node* node = assertNode(errorString, nodeId);
561 if (!node) 561 if (!node)
562 return; 562 return;
563 563
564 TrackExceptionState exceptionState; 564 TrackExceptionState exceptionState;
565 RefPtr<Element> element = node->querySelector(selectors, exceptionState); 565 RefPtr<Element> element = node->querySelector(AtomicString(selectors), excep tionState);
566 if (exceptionState.hadException()) { 566 if (exceptionState.hadException()) {
567 *errorString = "DOM Error while querying"; 567 *errorString = "DOM Error while querying";
568 return; 568 return;
569 } 569 }
570 570
571 if (element) 571 if (element)
572 *elementId = pushNodePathToFrontend(element.get()); 572 *elementId = pushNodePathToFrontend(element.get());
573 } 573 }
574 574
575 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result) 575 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result)
576 { 576 {
577 Node* node = assertNode(errorString, nodeId); 577 Node* node = assertNode(errorString, nodeId);
578 if (!node) 578 if (!node)
579 return; 579 return;
580 580
581 TrackExceptionState exceptionState; 581 TrackExceptionState exceptionState;
582 RefPtr<NodeList> nodes = node->querySelectorAll(selectors, exceptionState); 582 RefPtr<NodeList> nodes = node->querySelectorAll(AtomicString(selectors), exc eptionState);
583 if (exceptionState.hadException()) { 583 if (exceptionState.hadException()) {
584 *errorString = "DOM Error while querying"; 584 *errorString = "DOM Error while querying";
585 return; 585 return;
586 } 586 }
587 587
588 result = TypeBuilder::Array<int>::create(); 588 result = TypeBuilder::Array<int>::create();
589 589
590 for (unsigned i = 0; i < nodes->length(); ++i) 590 for (unsigned i = 0; i < nodes->length(); ++i)
591 result->addItem(pushNodePathToFrontend(nodes->item(i))); 591 result->addItem(pushNodePathToFrontend(nodes->item(i)));
592 } 592 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 755
756 void InspectorDOMAgent::setNodeName(ErrorString* errorString, int nodeId, const String& tagName, int* newId) 756 void InspectorDOMAgent::setNodeName(ErrorString* errorString, int nodeId, const String& tagName, int* newId)
757 { 757 {
758 *newId = 0; 758 *newId = 0;
759 759
760 Node* oldNode = nodeForId(nodeId); 760 Node* oldNode = nodeForId(nodeId);
761 if (!oldNode || !oldNode->isElementNode()) 761 if (!oldNode || !oldNode->isElementNode())
762 return; 762 return;
763 763
764 TrackExceptionState exceptionState; 764 TrackExceptionState exceptionState;
765 RefPtr<Element> newElem = oldNode->document().createElement(tagName, excepti onState); 765 RefPtr<Element> newElem = oldNode->document().createElement(AtomicString(tag Name), exceptionState);
766 if (exceptionState.hadException()) 766 if (exceptionState.hadException())
767 return; 767 return;
768 768
769 // Copy over the original node's attributes. 769 // Copy over the original node's attributes.
770 newElem->cloneAttributesFromElement(*toElement(oldNode)); 770 newElem->cloneAttributesFromElement(*toElement(oldNode));
771 771
772 // Copy over the original node's children. 772 // Copy over the original node's children.
773 Node* child; 773 Node* child;
774 while ((child = oldNode->firstChild())) { 774 while ((child = oldNode->firstChild())) {
775 if (!m_domEditor->insertBefore(newElem.get(), child, 0, errorString)) 775 if (!m_domEditor->insertBefore(newElem.get(), child, 0, errorString))
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 if (node->nodeType() == Node::ATTRIBUTE_NODE) 1011 if (node->nodeType() == Node::ATTRIBUTE_NODE)
1012 node = toAttr(node)->ownerElement(); 1012 node = toAttr(node)->ownerElement();
1013 resultCollector.add(node); 1013 resultCollector.add(node);
1014 } 1014 }
1015 } 1015 }
1016 1016
1017 // Selector evaluation 1017 // Selector evaluation
1018 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) { 1018 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) {
1019 Document* document = *it; 1019 Document* document = *it;
1020 TrackExceptionState exceptionState; 1020 TrackExceptionState exceptionState;
1021 RefPtr<NodeList> nodeList = document->querySelectorAll(whitespaceTri mmedQuery, exceptionState); 1021 RefPtr<NodeList> nodeList = document->querySelectorAll(AtomicString( whitespaceTrimmedQuery), exceptionState);
1022 if (exceptionState.hadException() || !nodeList) 1022 if (exceptionState.hadException() || !nodeList)
1023 continue; 1023 continue;
1024 1024
1025 unsigned size = nodeList->length(); 1025 unsigned size = nodeList->length();
1026 for (unsigned i = 0; i < size; ++i) 1026 for (unsigned i = 0; i < size; ++i)
1027 resultCollector.add(nodeList->item(i)); 1027 resultCollector.add(nodeList->item(i));
1028 } 1028 }
1029 } 1029 }
1030 1030
1031 *searchId = IdentifiersFactory::createIdentifier(); 1031 *searchId = IdentifiersFactory::createIdentifier();
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 if (!m_documentNodeToIdMap.contains(m_document)) { 2030 if (!m_documentNodeToIdMap.contains(m_document)) {
2031 RefPtr<TypeBuilder::DOM::Node> root; 2031 RefPtr<TypeBuilder::DOM::Node> root;
2032 getDocument(errorString, root); 2032 getDocument(errorString, root);
2033 return errorString->isEmpty(); 2033 return errorString->isEmpty();
2034 } 2034 }
2035 return true; 2035 return true;
2036 } 2036 }
2037 2037
2038 } // namespace WebCore 2038 } // namespace WebCore
2039 2039
OLDNEW
« no previous file with comments | « Source/core/inspector/DOMEditor.cpp ('k') | Source/core/inspector/InspectorResourceAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698