void RenderListBox::autoscroll() { IntPoint pos = document()->frame()->view()->windowToContents(document()->frame()->eventHandler()->currentMousePosition()); int rx = 0; int ry = 0; absolutePosition(rx, ry); int offsetX = pos.x() - rx; int offsetY = pos.y() - ry; int endIndex = -1; int rows = numVisibleItems(); int offset = m_indexOffset; if (offsetY < borderTop() + paddingTop() && scrollToRevealElementAtListIndex(offset - 1)) endIndex = offset - 1; else if (offsetY > height() - paddingBottom() - borderBottom() && scrollToRevealElementAtListIndex(offset + rows)) endIndex = offset + rows - 1; else endIndex = listIndexAtOffset(offsetX, offsetY); if (endIndex >= 0) { HTMLSelectElement* select = static_cast<HTMLSelectElement*>(node()); m_inAutoscroll = true; if (!select->multiple()) select->setActiveSelectionAnchorIndex(endIndex); select->setActiveSelectionEndIndex(endIndex); select->updateListBoxSelection(!select->multiple()); m_inAutoscroll = false; } }
void RenderListBox::autoscroll() { IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->currentMousePosition()); int endIndex = scrollToward(pos); if (endIndex >= 0) { HTMLSelectElement* select = toHTMLSelectElement(node()); m_inAutoscroll = true; if (!select->multiple()) select->setActiveSelectionAnchorIndex(endIndex); select->setActiveSelectionEndIndex(endIndex); select->updateListBoxSelection(!select->multiple()); m_inAutoscroll = false; } }