Commit 2e8311bc authored by leviw@chromium.org's avatar leviw@chromium.org

Fix slimming paint clipping and add a debug fill color

The Slimming Paint codepath wasn't properly adding paint offsets
to the applied clip rects, causing only a fraction of text to be
drawn. Also adding a debug red background to make it more obvious
when we're failing to paint. Cribbed from FrameView's old paint
code.

BUG=423071

Review URL: https://codereview.chromium.org/654713003

git-svn-id: svn://svn.chromium.org/blink/trunk@183634 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a79ef970
...@@ -72,7 +72,7 @@ void BlockPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) ...@@ -72,7 +72,7 @@ void BlockPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
// z-index. We paint after we painted the background/border, so that the scrollbars will // z-index. We paint after we painted the background/border, so that the scrollbars will
// sit above the background/border. // sit above the background/border.
if (m_renderBlock.hasOverflowClip() && m_renderBlock.style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(&m_renderBlock) && !paintInfo.paintRootBackgroundOnly()) { if (m_renderBlock.hasOverflowClip() && m_renderBlock.style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(&m_renderBlock) && !paintInfo.paintRootBackgroundOnly()) {
PaintCommandRecorder recorder(paintInfo.context, &m_renderBlock, paintInfo.phase, m_renderBlock.visualOverflowRect()); PaintCommandRecorder recorder(paintInfo.context, &m_renderBlock, paintInfo.phase, pixelSnappedIntRect(adjustedPaintOffset, m_renderBlock.visualOverflowRect().size()));
m_renderBlock.layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayControls */); m_renderBlock.layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayControls */);
} }
} }
...@@ -144,15 +144,17 @@ void BlockPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff ...@@ -144,15 +144,17 @@ void BlockPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
{ {
PaintPhase paintPhase = paintInfo.phase; PaintPhase paintPhase = paintInfo.phase;
LayoutRect bounds;
if (RuntimeEnabledFeatures::slimmingPaintEnabled())
bounds = m_renderBlock.visualOverflowRect();
// Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div). // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div).
LayoutPoint scrolledOffset = paintOffset; LayoutPoint scrolledOffset = paintOffset;
if (m_renderBlock.hasOverflowClip()) if (m_renderBlock.hasOverflowClip())
scrolledOffset.move(-m_renderBlock.scrolledContentOffset()); scrolledOffset.move(-m_renderBlock.scrolledContentOffset());
LayoutRect bounds;
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
bounds = m_renderBlock.visualOverflowRect();
bounds.moveBy(scrolledOffset);
}
// 1. paint background, borders etc // 1. paint background, borders etc
if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && m_renderBlock.style()->visibility() == VISIBLE) { if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && m_renderBlock.style()->visibility() == VISIBLE) {
if (m_renderBlock.hasBoxDecorationBackground()) { if (m_renderBlock.hasBoxDecorationBackground()) {
......
...@@ -33,7 +33,7 @@ void LineBoxListPainter::paint(RenderBoxModelObject* renderer, PaintInfo& paintI ...@@ -33,7 +33,7 @@ void LineBoxListPainter::paint(RenderBoxModelObject* renderer, PaintInfo& paintI
return; return;
PaintInfo info(paintInfo); PaintInfo info(paintInfo);
PaintCommandRecorder recorder(paintInfo.context, renderer, paintInfo.phase, renderer->borderBoundingBox()); PaintCommandRecorder recorder(paintInfo.context, renderer, paintInfo.phase, pixelSnappedIntRect(paintOffset, renderer->borderBoundingBox().size()));
ListHashSet<RenderInline*> outlineObjects; ListHashSet<RenderInline*> outlineObjects;
info.setOutlineObjects(&outlineObjects); info.setOutlineObjects(&outlineObjects);
......
...@@ -37,7 +37,7 @@ const PaintCommandList& ViewDisplayList::paintCommandList() ...@@ -37,7 +37,7 @@ const PaintCommandList& ViewDisplayList::paintCommandList()
ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled());
updatePaintCommandList(); updatePaintCommandList();
return m_paintList; return m_newPaints;
} }
void ViewDisplayList::add(WTF::PassOwnPtr<AtomicPaintChunk> atomicPaintChunk) void ViewDisplayList::add(WTF::PassOwnPtr<AtomicPaintChunk> atomicPaintChunk)
......
...@@ -2134,6 +2134,11 @@ void CompositedLayerMapping::doPaintTask(const GraphicsLayerPaintInfo& paintInfo ...@@ -2134,6 +2134,11 @@ void CompositedLayerMapping::doPaintTask(const GraphicsLayerPaintInfo& paintInfo
LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, paintingInfo, paintLayerFlags); LayerPainter(*paintInfo.renderLayer).paintLayerContents(context, paintingInfo, paintLayerFlags);
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
#ifndef NDEBUG
context->fillRect(dirtyRect, Color(0xFF, 0, 0));
#endif
if (RenderView* view = paintInfo.renderLayer->renderer()->view()) { if (RenderView* view = paintInfo.renderLayer->renderer()->view()) {
const PaintCommandList& paintCommandList = view->viewDisplayList().paintCommandList(); const PaintCommandList& paintCommandList = view->viewDisplayList().paintCommandList();
for (PaintCommandList::const_iterator it = paintCommandList.begin(); it != paintCommandList.end(); ++it) for (PaintCommandList::const_iterator it = paintCommandList.begin(); it != paintCommandList.end(); ++it)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment