本文整理汇总了C++中LayoutRect::center方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutRect::center方法的具体用法?C++ LayoutRect::center怎么用?C++ LayoutRect::center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutRect
的用法示例。
在下文中一共展示了LayoutRect::center方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapFromFlowToRegion
RenderRegion* RenderMultiColumnFlowThread::mapFromFlowToRegion(TransformState& transformState) const
{
if (!hasValidRegionInfo())
return nullptr;
// Get back into our local flow thread space.
LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox();
flipForWritingMode(boxRect);
// FIXME: We need to refactor RenderObject::absoluteQuads to be able to split the quads across regions,
// for now we just take the center of the mapped enclosing box and map it to a column.
LayoutPoint centerPoint = boxRect.center();
LayoutUnit centerLogicalOffset = isHorizontalWritingMode() ? centerPoint.y() : centerPoint.x();
RenderRegion* renderRegion = const_cast<RenderMultiColumnFlowThread*>(this)->regionAtBlockOffset(this, centerLogicalOffset, true, DisallowRegionAutoGeneration);
if (!renderRegion)
return nullptr;
transformState.move(physicalTranslationOffsetFromFlowToRegion(renderRegion, centerLogicalOffset));
return renderRegion;
}
示例2: mapFromFlowToRegion
RenderRegion* RenderFlowThread::mapFromFlowToRegion(TransformState& transformState) const
{
if (!hasValidRegionInfo())
return 0;
LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox();
flipForWritingMode(boxRect);
// FIXME: We need to refactor RenderObject::absoluteQuads to be able to split the quads across regions,
// for now we just take the center of the mapped enclosing box and map it to a region.
// Note: Using the center in order to avoid rounding errors.
LayoutPoint center = boxRect.center();
RenderRegion* renderRegion = regionAtBlockOffset(isHorizontalWritingMode() ? center.y() : center.x(), true);
if (!renderRegion)
return 0;
LayoutRect flippedRegionRect(renderRegion->flowThreadPortionRect());
flipForWritingMode(flippedRegionRect);
transformState.move(renderRegion->contentBoxRect().location() - flippedRegionRect.location());
return renderRegion;
}
示例3: mapFromFlowToRegion
RenderRegion* RenderMultiColumnFlowThread::mapFromFlowToRegion(TransformState& transformState) const
{
if (!hasValidRegionInfo())
return nullptr;
// Get back into our local flow thread space.
LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox();
flipForWritingMode(boxRect);
// FIXME: We need to refactor RenderObject::absoluteQuads to be able to split the quads across regions,
// for now we just take the center of the mapped enclosing box and map it to a column.
LayoutPoint center = boxRect.center();
LayoutUnit centerOffset = isHorizontalWritingMode() ? center.y() : center.x();
RenderRegion* renderRegion = const_cast<RenderMultiColumnFlowThread*>(this)->regionAtBlockOffset(this, centerOffset, true, DisallowRegionAutoGeneration);
if (!renderRegion)
return nullptr;
// Now that we know which multicolumn set we hit, we need to get the appropriate translation offset for the column.
RenderMultiColumnSet* columnSet = toRenderMultiColumnSet(renderRegion);
LayoutPoint translationOffset = columnSet->columnTranslationForOffset(centerOffset);
// Now we know how we want the rect to be translated into the region.
LayoutRect flippedRegionRect(renderRegion->flowThreadPortionRect());
if (isHorizontalWritingMode())
flippedRegionRect.setHeight(columnSet->computedColumnHeight());
else
flippedRegionRect.setWidth(columnSet->computedColumnHeight());
flipForWritingMode(flippedRegionRect);
flippedRegionRect.moveBy(-translationOffset);
// There is an additional offset to apply, which is the offset of the region within the multi-column space.
transformState.move(renderRegion->contentBoxRect().location() - flippedRegionRect.location());
return renderRegion;
}
示例4: center
static inline LayoutUnit middle(FocusType type, const LayoutRect& rect)
{
LayoutPoint center(rect.center());
return isHorizontalMove(type) ? center.y(): center.x();
}
示例5: center
static inline LayoutUnit middle(FocusDirection direction, const LayoutRect& rect)
{
LayoutPoint center(rect.center());
return isHorizontalMove(direction) ? center.y(): center.x();
}