本文整理汇总了C++中LayoutUnit::toFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutUnit::toFloat方法的具体用法?C++ LayoutUnit::toFloat怎么用?C++ LayoutUnit::toFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutUnit
的用法示例。
在下文中一共展示了LayoutUnit::toFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
const Shape& ShapeOutsideInfo::computedShape() const
{
if (Shape* shape = m_shape.get())
return *shape;
const RenderStyle& style = *m_renderer.style();
ASSERT(m_renderer.containingBlock());
const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->style();
WritingMode writingMode = containingBlockStyle.writingMode();
LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit();
float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximumValue.toFloat());
float shapeImageThreshold = style.shapeImageThreshold();
ASSERT(style.shapeOutside());
const ShapeValue& shapeValue = *style.shapeOutside();
switch (shapeValue.type()) {
case ShapeValue::Shape:
ASSERT(shapeValue.shape());
m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin);
break;
case ShapeValue::Image:
ASSERT(shapeValue.isImageValid());
m_shape = createShapeForImage(shapeValue.image(), shapeImageThreshold, writingMode, margin);
break;
case ShapeValue::Box: {
const RoundedRect& shapeRect = style.getRoundedBorderFor(LayoutRect(LayoutPoint(), m_referenceBoxLogicalSize), m_renderer.view());
m_shape = Shape::createLayoutBoxShape(shapeRect, writingMode, margin);
break;
}
}
ASSERT(m_shape);
return *m_shape;
}
示例2: number
// These helpers are only used by the PODIntervalTree for debugging purposes.
String ValueToString<LayoutUnit>::toString(const LayoutUnit value) {
return String::number(value.toFloat());
}