summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebKit/chromium/src/WebPagePopupImpl.cpp
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebKit/chromium/src/WebPagePopupImpl.cpp')
-rw-r--r--Source/WebKit/chromium/src/WebPagePopupImpl.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
index fd5d2f2ad..18f5de20a 100644
--- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
+++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp
@@ -78,11 +78,7 @@ private:
virtual void setWindowRect(const FloatRect& rect) OVERRIDE
{
- IntRect intRect(rect);
- const WebRect currentRect = m_popup->m_windowRectInScreen;
- if (intRect.x() == currentRect.x && intRect.y() == currentRect.y && m_popup->m_isPutAboveOrigin)
- intRect.setY(currentRect.y + currentRect.height - intRect.height());
- m_popup->m_windowRectInScreen = intRect;
+ m_popup->m_windowRectInScreen = IntRect(rect);
m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen);
}
@@ -123,6 +119,11 @@ private:
return m_popup->m_webView;
}
+ virtual FloatSize minimumWindowSize() const OVERRIDE
+ {
+ return FloatSize(0, 0);
+ }
+
WebPagePopupImpl* m_popup;
};
@@ -141,7 +142,6 @@ bool PagePopupFeaturesClient::isEnabled(Document*, ContextFeatures::FeatureType
WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client)
: m_widgetClient(client)
- , m_isPutAboveOrigin(false)
{
ASSERT(client);
}
@@ -157,24 +157,13 @@ bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient,
ASSERT(popupClient);
m_webView = webView;
m_popupClient = popupClient;
+ m_originBoundsInRootView = originBoundsInRootView;
- WebSize rootViewSize = webView->size();
- IntSize popupSize = popupClient->contentSize();
- IntRect popupBoundsInRootView(IntPoint(max(0, originBoundsInRootView.x()), max(0, originBoundsInRootView.maxY())), popupSize);
- if (popupBoundsInRootView.maxY() > rootViewSize.height) {
- popupBoundsInRootView.setY(max(0, originBoundsInRootView.y() - popupSize.height()));
- m_isPutAboveOrigin = true;
- }
- if (popupBoundsInRootView.maxX() > rootViewSize.width)
- popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width()));
- IntRect boundsInScreen = webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView);
+ reposition(m_popupClient->contentSize());
- m_widgetClient->setWindowRect(boundsInScreen);
- m_windowRectInScreen = boundsInScreen;
if (!initPage())
return false;
m_widgetClient->show(WebNavigationPolicy());
-
setFocus(true);
return true;
@@ -242,8 +231,23 @@ void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect)
PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect, PageWidgetDelegate::Opaque);
}
+void WebPagePopupImpl::reposition(const WebSize& popupSize)
+{
+ WebSize rootViewSize = m_webView->size();
+ IntRect popupBoundsInRootView(IntPoint(max(0, m_originBoundsInRootView.x()), max(0, m_originBoundsInRootView.maxY())), popupSize);
+ if (popupBoundsInRootView.maxY() > rootViewSize.height)
+ popupBoundsInRootView.setY(max(0, m_originBoundsInRootView.y() - popupSize.height));
+ if (popupBoundsInRootView.maxX() > rootViewSize.width)
+ popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width));
+ IntRect boundsInScreen = m_webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView);
+ m_widgetClient->setWindowRect(boundsInScreen);
+ m_windowRectInScreen = boundsInScreen;
+}
+
void WebPagePopupImpl::resize(const WebSize& newSize)
{
+ reposition(newSize);
+
if (m_page)
m_page->mainFrame()->view()->resize(newSize);
m_widgetClient->didInvalidateRect(WebRect(0, 0, newSize.width, newSize.height));