This source file includes following definitions.
- meterElement
- updateLogicalWidth
- computeLogicalHeight
- valueRatio
- updateFromElement
#include "config.h"
#include "core/rendering/RenderMeter.h"
#include "core/html/HTMLMeterElement.h"
#include "core/rendering/RenderTheme.h"
using namespace std;
namespace WebCore {
using namespace HTMLNames;
RenderMeter::RenderMeter(HTMLElement* element)
: RenderBlockFlow(element)
{
}
RenderMeter::~RenderMeter()
{
}
HTMLMeterElement* RenderMeter::meterElement() const
{
ASSERT(node());
if (isHTMLMeterElement(*node()))
return toHTMLMeterElement(node());
ASSERT(node()->shadowHost());
return toHTMLMeterElement(node()->shadowHost());
}
void RenderMeter::updateLogicalWidth()
{
RenderBox::updateLogicalWidth();
IntSize frameSize = RenderTheme::theme().meterSizeForBounds(this, pixelSnappedIntRect(frameRect()));
setLogicalWidth(isHorizontalWritingMode() ? frameSize.width() : frameSize.height());
}
void RenderMeter::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
LayoutRect frame = frameRect();
if (isHorizontalWritingMode())
frame.setHeight(computedValues.m_extent);
else
frame.setWidth(computedValues.m_extent);
IntSize frameSize = RenderTheme::theme().meterSizeForBounds(this, pixelSnappedIntRect(frame));
computedValues.m_extent = isHorizontalWritingMode() ? frameSize.height() : frameSize.width();
}
double RenderMeter::valueRatio() const
{
return meterElement()->valueRatio();
}
void RenderMeter::updateFromElement()
{
repaint();
}
}