• benjamin@webkit.org's avatar
    Add a nicer way to iterate over all the attributes of an element · 64c95337
    benjamin@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=127266
    
    Reviewed by Geoffrey Garen.
    
    When using Element::attributeAt() in a loop, the compiler had to generate two kinds of
    accessor:
    -If the element data is unique, the length and data comes from the attribute Vector.
    -If the element data is shared, the data comes from the tail of elementData itself.
    
    The choice was done for every access, which caused the assembly to be a little
    hard to follow.
    This patch unify the data access by doing everything as a array pointer with offset (getting
    that data from Vector when necessary).
    
    To make it easier to do the right thing, a new iterator was added so that range-based loops
    can replace all the faulty cases.
    
    * css/SelectorChecker.cpp:
    (WebCore::anyAttributeMatches):
    * css/SelectorChecker.h:
    (WebCore::SelectorChecker::checkExactAttribute):
    * dom/DatasetDOMStringMap.cpp:
    (WebCore::DatasetDOMStringMap::getNames):
    (WebCore::DatasetDOMStringMap::item):
    (WebCore::DatasetDOMStringMap::contains):
    * dom/Element.cpp:
    (WebCore::Element::normalizeAttributes):
    (WebCore::Element::detachAllAttrNodesFromElement):
    (WebCore::Element::cloneAttributesFromElement):
    * dom/Element.h:
    (WebCore::Element::attributesIterator):
    * dom/ElementData.cpp:
    (WebCore::ElementData::isEquivalent):
    (WebCore::ElementData::findAttributeIndexByNameSlowCase):
    * dom/ElementData.h:
    (WebCore::AttributeConstIterator::AttributeConstIterator):
    (WebCore::AttributeConstIterator::operator*):
    (WebCore::AttributeConstIterator::operator->):
    (WebCore::AttributeConstIterator::operator++):
    (WebCore::AttributeConstIterator::operator==):
    (WebCore::AttributeConstIterator::operator!=):
    (WebCore::AttributeIteratorAccessor::AttributeIteratorAccessor):
    (WebCore::AttributeIteratorAccessor::begin):
    (WebCore::AttributeIteratorAccessor::end):
    (WebCore::ElementData::attributesIterator):
    * dom/Node.cpp:
    (WebCore::Node::isDefaultNamespace):
    (WebCore::Node::lookupNamespaceURI):
    (WebCore::Node::lookupNamespacePrefix):
    (WebCore::Node::compareDocumentPosition):
    * dom/StyledElement.cpp:
    (WebCore::StyledElement::makePresentationAttributeCacheKey):
    (WebCore::StyledElement::rebuildPresentationAttributeStyle):
    * editing/MarkupAccumulator.cpp:
    (WebCore::MarkupAccumulator::appendElement):
    * editing/markup.cpp:
    (WebCore::completeURLs):
    (WebCore::StyledMarkupAccumulator::appendElement):
    * html/HTMLEmbedElement.cpp:
    (WebCore::HTMLEmbedElement::parametersForPlugin):
    * html/HTMLObjectElement.cpp:
    (WebCore::HTMLObjectElement::parametersForPlugin):
    * inspector/DOMPatchSupport.cpp:
    (WebCore::DOMPatchSupport::innerPatchNode):
    (WebCore::DOMPatchSupport::createDigest):
    * inspector/InspectorDOMAgent.cpp:
    (WebCore::InspectorDOMAgent::setAttributesAsText):
    (WebCore::InspectorDOMAgent::buildArrayForElementAttributes):
    * inspector/InspectorNodeFinder.cpp:
    (WebCore::InspectorNodeFinder::matchesElement):
    * page/PageSerializer.cpp:
    (WebCore::isCharsetSpecifyingNode):
    * xml/XPathNodeSet.cpp:
    (WebCore::XPath::NodeSet::traversalSort):
    * xml/XPathStep.cpp:
    (WebCore::XPath::Step::nodesInAxis):
    * xml/parser/XMLDocumentParserLibxml2.cpp:
    (WebCore::XMLDocumentParser::XMLDocumentParser):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162394 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    64c95337
Name
Last commit
Last update
..
parser Loading commit data...
DOMParser.cpp Loading commit data...
DOMParser.h Loading commit data...
DOMParser.idl Loading commit data...
NativeXPathNSResolver.cpp Loading commit data...
NativeXPathNSResolver.h Loading commit data...
XMLErrors.cpp Loading commit data...
XMLErrors.h Loading commit data...
XMLHttpRequest.cpp Loading commit data...
XMLHttpRequest.h Loading commit data...
XMLHttpRequest.idl Loading commit data...
XMLHttpRequestException.cpp Loading commit data...
XMLHttpRequestException.h Loading commit data...
XMLHttpRequestException.idl Loading commit data...
XMLHttpRequestProgressEvent.h Loading commit data...
XMLHttpRequestProgressEvent.idl Loading commit data...
XMLHttpRequestProgressEventThrottle.cpp Loading commit data...
XMLHttpRequestProgressEventThrottle.h Loading commit data...
XMLHttpRequestUpload.cpp Loading commit data...
XMLHttpRequestUpload.h Loading commit data...
XMLHttpRequestUpload.idl Loading commit data...
XMLSerializer.cpp Loading commit data...
XMLSerializer.h Loading commit data...
XMLSerializer.idl Loading commit data...
XMLTreeViewer.cpp Loading commit data...
XMLTreeViewer.h Loading commit data...
XMLViewer.css Loading commit data...
XMLViewer.js Loading commit data...
XPathEvaluator.cpp Loading commit data...
XPathEvaluator.h Loading commit data...
XPathEvaluator.idl Loading commit data...
XPathException.cpp Loading commit data...
XPathException.h Loading commit data...
XPathException.idl Loading commit data...
XPathExpression.cpp Loading commit data...
XPathExpression.h Loading commit data...
XPathExpression.idl Loading commit data...
XPathExpressionNode.cpp Loading commit data...
XPathExpressionNode.h Loading commit data...
XPathFunctions.cpp Loading commit data...
XPathFunctions.h Loading commit data...
XPathGrammar.y Loading commit data...
XPathNSResolver.cpp Loading commit data...
XPathNSResolver.h Loading commit data...
XPathNSResolver.idl Loading commit data...
XPathNodeSet.cpp Loading commit data...
XPathNodeSet.h Loading commit data...
XPathParser.cpp Loading commit data...
XPathParser.h Loading commit data...
XPathPath.cpp Loading commit data...
XPathPath.h Loading commit data...
XPathPredicate.cpp Loading commit data...
XPathPredicate.h Loading commit data...
XPathResult.cpp Loading commit data...
XPathResult.h Loading commit data...
XPathResult.idl Loading commit data...
XPathStep.cpp Loading commit data...
XPathStep.h Loading commit data...
XPathUtil.cpp Loading commit data...
XPathUtil.h Loading commit data...
XPathValue.cpp Loading commit data...
XPathValue.h Loading commit data...
XPathVariableReference.cpp Loading commit data...
XPathVariableReference.h Loading commit data...
XSLImportRule.cpp Loading commit data...
XSLImportRule.h Loading commit data...
XSLStyleSheet.h Loading commit data...
XSLStyleSheetLibxslt.cpp Loading commit data...
XSLTExtensions.cpp Loading commit data...
XSLTExtensions.h Loading commit data...
XSLTProcessor.cpp Loading commit data...
XSLTProcessor.h Loading commit data...
XSLTProcessor.idl Loading commit data...
XSLTProcessorLibxslt.cpp Loading commit data...
XSLTUnicodeSort.cpp Loading commit data...
XSLTUnicodeSort.h Loading commit data...
xmlattrs.in Loading commit data...
xmlnsattrs.in Loading commit data...