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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return false; | 122 return false; |
123 | 123 |
124 selectIndex(pointToRowIndex(event.position())); | 124 selectIndex(pointToRowIndex(event.position())); |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 bool PopupListBox::handleMouseReleaseEvent(const PlatformMouseEvent& event) | 128 bool PopupListBox::handleMouseReleaseEvent(const PlatformMouseEvent& event) |
129 { | 129 { |
130 if (m_capturingScrollbar) { | 130 if (m_capturingScrollbar) { |
131 m_capturingScrollbar->mouseUp(event); | 131 m_capturingScrollbar->mouseUp(event); |
132 m_capturingScrollbar = 0; | 132 m_capturingScrollbar = nullptr; |
133 return true; | 133 return true; |
134 } | 134 } |
135 | 135 |
136 if (!isPointInBounds(event.position())) | 136 if (!isPointInBounds(event.position())) |
137 return true; | 137 return true; |
138 | 138 |
139 if (acceptIndex(pointToRowIndex(event.position())) && m_focusedElement) { | 139 if (acceptIndex(pointToRowIndex(event.position())) && m_focusedElement) { |
140 m_focusedElement->dispatchMouseEvent(event, EventTypeNames::mouseup); | 140 m_focusedElement->dispatchMouseEvent(event, EventTypeNames::mouseup); |
141 m_focusedElement->dispatchMouseEvent(event, EventTypeNames::click); | 141 m_focusedElement->dispatchMouseEvent(event, EventTypeNames::click); |
142 | 142 |
143 // Clear m_focusedElement here, because we cannot clear in hidePopup() | 143 // Clear m_focusedElement here, because we cannot clear in hidePopup() |
144 // which is called before dispatchMouseEvent() is called. | 144 // which is called before dispatchMouseEvent() is called. |
145 m_focusedElement = 0; | 145 m_focusedElement = nullptr; |
146 } | 146 } |
147 | 147 |
148 return true; | 148 return true; |
149 } | 149 } |
150 | 150 |
151 bool PopupListBox::handleWheelEvent(const PlatformWheelEvent& event) | 151 bool PopupListBox::handleWheelEvent(const PlatformWheelEvent& event) |
152 { | 152 { |
153 if (!isPointInBounds(event.position())) { | 153 if (!isPointInBounds(event.position())) { |
154 abandon(); | 154 abandon(); |
155 return true; | 155 return true; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 465 } |
466 | 466 |
467 Font PopupListBox::getRowFont(int rowIndex) | 467 Font PopupListBox::getRowFont(int rowIndex) |
468 { | 468 { |
469 Font itemFont = m_popupClient->itemStyle(rowIndex).font(); | 469 Font itemFont = m_popupClient->itemStyle(rowIndex).font(); |
470 if (m_popupClient->itemIsLabel(rowIndex)) { | 470 if (m_popupClient->itemIsLabel(rowIndex)) { |
471 // Bold-ify labels (ie, an <optgroup> heading). | 471 // Bold-ify labels (ie, an <optgroup> heading). |
472 FontDescription d = itemFont.fontDescription(); | 472 FontDescription d = itemFont.fontDescription(); |
473 d.setWeight(FontWeightBold); | 473 d.setWeight(FontWeightBold); |
474 Font font(d); | 474 Font font(d); |
475 font.update(0); | 475 font.update(nullptr); |
476 return font; | 476 return font; |
477 } | 477 } |
478 | 478 |
479 return itemFont; | 479 return itemFont; |
480 } | 480 } |
481 | 481 |
482 void PopupListBox::abandon() | 482 void PopupListBox::abandon() |
483 { | 483 { |
484 RefPtr<PopupListBox> keepAlive(this); | 484 RefPtr<PopupListBox> keepAlive(this); |
485 | 485 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 { | 818 { |
819 return numItems() && IntRect(0, 0, width(), height()).contains(point); | 819 return numItems() && IntRect(0, 0, width(), height()).contains(point); |
820 } | 820 } |
821 | 821 |
822 int PopupListBox::popupContentHeight() const | 822 int PopupListBox::popupContentHeight() const |
823 { | 823 { |
824 return height(); | 824 return height(); |
825 } | 825 } |
826 | 826 |
827 } // namespace blink | 827 } // namespace blink |
OLD | NEW |