summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-20 18:42:15 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-20 18:42:15 +0000
commit0cb165a2ba40eb2c5b338ff183ce8ad1139eca18 (patch)
tree1f5bfe67229d7dfe2116f1b56a32652230b9b1c2 /webkit/port
parent7082ef02ec7b3299912bdf9829950d1b6125f080 (diff)
downloadchromium_src-0cb165a2ba40eb2c5b338ff183ce8ad1139eca18.zip
chromium_src-0cb165a2ba40eb2c5b338ff183ce8ad1139eca18.tar.gz
chromium_src-0cb165a2ba40eb2c5b338ff183ce8ad1139eca18.tar.bz2
Fixed crash when clicking empty select element.
I believe this is not needed: if (windowHeight == 0) windowHeight = min(getRowHeight(-1), kMaxHeight); windowHeight is dependent on the number of items within the popup, if you have no items within the popup, it returns 0. I don't understand why we need to do "min(getRowHeight(-1), kMaxHeight)" when its 0, that doesn't make sense to me. Since getRowHeight gets the height of that item@index, everyone knows there are no item for index -1 (hence crash). Patch by Mohamed Mansour R=darin BUG=4334 (http://crbug.com/4334) TEST=<select></select> git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/platform/chromium/PopupMenuChromium.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/webkit/port/platform/chromium/PopupMenuChromium.cpp b/webkit/port/platform/chromium/PopupMenuChromium.cpp
index 82696cf..fb350e9 100644
--- a/webkit/port/platform/chromium/PopupMenuChromium.cpp
+++ b/webkit/port/platform/chromium/PopupMenuChromium.cpp
@@ -893,7 +893,11 @@ void PopupListBox::setOriginalIndex(int index)
int PopupListBox::getRowHeight(int index)
{
- return m_popupClient->itemStyle(index).font().height();
+ if (index >= 0) {
+ return m_popupClient->itemStyle(index).font().height();
+ } else {
+ return 0;
+ }
}
IntRect PopupListBox::getRowBounds(int index)
@@ -1035,9 +1039,6 @@ void PopupListBox::layout()
windowHeight += rowHeight;
}
- if (windowHeight == 0)
- windowHeight = min(getRowHeight(-1), kMaxHeight);
-
// Set our widget and scrollable contents sizes.
int scrollbarWidth = 0;
if (m_visibleRows < numItems())
@@ -1055,7 +1056,7 @@ void PopupListBox::layout()
resize(windowWidth, windowHeight);
setContentsSize(IntSize(contentWidth, getRowBounds(numItems() - 1).bottom()));
-
+
if (hostWindow())
scrollToRevealSelection();