本文整理汇总了C++中LayoutView::assertSubtreeIsLaidOut方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutView::assertSubtreeIsLaidOut方法的具体用法?C++ LayoutView::assertSubtreeIsLaidOut怎么用?C++ LayoutView::assertSubtreeIsLaidOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutView
的用法示例。
在下文中一共展示了LayoutView::assertSubtreeIsLaidOut方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintContents
void FramePainter::paintContents(GraphicsContext& context, const GlobalPaintFlags globalPaintFlags, const IntRect& rect)
{
Document* document = frameView().frame().document();
#ifndef NDEBUG
bool fillWithRed;
if (document->printing())
fillWithRed = false; // Printing, don't fill with red (can't remember why).
else if (frameView().frame().owner())
fillWithRed = false; // Subframe, don't fill with red.
else if (frameView().isTransparent())
fillWithRed = false; // Transparent, don't fill with red.
else if (globalPaintFlags & GlobalPaintSelectionOnly)
fillWithRed = false; // Selections are transparent, don't fill with red.
else
fillWithRed = true;
if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) {
IntRect contentRect(IntPoint(), frameView().contentsSize());
LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layoutView(), DisplayItem::DebugRedFill, contentRect, LayoutPoint());
}
#endif
LayoutView* layoutView = frameView().layoutView();
if (!layoutView) {
WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject");
return;
}
if (!frameView().shouldThrottleRendering()) {
RELEASE_ASSERT(!frameView().needsLayout());
ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean);
}
TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data(layoutView, LayoutRect(rect), 0));
bool isTopLevelPainter = !s_inPaintContents;
s_inPaintContents = true;
FontCachePurgePreventer fontCachePurgePreventer;
// TODO(jchaffraix): GlobalPaintFlags should be const during a paint
// phase. Thus we should set this flag upfront (crbug.com/510280).
GlobalPaintFlags localPaintFlags = globalPaintFlags;
if (document->printing())
localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrinting;
PaintLayer* rootLayer = layoutView->layer();
#if ENABLE(ASSERT)
if (!frameView().shouldThrottleRendering())
layoutView->assertSubtreeIsLaidOut();
LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer->layoutObject());
#endif
PaintLayerPainter layerPainter(*rootLayer);
float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()->frame());
context.setDeviceScaleFactor(deviceScaleFactor);
layerPainter.paint(context, LayoutRect(rect), localPaintFlags);
if (rootLayer->containsDirtyOverlayScrollbars())
layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPaintFlags);
// Regions may have changed as a result of the visibility/z-index of element changing.
if (document->annotatedRegionsDirty())
frameView().updateDocumentAnnotatedRegions();
if (isTopLevelPainter) {
// Everything that happens after paintContents completions is considered
// to be part of the next frame.
memoryCache()->updateFramePaintTimestamp();
s_inPaintContents = false;
}
InspectorInstrumentation::didPaint(layoutView, 0, context, LayoutRect(rect));
}
示例2: paintContents
void FramePainter::paintContents(GraphicsContext* context, const IntRect& rect)
{
Document* document = m_frameView.frame().document();
#ifndef NDEBUG
bool fillWithRed;
if (document->printing())
fillWithRed = false; // Printing, don't fill with red (can't remember why).
else if (m_frameView.frame().owner())
fillWithRed = false; // Subframe, don't fill with red.
else if (m_frameView.isTransparent())
fillWithRed = false; // Transparent, don't fill with red.
else if (m_frameView.paintBehavior() & PaintBehaviorSelectionOnly)
fillWithRed = false; // Selections are transparent, don't fill with red.
else if (m_frameView.nodeToDraw())
fillWithRed = false; // Element images are transparent, don't fill with red.
else
fillWithRed = true;
if (fillWithRed) {
IntRect contentRect(IntPoint(), m_frameView.contentsSize());
DrawingRecorder drawingRecorder(*context, *m_frameView.layoutView(), DisplayItem::DebugRedFill, contentRect);
if (!drawingRecorder.canUseCachedDrawing())
context->fillRect(contentRect, Color(0xFF, 0, 0));
}
#endif
LayoutView* layoutView = m_frameView.layoutView();
if (!layoutView) {
WTF_LOG_ERROR("called FramePainter::paint with nil renderer");
return;
}
RELEASE_ASSERT(!m_frameView.needsLayout());
ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean);
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data", InspectorPaintEvent::data(layoutView, LayoutRect(rect), 0));
bool isTopLevelPainter = !s_inPaintContents;
s_inPaintContents = true;
FontCachePurgePreventer fontCachePurgePreventer;
PaintBehavior oldPaintBehavior = m_frameView.paintBehavior();
if (FrameView* parentView = m_frameView.parentFrameView()) {
if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
m_frameView.setPaintBehavior(m_frameView.paintBehavior() | PaintBehaviorFlattenCompositingLayers);
}
if (m_frameView.paintBehavior() == PaintBehaviorNormal)
document->markers().invalidateRenderedRectsForMarkersInRect(LayoutRect(rect));
if (document->printing())
m_frameView.setPaintBehavior(m_frameView.paintBehavior() | PaintBehaviorFlattenCompositingLayers);
ASSERT(!m_frameView.isPainting());
m_frameView.setIsPainting(true);
// m_frameView.nodeToDraw() is used to draw only one element (and its descendants)
LayoutObject* renderer = m_frameView.nodeToDraw() ? m_frameView.nodeToDraw()->layoutObject() : 0;
DeprecatedPaintLayer* rootLayer = layoutView->layer();
#if ENABLE(ASSERT)
layoutView->assertSubtreeIsLaidOut();
LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer->layoutObject());
#endif
DeprecatedPaintLayerPainter layerPainter(*rootLayer);
float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()->frame());
context->setDeviceScaleFactor(deviceScaleFactor);
layerPainter.paint(context, LayoutRect(rect), m_frameView.paintBehavior(), renderer);
if (rootLayer->containsDirtyOverlayScrollbars())
layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), m_frameView.paintBehavior(), renderer);
m_frameView.setIsPainting(false);
m_frameView.setPaintBehavior(oldPaintBehavior);
m_frameView.setLastPaintTime(currentTime());
// Regions may have changed as a result of the visibility/z-index of element changing.
if (document->annotatedRegionsDirty())
m_frameView.updateAnnotatedRegions();
if (isTopLevelPainter) {
// Everything that happens after paintContents completions is considered
// to be part of the next frame.
memoryCache()->updateFramePaintTimestamp();
s_inPaintContents = false;
}
InspectorInstrumentation::didPaint(layoutView, 0, context, LayoutRect(rect));
}