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

Unified Diff: Source/web/PopupContainer.cpp

Issue 879913003: Use IntRect instead of FloatRect for window positions and sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added FIXME comments Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/PopupContainer.h ('k') | Source/web/PopupContainerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/PopupContainer.cpp
diff --git a/Source/web/PopupContainer.cpp b/Source/web/PopupContainer.cpp
index 61aee602988489ee0421f85403889bd610d503b2..9d83814a509525d2fcbbea90eefa0357244bac16 100644
--- a/Source/web/PopupContainer.cpp
+++ b/Source/web/PopupContainer.cpp
@@ -112,7 +112,7 @@ void PopupContainer::trace(Visitor* visitor)
Widget::trace(visitor);
}
-IntRect PopupContainer::layoutAndCalculateWidgetRectInternal(IntRect widgetRectInScreen, int targetControlHeight, const FloatRect& windowRect, const FloatRect& screen, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize& transformOffset, PopupContent* listBox, bool& needToResizeView)
+IntRect PopupContainer::layoutAndCalculateWidgetRectInternal(IntRect widgetRectInScreen, int targetControlHeight, const IntRect& windowRect, const IntRect& screen, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize& transformOffset, PopupContent* listBox, bool& needToResizeView)
{
ASSERT(listBox);
if (windowRect.x() >= screen.x() && windowRect.maxX() <= screen.maxX() && (widgetRectInScreen.x() < screen.x() || widgetRectInScreen.maxX() > screen.maxX())) {
@@ -121,9 +121,8 @@ IntRect PopupContainer::layoutAndCalculateWidgetRectInternal(IntRect widgetRectI
IntRect inverseWidgetRectInScreen = widgetRectInScreen;
inverseWidgetRectInScreen.setX(inverseWidgetRectInScreen.x() + (isRTL ? -rtlOffset : rtlOffset));
inverseWidgetRectInScreen.setY(inverseWidgetRectInScreen.y() + (isRTL ? -verticalOffset : verticalOffset));
- IntRect enclosingScreen = enclosingIntRect(screen);
- unsigned originalCutoff = std::max(enclosingScreen.x() - widgetRectInScreen.x(), 0) + std::max(widgetRectInScreen.maxX() - enclosingScreen.maxX(), 0);
- unsigned inverseCutoff = std::max(enclosingScreen.x() - inverseWidgetRectInScreen.x(), 0) + std::max(inverseWidgetRectInScreen.maxX() - enclosingScreen.maxX(), 0);
+ unsigned originalCutoff = std::max(screen.x() - widgetRectInScreen.x(), 0) + std::max(widgetRectInScreen.maxX() - screen.maxX(), 0);
+ unsigned inverseCutoff = std::max(screen.x() - inverseWidgetRectInScreen.x(), 0) + std::max(inverseWidgetRectInScreen.maxX() - screen.maxX(), 0);
// Accept the inverse popup alignment if the trimmed content gets
// shorter than that in the original alignment case.
@@ -198,7 +197,7 @@ IntRect PopupContainer::layoutAndCalculateWidgetRect(int targetControlHeight, co
IntRect widgetRectInScreen;
// If the popup would extend past the bottom of the screen, open upwards
// instead.
- FloatRect screen = screenAvailableRect(m_frameView.get());
+ IntRect screen = screenAvailableRect(m_frameView.get());
// Use popupInitialCoordinate.x() + rightOffset because RTL position
// needs to be considered.
float pageScaleFactor = m_frameView->frame().page()->pageScaleFactor();
@@ -209,7 +208,7 @@ IntRect PopupContainer::layoutAndCalculateWidgetRect(int targetControlHeight, co
// If we have multiple screens and the browser rect is in one screen, we
// have to clip the window width to the screen width.
// When clipping, we also need to set a maximum width for the list box.
- FloatRect windowRect = chromeClient().windowRect();
+ IntRect windowRect = chromeClient().windowRect();
bool needToResizeView = false;
widgetRectInScreen = layoutAndCalculateWidgetRectInternal(widgetRectInScreen, targetControlHeight, windowRect, screen, isRTL, rtlOffset, verticalOffset, transformOffset, m_listBox.get(), needToResizeView);
« no previous file with comments | « Source/web/PopupContainer.h ('k') | Source/web/PopupContainerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698