Diff
Modified: trunk/Source/WebCore/ChangeLog (161195 => 161196)
--- trunk/Source/WebCore/ChangeLog 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/ChangeLog 2014-01-01 21:48:13 UTC (rev 161196)
@@ -1,5 +1,57 @@
2014-01-01 Antti Koivisto <[email protected]>
+ Remove elementChildren/elementDescendants shorthands
+ https://bugs.webkit.org/show_bug.cgi?id=126363
+
+ Reviewed by Anders Carlsson.
+
+ Just use childrenOfType<Element>/descendantsOfType<Element> instead. They are not that much longer
+ and consistency is valuable.
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::canvasHasFallbackContent):
+ (WebCore::siblingWithAriaRole):
+ * accessibility/AccessibilityTable.cpp:
+ (WebCore::AccessibilityTable::isDataTable):
+ * css/StyleInvalidationAnalysis.cpp:
+ (WebCore::StyleInvalidationAnalysis::invalidateStyle):
+ * dom/ChildNodeList.cpp:
+ (WebCore::ChildNodeList::namedItem):
+ * dom/Document.cpp:
+ (WebCore::Document::buildAccessKeyMap):
+ (WebCore::Document::childrenChanged):
+ * dom/Element.cpp:
+ (WebCore::Element::resetComputedStyle):
+ * dom/ElementChildIterator.h:
+ * dom/ElementDescendantIterator.h:
+ * dom/SelectorQuery.cpp:
+ (WebCore::elementsForLocalName):
+ (WebCore::anyElement):
+ (WebCore::SelectorDataList::executeSingleTagNameSelectorData):
+ (WebCore::SelectorDataList::executeSingleClassNameSelectorData):
+ (WebCore::SelectorDataList::executeSingleSelectorData):
+ (WebCore::SelectorDataList::executeSingleMultiSelectorData):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::removeHeadContents):
+ * editing/markup.cpp:
+ (WebCore::completeURLs):
+ * html/HTMLFieldSetElement.cpp:
+ (WebCore::HTMLFieldSetElement::refreshElementsIfNeeded):
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::containsJavaApplet):
+ * loader/PlaceholderDocument.cpp:
+ (WebCore::PlaceholderDocument::createRenderTree):
+ * rendering/RenderChildIterator.h:
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::getElementById):
+ * svg/SVGUseElement.cpp:
+ (WebCore::subtreeContainsDisallowedElement):
+ (WebCore::removeDisallowedElementsFromSubtree):
+
+2014-01-01 Antti Koivisto <[email protected]>
+
Do less synchronous render tree construction
https://bugs.webkit.org/show_bug.cgi?id=126359
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (161195 => 161196)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -439,7 +439,7 @@
// If it has any children that are elements, we'll assume it might be fallback
// content. If it has no children or its only children are not elements
// (e.g. just text nodes), it doesn't have fallback content.
- return elementChildren(canvasElement).first();
+ return childrenOfType<Element>(canvasElement).first();
}
bool AccessibilityNodeObject::isImageButton() const
@@ -1183,7 +1183,7 @@
if (!parent)
return nullptr;
- for (auto& sibling : elementChildren(*parent)) {
+ for (auto& sibling : childrenOfType<Element>(*parent)) {
const AtomicString& siblingAriaRole = sibling.fastGetAttribute(roleAttr);
if (equalIgnoringCase(siblingAriaRole, role))
return &sibling;
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (161195 => 161196)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -124,7 +124,7 @@
return true;
// if there's a colgroup or col element, it's probably a data table.
- for (auto& child : elementChildren(*tableElement)) {
+ for (auto& child : childrenOfType<Element>(*tableElement)) {
if (child.hasTagName(colTag) || child.hasTagName(colgroupTag))
return true;
}
Modified: trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp (161195 => 161196)
--- trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -118,8 +118,8 @@
if (m_idScopes.isEmpty() && m_classScopes.isEmpty())
return;
- auto it = elementDescendants(document).begin();
- auto end = elementDescendants(document).end();
+ auto it = descendantsOfType<Element>(document).begin();
+ auto end = descendantsOfType<Element>(document).end();
while (it != end) {
if (elementMatchesSelectorScopes(*it, m_idScopes, m_classScopes)) {
it->setNeedsStyleRecalc();
Modified: trunk/Source/WebCore/dom/ChildNodeList.cpp (161195 => 161196)
--- trunk/Source/WebCore/dom/ChildNodeList.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/dom/ChildNodeList.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -94,7 +94,7 @@
if (!element || !m_parent.get().treeScope().containsMultipleElementsWithId(name))
return nullptr;
}
- for (auto& element : elementChildren(m_parent.get())) {
+ for (auto& element : childrenOfType<Element>(m_parent.get())) {
if (element.hasID() && element.idForStyleResolution() == name)
return const_cast<Element*>(&element);
}
Modified: trunk/Source/WebCore/dom/Document.cpp (161195 => 161196)
--- trunk/Source/WebCore/dom/Document.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -686,7 +686,7 @@
{
ASSERT(scope);
ContainerNode* rootNode = scope->rootNode();
- for (auto& element : elementDescendants(*rootNode)) {
+ for (auto& element : descendantsOfType<Element>(*rootNode)) {
const AtomicString& accessKey = element.fastGetAttribute(accesskeyAttr);
if (!accessKey.isEmpty())
m_elementsByAccessKey.set(accessKey.impl(), &element);
@@ -806,7 +806,7 @@
}
#endif
- Element* newDocumentElement = elementChildren(*this).first();
+ Element* newDocumentElement = childrenOfType<Element>(*this).first();
if (newDocumentElement == m_documentElement)
return;
Modified: trunk/Source/WebCore/dom/Element.cpp (161195 => 161196)
--- trunk/Source/WebCore/dom/Element.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/dom/Element.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -2930,7 +2930,7 @@
if (!hasRareData() || !elementRareData()->computedStyle())
return;
elementRareData()->resetComputedStyle();
- for (auto& child : elementDescendants(*this)) {
+ for (auto& child : descendantsOfType<Element>(*this)) {
if (child.hasRareData())
child.elementRareData()->resetComputedStyle();
}
Modified: trunk/Source/WebCore/dom/ElementChildIterator.h (161195 => 161196)
--- trunk/Source/WebCore/dom/ElementChildIterator.h 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/dom/ElementChildIterator.h 2014-01-01 21:48:13 UTC (rev 161196)
@@ -72,8 +72,6 @@
const ContainerNode& m_parent;
};
-ElementChildIteratorAdapter<Element> elementChildren(ContainerNode&);
-ElementChildConstIteratorAdapter<Element> elementChildren(const ContainerNode&);
template <typename ElementType> ElementChildIteratorAdapter<ElementType> childrenOfType(ContainerNode&);
template <typename ElementType> ElementChildConstIteratorAdapter<ElementType> childrenOfType(const ContainerNode&);
@@ -183,22 +181,12 @@
// Standalone functions
-inline ElementChildIteratorAdapter<Element> elementChildren(ContainerNode& parent)
-{
- return ElementChildIteratorAdapter<Element>(parent);
-}
-
template <typename ElementType>
inline ElementChildIteratorAdapter<ElementType> childrenOfType(ContainerNode& parent)
{
return ElementChildIteratorAdapter<ElementType>(parent);
}
-inline ElementChildConstIteratorAdapter<Element> elementChildren(const ContainerNode& parent)
-{
- return ElementChildConstIteratorAdapter<Element>(parent);
-}
-
template <typename ElementType>
inline ElementChildConstIteratorAdapter<ElementType> childrenOfType(const ContainerNode& parent)
{
Modified: trunk/Source/WebCore/dom/ElementDescendantIterator.h (161195 => 161196)
--- trunk/Source/WebCore/dom/ElementDescendantIterator.h 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/dom/ElementDescendantIterator.h 2014-01-01 21:48:13 UTC (rev 161196)
@@ -78,8 +78,6 @@
const ContainerNode& m_root;
};
-ElementDescendantIteratorAdapter<Element> elementDescendants(ContainerNode&);
-ElementDescendantConstIteratorAdapter<Element> elementDescendants(const ContainerNode&);
template <typename ElementType> ElementDescendantIteratorAdapter<ElementType> descendantsOfType(ContainerNode&);
template <typename ElementType> ElementDescendantConstIteratorAdapter<ElementType> descendantsOfType(const ContainerNode&);
@@ -230,22 +228,12 @@
// Standalone functions
-inline ElementDescendantIteratorAdapter<Element> elementDescendants(ContainerNode& root)
-{
- return ElementDescendantIteratorAdapter<Element>(root);
-}
-
template <typename ElementType>
inline ElementDescendantIteratorAdapter<ElementType> descendantsOfType(ContainerNode& root)
{
return ElementDescendantIteratorAdapter<ElementType>(root);
}
-inline ElementDescendantConstIteratorAdapter<Element> elementDescendants(const ContainerNode& root)
-{
- return ElementDescendantConstIteratorAdapter<Element>(root);
-}
-
template <typename ElementType>
inline ElementDescendantConstIteratorAdapter<ElementType> descendantsOfType(const ContainerNode& root)
{
Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (161195 => 161196)
--- trunk/Source/WebCore/dom/SelectorQuery.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -165,7 +165,7 @@
template <typename SelectorQueryTrait>
static inline void elementsForLocalName(const ContainerNode& rootNode, const AtomicString& localName, typename SelectorQueryTrait::OutputType& output)
{
- for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<ContainerNode&>(rootNode))) {
if (element.tagQName().localName() == localName) {
SelectorQueryTrait::appendOutputForElement(output, &element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
@@ -177,7 +177,7 @@
template <typename SelectorQueryTrait>
static inline void anyElement(const ContainerNode& rootNode, typename SelectorQueryTrait::OutputType& output)
{
- for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<ContainerNode&>(rootNode))) {
SelectorQueryTrait::appendOutputForElement(output, &element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
return;
@@ -205,7 +205,7 @@
}
} else {
// Fallback: NamespaceURI is set, selectorLocalName may be starAtom.
- for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<ContainerNode&>(rootNode))) {
if (element.namespaceURI() == selectorNamespaceURI && (selectorLocalName == starAtom || element.tagQName().localName() == selectorLocalName)) {
SelectorQueryTrait::appendOutputForElement(output, &element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
@@ -227,7 +227,7 @@
ASSERT(isSingleClassNameSelector(*selectorData.selector));
const AtomicString& className = selectorData.selector->value();
- for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<ContainerNode&>(rootNode))) {
if (element.hasClass() && element.classNames().contains(className)) {
SelectorQueryTrait::appendOutputForElement(output, &element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
@@ -241,7 +241,7 @@
{
ASSERT(m_selectors.size() == 1);
- for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<ContainerNode&>(rootNode))) {
if (selectorMatches(selectorData, element, rootNode)) {
SelectorQueryTrait::appendOutputForElement(output, &element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
@@ -254,7 +254,7 @@
ALWAYS_INLINE void SelectorDataList::executeSingleMultiSelectorData(const ContainerNode& rootNode, typename SelectorQueryTrait::OutputType& output) const
{
unsigned selectorCount = m_selectors.size();
- for (auto& element : elementDescendants(const_cast<ContainerNode&>(rootNode))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<ContainerNode&>(rootNode))) {
for (unsigned i = 0; i < selectorCount; ++i) {
if (selectorMatches(m_selectors[i], element, rootNode)) {
SelectorQueryTrait::appendOutputForElement(output, &element);
Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (161195 => 161196)
--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -439,7 +439,7 @@
// all the children of the dummy's parent
Vector<Element*> toRemove;
- for (auto& child : elementChildren(*dummySpanAncestor)) {
+ for (auto& child : childrenOfType<Element>(*dummySpanAncestor)) {
if (isSpanWithoutAttributesOrUnstyledStyleSpan(&child))
toRemove.append(&child);
}
Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (161195 => 161196)
--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -706,8 +706,8 @@
Vector<Element*> toRemove;
- auto it = elementDescendants(*fragment.fragment()).begin();
- auto end = elementDescendants(*fragment.fragment()).end();
+ auto it = descendantsOfType<Element>(*fragment.fragment()).begin();
+ auto end = descendantsOfType<Element>(*fragment.fragment()).end();
while (it != end) {
if (it->hasTagName(baseTag) || it->hasTagName(linkTag) || it->hasTagName(metaTag) || it->hasTagName(styleTag) || isHTMLTitleElement(*it)) {
toRemove.append(&*it);
Modified: trunk/Source/WebCore/editing/markup.cpp (161195 => 161196)
--- trunk/Source/WebCore/editing/markup.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/editing/markup.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -99,7 +99,7 @@
URL parsedBaseURL(ParsedURLString, baseURL);
- for (auto& element : elementDescendants(*fragment)) {
+ for (auto& element : descendantsOfType<Element>(*fragment)) {
if (!element.hasAttributes())
continue;
unsigned length = element.attributeCount();
Modified: trunk/Source/WebCore/html/HTMLFieldSetElement.cpp (161195 => 161196)
--- trunk/Source/WebCore/html/HTMLFieldSetElement.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/html/HTMLFieldSetElement.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -106,7 +106,7 @@
m_associatedElements.clear();
- for (auto& element : elementDescendants(const_cast<HTMLFieldSetElement&>(*this))) {
+ for (auto& element : descendantsOfType<Element>(const_cast<HTMLFieldSetElement&>(*this))) {
if (element.hasTagName(objectTag))
m_associatedElements.append(&toHTMLObjectElement(element));
else if (element.isFormControlElement())
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (161195 => 161196)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -461,7 +461,7 @@
if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr)))
return true;
- for (auto& child : elementChildren(*this)) {
+ for (auto& child : childrenOfType<Element>(*this)) {
if (child.hasTagName(paramTag) && equalIgnoringCase(child.getNameAttribute(), "type")
&& MIMETypeRegistry::isJavaAppletMIMEType(child.getAttribute(valueAttr).string()))
return true;
Modified: trunk/Source/WebCore/loader/PlaceholderDocument.cpp (161195 => 161196)
--- trunk/Source/WebCore/loader/PlaceholderDocument.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/loader/PlaceholderDocument.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -34,7 +34,7 @@
{
ASSERT(!renderView());
- for (auto& child : elementChildren(*this))
+ for (auto& child : childrenOfType<Element>(*this))
Style::attachRenderTree(child);
}
Modified: trunk/Source/WebCore/rendering/RenderChildIterator.h (161195 => 161196)
--- trunk/Source/WebCore/rendering/RenderChildIterator.h 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/rendering/RenderChildIterator.h 2014-01-01 21:48:13 UTC (rev 161196)
@@ -72,8 +72,6 @@
const RenderElement& m_parent;
};
-RenderChildIteratorAdapter<RenderObject> elementChildren(RenderElement&);
-RenderChildConstIteratorAdapter<RenderObject> elementChildren(const RenderElement&);
template <typename T> RenderChildIteratorAdapter<T> childrenOfType(RenderElement&);
template <typename T> RenderChildConstIteratorAdapter<T> childrenOfType(const RenderElement&);
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (161195 => 161196)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -775,7 +775,7 @@
// Fall back to traversing our subtree. Duplicate ids are allowed, the first found will
// be returned.
- for (auto& element : elementDescendants(*this)) {
+ for (auto& element : descendantsOfType<Element>(*this)) {
if (element.getIdAttribute() == id)
return &element;
}
Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (161195 => 161196)
--- trunk/Source/WebCore/svg/SVGUseElement.cpp 2014-01-01 21:20:51 UTC (rev 161195)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp 2014-01-01 21:48:13 UTC (rev 161196)
@@ -365,7 +365,7 @@
static bool subtreeContainsDisallowedElement(SVGElement& start)
{
- for (auto& element : elementDescendants(start)) {
+ for (auto& element : descendantsOfType<Element>(start)) {
if (isDisallowedElement(element))
return true;
}
@@ -658,8 +658,8 @@
{
ASSERT(!subtree.inDocument());
Vector<Element*> toRemove;
- auto it = elementDescendants(subtree).begin();
- auto end = elementDescendants(subtree).end();
+ auto it = descendantsOfType<Element>(subtree).begin();
+ auto end = descendantsOfType<Element>(subtree).end();
while (it != end) {
if (isDisallowedElement(*it)) {
toRemove.append(&*it);