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

Side by Side Diff: Source/core/page/SpatialNavigation.cpp

Issue 18251004: Introduce isHTMLAreaElement and toHTMLAreaElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/page/FocusController.cpp ('k') | Source/core/rendering/HitTestResult.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> 3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org>
4 * 4 *
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 , distance(maxDistance()) 60 , distance(maxDistance())
61 , parentDistance(maxDistance()) 61 , parentDistance(maxDistance())
62 , alignment(None) 62 , alignment(None)
63 , parentAlignment(None) 63 , parentAlignment(None)
64 , isOffscreen(true) 64 , isOffscreen(true)
65 , isOffscreenAfterScrolling(true) 65 , isOffscreenAfterScrolling(true)
66 { 66 {
67 ASSERT(node); 67 ASSERT(node);
68 ASSERT(node->isElementNode()); 68 ASSERT(node->isElementNode());
69 69
70 if (node->hasTagName(HTMLNames::areaTag)) { 70 if (isHTMLAreaElement(node)) {
71 HTMLAreaElement* area = static_cast<HTMLAreaElement*>(node); 71 HTMLAreaElement* area = toHTMLAreaElement(node);
72 HTMLImageElement* image = area->imageElement(); 72 HTMLImageElement* image = area->imageElement();
73 if (!image || !image->renderer()) 73 if (!image || !image->renderer())
74 return; 74 return;
75 75
76 visibleNode = image; 76 visibleNode = image;
77 rect = virtualRectForAreaElementAndDirection(area, direction); 77 rect = virtualRectForAreaElementAndDirection(area, direction);
78 } else { 78 } else {
79 if (!node->renderer()) 79 if (!node->renderer())
80 return; 80 return;
81 81
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 { 597 {
598 if (firstCandidate.isNull() || secondCandidate.isNull()) 598 if (firstCandidate.isNull() || secondCandidate.isNull())
599 return false; 599 return false;
600 600
601 if (!firstCandidate.visibleNode->renderer() || !secondCandidate.visibleNode- >renderer()) 601 if (!firstCandidate.visibleNode->renderer() || !secondCandidate.visibleNode- >renderer())
602 return false; 602 return false;
603 603
604 if (!firstCandidate.rect.intersects(secondCandidate.rect)) 604 if (!firstCandidate.rect.intersects(secondCandidate.rect))
605 return false; 605 return false;
606 606
607 if (firstCandidate.focusableNode->hasTagName(HTMLNames::areaTag) || secondCa ndidate.focusableNode->hasTagName(HTMLNames::areaTag)) 607 if (isHTMLAreaElement(firstCandidate.focusableNode) || isHTMLAreaElement(sec ondCandidate.focusableNode))
608 return false; 608 return false;
609 609
610 if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCand idate.visibleNode->renderer()->isRenderInline()) 610 if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCand idate.visibleNode->renderer()->isRenderInline())
611 return false; 611 return false;
612 612
613 if (firstCandidate.visibleNode->renderer()->containingBlock() != secondCandi date.visibleNode->renderer()->containingBlock()) 613 if (firstCandidate.visibleNode->renderer()->containingBlock() != secondCandi date.visibleNode->renderer()->containingBlock())
614 return false; 614 return false;
615 615
616 return true; 616 return true;
617 } 617 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 LayoutRect rect = virtualRectForDirection(direction, rectToAbsoluteCoordinat es(area->document()->frame(), area->computeRect(area->imageElement()->renderer() )), 1); 730 LayoutRect rect = virtualRectForDirection(direction, rectToAbsoluteCoordinat es(area->document()->frame(), area->computeRect(area->imageElement()->renderer() )), 1);
731 return rect; 731 return rect;
732 } 732 }
733 733
734 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) 734 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate)
735 { 735 {
736 return candidate.isFrameOwnerElement() ? static_cast<HTMLFrameOwnerElement*> (candidate.visibleNode) : 0; 736 return candidate.isFrameOwnerElement() ? static_cast<HTMLFrameOwnerElement*> (candidate.visibleNode) : 0;
737 }; 737 };
738 738
739 } // namespace WebCore 739 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/FocusController.cpp ('k') | Source/core/rendering/HitTestResult.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698