本文整理汇总了C++中LayoutBlock::lastChild方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBlock::lastChild方法的具体用法?C++ LayoutBlock::lastChild怎么用?C++ LayoutBlock::lastChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBlock
的用法示例。
在下文中一共展示了LayoutBlock::lastChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: originalRect
TEST_F(VisualRectMappingTest, LayoutInline) {
document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
setBodyInnerHTML(
"<style>body { margin: 0; }</style>"
"<div id='container' style='overflow: scroll; width: 50px; height: 50px'>"
" <span><img style='width: 20px; height: 100px'></span>"
" <span id=leaf></span></div>");
LayoutBlock* container =
toLayoutBlock(getLayoutObjectByElementId("container"));
LayoutObject* leaf = container->lastChild();
container->setScrollTop(LayoutUnit(50));
LayoutRect originalRect(0, 60, 20, 80);
LayoutRect rect = originalRect;
EXPECT_TRUE(leaf->mapToVisualRectInAncestorSpace(container, rect));
rect.move(-container->scrolledContentOffset());
EXPECT_EQ(rect, LayoutRect(0, 10, 20, 80));
rect = originalRect;
EXPECT_TRUE(leaf->mapToVisualRectInAncestorSpace(&layoutView(), rect));
EXPECT_EQ(rect, LayoutRect(0, 10, 20, 40));
checkPaintInvalidationStateRectMapping(rect, originalRect, *leaf,
layoutView(), layoutView());
rect = LayoutRect(0, 60, 80, 0);
EXPECT_TRUE(
leaf->mapToVisualRectInAncestorSpace(container, rect, EdgeInclusive));
rect.move(-container->scrolledContentOffset());
EXPECT_EQ(rect, LayoutRect(0, 10, 80, 0));
}
示例2: rect
TEST_F(LayoutObjectTest, MapToVisibleRectInContainerSpace)
{
setBodyInnerHTML(
"<div id='container' style='overflow: scroll; will-change: transform; width: 50px; height: 50px'>"
" <span><img style='width: 20px; height: 100px'></span>"
" text text text text text text text"
"</div>");
LayoutBlock* container = toLayoutBlock(document().getElementById("container")->layoutObject());
LayoutText* text = toLayoutText(container->lastChild());
container->setScrollTop(50);
LayoutRect rect(0, 60, 20, 20);
text->mapToVisibleRectInAncestorSpace(container, rect, nullptr);
EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20));
}