本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}