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

Unified Diff: Source/core/rendering/RenderObject.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/RenderMeter.cpp ('k') | Source/core/rendering/RenderProgress.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index e6e9ba7dd2d924a948810eb49b63cea2e2e36ec5..82c6a94c70ae77bd2f0b85075f29ad67cb1ab6a6 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -42,6 +42,7 @@
#include "core/html/HTMLAnchorElement.h"
#include "core/html/HTMLElement.h"
#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLTableCellElement.h"
#include "core/html/HTMLTableElement.h"
#include "core/page/AutoscrollController.h"
#include "core/page/EventHandler.h"
@@ -248,17 +249,17 @@ bool RenderObject::isDescendantOf(const RenderObject* obj) const
bool RenderObject::isBody() const
{
- return node() && node()->hasTagName(bodyTag);
+ return isHTMLBodyElement(node());
}
bool RenderObject::isHR() const
{
- return node() && node()->hasTagName(hrTag);
+ return isHTMLHRElement(node());
}
bool RenderObject::isLegend() const
{
- return node() && node()->hasTagName(legendTag);
+ return isHTMLLegendElement(node());
}
void RenderObject::setFlowThreadStateIncludingDescendants(FlowThreadState state)
@@ -2474,7 +2475,7 @@ bool RenderObject::isRooted(RenderView** view) const
RenderObject* RenderObject::rendererForRootBackground()
{
ASSERT(isRoot());
- if (!hasBackground() && node() && node()->hasTagName(htmlTag)) {
+ if (!hasBackground() && isHTMLHtmlElement(node())) {
// Locate the <body> element using the DOM. This is easier than trying
// to crawl around a render tree with potential :before/:after content and
// anonymous blocks created by inline <body> tags etc. We can locate the <body>
@@ -2493,7 +2494,7 @@ RespectImageOrientationEnum RenderObject::shouldRespectImageOrientation() const
// Respect the image's orientation if it's being used as a full-page image or it's
// an <img> and the setting to respect it everywhere is set.
return document().isImageDocument()
- || (document().settings() && document().settings()->shouldRespectImageOrientation() && node() && node()->hasTagName(HTMLNames::imgTag)) ? RespectImageOrientation : DoNotRespectImageOrientation;
+ || (document().settings() && document().settings()->shouldRespectImageOrientation() && isHTMLImageElement(node())) ? RespectImageOrientation : DoNotRespectImageOrientation;
}
bool RenderObject::hasOutlineAnnotation() const
@@ -3031,7 +3032,7 @@ void RenderObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio
curr = curr->parent();
if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuation())
curr = toRenderBlock(curr)->continuation();
- } while (curr && decorations && (!quirksMode || !curr->node() || (!curr->node()->hasTagName(aTag) && !curr->node()->hasTagName(fontTag))));
+ } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnchorElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
// If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
if (decorations && curr) {
@@ -3177,10 +3178,10 @@ Element* RenderObject::offsetParent() const
if (ancestor->isPositioned())
break;
- if (node->hasTagName(bodyTag))
+ if (isHTMLBodyElement(*node))
break;
- if (!isPositioned() && (node->hasTagName(tableTag) || node->hasTagName(tdTag) || node->hasTagName(thTag)))
+ if (!isPositioned() && (isHTMLTableElement(*node) || isHTMLTableCellElement(*node)))
break;
// Webkit specific extension where offsetParent stops at zoom level changes.
« no previous file with comments | « Source/core/rendering/RenderMeter.cpp ('k') | Source/core/rendering/RenderProgress.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698