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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 widgetRectInScreen = layoutAndCalculateWidgetRectInternal(widgetRectInScreen
, targetControlHeight, windowRect, screen, isRTL, rtlOffset, verticalOffset, tra
nsformOffset, m_listBox.get(), needToResizeView); | 201 widgetRectInScreen = layoutAndCalculateWidgetRectInternal(widgetRectInScreen
, targetControlHeight, windowRect, screen, isRTL, rtlOffset, verticalOffset, tra
nsformOffset, m_listBox.get(), needToResizeView); |
202 if (needToResizeView) | 202 if (needToResizeView) |
203 fitToListBox(); | 203 fitToListBox(); |
204 | 204 |
205 return widgetRectInScreen; | 205 return widgetRectInScreen; |
206 } | 206 } |
207 | 207 |
208 void PopupContainer::showPopup(FrameView* view) | 208 void PopupContainer::showPopup(FrameView* view) |
209 { | 209 { |
210 m_frameView = view; | 210 m_frameView = view; |
211 listBox()->m_focusedElement = m_frameView->frame()->document()->focusedEleme
nt(); | 211 listBox()->m_focusedElement = m_frameView->frame().document()->focusedElemen
t(); |
212 | 212 |
213 IntSize transformOffset(m_controlPosition.p4().x() - m_controlPosition.p1().
x(), m_controlPosition.p4().y() - m_controlPosition.p1().y() - m_controlSize.hei
ght()); | 213 IntSize transformOffset(m_controlPosition.p4().x() - m_controlPosition.p1().
x(), m_controlPosition.p4().y() - m_controlPosition.p1().y() - m_controlSize.hei
ght()); |
214 chromeClient().popupOpened(this, layoutAndCalculateWidgetRect(m_controlSize.
height(), transformOffset, roundedIntPoint(m_controlPosition.p4())), false); | 214 chromeClient().popupOpened(this, layoutAndCalculateWidgetRect(m_controlSize.
height(), transformOffset, roundedIntPoint(m_controlPosition.p4())), false); |
215 m_popupOpen = true; | 215 m_popupOpen = true; |
216 | 216 |
217 if (!m_listBox->parent()) | 217 if (!m_listBox->parent()) |
218 addChild(m_listBox.get()); | 218 addChild(m_listBox.get()); |
219 | 219 |
220 // Enable scrollbars after the listbox is inserted into the hierarchy, | 220 // Enable scrollbars after the listbox is inserted into the hierarchy, |
221 // so it has a proper WidgetClient. | 221 // so it has a proper WidgetClient. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 gc->drawRect(IntRect(tx + width() - borderSize, ty, borderSize, height())); | 358 gc->drawRect(IntRect(tx + width() - borderSize, ty, borderSize, height())); |
359 } | 359 } |
360 | 360 |
361 bool PopupContainer::isInterestedInEventForKey(int keyCode) | 361 bool PopupContainer::isInterestedInEventForKey(int keyCode) |
362 { | 362 { |
363 return m_listBox->isInterestedInEventForKey(keyCode); | 363 return m_listBox->isInterestedInEventForKey(keyCode); |
364 } | 364 } |
365 | 365 |
366 ChromeClient& PopupContainer::chromeClient() | 366 ChromeClient& PopupContainer::chromeClient() |
367 { | 367 { |
368 return m_frameView->frame()->page()->chrome().client(); | 368 return m_frameView->frame().page()->chrome().client(); |
369 } | 369 } |
370 | 370 |
371 void PopupContainer::showInRect(const FloatQuad& controlPosition, const IntSize&
controlSize, FrameView* v, int index) | 371 void PopupContainer::showInRect(const FloatQuad& controlPosition, const IntSize&
controlSize, FrameView* v, int index) |
372 { | 372 { |
373 // The controlSize is the size of the select box. It's usually larger than | 373 // The controlSize is the size of the select box. It's usually larger than |
374 // we need. Subtract border size so that usually the container will be | 374 // we need. Subtract border size so that usually the container will be |
375 // displayed exactly the same width as the select box. | 375 // displayed exactly the same width as the select box. |
376 listBox()->setBaseWidth(max(controlSize.width() - borderSize * 2, 0)); | 376 listBox()->setBaseWidth(max(controlSize.width() - borderSize * 2, 0)); |
377 | 377 |
378 listBox()->updateFromElement(); | 378 listBox()->updateFromElement(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 452 |
453 String PopupContainer::getSelectedItemToolTip() | 453 String PopupContainer::getSelectedItemToolTip() |
454 { | 454 { |
455 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, | 455 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, |
456 // because the selectedIndex() might return final selected index, not | 456 // because the selectedIndex() might return final selected index, not |
457 // hovering selection. | 457 // hovering selection. |
458 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); | 458 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); |
459 } | 459 } |
460 | 460 |
461 } // namespace WebCore | 461 } // namespace WebCore |
OLD | NEW |