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


C++ InlineFlowBox::borderLogicalLeft方法代码示例

本文整理汇总了C++中InlineFlowBox::borderLogicalLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox::borderLogicalLeft方法的具体用法?C++ InlineFlowBox::borderLogicalLeft怎么用?C++ InlineFlowBox::borderLogicalLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InlineFlowBox的用法示例。


在下文中一共展示了InlineFlowBox::borderLogicalLeft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: computePositionedLogicalWidth


//.........这里部分代码省略.........
            valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
        marginLogicalRightAlias =
            valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);

        // Solve for 'left'
        logicalLeftValue =
            availableSpace -
            (logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias);
    } else if (logicalRight.isAuto()) {
        marginLogicalLeftAlias =
            valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
        marginLogicalRightAlias =
            valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);

        // Solve for 'right'
        logicalRightValue =
            availableSpace -
            (logicalLeftValue + marginLogicalLeftAlias + marginLogicalRightAlias);
    } else if (marginLogicalLeft.isAuto()) {
        marginLogicalRightAlias =
            valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);

        // Solve for 'margin-left'
        marginLogicalLeftAlias =
            availableSpace -
            (logicalLeftValue + logicalRightValue + marginLogicalRightAlias);
    } else if (marginLogicalRight.isAuto()) {
        marginLogicalLeftAlias =
            valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);

        // Solve for 'margin-right'
        marginLogicalRightAlias =
            availableSpace -
            (logicalLeftValue + logicalRightValue + marginLogicalLeftAlias);
    } else {
        // Nothing is 'auto', just calculate the values.
        marginLogicalLeftAlias =
            valueForLength(marginLogicalLeft, containerRelativeLogicalWidth);
        marginLogicalRightAlias =
            valueForLength(marginLogicalRight, containerRelativeLogicalWidth);
        logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
        logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
        // If the containing block is right-to-left, then push the left position as
        // far to the right as possible
        if (containerDirection == RTL) {
            int totalLogicalWidth =
                (computedValues.m_extent + logicalLeftValue + logicalRightValue +
                 marginLogicalLeftAlias + marginLogicalRightAlias)
                .toInt();
            logicalLeftValue =
                containerLogicalWidth - (totalLogicalWidth - logicalLeftValue);
        }
    }

    // ---------------------------------------------------------------------------
    // 6. If at this point the values are over-constrained, ignore the value for
    //    either 'left' (in case the 'direction' property of the containing block
    //    is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that
    //    value.
    // ---------------------------------------------------------------------------
    // NOTE: Constraints imposed by the width of the containing block and its
    // content have already been accounted for above.
    //
    // FIXME: Deal with differing writing modes here.  Our offset needs to be in
    // the containing block's coordinate space, so that
    // can make the result here rather complicated to compute.
    //
    // Use computed values to calculate the horizontal position.
    //
    // FIXME: This hack is needed to calculate the logical left position for a
    // 'rtl' relatively positioned, inline containing block because right now, it
    // is using the logical left position of the first line box when really it
    // should use the last line box. When this is fixed elsewhere, this block
    // should be removed.
    if (containerBlock->isLayoutInline() &&
            !containerBlock->style()->isLeftToRightDirection()) {
        const LayoutInline* flow = toLayoutInline(containerBlock);
        InlineFlowBox* firstLine = flow->firstLineBox();
        InlineFlowBox* lastLine = flow->lastLineBox();
        if (firstLine && lastLine && firstLine != lastLine) {
            computedValues.m_position =
                logicalLeftValue + marginLogicalLeftAlias +
                lastLine->borderLogicalLeft() +
                (lastLine->logicalLeft() - firstLine->logicalLeft());
            return;
        }
    }

    LayoutUnit logicalLeftPos = logicalLeftValue + marginLogicalLeftAlias;
    computeLogicalLeftPositionedOffset(logicalLeftPos, this,
                                       computedValues.m_extent, containerBlock,
                                       containerLogicalWidth);
    computedValues.m_position = logicalLeftPos;
}
开发者ID:mirror,项目名称:chromium,代码行数:101,代码来源:LayoutReplaced.cpp


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