Commit 80e32d25 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Optimize / clean up hasTagName() call sites

Optimize / clean up hasTagName() call sites so that they call when possible
and in this order:
- HTMLElement::hasTagName(HTMLQualifiedName) / SVGElement::hasTagName(SVGQualifiedName)
- Node::hasTagName(HTMLQualifiedName) / Node::hasTagName(SVGQualifiedName)
- Element::hasTagName(QualifiedName)

Also use isHTML*Element() helpers in a couple of places to improve readability.

This is a follow-up to:
https://src.chromium.org/viewvc/blink?view=rev&revision=178540

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/405973004

git-svn-id: svn://svn.chromium.org/blink/trunk@178581 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 79d683e3
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "core/html/HTMLInputElement.h" #include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLabelElement.h" #include "core/html/HTMLLabelElement.h"
#include "core/html/HTMLLegendElement.h" #include "core/html/HTMLLegendElement.h"
#include "core/html/HTMLPlugInElement.h"
#include "core/html/HTMLSelectElement.h" #include "core/html/HTMLSelectElement.h"
#include "core/html/HTMLTextAreaElement.h" #include "core/html/HTMLTextAreaElement.h"
#include "core/rendering/RenderObject.h" #include "core/rendering/RenderObject.h"
...@@ -224,7 +225,7 @@ AccessibilityRole AXNodeObject::determineAccessibilityRole() ...@@ -224,7 +225,7 @@ AccessibilityRole AXNodeObject::determineAccessibilityRole()
return GroupRole; return GroupRole;
if (isHTMLAnchorElement(*node()) && isClickable()) if (isHTMLAnchorElement(*node()) && isClickable())
return LinkRole; return LinkRole;
if (node()->hasTagName(iframeTag)) if (isHTMLIFrameElement(*node()))
return IframeRole; return IframeRole;
if (isEmbeddedObject()) if (isEmbeddedObject())
return EmbeddedObjectRole; return EmbeddedObjectRole;
...@@ -477,9 +478,7 @@ bool AXNodeObject::isControl() const ...@@ -477,9 +478,7 @@ bool AXNodeObject::isControl() const
bool AXNodeObject::isEmbeddedObject() const bool AXNodeObject::isEmbeddedObject() const
{ {
return node() return isHTMLPlugInElement(node());
&& (node()->hasTagName(objectTag) || node()->hasTagName(embedTag)
|| node()->hasTagName(appletTag));
} }
bool AXNodeObject::isFieldset() const bool AXNodeObject::isFieldset() const
...@@ -814,27 +813,31 @@ int AXNodeObject::headingLevel() const ...@@ -814,27 +813,31 @@ int AXNodeObject::headingLevel() const
// headings can be in block flow and non-block flow // headings can be in block flow and non-block flow
Node* node = this->node(); Node* node = this->node();
if (!node) if (!node)
return false; return 0;
if (ariaRoleAttribute() == HeadingRole) if (ariaRoleAttribute() == HeadingRole)
return getAttribute(aria_levelAttr).toInt(); return getAttribute(aria_levelAttr).toInt();
if (node->hasTagName(h1Tag)) if (!node->isHTMLElement())
return 0;
HTMLElement& element = toHTMLElement(*node);
if (element.hasTagName(h1Tag))
return 1; return 1;
if (node->hasTagName(h2Tag)) if (element.hasTagName(h2Tag))
return 2; return 2;
if (node->hasTagName(h3Tag)) if (element.hasTagName(h3Tag))
return 3; return 3;
if (node->hasTagName(h4Tag)) if (element.hasTagName(h4Tag))
return 4; return 4;
if (node->hasTagName(h5Tag)) if (element.hasTagName(h5Tag))
return 5; return 5;
if (node->hasTagName(h6Tag)) if (element.hasTagName(h6Tag))
return 6; return 6;
return 0; return 0;
......
...@@ -1991,7 +1991,7 @@ RenderObject* AXRenderObject::renderParentObject() const ...@@ -1991,7 +1991,7 @@ RenderObject* AXRenderObject::renderParentObject() const
return parent; return parent;
} }
bool AXRenderObject::isDescendantOfElementType(const QualifiedName& tagName) const bool AXRenderObject::isDescendantOfElementType(const HTMLQualifiedName& tagName) const
{ {
for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) { for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) {
if (parent->node() && parent->node()->hasTagName(tagName)) if (parent->node() && parent->node()->hasTagName(tagName))
......
...@@ -209,7 +209,7 @@ private: ...@@ -209,7 +209,7 @@ private:
AXObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const; AXObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const;
bool renderObjectIsObservable(RenderObject*) const; bool renderObjectIsObservable(RenderObject*) const;
RenderObject* renderParentObject() const; RenderObject* renderParentObject() const;
bool isDescendantOfElementType(const QualifiedName& tagName) const; bool isDescendantOfElementType(const HTMLQualifiedName& tagName) const;
bool isSVGImage() const; bool isSVGImage() const;
void detachRemoteSVGRoot(); void detachRemoteSVGRoot();
AXSVGRoot* remoteSVGRootElement() const; AXSVGRoot* remoteSVGRootElement() const;
......
...@@ -144,7 +144,7 @@ bool AXTable::isDataTable() const ...@@ -144,7 +144,7 @@ bool AXTable::isDataTable() const
Element* rowElement = rows->item(rowIndex); Element* rowElement = rows->item(rowIndex);
if (elementHasAriaRole(rowElement)) if (elementHasAriaRole(rowElement))
return false; return false;
if (rowElement->hasTagName(trTag)) { if (isHTMLTableRowElement(*rowElement)) {
RefPtrWillBeRawPtr<HTMLCollection> cells = toHTMLTableRowElement(rowElement)->cells(); RefPtrWillBeRawPtr<HTMLCollection> cells = toHTMLTableRowElement(rowElement)->cells();
for (unsigned cellIndex = 0; cellIndex < cells->length(); ++cellIndex) { for (unsigned cellIndex = 0; cellIndex < cells->length(); ++cellIndex) {
if (elementHasAriaRole(cells->item(cellIndex))) if (elementHasAriaRole(cells->item(cellIndex)))
......
...@@ -24,7 +24,7 @@ class AffectedByFocusTest : public ::testing::Test { ...@@ -24,7 +24,7 @@ class AffectedByFocusTest : public ::testing::Test {
protected: protected:
struct ElementResult { struct ElementResult {
const blink::QualifiedName tag; const blink::HTMLQualifiedName tag;
bool affectedBy; bool affectedBy;
bool childrenOrSiblingsAffectedBy; bool childrenOrSiblingsAffectedBy;
}; };
......
...@@ -157,7 +157,7 @@ class HTMLElementEquivalent : public NoBaseWillBeGarbageCollected<HTMLElementEqu ...@@ -157,7 +157,7 @@ class HTMLElementEquivalent : public NoBaseWillBeGarbageCollected<HTMLElementEqu
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent); DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent);
public: public:
static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSPropertyID propertyID, CSSValueID primitiveValue, const QualifiedName& tagName) static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSPropertyID propertyID, CSSValueID primitiveValue, const HTMLQualifiedName& tagName)
{ {
return adoptPtrWillBeNoop(new HTMLElementEquivalent(propertyID, primitiveValue, tagName)); return adoptPtrWillBeNoop(new HTMLElementEquivalent(propertyID, primitiveValue, tagName));
} }
...@@ -172,11 +172,11 @@ public: ...@@ -172,11 +172,11 @@ public:
protected: protected:
HTMLElementEquivalent(CSSPropertyID); HTMLElementEquivalent(CSSPropertyID);
HTMLElementEquivalent(CSSPropertyID, const QualifiedName& tagName); HTMLElementEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName);
HTMLElementEquivalent(CSSPropertyID, CSSValueID primitiveValue, const QualifiedName& tagName); HTMLElementEquivalent(CSSPropertyID, CSSValueID primitiveValue, const HTMLQualifiedName& tagName);
const CSSPropertyID m_propertyID; const CSSPropertyID m_propertyID;
const RefPtrWillBeMember<CSSPrimitiveValue> m_primitiveValue; const RefPtrWillBeMember<CSSPrimitiveValue> m_primitiveValue;
const QualifiedName* m_tagName; // We can store a pointer because HTML tag names are const global. const HTMLQualifiedName* m_tagName; // We can store a pointer because HTML tag names are const global.
}; };
DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent); DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(HTMLElementEquivalent);
...@@ -187,13 +187,13 @@ HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id) ...@@ -187,13 +187,13 @@ HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id)
{ {
} }
HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, const QualifiedName& tagName) HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, const HTMLQualifiedName& tagName)
: m_propertyID(id) : m_propertyID(id)
, m_tagName(&tagName) , m_tagName(&tagName)
{ {
} }
HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primitiveValue, const QualifiedName& tagName) HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, CSSValueID primitiveValue, const HTMLQualifiedName& tagName)
: m_propertyID(id) : m_propertyID(id)
, m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue)) , m_primitiveValue(CSSPrimitiveValue::createIdentifier(primitiveValue))
, m_tagName(&tagName) , m_tagName(&tagName)
...@@ -214,7 +214,7 @@ void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const ...@@ -214,7 +214,7 @@ void HTMLElementEquivalent::addToStyle(Element*, EditingStyle* style) const
class HTMLTextDecorationEquivalent FINAL : public HTMLElementEquivalent { class HTMLTextDecorationEquivalent FINAL : public HTMLElementEquivalent {
public: public:
static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, const QualifiedName& tagName) static PassOwnPtrWillBeRawPtr<HTMLElementEquivalent> create(CSSValueID primitiveValue, const HTMLQualifiedName& tagName)
{ {
return adoptPtrWillBeNoop(new HTMLTextDecorationEquivalent(primitiveValue, tagName)); return adoptPtrWillBeNoop(new HTMLTextDecorationEquivalent(primitiveValue, tagName));
} }
...@@ -224,10 +224,10 @@ public: ...@@ -224,10 +224,10 @@ public:
virtual void trace(Visitor* visitor) OVERRIDE { HTMLElementEquivalent::trace(visitor); } virtual void trace(Visitor* visitor) OVERRIDE { HTMLElementEquivalent::trace(visitor); }
private: private:
HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName& tagName); HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedName& tagName);
}; };
HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName& tagName) HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const HTMLQualifiedName& tagName)
: HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue, tagName) : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue, tagName)
// m_propertyID is used in HTMLElementEquivalent::addToStyle // m_propertyID is used in HTMLElementEquivalent::addToStyle
{ {
...@@ -249,7 +249,7 @@ bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style ...@@ -249,7 +249,7 @@ bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style
class HTMLAttributeEquivalent : public HTMLElementEquivalent { class HTMLAttributeEquivalent : public HTMLElementEquivalent {
public: public:
static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID, const QualifiedName& tagName, const QualifiedName& attrName) static PassOwnPtrWillBeRawPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID, const HTMLQualifiedName& tagName, const QualifiedName& attrName)
{ {
return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, tagName, attrName)); return adoptPtrWillBeNoop(new HTMLAttributeEquivalent(propertyID, tagName, attrName));
} }
...@@ -268,12 +268,12 @@ public: ...@@ -268,12 +268,12 @@ public:
virtual void trace(Visitor* visitor) OVERRIDE { HTMLElementEquivalent::trace(visitor); } virtual void trace(Visitor* visitor) OVERRIDE { HTMLElementEquivalent::trace(visitor); }
protected: protected:
HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& tagName, const QualifiedName& attrName); HTMLAttributeEquivalent(CSSPropertyID, const HTMLQualifiedName& tagName, const QualifiedName& attrName);
HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName); HTMLAttributeEquivalent(CSSPropertyID, const QualifiedName& attrName);
const QualifiedName& m_attrName; // We can store a reference because HTML attribute names are const global. const QualifiedName& m_attrName; // We can store a reference because HTML attribute names are const global.
}; };
HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const QualifiedName& tagName, const QualifiedName& attrName) HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const HTMLQualifiedName& tagName, const QualifiedName& attrName)
: HTMLElementEquivalent(id, tagName) : HTMLElementEquivalent(id, tagName)
, m_attrName(attrName) , m_attrName(attrName)
{ {
......
...@@ -80,7 +80,7 @@ PassRefPtrWillBeRawPtr<HTMLElement> InsertListCommand::mergeWithNeighboringLists ...@@ -80,7 +80,7 @@ PassRefPtrWillBeRawPtr<HTMLElement> InsertListCommand::mergeWithNeighboringLists
return list.release(); return list.release();
} }
bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection, const QualifiedName& listTag) bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection, const HTMLQualifiedName& listTag)
{ {
VisiblePosition start = selection.visibleStart(); VisiblePosition start = selection.visibleStart();
...@@ -317,7 +317,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart, ...@@ -317,7 +317,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
moveParagraphs(start, end, insertionPoint, /* preserveSelection */ true, /* preserveStyle */ true, listChildNode); moveParagraphs(start, end, insertionPoint, /* preserveSelection */ true, /* preserveStyle */ true, listChildNode);
} }
static Element* adjacentEnclosingList(const VisiblePosition& pos, const VisiblePosition& adjacentPos, const QualifiedName& listTag) static Element* adjacentEnclosingList(const VisiblePosition& pos, const VisiblePosition& adjacentPos, const HTMLQualifiedName& listTag)
{ {
Element* listNode = outermostEnclosingList(adjacentPos.deepEquivalent().deprecatedNode()); Element* listNode = outermostEnclosingList(adjacentPos.deepEquivalent().deprecatedNode());
...@@ -336,7 +336,7 @@ static Element* adjacentEnclosingList(const VisiblePosition& pos, const VisibleP ...@@ -336,7 +336,7 @@ static Element* adjacentEnclosingList(const VisiblePosition& pos, const VisibleP
return listNode; return listNode;
} }
PassRefPtrWillBeRawPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag) PassRefPtrWillBeRawPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePosition& originalStart, const HTMLQualifiedName& listTag)
{ {
VisiblePosition start = startOfParagraph(originalStart, CanSkipOverEditingBoundary); VisiblePosition start = startOfParagraph(originalStart, CanSkipOverEditingBoundary);
VisiblePosition end = endOfParagraph(start, CanSkipOverEditingBoundary); VisiblePosition end = endOfParagraph(start, CanSkipOverEditingBoundary);
......
...@@ -52,11 +52,11 @@ private: ...@@ -52,11 +52,11 @@ private:
virtual EditAction editingAction() const OVERRIDE { return EditActionInsertList; } virtual EditAction editingAction() const OVERRIDE { return EditActionInsertList; }
HTMLElement* fixOrphanedListChild(Node*); HTMLElement* fixOrphanedListChild(Node*);
bool selectionHasListOfType(const VisibleSelection& selection, const QualifiedName&); bool selectionHasListOfType(const VisibleSelection&, const HTMLQualifiedName&);
PassRefPtrWillBeRawPtr<HTMLElement> mergeWithNeighboringLists(PassRefPtrWillBeRawPtr<HTMLElement>); PassRefPtrWillBeRawPtr<HTMLElement> mergeWithNeighboringLists(PassRefPtrWillBeRawPtr<HTMLElement>);
void doApplyForSingleParagraph(bool forceCreateList, const HTMLQualifiedName&, Range& currentSelection); void doApplyForSingleParagraph(bool forceCreateList, const HTMLQualifiedName&, Range& currentSelection);
void unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode); void unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode);
PassRefPtrWillBeRawPtr<HTMLElement> listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag); PassRefPtrWillBeRawPtr<HTMLElement> listifyParagraph(const VisiblePosition& originalStart, const HTMLQualifiedName& listTag);
RefPtrWillBeMember<HTMLElement> m_listElement; RefPtrWillBeMember<HTMLElement> m_listElement;
Type m_type; Type m_type;
......
...@@ -125,9 +125,9 @@ String MarkupAccumulator::serializeNodes(Node& targetNode, EChildrenOnly childre ...@@ -125,9 +125,9 @@ String MarkupAccumulator::serializeNodes(Node& targetNode, EChildrenOnly childre
void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildrenOnly childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNamesToSkip) void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildrenOnly childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNamesToSkip)
{ {
if (tagNamesToSkip) { if (tagNamesToSkip && targetNode.isElementNode()) {
for (size_t i = 0; i < tagNamesToSkip->size(); ++i) { for (size_t i = 0; i < tagNamesToSkip->size(); ++i) {
if (targetNode.hasTagName(tagNamesToSkip->at(i))) if (toElement(targetNode).hasTagName(tagNamesToSkip->at(i)))
return; return;
} }
} }
......
...@@ -437,15 +437,16 @@ static bool isMailPasteAsQuotationNode(const Node* node) ...@@ -437,15 +437,16 @@ static bool isMailPasteAsQuotationNode(const Node* node)
static bool isHeaderElement(const Node* a) static bool isHeaderElement(const Node* a)
{ {
if (!a) if (!a || !a->isHTMLElement())
return false; return false;
return a->hasTagName(h1Tag) const HTMLElement& element = toHTMLElement(*a);
|| a->hasTagName(h2Tag) return element.hasTagName(h1Tag)
|| a->hasTagName(h3Tag) || element.hasTagName(h2Tag)
|| a->hasTagName(h4Tag) || element.hasTagName(h3Tag)
|| a->hasTagName(h5Tag) || element.hasTagName(h4Tag)
|| a->hasTagName(h6Tag); || element.hasTagName(h5Tag)
|| element.hasTagName(h6Tag);
} }
static bool haveSameTagName(Node* a, Node* b) static bool haveSameTagName(Node* a, Node* b)
...@@ -460,8 +461,8 @@ bool ReplaceSelectionCommand::shouldMerge(const VisiblePosition& source, const V ...@@ -460,8 +461,8 @@ bool ReplaceSelectionCommand::shouldMerge(const VisiblePosition& source, const V
Node* sourceNode = source.deepEquivalent().deprecatedNode(); Node* sourceNode = source.deepEquivalent().deprecatedNode();
Node* destinationNode = destination.deepEquivalent().deprecatedNode(); Node* destinationNode = destination.deepEquivalent().deprecatedNode();
Node* sourceBlock = enclosingBlock(sourceNode); Element* sourceBlock = enclosingBlock(sourceNode);
Node* destinationBlock = enclosingBlock(destinationNode); Element* destinationBlock = enclosingBlock(destinationNode);
return !enclosingNodeOfType(source.deepEquivalent(), &isMailPasteAsQuotationNode) && return !enclosingNodeOfType(source.deepEquivalent(), &isMailPasteAsQuotationNode) &&
sourceBlock && (!sourceBlock->hasTagName(blockquoteTag) || isMailBlockquote(sourceBlock)) && sourceBlock && (!sourceBlock->hasTagName(blockquoteTag) || isMailBlockquote(sourceBlock)) &&
enclosingListChild(sourceBlock) == enclosingListChild(destinationNode) && enclosingListChild(sourceBlock) == enclosingListChild(destinationNode) &&
......
...@@ -77,7 +77,7 @@ void HTMLTableElement::setCaption(PassRefPtrWillBeRawPtr<HTMLTableCaptionElement ...@@ -77,7 +77,7 @@ void HTMLTableElement::setCaption(PassRefPtrWillBeRawPtr<HTMLTableCaptionElement
HTMLTableSectionElement* HTMLTableElement::tHead() const HTMLTableSectionElement* HTMLTableElement::tHead() const
{ {
for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) { for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
if (child->hasTagName(theadTag)) if (child->hasTagName(theadTag))
return toHTMLTableSectionElement(child); return toHTMLTableSectionElement(child);
} }
...@@ -88,8 +88,8 @@ void HTMLTableElement::setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> ...@@ -88,8 +88,8 @@ void HTMLTableElement::setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>
{ {
deleteTHead(); deleteTHead();
Element* child; HTMLElement* child;
for (child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) { for (child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag)) if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
break; break;
} }
...@@ -99,7 +99,7 @@ void HTMLTableElement::setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> ...@@ -99,7 +99,7 @@ void HTMLTableElement::setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>
HTMLTableSectionElement* HTMLTableElement::tFoot() const HTMLTableSectionElement* HTMLTableElement::tFoot() const
{ {
for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) { for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
if (child->hasTagName(tfootTag)) if (child->hasTagName(tfootTag))
return toHTMLTableSectionElement(child); return toHTMLTableSectionElement(child);
} }
...@@ -110,8 +110,8 @@ void HTMLTableElement::setTFoot(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> ...@@ -110,8 +110,8 @@ void HTMLTableElement::setTFoot(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>
{ {
deleteTFoot(); deleteTFoot();
Element* child; HTMLElement* child;
for (child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) { for (child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag)) if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag))
break; break;
} }
...@@ -172,7 +172,7 @@ void HTMLTableElement::deleteCaption() ...@@ -172,7 +172,7 @@ void HTMLTableElement::deleteCaption()
HTMLTableSectionElement* HTMLTableElement::lastBody() const HTMLTableSectionElement* HTMLTableElement::lastBody() const
{ {
for (Node* child = lastChild(); child; child = child->previousSibling()) { for (HTMLElement* child = Traversal<HTMLElement>::lastChild(*this); child; child = Traversal<HTMLElement>::previousSibling(*child)) {
if (child->hasTagName(tbodyTag)) if (child->hasTagName(tbodyTag))
return toHTMLTableSectionElement(child); return toHTMLTableSectionElement(child);
} }
......
...@@ -80,7 +80,7 @@ int HTMLTableRowElement::rowIndex() const ...@@ -80,7 +80,7 @@ int HTMLTableRowElement::rowIndex() const
} }
} }
for (Element* child = ElementTraversal::firstWithin(*table); child; child = ElementTraversal::nextSibling(*child)) { for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*table); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
if (child->hasTagName(tbodyTag)) { if (child->hasTagName(tbodyTag)) {
HTMLTableSectionElement* section = toHTMLTableSectionElement(child); HTMLTableSectionElement* section = toHTMLTableSectionElement(child);
for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChild(*section); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) { for (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstChild(*section); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment