OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the select element renderer in WebCore. | 2 * This file is part of the select element renderer in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
5 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 5 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
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 * | 10 * |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 { | 572 { |
573 // Determine an index and scroll to it. | 573 // Determine an index and scroll to it. |
574 int index = newTop / itemHeight(); | 574 int index = newTop / itemHeight(); |
575 if (index < 0 || index >= numItems() || index == m_indexOffset) | 575 if (index < 0 || index >= numItems() || index == m_indexOffset) |
576 return; | 576 return; |
577 m_indexOffset = index; | 577 m_indexOffset = index; |
578 if (m_vBar) | 578 if (m_vBar) |
579 m_vBar->setValue(index); | 579 m_vBar->setValue(index); |
580 } | 580 } |
581 | 581 |
| 582 bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
sult, int x, int y, int tx, int ty, HitTestAction hitTestAction) |
| 583 { |
| 584 if (!RenderBlock::nodeAtPoint(request, result, x, y, tx, ty, hitTestAction)) |
| 585 return false; |
| 586 const Vector<HTMLElement*>& listItems = static_cast<HTMLSelectElement*>(node
())->listItems(); |
| 587 int size = numItems(); |
| 588 tx += this->x(); |
| 589 ty += this->y(); |
| 590 for (int i = 0; i < size; ++i) { |
| 591 if (itemBoundingBoxRect(tx, ty, i).contains(x, y)) { |
| 592 if (HTMLElement* node = listItems[i]) { |
| 593 result.setInnerNode(node); |
| 594 if (!result.innerNonSharedNode()) |
| 595 result.setInnerNonSharedNode(node); |
| 596 result.setLocalPoint(IntPoint(x - tx, y - ty)); |
| 597 break; |
| 598 } |
| 599 } |
| 600 } |
| 601 |
| 602 return true; |
| 603 } |
| 604 |
582 IntRect RenderListBox::controlClipRect(int tx, int ty) const | 605 IntRect RenderListBox::controlClipRect(int tx, int ty) const |
583 { | 606 { |
584 IntRect clipRect = contentBoxRect(); | 607 IntRect clipRect = contentBoxRect(); |
585 clipRect.move(tx, ty); | 608 clipRect.move(tx, ty); |
586 return clipRect; | 609 return clipRect; |
587 } | 610 } |
588 | 611 |
589 bool RenderListBox::isActive() const | 612 bool RenderListBox::isActive() const |
590 { | 613 { |
591 Page* page = document()->frame()->page(); | 614 Page* page = document()->frame()->page(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 m_vBar->styleChanged(); | 658 m_vBar->styleChanged(); |
636 | 659 |
637 #if ENABLE(DASHBOARD_SUPPORT) | 660 #if ENABLE(DASHBOARD_SUPPORT) |
638 // Force an update since we know the scrollbars have changed things. | 661 // Force an update since we know the scrollbars have changed things. |
639 if (document()->hasDashboardRegions()) | 662 if (document()->hasDashboardRegions()) |
640 document()->setDashboardRegionsDirty(true); | 663 document()->setDashboardRegionsDirty(true); |
641 #endif | 664 #endif |
642 } | 665 } |
643 | 666 |
644 } // namespace WebCore | 667 } // namespace WebCore |
OLD | NEW |