OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 , distance(maxDistance()) | 61 , distance(maxDistance()) |
62 , parentDistance(maxDistance()) | 62 , parentDistance(maxDistance()) |
63 , alignment(None) | 63 , alignment(None) |
64 , parentAlignment(None) | 64 , parentAlignment(None) |
65 , isOffscreen(true) | 65 , isOffscreen(true) |
66 , isOffscreenAfterScrolling(true) | 66 , isOffscreenAfterScrolling(true) |
67 { | 67 { |
68 ASSERT(node); | 68 ASSERT(node); |
69 ASSERT(node->isElementNode()); | 69 ASSERT(node->isElementNode()); |
70 | 70 |
71 if (node->hasTagName(areaTag)) { | 71 if (isHTMLAreaElement(*node)) { |
72 HTMLAreaElement* area = toHTMLAreaElement(node); | 72 HTMLAreaElement& area = toHTMLAreaElement(*node); |
73 HTMLImageElement* image = area->imageElement(); | 73 HTMLImageElement* image = area.imageElement(); |
74 if (!image || !image->renderer()) | 74 if (!image || !image->renderer()) |
75 return; | 75 return; |
76 | 76 |
77 visibleNode = image; | 77 visibleNode = image; |
78 rect = virtualRectForAreaElementAndDirection(area, type); | 78 rect = virtualRectForAreaElementAndDirection(area, type); |
79 } else { | 79 } else { |
80 if (!node->renderer()) | 80 if (!node->renderer()) |
81 return; | 81 return; |
82 | 82 |
83 visibleNode = node; | 83 visibleNode = node; |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 { | 598 { |
599 if (firstCandidate.isNull() || secondCandidate.isNull()) | 599 if (firstCandidate.isNull() || secondCandidate.isNull()) |
600 return false; | 600 return false; |
601 | 601 |
602 if (!firstCandidate.visibleNode->renderer() || !secondCandidate.visibleNode-
>renderer()) | 602 if (!firstCandidate.visibleNode->renderer() || !secondCandidate.visibleNode-
>renderer()) |
603 return false; | 603 return false; |
604 | 604 |
605 if (!firstCandidate.rect.intersects(secondCandidate.rect)) | 605 if (!firstCandidate.rect.intersects(secondCandidate.rect)) |
606 return false; | 606 return false; |
607 | 607 |
608 if (firstCandidate.focusableNode->hasTagName(areaTag) || secondCandidate.foc
usableNode->hasTagName(areaTag)) | 608 if (isHTMLAreaElement(*firstCandidate.focusableNode) || isHTMLAreaElement(*s
econdCandidate.focusableNode)) |
609 return false; | 609 return false; |
610 | 610 |
611 if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCand
idate.visibleNode->renderer()->isRenderInline()) | 611 if (!firstCandidate.visibleNode->renderer()->isRenderInline() || !secondCand
idate.visibleNode->renderer()->isRenderInline()) |
612 return false; | 612 return false; |
613 | 613 |
614 if (firstCandidate.visibleNode->renderer()->containingBlock() != secondCandi
date.visibleNode->renderer()->containingBlock()) | 614 if (firstCandidate.visibleNode->renderer()->containingBlock() != secondCandi
date.visibleNode->renderer()->containingBlock()) |
615 return false; | 615 return false; |
616 | 616 |
617 return true; | 617 return true; |
618 } | 618 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 case FocusTypeDown: | 715 case FocusTypeDown: |
716 virtualStartingRect.setHeight(width); | 716 virtualStartingRect.setHeight(width); |
717 break; | 717 break; |
718 default: | 718 default: |
719 ASSERT_NOT_REACHED(); | 719 ASSERT_NOT_REACHED(); |
720 } | 720 } |
721 | 721 |
722 return virtualStartingRect; | 722 return virtualStartingRect; |
723 } | 723 } |
724 | 724 |
725 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement* area, FocusTyp
e type) | 725 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement& area, FocusTyp
e type) |
726 { | 726 { |
727 ASSERT(area); | 727 ASSERT(area.imageElement()); |
728 ASSERT(area->imageElement()); | |
729 // Area elements tend to overlap more than other focusable elements. We flat
ten the rect of the area elements | 728 // Area elements tend to overlap more than other focusable elements. We flat
ten the rect of the area elements |
730 // to minimize the effect of overlapping areas. | 729 // to minimize the effect of overlapping areas. |
731 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea->document().frame(), area->computeRect(area->imageElement()->renderer())), 1)
; | 730 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); |
732 return rect; | 731 return rect; |
733 } | 732 } |
734 | 733 |
735 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) | 734 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) |
736 { | 735 { |
737 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : 0; | 736 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : 0; |
738 }; | 737 }; |
739 | 738 |
740 } // namespace WebCore | 739 } // namespace WebCore |
OLD | NEW |