| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } | 714 } |
| 715 | 715 |
| 716 String caseAdjustedName = name ? (shouldIgnoreCase ? name->lower() : *name)
: String(); | 716 String caseAdjustedName = name ? (shouldIgnoreCase ? name->lower() : *name)
: String(); |
| 717 | 717 |
| 718 if (!parsedElement->hasAttributes() && name) { | 718 if (!parsedElement->hasAttributes() && name) { |
| 719 m_domEditor->removeAttribute(element, caseAdjustedName, errorString); | 719 m_domEditor->removeAttribute(element, caseAdjustedName, errorString); |
| 720 return; | 720 return; |
| 721 } | 721 } |
| 722 | 722 |
| 723 bool foundOriginalAttribute = false; | 723 bool foundOriginalAttribute = false; |
| 724 unsigned numAttrs = parsedElement->attributeCount(); | 724 AttributeIteratorAccessor attributes = parsedElement->attributesIterator(); |
| 725 for (unsigned i = 0; i < numAttrs; ++i) { | 725 AttributeConstIterator end = attributes.end(); |
| 726 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { |
| 726 // Add attribute pair | 727 // Add attribute pair |
| 727 const Attribute& attribute = parsedElement->attributeItem(i); | 728 String attributeName = it->name().toString(); |
| 728 String attributeName = attribute.name().toString(); | |
| 729 if (shouldIgnoreCase) | 729 if (shouldIgnoreCase) |
| 730 attributeName = attributeName.lower(); | 730 attributeName = attributeName.lower(); |
| 731 foundOriginalAttribute |= name && attributeName == caseAdjustedName; | 731 foundOriginalAttribute |= name && attributeName == caseAdjustedName; |
| 732 if (!m_domEditor->setAttribute(element, attributeName, attribute.value()
, errorString)) | 732 if (!m_domEditor->setAttribute(element, attributeName, it->value(), erro
rString)) |
| 733 return; | 733 return; |
| 734 } | 734 } |
| 735 | 735 |
| 736 if (!foundOriginalAttribute && name && !name->stripWhiteSpace().isEmpty()) | 736 if (!foundOriginalAttribute && name && !name->stripWhiteSpace().isEmpty()) |
| 737 m_domEditor->removeAttribute(element, caseAdjustedName, errorString); | 737 m_domEditor->removeAttribute(element, caseAdjustedName, errorString); |
| 738 } | 738 } |
| 739 | 739 |
| 740 void InspectorDOMAgent::removeAttribute(ErrorString* errorString, int elementId,
const String& name) | 740 void InspectorDOMAgent::removeAttribute(ErrorString* errorString, int elementId,
const String& name) |
| 741 { | 741 { |
| 742 Element* element = assertEditableElement(errorString, elementId); | 742 Element* element = assertEditableElement(errorString, elementId); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 || (startTagFound && !endTagFound && node->nodeName().starts
With(tagNameQuery, false)) | 974 || (startTagFound && !endTagFound && node->nodeName().starts
With(tagNameQuery, false)) |
| 975 || (!startTagFound && endTagFound && node->nodeName().endsWi
th(tagNameQuery, false))) { | 975 || (!startTagFound && endTagFound && node->nodeName().endsWi
th(tagNameQuery, false))) { |
| 976 resultCollector.add(node); | 976 resultCollector.add(node); |
| 977 break; | 977 break; |
| 978 } | 978 } |
| 979 // Go through all attributes and serialize them. | 979 // Go through all attributes and serialize them. |
| 980 const Element* element = toElement(node); | 980 const Element* element = toElement(node); |
| 981 if (!element->hasAttributes()) | 981 if (!element->hasAttributes()) |
| 982 break; | 982 break; |
| 983 | 983 |
| 984 unsigned numAttrs = element->attributeCount(); | 984 AttributeIteratorAccessor attributes = element->attributesIterat
or(); |
| 985 for (unsigned i = 0; i < numAttrs; ++i) { | 985 AttributeConstIterator end = attributes.end(); |
| 986 for (AttributeConstIterator it = attributes.begin(); it != end;
++it) { |
| 986 // Add attribute pair | 987 // Add attribute pair |
| 987 const Attribute& attribute = element->attributeItem(i); | 988 if (it->localName().find(whitespaceTrimmedQuery, 0, false) !
= kNotFound) { |
| 988 if (attribute.localName().find(whitespaceTrimmedQuery, 0, fa
lse) != kNotFound) { | |
| 989 resultCollector.add(node); | 989 resultCollector.add(node); |
| 990 break; | 990 break; |
| 991 } | 991 } |
| 992 size_t foundPosition = attribute.value().find(attributeQuery
, 0, false); | 992 size_t foundPosition = it->value().find(attributeQuery, 0, f
alse); |
| 993 if (foundPosition != kNotFound) { | 993 if (foundPosition != kNotFound) { |
| 994 if (!exactAttributeMatch || (!foundPosition && attribute
.value().length() == attributeQuery.length())) { | 994 if (!exactAttributeMatch || (!foundPosition && it->value
().length() == attributeQuery.length())) { |
| 995 resultCollector.add(node); | 995 resultCollector.add(node); |
| 996 break; | 996 break; |
| 997 } | 997 } |
| 998 } | 998 } |
| 999 } | 999 } |
| 1000 break; | 1000 break; |
| 1001 } | 1001 } |
| 1002 default: | 1002 default: |
| 1003 break; | 1003 break; |
| 1004 } | 1004 } |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 | 1590 |
| 1591 return value.release(); | 1591 return value.release(); |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 PassRefPtr<TypeBuilder::Array<String> > InspectorDOMAgent::buildArrayForElementA
ttributes(Element* element) | 1594 PassRefPtr<TypeBuilder::Array<String> > InspectorDOMAgent::buildArrayForElementA
ttributes(Element* element) |
| 1595 { | 1595 { |
| 1596 RefPtr<TypeBuilder::Array<String> > attributesValue = TypeBuilder::Array<Str
ing>::create(); | 1596 RefPtr<TypeBuilder::Array<String> > attributesValue = TypeBuilder::Array<Str
ing>::create(); |
| 1597 // Go through all attributes and serialize them. | 1597 // Go through all attributes and serialize them. |
| 1598 if (!element->hasAttributes()) | 1598 if (!element->hasAttributes()) |
| 1599 return attributesValue.release(); | 1599 return attributesValue.release(); |
| 1600 unsigned numAttrs = element->attributeCount(); | 1600 AttributeIteratorAccessor attributes = element->attributesIterator(); |
| 1601 for (unsigned i = 0; i < numAttrs; ++i) { | 1601 AttributeConstIterator end = attributes.end(); |
| 1602 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { |
| 1602 // Add attribute pair | 1603 // Add attribute pair |
| 1603 const Attribute& attribute = element->attributeItem(i); | 1604 attributesValue->addItem(it->name().toString()); |
| 1604 attributesValue->addItem(attribute.name().toString()); | 1605 attributesValue->addItem(it->value()); |
| 1605 attributesValue->addItem(attribute.value()); | |
| 1606 } | 1606 } |
| 1607 return attributesValue.release(); | 1607 return attributesValue.release(); |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > InspectorDOMAgent::build
ArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap) | 1610 PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > InspectorDOMAgent::build
ArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap) |
| 1611 { | 1611 { |
| 1612 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > children = TypeBuilder::
Array<TypeBuilder::DOM::Node>::create(); | 1612 RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > children = TypeBuilder::
Array<TypeBuilder::DOM::Node>::create(); |
| 1613 if (depth == 0) { | 1613 if (depth == 0) { |
| 1614 // Special-case the only text child - pretend that container's children
have been requested. | 1614 // Special-case the only text child - pretend that container's children
have been requested. |
| 1615 Node* firstChild = container->firstChild(); | 1615 Node* firstChild = container->firstChild(); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 if (!m_documentNodeToIdMap.contains(m_document)) { | 2092 if (!m_documentNodeToIdMap.contains(m_document)) { |
| 2093 RefPtr<TypeBuilder::DOM::Node> root; | 2093 RefPtr<TypeBuilder::DOM::Node> root; |
| 2094 getDocument(errorString, root); | 2094 getDocument(errorString, root); |
| 2095 return errorString->isEmpty(); | 2095 return errorString->isEmpty(); |
| 2096 } | 2096 } |
| 2097 return true; | 2097 return true; |
| 2098 } | 2098 } |
| 2099 | 2099 |
| 2100 } // namespace WebCore | 2100 } // namespace WebCore |
| 2101 | 2101 |
| OLD | NEW |