| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 { | 67 { |
| 68 m_inspectorDOMAgent->releaseDanglingNodes(); | 68 m_inspectorDOMAgent->releaseDanglingNodes(); |
| 69 InspectorConsoleAgent::clearMessages(errorString); | 69 InspectorConsoleAgent::clearMessages(errorString); |
| 70 } | 70 } |
| 71 | 71 |
| 72 ConsoleMessageStorage* PageConsoleAgent::messageStorage() | 72 ConsoleMessageStorage* PageConsoleAgent::messageStorage() |
| 73 { | 73 { |
| 74 return m_page->deprecatedLocalMainFrame()->console().messageStorage(); | 74 return m_page->deprecatedLocalMainFrame()->console().messageStorage(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 class InspectableNode FINAL : public InjectedScriptHost::InspectableObject { | 77 class InspectableNode final : public InjectedScriptHost::InspectableObject { |
| 78 public: | 78 public: |
| 79 explicit InspectableNode(Node* node) : m_node(node) { } | 79 explicit InspectableNode(Node* node) : m_node(node) { } |
| 80 virtual ScriptValue get(ScriptState* state) OVERRIDE | 80 virtual ScriptValue get(ScriptState* state) override |
| 81 { | 81 { |
| 82 return InjectedScriptHost::nodeAsScriptValue(state, m_node); | 82 return InjectedScriptHost::nodeAsScriptValue(state, m_node); |
| 83 } | 83 } |
| 84 private: | 84 private: |
| 85 Node* m_node; | 85 Node* m_node; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 void PageConsoleAgent::addInspectedNode(ErrorString* errorString, int nodeId) | 88 void PageConsoleAgent::addInspectedNode(ErrorString* errorString, int nodeId) |
| 89 { | 89 { |
| 90 Node* node = m_inspectorDOMAgent->nodeForId(nodeId); | 90 Node* node = m_inspectorDOMAgent->nodeForId(nodeId); |
| 91 if (!node) { | 91 if (!node) { |
| 92 *errorString = "nodeId is not valid"; | 92 *errorString = "nodeId is not valid"; |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 while (node->isInShadowTree()) { | 95 while (node->isInShadowTree()) { |
| 96 Node& ancestor = NodeTraversal::highestAncestorOrSelf(*node); | 96 Node& ancestor = NodeTraversal::highestAncestorOrSelf(*node); |
| 97 if (!ancestor.isShadowRoot() || toShadowRoot(ancestor).type() == ShadowR
oot::AuthorShadowRoot) | 97 if (!ancestor.isShadowRoot() || toShadowRoot(ancestor).type() == ShadowR
oot::AuthorShadowRoot) |
| 98 break; | 98 break; |
| 99 // User agent shadow root, keep climbing up. | 99 // User agent shadow root, keep climbing up. |
| 100 node = toShadowRoot(ancestor).host(); | 100 node = toShadowRoot(ancestor).host(); |
| 101 } | 101 } |
| 102 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableNode(node))); | 102 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableNode(node))); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |