コード例 #1
0
ファイル: PopupContainer.cpp プロジェクト: RobinWuDev/Qt
void PopupContainer::showPopup(FrameView* view)
{
    m_frameView = view;
    m_listBox->m_focusedElement = m_frameView->frame().document()->focusedElement();

    IntSize transformOffset(m_controlPosition.p4().x() - m_controlPosition.p1().x(), m_controlPosition.p4().y() - m_controlPosition.p1().y() - m_controlSize.height());
    popupOpened(layoutAndCalculateWidgetRect(m_controlSize.height(), transformOffset, roundedIntPoint(m_controlPosition.p4())));
    m_popupOpen = true;

    if (!m_listBox->parent())
        m_listBox->setParent(this);

    m_listBox->scrollToRevealSelection();

    invalidate();
}
コード例 #2
0
ファイル: PopupContainer.cpp プロジェクト: ragner/webkit
IntRect PopupContainer::refresh(const IntRect& targetControlRect)
{
    listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0));
    listBox()->updateFromElement();

    IntPoint locationInWindow = m_frameView->contentsToWindow(targetControlRect.location());

    // Move it below the select widget.
    locationInWindow.move(0, targetControlRect.height());

    IntRect widgetRectInScreen = layoutAndCalculateWidgetRect(targetControlRect.height(), locationInWindow);

    // Reset the size (which can be set to the PopupListBox size in layoutAndGetRTLOffset(), exceeding the available widget rectangle.)
    if (size() != widgetRectInScreen.size())
        resize(widgetRectInScreen.size());

    invalidate();

    return widgetRectInScreen;
}
コード例 #3
0
void PopupContainer::showPopup(FrameView* view)
{
    m_frameView = view;
    listBox()->m_focusedElement = m_frameView->frame().document()->focusedElement();

    IntSize transformOffset(m_controlPosition.p4().x() - m_controlPosition.p1().x(), m_controlPosition.p4().y() - m_controlPosition.p1().y() - m_controlSize.height());
    popupOpened(layoutAndCalculateWidgetRect(m_controlSize.height(), transformOffset, roundedIntPoint(m_controlPosition.p4())));
    m_popupOpen = true;

    if (!m_listBox->parent())
        addChild(m_listBox.get());

    // Enable scrollbars after the listbox is inserted into the hierarchy,
    // so it has a proper WidgetClient.
    m_listBox->setVerticalScrollbarMode(ScrollbarAuto);

    m_listBox->scrollToRevealSelection();

    invalidate();
}
コード例 #4
0
void PopupContainer::showPopup(FrameView* view)
{
    m_frameView = view;
    listBox()->m_focusedNode = m_frameView->frame()->document()->focusedNode();

    if (ChromeClient* client = chromeClient()) {
        IntRect popupRect = m_originalFrameRect;
        client->popupOpened(this, layoutAndCalculateWidgetRect(popupRect.height(), popupRect.location()), false);
        m_popupOpen = true;
    }

    if (!m_listBox->parent())
        addChild(m_listBox.get());

    // Enable scrollbars after the listbox is inserted into the hierarchy,
    // so it has a proper WidgetClient.
    m_listBox->setVerticalScrollbarMode(ScrollbarAuto);

    m_listBox->scrollToRevealSelection();

    invalidate();
}
コード例 #5
0
void PopupContainer::refresh(const IntRect& targetControlRect)
{
    IntPoint location = m_frameView->contentsToWindow(targetControlRect.location());
    // Move it below the select widget.
    location.move(0, targetControlRect.height());

    listBox()->setBaseWidth(max(m_originalFrameRect.width() - kBorderSize * 2, 0));

    listBox()->updateFromElement();
    // Store the original size to check if we need to request the location.
    IntSize originalSize = size();
    IntRect widgetRect = layoutAndCalculateWidgetRect(targetControlRect.height(), location);
    if (originalSize != widgetRect.size()) {
        ChromeClientChromium* chromeClient = chromeClientChromium();
        if (chromeClient) {
            IntPoint widgetLocation = chromeClient->screenToRootView(widgetRect.location());
            widgetRect.setLocation(widgetLocation);
            setFrameRect(widgetRect);
        }
    }

    invalidate();
}