Diff
Modified: trunk/Source/WebCore/ChangeLog (125168 => 125169)
--- trunk/Source/WebCore/ChangeLog 2012-08-09 12:24:47 UTC (rev 125168)
+++ trunk/Source/WebCore/ChangeLog 2012-08-09 12:43:21 UTC (rev 125169)
@@ -1,3 +1,15 @@
+2012-08-09 Keishi Hattori <[email protected]>
+
+ Page popups can show up at wrong locations
+ https://bugs.webkit.org/show_bug.cgi?id=93556
+
+ Reviewed by Kent Tamura.
+
+ No new tests. Cannot test popup position.
+
+ * html/shadow/CalendarPickerElement.cpp:
+ (WebCore::CalendarPickerElement::contentSize):
+
2012-08-08 Andrey Kosyakov <[email protected]>
Web Inspector: display progress bar while loading timeline data
Modified: trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp (125168 => 125169)
--- trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp 2012-08-09 12:24:47 UTC (rev 125168)
+++ trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp 2012-08-09 12:43:21 UTC (rev 125169)
@@ -148,7 +148,7 @@
IntSize CalendarPickerElement::contentSize()
{
- return IntSize(100, 100);
+ return IntSize(0, 0);
}
void CalendarPickerElement::writeDocument(DocumentWriter& writer)
Modified: trunk/Source/WebKit/chromium/ChangeLog (125168 => 125169)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-09 12:24:47 UTC (rev 125168)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-09 12:43:21 UTC (rev 125169)
@@ -1,3 +1,26 @@
+2012-08-09 Keishi Hattori <[email protected]>
+
+ Page popups can show up at wrong locations
+ https://bugs.webkit.org/show_bug.cgi?id=93556
+
+ Reviewed by Kent Tamura.
+
+ We were showing the popup at wrong positions. When there isn't enough
+ room below and above the element it adjusts the position but we weren't
+ resetting the adjustment when we resize the popup. This patch will make
+ the popup adjust the popup position each time we resize.
+
+ * src/ColorChooserUIController.cpp:
+ (WebKit::ColorChooserUIController::contentSize):
+ * src/WebPagePopupImpl.cpp:
+ (WevKit::PagePopupChromeClient::setWindowRect):
+ (WebKit::WebPagePopupImpl::init): Use reposition().
+ (WebKit::WebPagePopupImpl::reposition): Repositions the page popup based on the popup size.
+ (WebKit):
+ (WebKit::WebPagePopupImpl::resize): Use reposition().
+ * src/WebPagePopupImpl.h:
+ (WebPagePopupImpl):
+
2012-08-09 Peter Beverloo <[email protected]>
[Chromium] Pull in the android_tools directory for Android
Modified: trunk/Source/WebKit/chromium/src/ColorChooserUIController.cpp (125168 => 125169)
--- trunk/Source/WebKit/chromium/src/ColorChooserUIController.cpp 2012-08-09 12:24:47 UTC (rev 125168)
+++ trunk/Source/WebKit/chromium/src/ColorChooserUIController.cpp 2012-08-09 12:43:21 UTC (rev 125169)
@@ -92,7 +92,7 @@
WebCore::IntSize ColorChooserUIController::contentSize()
{
- return WebCore::IntSize(300, 300);
+ return WebCore::IntSize(0, 0);
}
void ColorChooserUIController::writeDocument(WebCore::DocumentWriter& writer)
Modified: trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp (125168 => 125169)
--- trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp 2012-08-09 12:24:47 UTC (rev 125168)
+++ trunk/Source/WebKit/chromium/src/WebPagePopupImpl.cpp 2012-08-09 12:43:21 UTC (rev 125169)
@@ -78,11 +78,7 @@
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);
}
@@ -146,7 +142,6 @@
WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client)
: m_widgetClient(client)
- , m_isPutAboveOrigin(false)
{
ASSERT(client);
}
@@ -162,24 +157,13 @@
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;
@@ -247,8 +231,23 @@
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));
Modified: trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h (125168 => 125169)
--- trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h 2012-08-09 12:24:47 UTC (rev 125168)
+++ trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h 2012-08-09 12:43:21 UTC (rev 125169)
@@ -87,14 +87,15 @@
explicit WebPagePopupImpl(WebWidgetClient*);
bool initPage();
+ void reposition(const WebSize&);
WebWidgetClient* m_widgetClient;
WebRect m_windowRectInScreen;
+ WebCore::IntRect m_originBoundsInRootView;
WebViewImpl* m_webView;
OwnPtr<WebCore::Page> m_page;
OwnPtr<PagePopupChromeClient> m_chromeClient;
WebCore::PagePopupClient* m_popupClient;
- bool m_isPutAboveOrigin;
friend class WebPagePopup;
friend class PagePopupChromeClient;