| 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 fragment->parseXML(markup, 0, AllowScriptingContent); | 747 fragment->parseXML(markup, 0, AllowScriptingContent); |
| 748 | 748 |
| 749 Element* parsedElement = fragment->firstChild() && fragment->firstChild()->i
sElementNode() ? toElement(fragment->firstChild()) : 0; | 749 Element* parsedElement = fragment->firstChild() && fragment->firstChild()->i
sElementNode() ? toElement(fragment->firstChild()) : 0; |
| 750 if (!parsedElement) { | 750 if (!parsedElement) { |
| 751 *errorString = "Could not parse value as attributes"; | 751 *errorString = "Could not parse value as attributes"; |
| 752 return; | 752 return; |
| 753 } | 753 } |
| 754 | 754 |
| 755 String caseAdjustedName = name ? (shouldIgnoreCase ? name->lower() : *name)
: String(); | 755 String caseAdjustedName = name ? (shouldIgnoreCase ? name->lower() : *name)
: String(); |
| 756 | 756 |
| 757 if (!parsedElement->hasAttributes() && name) { | 757 AttributeCollection attributes = parsedElement->attributes(); |
| 758 if (attributes.isEmpty() && name) { |
| 758 m_domEditor->removeAttribute(element, caseAdjustedName, errorString); | 759 m_domEditor->removeAttribute(element, caseAdjustedName, errorString); |
| 759 return; | 760 return; |
| 760 } | 761 } |
| 761 | 762 |
| 762 bool foundOriginalAttribute = false; | 763 bool foundOriginalAttribute = false; |
| 763 AttributeCollection attributes = parsedElement->attributes(); | |
| 764 AttributeCollection::const_iterator end = attributes.end(); | 764 AttributeCollection::const_iterator end = attributes.end(); |
| 765 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { | 765 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { |
| 766 // Add attribute pair | 766 // Add attribute pair |
| 767 String attributeName = it->name().toString(); | 767 String attributeName = it->name().toString(); |
| 768 if (shouldIgnoreCase) | 768 if (shouldIgnoreCase) |
| 769 attributeName = attributeName.lower(); | 769 attributeName = attributeName.lower(); |
| 770 foundOriginalAttribute |= name && attributeName == caseAdjustedName; | 770 foundOriginalAttribute |= name && attributeName == caseAdjustedName; |
| 771 if (!m_domEditor->setAttribute(element, attributeName, it->value(), erro
rString)) | 771 if (!m_domEditor->setAttribute(element, attributeName, it->value(), erro
rString)) |
| 772 return; | 772 return; |
| 773 } | 773 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 case Node::ELEMENT_NODE: { | 1009 case Node::ELEMENT_NODE: { |
| 1010 if ((!startTagFound && !endTagFound && (node->nodeName().findIgn
oringCase(tagNameQuery) != kNotFound)) | 1010 if ((!startTagFound && !endTagFound && (node->nodeName().findIgn
oringCase(tagNameQuery) != kNotFound)) |
| 1011 || (startTagFound && endTagFound && equalIgnoringCase(node->
nodeName(), tagNameQuery)) | 1011 || (startTagFound && endTagFound && equalIgnoringCase(node->
nodeName(), tagNameQuery)) |
| 1012 || (startTagFound && !endTagFound && node->nodeName().starts
With(tagNameQuery, false)) | 1012 || (startTagFound && !endTagFound && node->nodeName().starts
With(tagNameQuery, false)) |
| 1013 || (!startTagFound && endTagFound && node->nodeName().endsWi
th(tagNameQuery, false))) { | 1013 || (!startTagFound && endTagFound && node->nodeName().endsWi
th(tagNameQuery, false))) { |
| 1014 resultCollector.add(node); | 1014 resultCollector.add(node); |
| 1015 break; | 1015 break; |
| 1016 } | 1016 } |
| 1017 // Go through all attributes and serialize them. | 1017 // Go through all attributes and serialize them. |
| 1018 const Element* element = toElement(node); | 1018 const Element* element = toElement(node); |
| 1019 if (!element->hasAttributes()) | |
| 1020 break; | |
| 1021 | |
| 1022 AttributeCollection attributes = element->attributes(); | 1019 AttributeCollection attributes = element->attributes(); |
| 1023 AttributeCollection::const_iterator end = attributes.end(); | 1020 AttributeCollection::const_iterator end = attributes.end(); |
| 1024 for (AttributeCollection::const_iterator it = attributes.begin()
; it != end; ++it) { | 1021 for (AttributeCollection::const_iterator it = attributes.begin()
; it != end; ++it) { |
| 1025 // Add attribute pair | 1022 // Add attribute pair |
| 1026 if (it->localName().find(whitespaceTrimmedQuery, 0, false) !
= kNotFound) { | 1023 if (it->localName().find(whitespaceTrimmedQuery, 0, false) !
= kNotFound) { |
| 1027 resultCollector.add(node); | 1024 resultCollector.add(node); |
| 1028 break; | 1025 break; |
| 1029 } | 1026 } |
| 1030 size_t foundPosition = it->value().find(attributeQuery, 0, f
alse); | 1027 size_t foundPosition = it->value().find(attributeQuery, 0, f
alse); |
| 1031 if (foundPosition != kNotFound) { | 1028 if (foundPosition != kNotFound) { |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 value->setChildren(children.release()); | 1634 value->setChildren(children.release()); |
| 1638 } | 1635 } |
| 1639 | 1636 |
| 1640 return value.release(); | 1637 return value.release(); |
| 1641 } | 1638 } |
| 1642 | 1639 |
| 1643 PassRefPtr<TypeBuilder::Array<String> > InspectorDOMAgent::buildArrayForElementA
ttributes(Element* element) | 1640 PassRefPtr<TypeBuilder::Array<String> > InspectorDOMAgent::buildArrayForElementA
ttributes(Element* element) |
| 1644 { | 1641 { |
| 1645 RefPtr<TypeBuilder::Array<String> > attributesValue = TypeBuilder::Array<Str
ing>::create(); | 1642 RefPtr<TypeBuilder::Array<String> > attributesValue = TypeBuilder::Array<Str
ing>::create(); |
| 1646 // Go through all attributes and serialize them. | 1643 // Go through all attributes and serialize them. |
| 1647 if (!element->hasAttributes()) | |
| 1648 return attributesValue.release(); | |
| 1649 AttributeCollection attributes = element->attributes(); | 1644 AttributeCollection attributes = element->attributes(); |
| 1650 AttributeCollection::const_iterator end = attributes.end(); | 1645 AttributeCollection::const_iterator end = attributes.end(); |
| 1651 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { | 1646 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { |
| 1652 // Add attribute pair | 1647 // Add attribute pair |
| 1653 attributesValue->addItem(it->name().toString()); | 1648 attributesValue->addItem(it->name().toString()); |
| 1654 attributesValue->addItem(it->value()); | 1649 attributesValue->addItem(it->value()); |
| 1655 } | 1650 } |
| 1656 return attributesValue.release(); | 1651 return attributesValue.release(); |
| 1657 } | 1652 } |
| 1658 | 1653 |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 visitor->trace(m_searchResults); | 2158 visitor->trace(m_searchResults); |
| 2164 #endif | 2159 #endif |
| 2165 visitor->trace(m_history); | 2160 visitor->trace(m_history); |
| 2166 visitor->trace(m_domEditor); | 2161 visitor->trace(m_domEditor); |
| 2167 visitor->trace(m_listener); | 2162 visitor->trace(m_listener); |
| 2168 InspectorBaseAgent::trace(visitor); | 2163 InspectorBaseAgent::trace(visitor); |
| 2169 } | 2164 } |
| 2170 | 2165 |
| 2171 } // namespace blink | 2166 } // namespace blink |
| 2172 | 2167 |
| OLD | NEW |