本文整理汇总了C++中RenderElement::needsBoundariesUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderElement::needsBoundariesUpdate方法的具体用法?C++ RenderElement::needsBoundariesUpdate怎么用?C++ RenderElement::needsBoundariesUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderElement
的用法示例。
在下文中一共展示了RenderElement::needsBoundariesUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layoutChildren
void SVGRenderSupport::layoutChildren(RenderElement& start, bool selfNeedsLayout)
{
bool layoutSizeChanged = layoutSizeOfNearestViewportChanged(start);
bool transformChanged = transformToRootChanged(&start);
bool hasSVGShadow = rendererHasSVGShadow(start);
bool needsBoundariesUpdate = start.needsBoundariesUpdate();
HashSet<RenderObject*> notlayoutedObjects;
for (RenderObject* child = start.firstChild(); child; child = child->nextSibling()) {
bool needsLayout = selfNeedsLayout;
bool childEverHadLayout = child->everHadLayout();
if (needsBoundariesUpdate && hasSVGShadow) {
// If we have a shadow, our shadow is baked into our children's cached boundaries,
// so they need to update.
child->setNeedsBoundariesUpdate();
needsLayout = true;
}
if (transformChanged) {
// If the transform changed we need to update the text metrics (note: this also happens for layoutSizeChanged=true).
if (child->isSVGText())
toRenderSVGText(child)->setNeedsTextMetricsUpdate();
needsLayout = true;
}
if (layoutSizeChanged) {
// When selfNeedsLayout is false and the layout size changed, we have to check whether this child uses relative lengths
if (SVGElement* element = child->node()->isSVGElement() ? toSVGElement(child->node()) : 0) {
if (element->hasRelativeLengths()) {
// When the layout size changed and when using relative values tell the RenderSVGShape to update its shape object
if (child->isSVGShape())
toRenderSVGShape(child)->setNeedsShapeUpdate();
else if (child->isSVGText()) {
toRenderSVGText(child)->setNeedsTextMetricsUpdate();
toRenderSVGText(child)->setNeedsPositioningValuesUpdate();
}
needsLayout = true;
}
}
}
if (needsLayout)
child->setNeedsLayout(MarkOnlyThis);
if (child->needsLayout()) {
toRenderElement(child)->layout();
// Renderers are responsible for repainting themselves when changing, except
// for the initial paint to avoid potential double-painting caused by non-sensical "old" bounds.
// We could handle this in the individual objects, but for now it's easier to have
// parent containers call repaint(). (RenderBlock::layout* has similar logic.)
if (!childEverHadLayout)
child->repaint();
} else if (layoutSizeChanged)
notlayoutedObjects.add(child);
ASSERT(!child->needsLayout());
}
if (!layoutSizeChanged) {
ASSERT(notlayoutedObjects.isEmpty());
return;
}
// If the layout size changed, invalidate all resources of all children that didn't go through the layout() code path.
for (auto child : notlayoutedObjects)
invalidateResourcesOfChildren(*child);
}