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

Unified Diff: Source/core/page/SpatialNavigation.cpp

Issue 190953009: Use new is*Element() helper functions in page/ 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/page/SpatialNavigation.h ('k') | Source/core/page/TouchDisambiguation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/SpatialNavigation.cpp
diff --git a/Source/core/page/SpatialNavigation.cpp b/Source/core/page/SpatialNavigation.cpp
index 2c2cc053363f5031e65fabb57afc17c6fc3c0d9f..77606ddb4c91a389207c7a5c04d15528bccd0c8e 100644
--- a/Source/core/page/SpatialNavigation.cpp
+++ b/Source/core/page/SpatialNavigation.cpp
@@ -68,9 +68,9 @@ FocusCandidate::FocusCandidate(Node* node, FocusType type)
ASSERT(node);
ASSERT(node->isElementNode());
- if (node->hasTagName(areaTag)) {
- HTMLAreaElement* area = toHTMLAreaElement(node);
- HTMLImageElement* image = area->imageElement();
+ if (isHTMLAreaElement(*node)) {
+ HTMLAreaElement& area = toHTMLAreaElement(*node);
+ HTMLImageElement* image = area.imageElement();
if (!image || !image->renderer())
return;
@@ -605,7 +605,7 @@ bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
if (!firstCandidate.rect.intersects(secondCandidate.rect))
return false;
- if (firstCandidate.focusableNode->hasTagName(areaTag) || secondCandidate.focusableNode->hasTagName(areaTag))
+ if (isHTMLAreaElement(*firstCandidate.focusableNode) || isHTMLAreaElement(*secondCandidate.focusableNode))
return false;
if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCandidate.visibleNode->renderer()->isRenderInline())
@@ -722,13 +722,12 @@ LayoutRect virtualRectForDirection(FocusType type, const LayoutRect& startingRec
return virtualStartingRect;
}
-LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement* area, FocusType type)
+LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement& area, FocusType type)
{
- ASSERT(area);
- ASSERT(area->imageElement());
+ ASSERT(area.imageElement());
// Area elements tend to overlap more than other focusable elements. We flatten the rect of the area elements
// to minimize the effect of overlapping areas.
- LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(area->document().frame(), area->computeRect(area->imageElement()->renderer())), 1);
+ LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(area.document().frame(), area.computeRect(area.imageElement()->renderer())), 1);
return rect;
}
« no previous file with comments | « Source/core/page/SpatialNavigation.h ('k') | Source/core/page/TouchDisambiguation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698