本文整理汇总了C++中FrameView::contentClip方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameView::contentClip方法的具体用法?C++ FrameView::contentClip怎么用?C++ FrameView::contentClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameView
的用法示例。
在下文中一共展示了FrameView::contentClip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTestData
TEST_F(PaintPropertyTreeBuilderTest, PositionAndScroll)
{
loadTestData("position-and-scroll.html");
Element* scroller = document().getElementById("scroller");
scroller->scrollTo(0, 100);
FrameView* frameView = document().view();
frameView->updateAllLifecyclePhases();
ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scrollTranslation()->matrix());
EXPECT_EQ(frameView->scrollTranslation(), scrollerProperties->scrollTranslation()->parent());
EXPECT_EQ(frameView->scrollTranslation(), scrollerProperties->overflowClip()->localTransformSpace());
EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflowClip()->clipRect());
EXPECT_EQ(frameView->contentClip(), scrollerProperties->overflowClip()->parent());
// The relative-positioned element should have accumulated box offset (exclude scrolling),
// and should be affected by ancestor scroll transforms.
Element* relPos = document().getElementById("rel-pos");
ObjectPaintProperties* relPosProperties = relPos->layoutObject()->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->paintOffsetTranslation()->matrix());
EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOffsetTranslation()->parent());
EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->localTransformSpace());
EXPECT_EQ(FloatRoundedRect(0, 0, 400, 0), relPosProperties->overflowClip()->clipRect());
EXPECT_EQ(scrollerProperties->overflowClip(), relPosProperties->overflowClip()->parent());
// The absolute-positioned element should not be affected by non-positioned scroller at all.
Element* absPos = document().getElementById("abs-pos");
ObjectPaintProperties* absPosProperties = absPos->layoutObject()->objectPaintProperties();
EXPECT_EQ(TransformationMatrix().translate(123, 456), absPosProperties->paintOffsetTranslation()->matrix());
EXPECT_EQ(frameView->scrollTranslation(), absPosProperties->paintOffsetTranslation()->parent());
EXPECT_EQ(absPosProperties->transform(), absPosProperties->overflowClip()->localTransformSpace());
EXPECT_EQ(FloatRoundedRect(), absPosProperties->overflowClip()->clipRect());
EXPECT_EQ(frameView->contentClip(), absPosProperties->overflowClip()->parent());
}
示例2: setBodyInnerHTML
TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
{
setBodyInnerHTML("<style> body { height: 10000px; } </style>");
document().domWindow()->scrollTo(0, 100);
FrameView* frameView = document().view();
frameView->updateAllLifecyclePhases();
EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix());
EXPECT_EQ(nullptr, frameView->preTranslation()->parent());
EXPECT_EQ(TransformationMatrix().translate(0, -100), frameView->scrollTranslation()->matrix());
EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->parent());
EXPECT_EQ(frameView->preTranslation(), frameView->contentClip()->localTransformSpace());
EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameView->contentClip()->clipRect());
EXPECT_EQ(nullptr, frameView->contentClip()->parent());
LayoutView* layoutView = document().layoutView();
ObjectPaintProperties* layoutViewProperties = layoutView->objectPaintProperties();
EXPECT_EQ(nullptr, layoutViewProperties);
}
示例3: updateFrameViewContentClip
void updateFrameViewContentClip(
FrameView& frameView,
PassRefPtr<const ClipPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
const FloatRoundedRect& clipRect) {
DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled());
if (auto* existingContentClip = frameView.contentClip()) {
existingContentClip->update(std::move(parent),
std::move(localTransformSpace), clipRect);
} else {
frameView.setContentClip(ClipPaintPropertyNode::create(
std::move(parent), std::move(localTransformSpace), clipRect));
}
}
示例4: updateFramePropertiesAndContext
void PaintPropertyTreeBuilder::updateFramePropertiesAndContext(
FrameView& frameView,
PaintPropertyTreeBuilderContext& context) {
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
// With root layer scrolling, the LayoutView (a LayoutObject) properties are
// updated like other objects (see updatePropertiesAndContextForSelf and
// updatePropertiesAndContextForChildren) instead of needing LayoutView-
// specific property updates here.
context.current.paintOffset.moveBy(frameView.location());
context.current.renderingContextID = 0;
context.current.shouldFlattenInheritedTransform = true;
context.absolutePosition = context.current;
context.containerForAbsolutePosition = nullptr;
context.fixedPosition = context.current;
return;
}
TransformationMatrix frameTranslate;
frameTranslate.translate(frameView.x() + context.current.paintOffset.x(),
frameView.y() + context.current.paintOffset.y());
updateFrameViewPreTranslation(frameView, context.current.transform,
frameTranslate, FloatPoint3D());
FloatRoundedRect contentClip(
IntRect(IntPoint(), frameView.visibleContentSize()));
updateFrameViewContentClip(frameView, context.current.clip,
frameView.preTranslation(), contentClip);
ScrollOffset scrollOffset = frameView.scrollOffset();
if (frameView.isScrollable() || !scrollOffset.isZero()) {
TransformationMatrix frameScroll;
frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
updateFrameViewScrollTranslation(frameView, frameView.preTranslation(),
frameScroll, FloatPoint3D());
IntSize scrollClip = frameView.visibleContentSize();
IntSize scrollBounds = frameView.contentsSize();
bool userScrollableHorizontal =
frameView.userInputScrollable(HorizontalScrollbar);
bool userScrollableVertical =
frameView.userInputScrollable(VerticalScrollbar);
updateFrameViewScroll(frameView, context.current.scroll,
frameView.scrollTranslation(), scrollClip,
scrollBounds, userScrollableHorizontal,
userScrollableVertical);
} else {
// Ensure pre-existing properties are cleared when there is no scrolling.
frameView.setScrollTranslation(nullptr);
frameView.setScroll(nullptr);
}
// Initialize the context for current, absolute and fixed position cases.
// They are the same, except that scroll translation does not apply to
// fixed position descendants.
const auto* fixedTransformNode = frameView.preTranslation()
? frameView.preTranslation()
: context.current.transform;
auto* fixedScrollNode = context.current.scroll;
DCHECK(frameView.preTranslation());
context.current.transform = frameView.preTranslation();
DCHECK(frameView.contentClip());
context.current.clip = frameView.contentClip();
if (const auto* scrollTranslation = frameView.scrollTranslation())
context.current.transform = scrollTranslation;
if (auto* scroll = frameView.scroll())
context.current.scroll = scroll;
context.current.paintOffset = LayoutPoint();
context.current.renderingContextID = 0;
context.current.shouldFlattenInheritedTransform = true;
context.absolutePosition = context.current;
context.containerForAbsolutePosition = nullptr;
context.fixedPosition = context.current;
context.fixedPosition.transform = fixedTransformNode;
context.fixedPosition.scroll = fixedScrollNode;
std::unique_ptr<PropertyTreeState> contentsState(
new PropertyTreeState(context.current.transform, context.current.clip,
context.currentEffect, context.current.scroll));
frameView.setTotalPropertyTreeStateForContents(std::move(contentsState));
}