Chromium Code Reviews| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 listBox()->setBaseWidth(max(controlSize.width() - borderSize * 2, 0)); | 380 listBox()->setBaseWidth(max(controlSize.width() - borderSize * 2, 0)); |
| 381 | 381 |
| 382 listBox()->updateFromElement(); | 382 listBox()->updateFromElement(); |
| 383 | 383 |
| 384 // We set the selected item in updateFromElement(), and disregard the | 384 // We set the selected item in updateFromElement(), and disregard the |
| 385 // index passed into this function (same as Webkit's PopupMenuWin.cpp) | 385 // index passed into this function (same as Webkit's PopupMenuWin.cpp) |
| 386 // FIXME: make sure this is correct, and add an assertion. | 386 // FIXME: make sure this is correct, and add an assertion. |
| 387 // ASSERT(popupWindow(popup)->listBox()->selectedIndex() == index); | 387 // ASSERT(popupWindow(popup)->listBox()->selectedIndex() == index); |
| 388 | 388 |
| 389 // Save and convert the controlPosition to main window coords. | 389 // Save and convert the controlPosition to main window coords. |
| 390 m_controlPosition = controlPosition; | 390 m_controlPosition.setP1(v->contentsToWindow(IntPoint(controlPosition.p1().x( ), controlPosition.p1().y()))); |
|
tkent
2013/06/07 03:16:52
Would you add a comment about a reason why we need
| |
| 391 IntPoint delta = v->contentsToWindow(IntPoint()); | 391 m_controlPosition.setP2(v->contentsToWindow(IntPoint(controlPosition.p2().x( ), controlPosition.p2().y()))); |
| 392 m_controlPosition.move(delta.x(), delta.y()); | 392 m_controlPosition.setP3(v->contentsToWindow(IntPoint(controlPosition.p3().x( ), controlPosition.p3().y()))); |
| 393 m_controlPosition.setP4(v->contentsToWindow(IntPoint(controlPosition.p4().x( ), controlPosition.p4().y()))); | |
| 394 | |
| 393 m_controlSize = controlSize; | 395 m_controlSize = controlSize; |
| 394 | 396 |
| 395 // Position at (0, 0) since the frameRect().location() is relative to the | 397 // Position at (0, 0) since the frameRect().location() is relative to the |
| 396 // parent WebWidget. | 398 // parent WebWidget. |
| 397 setFrameRect(IntRect(IntPoint(), controlSize)); | 399 setFrameRect(IntRect(IntPoint(), controlSize)); |
| 398 showPopup(v); | 400 showPopup(v); |
| 399 } | 401 } |
| 400 | 402 |
| 401 IntRect PopupContainer::refresh(const IntRect& targetControlRect) | 403 IntRect PopupContainer::refresh(const IntRect& targetControlRect) |
| 402 { | 404 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 | 454 |
| 453 String PopupContainer::getSelectedItemToolTip() | 455 String PopupContainer::getSelectedItemToolTip() |
| 454 { | 456 { |
| 455 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, | 457 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, |
| 456 // because the selectedIndex() might return final selected index, not | 458 // because the selectedIndex() might return final selected index, not |
| 457 // hovering selection. | 459 // hovering selection. |
| 458 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); | 460 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); |
| 459 } | 461 } |
| 460 | 462 |
| 461 } // namespace WebCore | 463 } // namespace WebCore |
| OLD | NEW |