OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |