本文整理汇总了C++中LayoutBlock::scrollTop方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBlock::scrollTop方法的具体用法?C++ LayoutBlock::scrollTop怎么用?C++ LayoutBlock::scrollTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBlock
的用法示例。
在下文中一共展示了LayoutBlock::scrollTop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBodyInnerHTML
TEST_F(VisualRectMappingTest, ContainerOverflowHidden) {
setBodyInnerHTML(
"<div id='container' style='position: absolute; top: 111px; left: 222px;"
" border: 10px solid red; overflow: hidden; width: 50px; height: "
"80px;'>"
" <div id='target' style='box-shadow: 40px 20px black; width: 100px; "
"height: 90px'></div>"
"</div>");
LayoutBlock* container =
toLayoutBlock(getLayoutObjectByElementId("container"));
EXPECT_EQ(LayoutUnit(), container->scrollTop());
EXPECT_EQ(LayoutUnit(), container->scrollLeft());
container->setScrollTop(LayoutUnit(27));
container->setScrollLeft(LayoutUnit(28));
document().view()->updateAllLifecyclePhases();
LayoutBlock* target = toLayoutBlock(getLayoutObjectByElementId("target"));
LayoutRect targetVisualRect = target->localVisualRect();
// 140 = width(100) + box_shadow_offset_x(40)
// 110 = height(90) + box_shadow_offset_y(20)
EXPECT_EQ(LayoutRect(0, 0, 140, 110), targetVisualRect);
LayoutRect rect = targetVisualRect;
EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect));
EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect);
rect = targetVisualRect;
EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect));
// Rect is not clipped by container's overflow clip.
EXPECT_EQ(LayoutRect(10, 10, 140, 110), rect);
}