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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 // points. If the <select>/<input> is transformed, they are not the same. | 193 // points. If the <select>/<input> is transformed, they are not the same. |
| 194 int verticalOffset = - m_controlPosition.p4().y() + m_controlPosition.p3().y (); | 194 int verticalOffset = - m_controlPosition.p4().y() + m_controlPosition.p3().y (); |
| 195 int verticalForRTLOffset = isRTL ? verticalOffset : 0; | 195 int verticalForRTLOffset = isRTL ? verticalOffset : 0; |
| 196 | 196 |
| 197 // Assume m_listBox size is already calculated. | 197 // Assume m_listBox size is already calculated. |
| 198 IntSize targetSize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize * 2); | 198 IntSize targetSize(m_listBox->width() + borderSize * 2, m_listBox->height() + borderSize * 2); |
| 199 | 199 |
| 200 IntRect widgetRectInScreen; | 200 IntRect widgetRectInScreen; |
| 201 // If the popup would extend past the bottom of the screen, open upwards | 201 // If the popup would extend past the bottom of the screen, open upwards |
| 202 // instead. | 202 // instead. |
| 203 IntRect screen = screenAvailableRect(m_frameView.get()); | 203 Widget* rootWidget = m_frameView.get(); |
| 204 while (rootWidget->parent()) | |
| 205 rootWidget = rootWidget->parent(); | |
| 206 IntRect screen = rootWidget->hostWindow() ? screenAvailableRect(*rootWidget- >hostWindow()) : IntRect(); | |
|
dcheng
2015/05/04 17:38:11
Does m_frameView->root() not work here?
| |
| 204 // Use popupInitialCoordinate.x() + rightOffset because RTL position | 207 // Use popupInitialCoordinate.x() + rightOffset because RTL position |
| 205 // needs to be considered. | 208 // needs to be considered. |
| 206 float pageScaleFactor = m_frameView->frame().page()->pageScaleFactor(); | 209 float pageScaleFactor = m_frameView->frame().page()->pageScaleFactor(); |
| 207 int popupX = round((popupInitialCoordinate.x() + rightOffset) * pageScaleFac tor); | 210 int popupX = round((popupInitialCoordinate.x() + rightOffset) * pageScaleFac tor); |
| 208 int popupY = round((popupInitialCoordinate.y() + verticalForRTLOffset) * pag eScaleFactor); | 211 int popupY = round((popupInitialCoordinate.y() + verticalForRTLOffset) * pag eScaleFactor); |
| 209 widgetRectInScreen = chromeClient().viewportToScreen(IntRect(popupX, popupY, targetSize.width(), targetSize.height())); | 212 widgetRectInScreen = chromeClient().viewportToScreen(IntRect(popupX, popupY, targetSize.width(), targetSize.height())); |
| 210 | 213 |
| 211 // If we have multiple screens and the browser rect is in one screen, we | 214 // If we have multiple screens and the browser rect is in one screen, we |
| 212 // have to clip the window width to the screen width. | 215 // have to clip the window width to the screen width. |
| 213 // When clipping, we also need to set a maximum width for the list box. | 216 // When clipping, we also need to set a maximum width for the list box. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 } | 496 } |
| 494 | 497 |
| 495 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const | 498 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const |
| 496 { | 499 { |
| 497 IntPoint newPoint = point; | 500 IntPoint newPoint = point; |
| 498 newPoint.moveBy(-child->location()); | 501 newPoint.moveBy(-child->location()); |
| 499 return newPoint; | 502 return newPoint; |
| 500 } | 503 } |
| 501 | 504 |
| 502 } // namespace blink | 505 } // namespace blink |
| OLD | NEW |