| 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 if (!node) | 953 if (!node) |
| 954 continue; | 954 continue; |
| 955 | 955 |
| 956 // Manual plain text search. | 956 // Manual plain text search. |
| 957 while ((node = NodeTraversal::next(node, document->documentElement())))
{ | 957 while ((node = NodeTraversal::next(node, document->documentElement())))
{ |
| 958 switch (node->nodeType()) { | 958 switch (node->nodeType()) { |
| 959 case Node::TEXT_NODE: | 959 case Node::TEXT_NODE: |
| 960 case Node::COMMENT_NODE: | 960 case Node::COMMENT_NODE: |
| 961 case Node::CDATA_SECTION_NODE: { | 961 case Node::CDATA_SECTION_NODE: { |
| 962 String text = node->nodeValue(); | 962 String text = node->nodeValue(); |
| 963 if (text.findIgnoringCase(whitespaceTrimmedQuery) != notFound) | 963 if (text.findIgnoringCase(whitespaceTrimmedQuery) != kNotFound) |
| 964 resultCollector.add(node); | 964 resultCollector.add(node); |
| 965 break; | 965 break; |
| 966 } | 966 } |
| 967 case Node::ELEMENT_NODE: { | 967 case Node::ELEMENT_NODE: { |
| 968 if ((!startTagFound && !endTagFound && (node->nodeName().findIgn
oringCase(tagNameQuery) != notFound)) | 968 if ((!startTagFound && !endTagFound && (node->nodeName().findIgn
oringCase(tagNameQuery) != kNotFound)) |
| 969 || (startTagFound && endTagFound && equalIgnoringCase(node->
nodeName(), tagNameQuery)) | 969 || (startTagFound && endTagFound && equalIgnoringCase(node->
nodeName(), tagNameQuery)) |
| 970 || (startTagFound && !endTagFound && node->nodeName().starts
With(tagNameQuery, false)) | 970 || (startTagFound && !endTagFound && node->nodeName().starts
With(tagNameQuery, false)) |
| 971 || (!startTagFound && endTagFound && node->nodeName().endsWi
th(tagNameQuery, false))) { | 971 || (!startTagFound && endTagFound && node->nodeName().endsWi
th(tagNameQuery, false))) { |
| 972 resultCollector.add(node); | 972 resultCollector.add(node); |
| 973 break; | 973 break; |
| 974 } | 974 } |
| 975 // Go through all attributes and serialize them. | 975 // Go through all attributes and serialize them. |
| 976 const Element* element = toElement(node); | 976 const Element* element = toElement(node); |
| 977 if (!element->hasAttributes()) | 977 if (!element->hasAttributes()) |
| 978 break; | 978 break; |
| 979 | 979 |
| 980 unsigned numAttrs = element->attributeCount(); | 980 unsigned numAttrs = element->attributeCount(); |
| 981 for (unsigned i = 0; i < numAttrs; ++i) { | 981 for (unsigned i = 0; i < numAttrs; ++i) { |
| 982 // Add attribute pair | 982 // Add attribute pair |
| 983 const Attribute* attribute = element->attributeItem(i); | 983 const Attribute* attribute = element->attributeItem(i); |
| 984 if (attribute->localName().find(whitespaceTrimmedQuery) != n
otFound) { | 984 if (attribute->localName().find(whitespaceTrimmedQuery) != k
NotFound) { |
| 985 resultCollector.add(node); | 985 resultCollector.add(node); |
| 986 break; | 986 break; |
| 987 } | 987 } |
| 988 size_t foundPosition = attribute->value().find(attributeQuer
y); | 988 size_t foundPosition = attribute->value().find(attributeQuer
y); |
| 989 if (foundPosition != notFound) { | 989 if (foundPosition != kNotFound) { |
| 990 if (!exactAttributeMatch || (!foundPosition && attribute
->value().length() == attributeQuery.length())) { | 990 if (!exactAttributeMatch || (!foundPosition && attribute
->value().length() == attributeQuery.length())) { |
| 991 resultCollector.add(node); | 991 resultCollector.add(node); |
| 992 break; | 992 break; |
| 993 } | 993 } |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 break; | 996 break; |
| 997 } | 997 } |
| 998 default: | 998 default: |
| 999 break; | 999 break; |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 | 1991 |
| 1992 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
ainWorldScriptState(frame)); | 1992 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
ainWorldScriptState(frame)); |
| 1993 if (injectedScript.hasNoValue()) | 1993 if (injectedScript.hasNoValue()) |
| 1994 return 0; | 1994 return 0; |
| 1995 | 1995 |
| 1996 return injectedScript.wrapNode(node, objectGroup); | 1996 return injectedScript.wrapNode(node, objectGroup); |
| 1997 } | 1997 } |
| 1998 | 1998 |
| 1999 } // namespace WebCore | 1999 } // namespace WebCore |
| 2000 | 2000 |
| OLD | NEW |