本文整理汇总了C++中PaintLayer::graphicsLayerBacking方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintLayer::graphicsLayerBacking方法的具体用法?C++ PaintLayer::graphicsLayerBacking怎么用?C++ PaintLayer::graphicsLayerBacking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintLayer
的用法示例。
在下文中一共展示了PaintLayer::graphicsLayerBacking方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBodyInnerHTML
TEST_F(CompositedLayerMappingTest, RotatedInterestRect)
{
setBodyInnerHTML(
"<div id='target' style='width: 200px; height: 200px; will-change: transform; transform: rotateZ(45deg)'></div>");
document().view()->updateAllLifecyclePhases();
Element* element = document().getElementById("target");
PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
ASSERT_TRUE(!!paintLayer->graphicsLayerBacking());
EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), recomputeInterestRect(paintLayer->graphicsLayerBacking()));
}
示例2: compositeOpaqueScrollers
// Test that opacity applied to the scroller or an ancestor will cause the
// scrolling contents layer to not be promoted.
TEST_F(PaintLayerScrollableAreaTest, OnlyOpaqueLayersPromoted) {
ScopedCompositeOpaqueScrollersForTest compositeOpaqueScrollers(true);
setBodyInnerHTML(
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
"white local content-box; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"parent\">"
" <div id=\"scroller\"><div id=\"scrolled\"></div></div>"
"</div>");
document().view()->updateAllLifecyclePhases();
EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled());
Element* parent = document().getElementById("parent");
Element* scroller = document().getElementById("scroller");
PaintLayer* paintLayer =
toLayoutBoxModelObject(scroller->layoutObject())->layer();
ASSERT_TRUE(paintLayer);
EXPECT_TRUE(paintLayer->needsCompositedScrolling());
EXPECT_TRUE(paintLayer->graphicsLayerBacking());
ASSERT_TRUE(paintLayer->graphicsLayerBackingForScrolling());
EXPECT_TRUE(paintLayer->graphicsLayerBackingForScrolling()->contentsOpaque());
// Change the parent to be partially translucent.
parent->setAttribute(HTMLNames::styleAttr, "opacity: 0.5;");
document().view()->updateAllLifecyclePhases();
paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
ASSERT_TRUE(paintLayer);
EXPECT_FALSE(paintLayer->needsCompositedScrolling());
EXPECT_FALSE(paintLayer->graphicsLayerBacking());
// Change the parent to be opaque again.
parent->setAttribute(HTMLNames::styleAttr, "opacity: 1;");
document().view()->updateAllLifecyclePhases();
paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
ASSERT_TRUE(paintLayer);
EXPECT_TRUE(paintLayer->needsCompositedScrolling());
EXPECT_TRUE(paintLayer->graphicsLayerBacking());
ASSERT_TRUE(paintLayer->graphicsLayerBackingForScrolling());
EXPECT_TRUE(paintLayer->graphicsLayerBackingForScrolling()->contentsOpaque());
// Make the scroller translucent.
scroller->setAttribute(HTMLNames::styleAttr, "opacity: 0.5");
document().view()->updateAllLifecyclePhases();
paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
ASSERT_TRUE(paintLayer);
EXPECT_FALSE(paintLayer->needsCompositedScrolling());
EXPECT_FALSE(paintLayer->graphicsLayerBacking());
}
示例3: setBodyInnerHTML
TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromotedOnStyleChange) {
RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true);
setBodyInnerHTML(
"<style>"
"#scroller { overflow: scroll; height: 200px; width: 200px; background: "
"rgba(255,255,255,0.5) local content-box; }"
"#scrolled { height: 300px; }"
"</style>"
"<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
document().view()->updateAllLifecyclePhases();
EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled());
Element* scroller = document().getElementById("scroller");
PaintLayer* paintLayer =
toLayoutBoxModelObject(scroller->layoutObject())->layer();
ASSERT_TRUE(paintLayer);
EXPECT_FALSE(paintLayer->needsCompositedScrolling());
// Change the background to transparent
scroller->setAttribute(HTMLNames::styleAttr,
"background: white local content-box;");
document().view()->updateAllLifecyclePhases();
paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
ASSERT_TRUE(paintLayer);
EXPECT_TRUE(paintLayer->needsCompositedScrolling());
EXPECT_TRUE(paintLayer->graphicsLayerBacking());
ASSERT_TRUE(paintLayer->graphicsLayerBackingForScrolling());
EXPECT_TRUE(paintLayer->graphicsLayerBackingForScrolling()->contentsOpaque());
}
示例4: positionInGraphicsLayerBacking
void RenderedPosition::positionInGraphicsLayerBacking(CompositedSelectionBound& bound) const
{
bound.layer = nullptr;
bound.edgeTopInLayer = bound.edgeBottomInLayer = FloatPoint();
if (isNull())
return;
LayoutRect rect = m_layoutObject->localCaretRect(m_inlineBox, m_offset);
PaintLayer* layer = nullptr;
bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMinYCorner(), &layer);
bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMaxYCorner(), nullptr);
bound.layer = layer ? layer->graphicsLayerBacking() : nullptr;
}