本文整理汇总了C++中InlineFlowBox::logicalLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineFlowBox::logicalLeft方法的具体用法?C++ InlineFlowBox::logicalLeft怎么用?C++ InlineFlowBox::logicalLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineFlowBox
的用法示例。
在下文中一共展示了InlineFlowBox::logicalLeft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computePositionedLogicalWidth
void LayoutReplaced::computePositionedLogicalWidth(
LogicalExtentComputedValues& computedValues) const {
// The following is based off of the W3C Working Draft from April 11, 2006 of
// CSS 2.1: Section 10.3.8 "Absolutely positioned, replaced elements"
// <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-replaced-width>
// (block-style-comments in this function correspond to text from the spec and
// the numbers correspond to numbers in spec).
// We don't use containingBlock(), since we may be positioned by an enclosing
// relative positioned inline.
const LayoutBoxModelObject* containerBlock =
toLayoutBoxModelObject(container());
const LayoutUnit containerLogicalWidth =
containingBlockLogicalWidthForPositioned(containerBlock);
const LayoutUnit containerRelativeLogicalWidth =
containingBlockLogicalWidthForPositioned(containerBlock, false);
// To match WinIE, in quirks mode use the parent's 'direction' property
// instead of the the container block's.
TextDirection containerDirection = containerBlock->style()->direction();
// Variables to solve.
bool isHorizontal = isHorizontalWritingMode();
Length logicalLeft = style()->logicalLeft();
Length logicalRight = style()->logicalRight();
Length marginLogicalLeft =
isHorizontal ? style()->marginLeft() : style()->marginTop();
Length marginLogicalRight =
isHorizontal ? style()->marginRight() : style()->marginBottom();
LayoutUnit& marginLogicalLeftAlias = style()->isLeftToRightDirection()
? computedValues.m_margins.m_start
: computedValues.m_margins.m_end;
LayoutUnit& marginLogicalRightAlias = style()->isLeftToRightDirection()
? computedValues.m_margins.m_end
: computedValues.m_margins.m_start;
// ---------------------------------------------------------------------------
// 1. The used value of 'width' is determined as for inline replaced
// elements.
// ---------------------------------------------------------------------------
// NOTE: This value of width is final in that the min/max width calculations
// are dealt with in computeReplacedWidth(). This means that the steps to
// produce correct max/min in the non-replaced version, are not necessary.
computedValues.m_extent =
computeReplacedLogicalWidth() + borderAndPaddingLogicalWidth();
const LayoutUnit availableSpace =
containerLogicalWidth - computedValues.m_extent;
// ---------------------------------------------------------------------------
// 2. If both 'left' and 'right' have the value 'auto', then if 'direction'
// of the containing block is 'ltr', set 'left' to the static position;
// else if 'direction' is 'rtl', set 'right' to the static position.
// ---------------------------------------------------------------------------
// see FIXME 1
computeInlineStaticDistance(logicalLeft, logicalRight, this, containerBlock,
containerLogicalWidth);
// ---------------------------------------------------------------------------
// 3. If 'left' or 'right' are 'auto', replace any 'auto' on 'margin-left'
// or 'margin-right' with '0'.
// ---------------------------------------------------------------------------
if (logicalLeft.isAuto() || logicalRight.isAuto()) {
if (marginLogicalLeft.isAuto())
marginLogicalLeft.setValue(Fixed, 0);
if (marginLogicalRight.isAuto())
marginLogicalRight.setValue(Fixed, 0);
}
// ---------------------------------------------------------------------------
// 4. If at this point both 'margin-left' and 'margin-right' are still 'auto',
// solve the equation under the extra constraint that the two margins must
// get equal values, unless this would make them negative, in which case
// when the direction of the containing block is 'ltr' ('rtl'), set
// 'margin-left' ('margin-right') to zero and solve for 'margin-right'
// ('margin-left').
// ---------------------------------------------------------------------------
LayoutUnit logicalLeftValue;
LayoutUnit logicalRightValue;
if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
// 'left' and 'right' cannot be 'auto' due to step 3
ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
LayoutUnit difference =
availableSpace - (logicalLeftValue + logicalRightValue);
if (difference > LayoutUnit()) {
marginLogicalLeftAlias = difference / 2; // split the difference
marginLogicalRightAlias =
difference -
marginLogicalLeftAlias; // account for odd valued differences
} else {
// Use the containing block's direction rather than the parent block's
// per CSS 2.1 reference test abspos-replaced-width-margin-000.
if (containerDirection == LTR) {
marginLogicalLeftAlias = LayoutUnit();
//.........这里部分代码省略.........