当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLMeterElement::min方法代码示例

本文整理汇总了C++中HTMLMeterElement::min方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLMeterElement::min方法的具体用法?C++ HTMLMeterElement::min怎么用?C++ HTMLMeterElement::min使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLMeterElement的用法示例。


在下文中一共展示了HTMLMeterElement::min方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: jsHTMLMeterElementMin

JSValue jsHTMLMeterElementMin(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl());
    JSValue result = jsNumber(imp->min());
    return result;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSHTMLMeterElement.cpp

示例2: valueRatio

double RenderMeter::valueRatio() const
{
    HTMLMeterElement* element = static_cast<HTMLMeterElement*>(node());
    double min = element->min();
    double max = element->max();
    double value = element->value();

    if (max <= min)
        return 0;
    return (value - min) / (max - min);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例3: paintMeter

bool RenderTheme::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
{
    // Some platforms do not have a native gauge widget, so we draw here a default implementation.
    RenderMeter* renderMeter = toRenderMeter(renderObject);
    RenderStyle* style = renderObject->style();
    int left = style->borderLeft().width() + style->paddingLeft().value();
    int top = style->borderTop().width() + style->paddingTop().value();
    int right = style->borderRight().width() + style->paddingRight().value();
    int bottom = style->borderBottom().width() + style->paddingBottom().value();
    FloatRect innerRect(rect.x() + left, rect.y() + top, rect.width() - left - right, rect.height() - top - bottom);

    HTMLMeterElement* element = static_cast<HTMLMeterElement*>(renderMeter->node());
    double min = element->min();
    double max = element->max();
    double value = element->value();

    if (min >= max) {
        paintInfo.context->fillRect(innerRect, Color::black, style->colorSpace());
        return false;
    }

    // Paint the background first
    paintInfo.context->fillRect(innerRect, Color::lightGray, style->colorSpace());

    FloatRect valueRect;

    if (rect.width() < rect.height()) {
        // Vertical gauge
        double scale = innerRect.height() / (max - min);
        valueRect.setLocation(FloatPoint(innerRect.x(), innerRect.y() + narrowPrecisionToFloat((max - value) * scale)));
        valueRect.setSize(FloatSize(innerRect.width(), narrowPrecisionToFloat((value - min) * scale)));
    } else if (renderMeter->style()->direction() == RTL) {
        // right to left horizontal gauge
        double scale = innerRect.width() / (max - min);
        valueRect.setLocation(FloatPoint(innerRect.x() + narrowPrecisionToFloat((max - value) * scale), innerRect.y()));
        valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min) * scale), innerRect.height()));
    } else {
        // left to right horizontal gauge
        double scale = innerRect.width() / (max - min);
        valueRect.setLocation(innerRect.location());
        valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min)) * scale, innerRect.height()));
    }
    if (!valueRect.isEmpty())
        paintInfo.context->fillRect(valueRect, Color::black, style->colorSpace());

    return false;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:47,代码来源:RenderTheme.cpp

示例4: paintMeter

bool RenderThemeNix::paintMeter(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
    if (!o->isMeter())
        return true;

    RenderMeter* renderMeter = toRenderMeter(o);
    HTMLMeterElement* e = renderMeter->meterElement();
    WebKit::WebThemeEngine::MeterExtraParams extraParams;
    extraParams.min = e->min();
    extraParams.max = e->max();
    extraParams.value = e->value();
    extraParams.low = e->low();
    extraParams.high = e->high();
    extraParams.optimum = e->optimum();

    themeEngine()->paintMeter(webCanvas(i), getWebThemeState(this, o), rect, extraParams);

    return false;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:19,代码来源:RenderThemeNix.cpp


注:本文中的HTMLMeterElement::min方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。