Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Unified Diff: Source/core/rendering/RenderListItem.cpp

Issue 197283025: Use new is*Element() helper functions more in rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderListBox.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderListItem.cpp
diff --git a/Source/core/rendering/RenderListItem.cpp b/Source/core/rendering/RenderListItem.cpp
index c0867e2dd2f681ceec5b518b113fdd1c5f4800c6..8f14092e2bb9d2afb7f88a4e99e1573b169bcc61 100644
--- a/Source/core/rendering/RenderListItem.cpp
+++ b/Source/core/rendering/RenderListItem.cpp
@@ -92,9 +92,9 @@ void RenderListItem::willBeRemovedFromTree()
updateListMarkerNumbers();
}
-static bool isList(const Node* node)
+static bool isList(const Node& node)
{
- return (node->hasTagName(ulTag) || node->hasTagName(olTag));
+ return isHTMLUListElement(node) || isHTMLOListElement(node);
}
// Returns the enclosing list with respect to the DOM order.
@@ -104,7 +104,7 @@ static Node* enclosingList(const RenderListItem* listItem)
Node* firstNode = 0;
// We use parentNode because the enclosing list could be a ShadowRoot that's not Element.
for (Node* parent = NodeRenderingTraversal::parent(listItemNode); parent; parent = NodeRenderingTraversal::parent(parent)) {
- if (isList(parent))
+ if (isList(*parent))
return parent;
if (!firstNode)
firstNode = parent;
@@ -128,7 +128,7 @@ static RenderListItem* nextListItem(const Node* listNode, const RenderListItem*
current = NodeRenderingTraversal::next(current, listNode);
while (current) {
- if (isList(current)) {
+ if (isList(*current)) {
// We've found a nested, independent list: nothing to do here.
current = NodeRenderingTraversal::next(current, listNode);
continue;
@@ -194,7 +194,7 @@ inline int RenderListItem::calcValue() const
return m_explicitValue;
Node* list = enclosingList(this);
- HTMLOListElement* oListElement = (list && list->hasTagName(olTag)) ? toHTMLOListElement(list) : 0;
+ HTMLOListElement* oListElement = isHTMLOListElement(list) ? toHTMLOListElement(list) : 0;
int valueStep = 1;
if (oListElement && oListElement->isReversed())
valueStep = -1;
@@ -242,7 +242,7 @@ static RenderObject* getParentOfFirstLineBox(RenderBlockFlow* curr, RenderObject
break;
if (curr->isListItem() && inQuirksMode && currChild->node() &&
- (currChild->node()->hasTagName(ulTag)|| currChild->node()->hasTagName(olTag)))
+ (isHTMLUListElement(*currChild->node()) || isHTMLOListElement(*currChild->node())))
break;
RenderObject* lineBox = getParentOfFirstLineBox(toRenderBlockFlow(currChild), marker);
@@ -517,7 +517,7 @@ void RenderListItem::updateListMarkerNumbers()
return;
bool isListReversed = false;
- HTMLOListElement* oListElement = (listNode && listNode->hasTagName(olTag)) ? toHTMLOListElement(listNode) : 0;
+ HTMLOListElement* oListElement = isHTMLOListElement(listNode) ? toHTMLOListElement(listNode) : 0;
if (oListElement) {
oListElement->itemCountChanged();
isListReversed = oListElement->isReversed();
« no previous file with comments | « Source/core/rendering/RenderListBox.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698