Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: Source/web/PopupContainer.cpp

Issue 1109213002: Make createWindow (mostly) work with OOPIF (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix style, use FrameView::root Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 IntRect screen = m_frameView->root()->hostWindow() ? screenAvailableRect(*m _frameView->root()->hostWindow()) : IntRect();
204 // Use popupInitialCoordinate.x() + rightOffset because RTL position 204 // Use popupInitialCoordinate.x() + rightOffset because RTL position
205 // needs to be considered. 205 // needs to be considered.
206 float pageScaleFactor = m_frameView->frame().page()->pageScaleFactor(); 206 float pageScaleFactor = m_frameView->frame().page()->pageScaleFactor();
207 int popupX = round((popupInitialCoordinate.x() + rightOffset) * pageScaleFac tor); 207 int popupX = round((popupInitialCoordinate.x() + rightOffset) * pageScaleFac tor);
208 int popupY = round((popupInitialCoordinate.y() + verticalForRTLOffset) * pag eScaleFactor); 208 int popupY = round((popupInitialCoordinate.y() + verticalForRTLOffset) * pag eScaleFactor);
209 widgetRectInScreen = chromeClient().viewportToScreen(IntRect(popupX, popupY, targetSize.width(), targetSize.height())); 209 widgetRectInScreen = chromeClient().viewportToScreen(IntRect(popupX, popupY, targetSize.width(), targetSize.height()));
210 210
211 // If we have multiple screens and the browser rect is in one screen, we 211 // 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. 212 // 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. 213 // 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
493 } 493 }
494 494
495 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const 495 IntPoint PopupContainer::convertSelfToChild(const Widget* child, const IntPoint& point) const
496 { 496 {
497 IntPoint newPoint = point; 497 IntPoint newPoint = point;
498 newPoint.moveBy(-child->location()); 498 newPoint.moveBy(-child->location());
499 return newPoint; 499 return newPoint;
500 } 500 }
501 501
502 } // namespace blink 502 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698