| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 for (unsigned i = 0; i < nodeCount; ++i) | 192 for (unsigned i = 0; i < nodeCount; ++i) |
| 193 sortedNodes.append(parentMatrix[i][0]); | 193 sortedNodes.append(parentMatrix[i][0]); |
| 194 | 194 |
| 195 const_cast<HeapVector<Member<Node>>&>(m_nodes).swap(sortedNodes); | 195 const_cast<HeapVector<Member<Node>>&>(m_nodes).swap(sortedNodes); |
| 196 } | 196 } |
| 197 | 197 |
| 198 static Node* findRootNode(Node* node) | 198 static Node* findRootNode(Node* node) |
| 199 { | 199 { |
| 200 if (node->isAttributeNode()) | 200 if (node->isAttributeNode()) |
| 201 node = toAttr(node)->ownerElement(); | 201 node = toAttr(node)->ownerElement(); |
| 202 if (node->inShadowIncludingDocument()) { | 202 if (node->isConnected()) { |
| 203 node = &node->document(); | 203 node = &node->document(); |
| 204 } else { | 204 } else { |
| 205 while (Node* parent = node->parentNode()) | 205 while (Node* parent = node->parentNode()) |
| 206 node = parent; | 206 node = parent; |
| 207 } | 207 } |
| 208 return node; | 208 return node; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void NodeSet::traversalSort() const | 211 void NodeSet::traversalSort() const |
| 212 { | 212 { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 Node* NodeSet::anyNode() const | 273 Node* NodeSet::anyNode() const |
| 274 { | 274 { |
| 275 if (isEmpty()) | 275 if (isEmpty()) |
| 276 return nullptr; | 276 return nullptr; |
| 277 | 277 |
| 278 return m_nodes.at(0).get(); | 278 return m_nodes.at(0).get(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 } // namespace XPath | 281 } // namespace XPath |
| 282 } // namespace blink | 282 } // namespace blink |
| OLD | NEW |