本文整理汇总了C++中LayoutSize::expand方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutSize::expand方法的具体用法?C++ LayoutSize::expand怎么用?C++ LayoutSize::expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutSize
的用法示例。
在下文中一共展示了LayoutSize::expand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setReferenceBoxLogicalSize
void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogicalSize)
{
bool isHorizontalWritingMode = m_renderer.containingBlock()->style()->isHorizontalWritingMode();
switch (referenceBox(*m_renderer.style()->shapeOutside())) {
case MarginBox:
if (isHorizontalWritingMode)
newReferenceBoxLogicalSize.expand(m_renderer.marginWidth(), m_renderer.marginHeight());
else
newReferenceBoxLogicalSize.expand(m_renderer.marginHeight(), m_renderer.marginWidth());
break;
case BorderBox:
break;
case PaddingBox:
if (isHorizontalWritingMode)
newReferenceBoxLogicalSize.shrink(m_renderer.borderWidth(), m_renderer.borderHeight());
else
newReferenceBoxLogicalSize.shrink(m_renderer.borderHeight(), m_renderer.borderWidth());
break;
case ContentBox:
if (isHorizontalWritingMode)
newReferenceBoxLogicalSize.shrink(m_renderer.borderAndPaddingWidth(), m_renderer.borderAndPaddingHeight());
else
newReferenceBoxLogicalSize.shrink(m_renderer.borderAndPaddingHeight(), m_renderer.borderAndPaddingWidth());
break;
case BoxMissing:
ASSERT_NOT_REACHED();
break;
}
if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize)
return;
markShapeAsDirty();
m_referenceBoxLogicalSize = newReferenceBoxLogicalSize;
}
示例2: relativePositionOffset
LayoutSize RenderBoxModelObject::relativePositionOffset() const
{
LayoutSize offset = accumulateInFlowPositionOffsets(this);
RenderBlock* containingBlock = this->containingBlock();
// Objects that shrink to avoid floats normally use available line width when computing containing block width. However
// in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the
// available width of the containing block. Therefore we don't use containingBlockLogicalWidthForContent() here, but instead explicitly
// call availableWidth on our containing block.
if (!style()->left().isAuto()) {
if (!style()->right().isAuto() && !containingBlock->style()->isLeftToRightDirection())
offset.setWidth(-valueForLength(style()->right(), containingBlock->availableWidth()));
else
offset.expand(valueForLength(style()->left(), containingBlock->availableWidth()), 0);
} else if (!style()->right().isAuto()) {
offset.expand(-valueForLength(style()->right(), containingBlock->availableWidth()), 0);
}
// If the containing block of a relatively positioned element does not
// specify a height, a percentage top or bottom offset should be resolved as
// auto. An exception to this is if the containing block has the WinIE quirk
// where <html> and <body> assume the size of the viewport. In this case,
// calculate the percent offset based on this height.
// See <https://bugs.webkit.org/show_bug.cgi?id=26396>.
if (!style()->top().isAuto()
&& (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight()
|| !style()->top().isPercent()
|| containingBlock->stretchesToViewport()))
offset.expand(0, valueForLength(style()->top(), containingBlock->availableHeight()));
else if (!style()->bottom().isAuto()
&& (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight()
|| !style()->bottom().isPercent()
|| containingBlock->stretchesToViewport()))
offset.expand(0, -valueForLength(style()->bottom(), containingBlock->availableHeight()));
return offset;
}
示例3: setReferenceBoxLogicalSize
void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogicalSize)
{
bool isHorizontalWritingMode = m_renderer.containingBlock()->style().isHorizontalWritingMode();
switch (referenceBox(*m_renderer.style().shapeOutside())) {
case MarginBox:
if (isHorizontalWritingMode)
newReferenceBoxLogicalSize.expand(m_renderer.horizontalMarginExtent(), m_renderer.verticalMarginExtent());
else
newReferenceBoxLogicalSize.expand(m_renderer.verticalMarginExtent(), m_renderer.horizontalMarginExtent());
break;
case BorderBox:
break;
case PaddingBox:
if (isHorizontalWritingMode)
newReferenceBoxLogicalSize.shrink(m_renderer.horizontalBorderExtent(), m_renderer.verticalBorderExtent());
else
newReferenceBoxLogicalSize.shrink(m_renderer.verticalBorderExtent(), m_renderer.horizontalBorderExtent());
break;
case ContentBox:
if (isHorizontalWritingMode)
newReferenceBoxLogicalSize.shrink(m_renderer.horizontalBorderAndPaddingExtent(), m_renderer.verticalBorderAndPaddingExtent());
else
newReferenceBoxLogicalSize.shrink(m_renderer.verticalBorderAndPaddingExtent(), m_renderer.horizontalBorderAndPaddingExtent());
break;
case Fill:
case Stroke:
case ViewBox:
case BoxMissing:
ASSERT_NOT_REACHED();
break;
}
if (m_referenceBoxLogicalSize == newReferenceBoxLogicalSize)
return;
markShapeAsDirty();
m_referenceBoxLogicalSize = newReferenceBoxLogicalSize;
}