本文整理汇总了C++中LayoutBox::borderBoxRect方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBox::borderBoxRect方法的具体用法?C++ LayoutBox::borderBoxRect怎么用?C++ LayoutBox::borderBoxRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBox
的用法示例。
在下文中一共展示了LayoutBox::borderBoxRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildNodeQuads
bool InspectorHighlight::buildNodeQuads(Node* node, FloatQuad* content, FloatQuad* padding, FloatQuad* border, FloatQuad* margin)
{
LayoutObject* layoutObject = node->layoutObject();
if (!layoutObject)
return false;
FrameView* containingView = layoutObject->frameView();
if (!containingView)
return false;
if (!layoutObject->isBox() && !layoutObject->isLayoutInline())
return false;
LayoutRect contentBox;
LayoutRect paddingBox;
LayoutRect borderBox;
LayoutRect marginBox;
if (layoutObject->isBox()) {
LayoutBox* layoutBox = toLayoutBox(layoutObject);
// LayoutBox returns the "pure" content area box, exclusive of the scrollbars (if present), which also count towards the content area in CSS.
const int verticalScrollbarWidth = layoutBox->verticalScrollbarWidth();
const int horizontalScrollbarHeight = layoutBox->horizontalScrollbarHeight();
contentBox = layoutBox->contentBoxRect();
contentBox.setWidth(contentBox.width() + verticalScrollbarWidth);
contentBox.setHeight(contentBox.height() + horizontalScrollbarHeight);
paddingBox = layoutBox->paddingBoxRect();
paddingBox.setWidth(paddingBox.width() + verticalScrollbarWidth);
paddingBox.setHeight(paddingBox.height() + horizontalScrollbarHeight);
borderBox = layoutBox->borderBoxRect();
marginBox = LayoutRect(borderBox.x() - layoutBox->marginLeft(), borderBox.y() - layoutBox->marginTop(),
borderBox.width() + layoutBox->marginWidth(), borderBox.height() + layoutBox->marginHeight());
} else {
LayoutInline* layoutInline = toLayoutInline(layoutObject);
// LayoutInline's bounding box includes paddings and borders, excludes margins.
borderBox = LayoutRect(layoutInline->linesBoundingBox());
paddingBox = LayoutRect(borderBox.x() + layoutInline->borderLeft(), borderBox.y() + layoutInline->borderTop(),
borderBox.width() - layoutInline->borderLeft() - layoutInline->borderRight(), borderBox.height() - layoutInline->borderTop() - layoutInline->borderBottom());
contentBox = LayoutRect(paddingBox.x() + layoutInline->paddingLeft(), paddingBox.y() + layoutInline->paddingTop(),
paddingBox.width() - layoutInline->paddingLeft() - layoutInline->paddingRight(), paddingBox.height() - layoutInline->paddingTop() - layoutInline->paddingBottom());
// Ignore marginTop and marginBottom for inlines.
marginBox = LayoutRect(borderBox.x() - layoutInline->marginLeft(), borderBox.y(),
borderBox.width() + layoutInline->marginWidth(), borderBox.height());
}
*content = layoutObject->localToAbsoluteQuad(FloatRect(contentBox));
*padding = layoutObject->localToAbsoluteQuad(FloatRect(paddingBox));
*border = layoutObject->localToAbsoluteQuad(FloatRect(borderBox));
*margin = layoutObject->localToAbsoluteQuad(FloatRect(marginBox));
contentsQuadToViewport(containingView, *content);
contentsQuadToViewport(containingView, *padding);
contentsQuadToViewport(containingView, *border);
contentsQuadToViewport(containingView, *margin);
return true;
}