| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/BlockPainter.h" | 6 #include "core/paint/BlockPainter.h" |
| 7 | 7 |
| 8 #include "core/editing/Caret.h" | 8 #include "core/editing/Caret.h" |
| 9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 m_renderBlock.paintObject(paintInfo, adjustedPaintOffset); | 65 m_renderBlock.paintObject(paintInfo, adjustedPaintOffset); |
| 66 } | 66 } |
| 67 // FIXME: move popContentsClip out of RenderBox. | 67 // FIXME: move popContentsClip out of RenderBox. |
| 68 if (pushedClip) | 68 if (pushedClip) |
| 69 m_renderBlock.popContentsClip(paintInfo, phase, adjustedPaintOffset); | 69 m_renderBlock.popContentsClip(paintInfo, phase, adjustedPaintOffset); |
| 70 | 70 |
| 71 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | 71 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with |
| 72 // z-index. We paint after we painted the background/border, so that the scr
ollbars will | 72 // z-index. We paint after we painted the background/border, so that the scr
ollbars will |
| 73 // sit above the background/border. | 73 // sit above the background/border. |
| 74 if (m_renderBlock.hasOverflowClip() && m_renderBlock.style()->visibility() =
= VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBloc
kBackground) && paintInfo.shouldPaintWithinRoot(&m_renderBlock) && !paintInfo.pa
intRootBackgroundOnly()) { | 74 if (m_renderBlock.hasOverflowClip() && m_renderBlock.style()->visibility() =
= VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBloc
kBackground) && paintInfo.shouldPaintWithinRoot(&m_renderBlock) && !paintInfo.pa
intRootBackgroundOnly()) { |
| 75 PaintCommandRecorder recorder(paintInfo.context, &m_renderBlock, paintIn
fo.phase, m_renderBlock.visualOverflowRect()); | 75 PaintCommandRecorder recorder(paintInfo.context, &m_renderBlock, paintIn
fo.phase, pixelSnappedIntRect(adjustedPaintOffset, m_renderBlock.visualOverflowR
ect().size())); |
| 76 m_renderBlock.layer()->scrollableArea()->paintOverflowControls(paintInfo
.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintin
gOverlayControls */); | 76 m_renderBlock.layer()->scrollableArea()->paintOverflowControls(paintInfo
.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintin
gOverlayControls */); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void BlockPainter::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 80 void BlockPainter::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
| 81 { | 81 { |
| 82 for (RenderBox* child = m_renderBlock.firstChildBox(); child; child = child-
>nextSiblingBox()) | 82 for (RenderBox* child = m_renderBlock.firstChildBox(); child; child = child-
>nextSiblingBox()) |
| 83 paintChild(child, paintInfo, paintOffset); | 83 paintChild(child, paintInfo, paintOffset); |
| 84 } | 84 } |
| 85 | 85 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 renderer->paint(info, childPoint); | 137 renderer->paint(info, childPoint); |
| 138 info.phase = PaintPhaseOutline; | 138 info.phase = PaintPhaseOutline; |
| 139 renderer->paint(info, childPoint); | 139 renderer->paint(info, childPoint); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 void BlockPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) | 143 void BlockPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) |
| 144 { | 144 { |
| 145 PaintPhase paintPhase = paintInfo.phase; | 145 PaintPhase paintPhase = paintInfo.phase; |
| 146 | 146 |
| 147 LayoutRect bounds; | |
| 148 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
| 149 bounds = m_renderBlock.visualOverflowRect(); | |
| 150 | |
| 151 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div). | 147 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div). |
| 152 LayoutPoint scrolledOffset = paintOffset; | 148 LayoutPoint scrolledOffset = paintOffset; |
| 153 if (m_renderBlock.hasOverflowClip()) | 149 if (m_renderBlock.hasOverflowClip()) |
| 154 scrolledOffset.move(-m_renderBlock.scrolledContentOffset()); | 150 scrolledOffset.move(-m_renderBlock.scrolledContentOffset()); |
| 155 | 151 |
| 152 LayoutRect bounds; |
| 153 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 154 bounds = m_renderBlock.visualOverflowRect(); |
| 155 bounds.moveBy(scrolledOffset); |
| 156 } |
| 157 |
| 156 // 1. paint background, borders etc | 158 // 1. paint background, borders etc |
| 157 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_renderBlock.style()->visibility() == VISIBLE) { | 159 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_renderBlock.style()->visibility() == VISIBLE) { |
| 158 if (m_renderBlock.hasBoxDecorationBackground()) { | 160 if (m_renderBlock.hasBoxDecorationBackground()) { |
| 159 PaintCommandRecorder recorder(paintInfo.context, &m_renderBlock, pai
ntPhase, bounds); | 161 PaintCommandRecorder recorder(paintInfo.context, &m_renderBlock, pai
ntPhase, bounds); |
| 160 m_renderBlock.paintBoxDecorationBackground(paintInfo, paintOffset); | 162 m_renderBlock.paintBoxDecorationBackground(paintInfo, paintOffset); |
| 161 } | 163 } |
| 162 if (m_renderBlock.hasColumns() && !paintInfo.paintRootBackgroundOnly())
{ | 164 if (m_renderBlock.hasColumns() && !paintInfo.paintRootBackgroundOnly())
{ |
| 163 // FIXME: PaintCommandRecorder needs to learn to handle this. | 165 // FIXME: PaintCommandRecorder needs to learn to handle this. |
| 164 paintColumnRules(paintInfo, scrolledOffset); | 166 paintColumnRules(paintInfo, scrolledOffset); |
| 165 } | 167 } |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 RenderBlock* block = flow->containingBlock(); | 512 RenderBlock* block = flow->containingBlock(); |
| 511 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) | 513 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) |
| 512 accumulatedPaintOffset.moveBy(block->location()); | 514 accumulatedPaintOffset.moveBy(block->location()); |
| 513 ASSERT(block); | 515 ASSERT(block); |
| 514 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 516 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 515 } | 517 } |
| 516 } | 518 } |
| 517 | 519 |
| 518 | 520 |
| 519 } // namespace blink | 521 } // namespace blink |
| OLD | NEW |