当前位置: 首页>>代码示例>>C++>>正文


C++ LayoutRect::center方法代码示例

本文整理汇总了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;
}
开发者ID:dreamsxin,项目名称:WebCore,代码行数:19,代码来源:RenderMultiColumnFlowThread.cpp

示例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;
}
开发者ID:rgabor-dev,项目名称:webkitnix,代码行数:24,代码来源:RenderFlowThread.cpp

示例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;
}
开发者ID:PTaylour,项目名称:webkit,代码行数:36,代码来源:RenderMultiColumnFlowThread.cpp

示例4: center

static inline LayoutUnit middle(FocusType type, const LayoutRect& rect)
{
    LayoutPoint center(rect.center());
    return isHorizontalMove(type) ? center.y(): center.x();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:5,代码来源:SpatialNavigation.cpp

示例5: center

static inline LayoutUnit middle(FocusDirection direction, const LayoutRect& rect)
{
    LayoutPoint center(rect.center());
    return isHorizontalMove(direction) ? center.y(): center.x();
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:5,代码来源:SpatialNavigation.cpp


注:本文中的LayoutRect::center方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。