Exemplo n.º 1
0
void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo,
                                   const LayoutPoint& paintOffset) {
  if (!m_layoutBlockFlow.floatingObjects())
    return;

  DCHECK(paintInfo.phase == PaintPhaseFloat ||
         paintInfo.phase == PaintPhaseSelection ||
         paintInfo.phase == PaintPhaseTextClip);
  PaintInfo floatPaintInfo(paintInfo);
  if (paintInfo.phase == PaintPhaseFloat)
    floatPaintInfo.phase = PaintPhaseForeground;

  for (const auto& floatingObject :
       m_layoutBlockFlow.floatingObjects()->set()) {
    if (!floatingObject->shouldPaint())
      continue;

    const LayoutBox* floatingLayoutObject = floatingObject->layoutObject();
    // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make
    // this much cleaner.
    LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChild(
        *floatingObject,
        LayoutPoint(paintOffset.x() +
                        m_layoutBlockFlow.xPositionForFloatIncludingMargin(
                            *floatingObject) -
                        floatingLayoutObject->location().x(),
                    paintOffset.y() +
                        m_layoutBlockFlow.yPositionForFloatIncludingMargin(
                            *floatingObject) -
                        floatingLayoutObject->location().y()));
    ObjectPainter(*floatingLayoutObject)
        .paintAllPhasesAtomically(floatPaintInfo, childPoint);
  }
}
Exemplo n.º 2
0
void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
    if (!m_layoutBlockFlow.floatingObjects())
        return;

    ASSERT(paintInfo.phase == PaintPhaseFloat);
    PaintInfo floatPaintInfo(paintInfo);
    floatPaintInfo.phase = PaintPhaseForeground;

    for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set()) {
        if (!floatingObject->shouldPaint())
            continue;

        const LayoutBox* floatingLayoutObject = floatingObject->layoutObject();
        if (floatingLayoutObject->hasSelfPaintingLayer())
            continue;

        // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner.
        LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChild(
            *floatingObject, LayoutPoint(paintOffset.x()
            + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject) - floatingLayoutObject->location().x(), paintOffset.y()
            + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject) - floatingLayoutObject->location().y()));
        ObjectPainter(*floatingLayoutObject).paintAsPseudoStackingContext(floatPaintInfo, childPoint);
    }
}