OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 clearSelection(); | 607 clearSelection(); |
608 } | 608 } |
609 | 609 |
610 void PopupListBox::setOriginalIndex(int index) | 610 void PopupListBox::setOriginalIndex(int index) |
611 { | 611 { |
612 m_originalIndex = m_selectedIndex = index; | 612 m_originalIndex = m_selectedIndex = index; |
613 } | 613 } |
614 | 614 |
615 int PopupListBox::getRowHeight(int index) | 615 int PopupListBox::getRowHeight(int index) |
616 { | 616 { |
| 617 int minimumHeight = PopupMenuChromium::minimumRowHeight(); |
| 618 if (m_settings.deviceSupportsTouch) |
| 619 minimumHeight = max(minimumHeight, PopupMenuChromium::optionRowHeightFor
Touch()); |
| 620 |
617 if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone()) | 621 if (index < 0 || m_popupClient->itemStyle(index).isDisplayNone()) |
618 return PopupMenuChromium::minimumRowHeight(); | 622 return minimumHeight; |
619 | 623 |
620 // Separator row height is the same size as itself. | 624 // Separator row height is the same size as itself. |
621 if (m_popupClient->itemIsSeparator(index)) | 625 if (m_popupClient->itemIsSeparator(index)) |
622 return max(separatorHeight, (PopupMenuChromium::minimumRowHeight())); | 626 return max(separatorHeight, minimumHeight); |
623 | 627 |
624 String icon = m_popupClient->itemIcon(index); | 628 String icon = m_popupClient->itemIcon(index); |
625 RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data())); | 629 RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data())); |
626 | 630 |
627 int fontHeight = getRowFont(index).fontMetrics().height(); | 631 int fontHeight = getRowFont(index).fontMetrics().height(); |
628 int iconHeight = (image && !image->isNull()) ? image->rect().height() : 0; | 632 int iconHeight = (image && !image->isNull()) ? image->rect().height() : 0; |
629 | 633 |
630 int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuSt
yle::AutofillPopup ? kLinePaddingHeight : 0; | 634 int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuSt
yle::AutofillPopup ? kLinePaddingHeight : 0; |
631 int calculatedRowHeight = max(fontHeight, iconHeight) + linePaddingHeight *
2; | 635 int calculatedRowHeight = max(fontHeight, iconHeight) + linePaddingHeight *
2; |
632 return max(calculatedRowHeight, PopupMenuChromium::minimumRowHeight()); | 636 return max(calculatedRowHeight, minimumHeight); |
633 } | 637 } |
634 | 638 |
635 IntRect PopupListBox::getRowBounds(int index) | 639 IntRect PopupListBox::getRowBounds(int index) |
636 { | 640 { |
637 if (index < 0) | 641 if (index < 0) |
638 return IntRect(0, 0, visibleWidth(), getRowHeight(index)); | 642 return IntRect(0, 0, visibleWidth(), getRowHeight(index)); |
639 | 643 |
640 return IntRect(0, m_items[index]->yOffset, visibleWidth(), getRowHeight(inde
x)); | 644 return IntRect(0, m_items[index]->yOffset, visibleWidth(), getRowHeight(inde
x)); |
641 } | 645 } |
642 | 646 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 { | 908 { |
905 return numItems() && IntRect(0, 0, width(), height()).contains(point); | 909 return numItems() && IntRect(0, 0, width(), height()).contains(point); |
906 } | 910 } |
907 | 911 |
908 int PopupListBox::popupContentHeight() const | 912 int PopupListBox::popupContentHeight() const |
909 { | 913 { |
910 return height(); | 914 return height(); |
911 } | 915 } |
912 | 916 |
913 } // namespace WebCore | 917 } // namespace WebCore |
OLD | NEW |