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

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

Issue 359903002: Call WTFString::split(UChar, Vector&) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update tests as well Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/Navigator.cpp ('k') | Source/core/inspector/InspectorTimelineAgent.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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 Node* InspectorDOMAgent::nodeForPath(const String& path) 2022 Node* InspectorDOMAgent::nodeForPath(const String& path)
2023 { 2023 {
2024 // The path is of form "1,HTML,2,BODY,1,DIV" (<index> and <nodeName> interle aved). 2024 // The path is of form "1,HTML,2,BODY,1,DIV" (<index> and <nodeName> interle aved).
2025 // <index> may also be "a" (author shadow root) or "u" (user-agent shadow ro ot), 2025 // <index> may also be "a" (author shadow root) or "u" (user-agent shadow ro ot),
2026 // in which case <nodeName> MUST be "#document-fragment". 2026 // in which case <nodeName> MUST be "#document-fragment".
2027 if (!m_document) 2027 if (!m_document)
2028 return 0; 2028 return 0;
2029 2029
2030 Node* node = m_document.get(); 2030 Node* node = m_document.get();
2031 Vector<String> pathTokens; 2031 Vector<String> pathTokens;
2032 path.split(",", false, pathTokens); 2032 path.split(',', pathTokens);
2033 if (!pathTokens.size()) 2033 if (!pathTokens.size())
2034 return 0; 2034 return 0;
2035 for (size_t i = 0; i < pathTokens.size() - 1; i += 2) { 2035 for (size_t i = 0; i < pathTokens.size() - 1; i += 2) {
2036 bool success = true; 2036 bool success = true;
2037 String& indexValue = pathTokens[i]; 2037 String& indexValue = pathTokens[i];
2038 unsigned childNumber = indexValue.toUInt(&success); 2038 unsigned childNumber = indexValue.toUInt(&success);
2039 Node* child; 2039 Node* child;
2040 if (!success) { 2040 if (!success) {
2041 child = shadowRootForNode(node, indexValue); 2041 child = shadowRootForNode(node, indexValue);
2042 } else { 2042 } else {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 if (!m_documentNodeToIdMap->contains(m_document.get())) { 2119 if (!m_documentNodeToIdMap->contains(m_document.get())) {
2120 RefPtr<TypeBuilder::DOM::Node> root; 2120 RefPtr<TypeBuilder::DOM::Node> root;
2121 getDocument(errorString, root); 2121 getDocument(errorString, root);
2122 return errorString->isEmpty(); 2122 return errorString->isEmpty();
2123 } 2123 }
2124 return true; 2124 return true;
2125 } 2125 }
2126 2126
2127 } // namespace WebCore 2127 } // namespace WebCore
2128 2128
OLDNEW
« no previous file with comments | « Source/core/frame/Navigator.cpp ('k') | Source/core/inspector/InspectorTimelineAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698