https://bugs.webkit.org/show_bug.cgi?id=84116
Reviewed by Kentaro Hara.
This makes no behavior change. Just move some code.
To fix Bug 84007, WebPagePopupImpl needs to know if the popup is
above the target element or below the target element.
* src/WebPagePopupImpl.cpp:
(WebKit::WebPagePopupImpl::init): Move some code from WebViewImpl::openPagePopup().
* src/WebPagePopupImpl.h:
(WebPagePopupImpl): Rename an argument name.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::openPagePopup): Move some code to WebPagePopupImpl::init().
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114336
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-16 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Move popup location detection code from WebViewImpl to WebPagePopupImpl
+ https://bugs.webkit.org/show_bug.cgi?id=84116
+
+ Reviewed by Kentaro Hara.
+
+ This makes no behavior change. Just move some code.
+ To fix Bug 84007, WebPagePopupImpl needs to know if the popup is
+ above the target element or below the target element.
+
+ * src/WebPagePopupImpl.cpp:
+ (WebKit::WebPagePopupImpl::init): Move some code from WebViewImpl::openPagePopup().
+ * src/WebPagePopupImpl.h:
+ (WebPagePopupImpl): Rename an argument name.
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::openPagePopup): Move some code to WebPagePopupImpl::init().
+
2012-04-13 James Robinson <jamesr@chromium.org>
[chromium] Expose WebVideoLayer to Platform API and port WebMediaPlayerClientImpl to using it
#include "config.h"
#include "WebPagePopupImpl.h"
+#include "Chrome.h"
#include "EmptyClients.h"
#include "FileChooser.h"
#include "FocusController.h"
#include "WebInputEvent.h"
#include "WebInputEventConversion.h"
#include "WebPagePopup.h"
+#include "WebViewImpl.h"
#include "WebWidgetClient.h"
using namespace WebCore;
+using namespace std;
namespace WebKit {
ASSERT(!m_page);
}
-bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient, const IntRect& boundsInScreen)
+bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient, const IntRect& originBoundsInRootView)
{
ASSERT(webView);
ASSERT(popupClient);
m_webView = webView;
m_popupClient = popupClient;
+ 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()));
+ if (popupBoundsInRootView.maxX() > rootViewSize.width)
+ popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width()));
+ IntRect boundsInScreen = webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView);
+
m_widgetClient->setWindowRect(boundsInScreen);
m_windowRectInScreen = boundsInScreen;
if (!initPage())
WTF_MAKE_FAST_ALLOCATED;
public:
- bool init(WebViewImpl*, WebCore::PagePopupClient*, const WebCore::IntRect& boundsInScreen);
+ bool init(WebViewImpl*, WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView);
bool handleKeyEvent(const WebCore::PlatformKeyboardEvent&);
void closePopup();
WebWidgetClient* widgetClient() const { return m_widgetClient; }
WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
ASSERT(popupWidget);
m_pagePopup = static_cast<WebPagePopupImpl*>(popupWidget);
- WebSize rootViewSize = size();
- IntSize popupSize = client->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()));
- if (popupBoundsInRootView.maxX() > rootViewSize.width)
- popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width()));
- if (!m_pagePopup->init(this, client, m_chromeClientImpl.rootViewToScreen(popupBoundsInRootView))) {
+ if (!m_pagePopup->init(this, client, originBoundsInRootView)) {
m_pagePopup->closePopup();
m_pagePopup = 0;
}