void FramePainter::paint(GraphicsContext* context, const IntRect& rect) { m_frameView.notifyPageThatContentAreaWillPaint(); IntRect documentDirtyRect = rect; IntRect visibleAreaWithoutScrollbars(m_frameView.location(), m_frameView.visibleContentRect().size()); documentDirtyRect.intersect(visibleAreaWithoutScrollbars); if (!documentDirtyRect.isEmpty()) { TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), AffineTransform::translation(m_frameView.x() - m_frameView.scrollX(), m_frameView.y() - m_frameView.scrollY())); ClipRecorder recorder(*context, *m_frameView.layoutView(), DisplayItem::ClipFrameToVisibleContentRect, LayoutRect(m_frameView.visibleContentRect())); documentDirtyRect.moveBy(-m_frameView.location() + m_frameView.scrollPosition()); paintContents(context, documentDirtyRect); } calculateAndPaintOverhangAreas(context, rect); // Now paint the scrollbars. if (!m_frameView.scrollbarsSuppressed() && (m_frameView.horizontalScrollbar() || m_frameView.verticalScrollbar())) { IntRect scrollViewDirtyRect = rect; IntRect visibleAreaWithScrollbars(m_frameView.location(), m_frameView.visibleContentRect(IncludeScrollbars).size()); scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); scrollViewDirtyRect.moveBy(-m_frameView.location()); TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), AffineTransform::translation(m_frameView.x(), m_frameView.y())); ClipRecorder recorder(*context, *m_frameView.layoutView(), DisplayItem::ClipFrameScrollbars, LayoutRect(IntPoint(), visibleAreaWithScrollbars.size())); paintScrollbars(context, scrollViewDirtyRect); } // Paint the panScroll Icon if (m_frameView.drawPanScrollIcon()) m_frameView.paintPanScrollIcon(context); }
void FramePainter::paint(GraphicsContext& context, const GlobalPaintFlags globalPaintFlags, const CullRect& rect) { frameView().notifyPageThatContentAreaWillPaint(); IntRect documentDirtyRect = rect.m_rect; IntRect visibleAreaWithoutScrollbars(frameView().location(), frameView().visibleContentRect().size()); documentDirtyRect.intersect(visibleAreaWithoutScrollbars); bool shouldPaintContents = !documentDirtyRect.isEmpty(); bool shouldPaintScrollbars = !frameView().scrollbarsSuppressed() && (frameView().horizontalScrollbar() || frameView().verticalScrollbar()); if (!shouldPaintContents && !shouldPaintScrollbars) return; if (shouldPaintContents) { // TODO(pdr): Creating frame paint properties here will not be needed once // settings()->rootLayerScrolls() is enabled. // TODO(pdr): Make this conditional on the rootLayerScrolls setting. Optional<ScopedPaintChunkProperties> scopedPaintChunkProperties; if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { TransformPaintPropertyNode* transform = m_frameView->scrollTranslation() ? m_frameView->scrollTranslation() : m_frameView->preTranslation(); ClipPaintPropertyNode* clip = m_frameView->contentClip(); if (transform || clip) { PaintChunkProperties properties(context.paintController().currentPaintChunkProperties()); if (transform) properties.transform = transform; if (clip) properties.clip = clip; scopedPaintChunkProperties.emplace(context.paintController(), properties); } } TransformRecorder transformRecorder(context, *frameView().layoutView(), AffineTransform::translation(frameView().x() - frameView().scrollX(), frameView().y() - frameView().scrollY())); ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::ClipFrameToVisibleContentRect, LayoutRect(frameView().visibleContentRect())); documentDirtyRect.moveBy(-frameView().location() + frameView().scrollPosition()); paintContents(context, globalPaintFlags, documentDirtyRect); } if (shouldPaintScrollbars) { IntRect scrollViewDirtyRect = rect.m_rect; IntRect visibleAreaWithScrollbars(frameView().location(), frameView().visibleContentRect(IncludeScrollbars).size()); scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); scrollViewDirtyRect.moveBy(-frameView().location()); Optional<ScopedPaintChunkProperties> scopedPaintChunkProperties; if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { if (TransformPaintPropertyNode* transform = m_frameView->preTranslation()) { PaintChunkProperties properties(context.paintController().currentPaintChunkProperties()); properties.transform = transform; scopedPaintChunkProperties.emplace(context.paintController(), properties); } } TransformRecorder transformRecorder(context, *frameView().layoutView(), AffineTransform::translation(frameView().x(), frameView().y())); ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::ClipFrameScrollbars, LayoutRect(IntPoint(), visibleAreaWithScrollbars.size())); paintScrollbars(context, scrollViewDirtyRect); } }