void InlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutUnit lineTop, const LayoutUnit lineBottom) { ASSERT(!shouldPaintSelfOutline(paintInfo.phase) && !shouldPaintDescendantOutlines(paintInfo.phase)); LayoutRect overflowRect(m_inlineFlowBox.visualOverflowRect(lineTop, lineBottom)); m_inlineFlowBox.flipForWritingMode(overflowRect); overflowRect.moveBy(paintOffset); if (!paintInfo.cullRect().intersectsCullRect(overflowRect)) return; if (paintInfo.phase == PaintPhaseMask) { if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_inlineFlowBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase))) return; DrawingRecorder recorder(paintInfo.context, m_inlineFlowBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase), pixelSnappedIntRect(overflowRect)); paintMask(paintInfo, paintOffset); return; } if (paintInfo.phase == PaintPhaseForeground) { // Paint our background, border and box-shadow. paintBoxDecorationBackground(paintInfo, paintOffset, overflowRect); } // Paint our children. PaintInfo childInfo(paintInfo); for (InlineBox* curr = m_inlineFlowBox.firstChild(); curr; curr = curr->nextOnLine()) { if (curr->lineLayoutItem().isText() || !curr->boxModelObject().hasSelfPaintingLayer()) curr->paint(childInfo, paintOffset, lineTop, lineBottom); } }
void LineBoxListPainter::paint(const LayoutBoxModelObject& layoutObject, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const { ASSERT(!shouldPaintSelfOutline(paintInfo.phase) && !shouldPaintDescendantOutlines(paintInfo.phase)); // Only paint during the foreground/selection phases. if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseTextClip && paintInfo.phase != PaintPhaseMask) return; ASSERT(layoutObject.isLayoutBlock() || (layoutObject.isLayoutInline() && layoutObject.hasLayer())); // The only way an inline could paint like this is if it has a layer. if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) addPDFURLRectsForInlineChildrenRecursively(layoutObject, paintInfo, paintOffset); // If we have no lines then we have no work to do. if (!m_lineBoxList.firstLineBox()) return; if (!m_lineBoxList.anyLineIntersectsRect(LineLayoutBoxModel(const_cast<LayoutBoxModelObject*>(&layoutObject)), paintInfo.cullRect(), paintOffset)) return; PaintInfo info(paintInfo); // See if our root lines intersect with the dirty rect. If so, then we paint // them. Note that boxes can easily overlap, so we can't make any assumptions // based off positions of our first line box or our last line box. for (InlineFlowBox* curr = m_lineBoxList.firstLineBox(); curr; curr = curr->nextLineBox()) { if (m_lineBoxList.lineIntersectsDirtyRect(LineLayoutBoxModel(const_cast<LayoutBoxModelObject*>(&layoutObject)), curr, info.cullRect(), paintOffset)) { RootInlineBox& root = curr->root(); curr->paint(info, paintOffset, root.lineTop(), root.lineBottom()); } } }
void BlockFlowPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) { // Avoid painting descendants of the root element when stylesheets haven't // loaded. This eliminates FOUC. It's ok not to draw, because later on, when // all the stylesheets do load, styleResolverMayHaveChanged() on Document will // trigger a full paint invalidation. if (m_layoutBlockFlow.document().didLayoutWithPendingStylesheets() && !m_layoutBlockFlow.isLayoutView()) return; if (!m_layoutBlockFlow.childrenInline()) { BlockPainter(m_layoutBlockFlow).paintContents(paintInfo, paintOffset); return; } if (shouldPaintDescendantOutlines(paintInfo.phase)) ObjectPainter(m_layoutBlockFlow) .paintInlineChildrenOutlines(paintInfo, paintOffset); else LineBoxListPainter(m_layoutBlockFlow.lineBoxes()) .paint(m_layoutBlockFlow, paintInfo, paintOffset); }