本文整理汇总了C++中LayoutUnit::setRawValue方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutUnit::setRawValue方法的具体用法?C++ LayoutUnit::setRawValue怎么用?C++ LayoutUnit::setRawValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutUnit
的用法示例。
在下文中一共展示了LayoutUnit::setRawValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(LayoutUnitTest, UnaryMinus) {
EXPECT_EQ(LayoutUnit(), -LayoutUnit());
EXPECT_EQ(LayoutUnit(999), -LayoutUnit(-999));
EXPECT_EQ(LayoutUnit(-999), -LayoutUnit(999));
LayoutUnit negativeMax;
negativeMax.setRawValue(LayoutUnit::min().rawValue() + 1);
EXPECT_EQ(negativeMax, -LayoutUnit::max());
EXPECT_EQ(LayoutUnit::max(), -negativeMax);
// -LayoutUnit::min() is saturated to LayoutUnit::max()
EXPECT_EQ(LayoutUnit::max(), -LayoutUnit::min());
}
示例2: mapRegionPointIntoFlowThreadCoordinates
LayoutPoint RenderRegion::mapRegionPointIntoFlowThreadCoordinates(const LayoutPoint& point)
{
// Assuming the point is relative to the region block, 3 cases will be considered:
// a) top margin, padding or border.
// b) bottom margin, padding or border.
// c) non-content region area.
LayoutUnit pointLogicalTop(isHorizontalWritingMode() ? point.y() : point.x());
LayoutUnit pointLogicalLeft(isHorizontalWritingMode() ? point.x() : point.y());
LayoutUnit flowThreadLogicalTop(isHorizontalWritingMode() ? m_flowThreadPortionRect.y() : m_flowThreadPortionRect.x());
LayoutUnit flowThreadLogicalLeft(isHorizontalWritingMode() ? m_flowThreadPortionRect.x() : m_flowThreadPortionRect.y());
LayoutUnit flowThreadPortionTopBound(isHorizontalWritingMode() ? m_flowThreadPortionRect.height() : m_flowThreadPortionRect.width());
LayoutUnit flowThreadPortionLeftBound(isHorizontalWritingMode() ? m_flowThreadPortionRect.width() : m_flowThreadPortionRect.height());
LayoutUnit flowThreadPortionTopMax(isHorizontalWritingMode() ? m_flowThreadPortionRect.maxY() : m_flowThreadPortionRect.maxX());
LayoutUnit flowThreadPortionLeftMax(isHorizontalWritingMode() ? m_flowThreadPortionRect.maxX() : m_flowThreadPortionRect.maxY());
LayoutUnit effectiveFixedPointDenominator;
effectiveFixedPointDenominator.setRawValue(1);
if (pointLogicalTop < 0) {
LayoutPoint pointInThread(0, flowThreadLogicalTop);
return isHorizontalWritingMode() ? pointInThread : pointInThread.transposedPoint();
}
if (pointLogicalTop >= flowThreadPortionTopBound) {
LayoutPoint pointInThread(flowThreadPortionLeftBound, flowThreadPortionTopMax - effectiveFixedPointDenominator);
return isHorizontalWritingMode() ? pointInThread : pointInThread.transposedPoint();
}
if (pointLogicalLeft < 0) {
LayoutPoint pointInThread(flowThreadLogicalLeft, pointLogicalTop + flowThreadLogicalTop);
return isHorizontalWritingMode() ? pointInThread : pointInThread.transposedPoint();
}
if (pointLogicalLeft >= flowThreadPortionLeftBound) {
LayoutPoint pointInThread(flowThreadPortionLeftMax - effectiveFixedPointDenominator, pointLogicalTop + flowThreadLogicalTop);
return isHorizontalWritingMode() ? pointInThread : pointInThread.transposedPoint();
}
LayoutPoint pointInThread(pointLogicalLeft + flowThreadLogicalLeft, pointLogicalTop + flowThreadLogicalTop);
return isHorizontalWritingMode() ? pointInThread : pointInThread.transposedPoint();
}