void HTMLProgressElement::didElementStateChange()
{
    m_value->setWidthPercentage(position() * 100);
    if (renderer()) {
        RenderProgress* render = toRenderProgress(renderer());
        bool wasDeterminate = render->isDeterminate();
        renderer()->updateFromElement();
        if (wasDeterminate != isDeterminate())
            setNeedsStyleRecalc();
    }
}
void LayoutProgress::updateAnimationState()
{
    m_animationDuration = LayoutTheme::theme().animationDurationForProgressBar();
    m_animationRepeatInterval = LayoutTheme::theme().animationRepeatIntervalForProgressBar();

    bool animating = !isDeterminate() && style()->hasAppearance() && m_animationDuration > 0;
    if (animating == m_animating)
        return;

    m_animating = animating;
    if (m_animating) {
        m_animationStartTime = currentTime();
        m_animationTimer.startOneShot(m_animationRepeatInterval, BLINK_FROM_HERE);
    } else {
        m_animationTimer.stop();
    }
}
double HTMLProgressElement::position() const
{
    if (!isDeterminate())
        return HTMLProgressElement::IndeterminatePosition;
    return value() / max();
}