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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 // Move it below the select widget. | 400 // Move it below the select widget. |
401 location.move(0, r.height()); | 401 location.move(0, r.height()); |
402 | 402 |
403 m_originalFrameRect = IntRect(location, r.size()); | 403 m_originalFrameRect = IntRect(location, r.size()); |
404 | 404 |
405 // Position at (0, 0) since the frameRect().location() is relative to the pa
rent WebWidget. | 405 // Position at (0, 0) since the frameRect().location() is relative to the pa
rent WebWidget. |
406 setFrameRect(IntRect(IntPoint(), r.size())); | 406 setFrameRect(IntRect(IntPoint(), r.size())); |
407 showPopup(v); | 407 showPopup(v); |
408 } | 408 } |
409 | 409 |
410 void PopupContainer::refresh(const IntRect& targetControlRect) | 410 IntRect PopupContainer::refresh(const IntRect& targetControlRect) |
411 { | 411 { |
412 listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0
)); | 412 listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0
)); |
413 listBox()->updateFromElement(); | 413 listBox()->updateFromElement(); |
414 | 414 |
415 IntPoint locationInWindow = m_frameView->contentsToWindow(targetControlRect.
location()); | 415 IntPoint locationInWindow = m_frameView->contentsToWindow(targetControlRect.
location()); |
416 | 416 |
417 // Move it below the select widget. | 417 // Move it below the select widget. |
418 locationInWindow.move(0, targetControlRect.height()); | 418 locationInWindow.move(0, targetControlRect.height()); |
419 | 419 |
420 IntRect widgetRectInScreen = layoutAndCalculateWidgetRect(targetControlRect.
height(), locationInWindow); | 420 IntRect widgetRectInScreen = layoutAndCalculateWidgetRect(targetControlRect.
height(), locationInWindow); |
421 | 421 |
422 // Reset the size (which can be set to the PopupListBox size in layoutAndGet
RTLOffset(), exceeding the available widget rectangle.) | 422 // Reset the size (which can be set to the PopupListBox size in layoutAndGet
RTLOffset(), exceeding the available widget rectangle.) |
423 if (size() != widgetRectInScreen.size()) | 423 if (size() != widgetRectInScreen.size()) |
424 resize(widgetRectInScreen.size()); | 424 resize(widgetRectInScreen.size()); |
425 | 425 |
426 ChromeClientChromium* chromeClient = chromeClientChromium(); | 426 invalidate(); |
427 if (chromeClient) { | |
428 // Update the WebWidget location (which is relative to the screen origin
). | |
429 if (widgetRectInScreen != chromeClient->windowRect()) | |
430 chromeClient->setWindowRect(widgetRectInScreen); | |
431 } | |
432 | 427 |
433 invalidate(); | 428 return widgetRectInScreen; |
434 } | 429 } |
435 | 430 |
436 inline bool PopupContainer::isRTL() const | 431 inline bool PopupContainer::isRTL() const |
437 { | 432 { |
438 return m_listBox->m_popupClient->menuStyle().textDirection() == RTL; | 433 return m_listBox->m_popupClient->menuStyle().textDirection() == RTL; |
439 } | 434 } |
440 | 435 |
441 int PopupContainer::selectedIndex() const | 436 int PopupContainer::selectedIndex() const |
442 { | 437 { |
443 return m_listBox->selectedIndex(); | 438 return m_listBox->selectedIndex(); |
(...skipping 20 matching lines...) Expand all Loading... |
464 } | 459 } |
465 | 460 |
466 String PopupContainer::getSelectedItemToolTip() | 461 String PopupContainer::getSelectedItemToolTip() |
467 { | 462 { |
468 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, | 463 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, |
469 // because the selectedIndex() might return final selected index, not hoveri
ng selection. | 464 // because the selectedIndex() might return final selected index, not hoveri
ng selection. |
470 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); | 465 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); |
471 } | 466 } |
472 | 467 |
473 } // namespace WebCore | 468 } // namespace WebCore |
OLD | NEW |