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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } else { | 178 } else { |
179 // Figure whether upwards or downwards has more room and set the | 179 // Figure whether upwards or downwards has more room and set the |
180 // maximum number of items. | 180 // maximum number of items. |
181 int spaceAbove = widgetRectInScreen.y() - targetControlHeight; | 181 int spaceAbove = widgetRectInScreen.y() - targetControlHeight; |
182 int spaceBelow = screen.maxY() - widgetRectInScreen.y(); | 182 int spaceBelow = screen.maxY() - widgetRectInScreen.y(); |
183 if (spaceAbove > spaceBelow) | 183 if (spaceAbove > spaceBelow) |
184 m_listBox->setMaxHeight(spaceAbove); | 184 m_listBox->setMaxHeight(spaceAbove); |
185 else | 185 else |
186 m_listBox->setMaxHeight(spaceBelow); | 186 m_listBox->setMaxHeight(spaceBelow); |
187 layoutAndGetRTLOffset(); | 187 layoutAndGetRTLOffset(); |
188 // Our height has changed, so recompute only Y axis of widgetRec
t. | 188 // Container height may have changed in layoutAndGetRTLOffset(), |
189 // We don't have to recompute X axis, so we only replace Y axis | 189 // so set the WebWidget height to the container height. |
190 // in widgetRect. | 190 widgetRectInScreen.setHeight(height()); |
191 IntRect frameInScreen = chromeClient->rootViewToScreen(frameRect
()); | 191 // Move WebWidget upwards if necessary. |
192 widgetRectInScreen.setY(frameInScreen.y()); | |
193 widgetRectInScreen.setHeight(frameInScreen.height()); | |
194 // And move upwards if necessary. | |
195 if (spaceAbove > spaceBelow) | 192 if (spaceAbove > spaceBelow) |
196 widgetRectInScreen.move(0, -(widgetRectInScreen.height() + t
argetControlHeight)); | 193 widgetRectInScreen.move(0, -(widgetRectInScreen.height() + t
argetControlHeight)); |
197 } | 194 } |
198 } | 195 } |
199 } | 196 } |
200 | 197 |
201 return widgetRectInScreen; | 198 return widgetRectInScreen; |
202 } | 199 } |
203 | 200 |
204 void PopupContainer::showPopup(FrameView* view) | 201 void PopupContainer::showPopup(FrameView* view) |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 456 } |
460 | 457 |
461 String PopupContainer::getSelectedItemToolTip() | 458 String PopupContainer::getSelectedItemToolTip() |
462 { | 459 { |
463 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, | 460 // We cannot use m_popupClient->selectedIndex() to choose tooltip message, |
464 // because the selectedIndex() might return final selected index, not hoveri
ng selection. | 461 // because the selectedIndex() might return final selected index, not hoveri
ng selection. |
465 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); | 462 return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex); |
466 } | 463 } |
467 | 464 |
468 } // namespace WebCore | 465 } // namespace WebCore |
OLD | NEW |