Index: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
index c1b513711c3747b6df2204199d5be67d57f4eaf1..391b5486f648de1f172eb69a84ebf8c90511dda4 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
@@ -1876,9 +1876,12 @@ IntRect HTMLSelectElement::elementRectRelativeToViewport() const |
{ |
if (!layoutObject()) |
return IntRect(); |
+ // Initialize with this frame rectangle relative to the viewport. |
+ IntRect rect = document().view()->convertToRootFrame(document().view()->boundsRect()); |
// We don't use absoluteBoundingBoxRect() because it can return an IntRect |
// larger the actual size by 1px. |
- return document().view()->contentsToViewport(roundedIntRect(layoutObject()->absoluteBoundingBoxFloatRect())); |
+ rect.intersect(document().view()->contentsToViewport(roundedIntRect(layoutObject()->absoluteBoundingBoxFloatRect()))); |
+ return rect; |
} |
LayoutUnit HTMLSelectElement::clientPaddingLeft() const |
@@ -1951,6 +1954,8 @@ void HTMLSelectElement::showPopup() |
return; |
if (!layoutObject() || !layoutObject()->isMenuList()) |
return; |
+ if (elementRectRelativeToViewport().isEmpty()) |
+ return; |
if (!m_popup) |
m_popup = document().frameHost()->chromeClient().openPopupMenu(*document().frame(), *this); |