Пример #1
0
void RenderFileUploadControl::updateFromElement()
{
    HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
    ASSERT(input->isFileUpload());

    if (HTMLInputElement* button = uploadButton()) {
        bool newDisabled = !theme()->isEnabled(this);
        // We should avoid to call HTMLFormControlElement::setDisabled() as
        // possible because setAttribute() in setDisabled() can cause style
        // recalculation, and HTMLFormControlElement::recalcStyle() calls
        // updateFromElement() eventually.
        if (button->disabled() != newDisabled)
            button->setDisabled(newDisabled);

        bool newCanReceiveDroppedFilesState = input->canReceiveDroppedFiles();
        if (m_canReceiveDroppedFiles != newCanReceiveDroppedFilesState) {
            m_canReceiveDroppedFiles = newCanReceiveDroppedFilesState;
            button->setActive(newCanReceiveDroppedFilesState);
        }
    }

    // This only supports clearing out the files, but that's OK because for
    // security reasons that's the only change the DOM is allowed to make.
    FileList* files = input->files();
    ASSERT(files);
    if (files && files->isEmpty())
        repaint();
}
Пример #2
0
void RenderFileUploadControl::updateFromElement()
{
    HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
    ASSERT(input->isFileUpload());

    if (HTMLInputElement* button = uploadButton()) {
        bool newCanReceiveDroppedFilesState = input->canReceiveDroppedFiles();
        if (m_canReceiveDroppedFiles != newCanReceiveDroppedFilesState) {
            m_canReceiveDroppedFiles = newCanReceiveDroppedFilesState;
            button->setActive(newCanReceiveDroppedFilesState);
        }
    }

    // This only supports clearing out the files, but that's OK because for
    // security reasons that's the only change the DOM is allowed to make.
    FileList* files = input->files();
    ASSERT(files);
    if (files && files->isEmpty())
        repaint();
}
RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement& input, PassRef<RenderStyle> style)
    : RenderBlockFlow(input, WTF::move(style))
    , m_canReceiveDroppedFiles(input.canReceiveDroppedFiles())
{
}
Пример #4
0
RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement& input)
    : RenderBlockFlow(&input)
    , m_canReceiveDroppedFiles(input.canReceiveDroppedFiles())
{
}