Chromium Code Reviews| 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" |
| 11 #include "core/frame/Settings.h" | 11 #include "core/frame/Settings.h" |
| 12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
| 13 #include "core/paint/BoxClipper.h" | 13 #include "core/paint/BoxClipper.h" |
| 14 #include "core/paint/BoxPainter.h" | 14 #include "core/paint/BoxPainter.h" |
| 15 #include "core/paint/GraphicsContextAnnotator.h" | 15 #include "core/paint/GraphicsContextAnnotator.h" |
| 16 #include "core/paint/InlinePainter.h" | 16 #include "core/paint/InlinePainter.h" |
| 17 #include "core/paint/LineBoxListPainter.h" | 17 #include "core/paint/LineBoxListPainter.h" |
| 18 #include "core/paint/RenderDrawingRecorder.h" | 18 #include "core/paint/RenderDrawingRecorder.h" |
| 19 #include "core/paint/ScrollRecorder.h" | 19 #include "core/paint/ScrollRecorder.h" |
| 20 #include "core/paint/ScrollableAreaPainter.h" | 20 #include "core/paint/ScrollableAreaPainter.h" |
| 21 #include "core/paint/SubtreeInfoRecorder.h" | |
| 21 #include "core/rendering/PaintInfo.h" | 22 #include "core/rendering/PaintInfo.h" |
| 22 #include "core/rendering/RenderBlock.h" | 23 #include "core/rendering/RenderBlock.h" |
| 23 #include "core/rendering/RenderFlexibleBox.h" | 24 #include "core/rendering/RenderFlexibleBox.h" |
| 24 #include "core/rendering/RenderInline.h" | 25 #include "core/rendering/RenderInline.h" |
| 25 #include "core/rendering/RenderLayer.h" | 26 #include "core/rendering/RenderLayer.h" |
| 26 #include "core/rendering/RenderView.h" | 27 #include "core/rendering/RenderView.h" |
| 27 #include "platform/geometry/LayoutPoint.h" | 28 #include "platform/geometry/LayoutPoint.h" |
| 28 #include "platform/geometry/LayoutRect.h" | 29 #include "platform/geometry/LayoutRect.h" |
| 29 #include "platform/graphics/paint/ClipRecorder.h" | 30 #include "platform/graphics/paint/ClipRecorder.h" |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) | 34 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) |
| 34 { | 35 { |
| 35 PaintInfo localPaintInfo(paintInfo); | 36 PaintInfo localPaintInfo(paintInfo); |
| 37 SubtreeInfoRecorder subtreeInfoRecorder(paintInfo.context, m_renderBlock, lo calPaintInfo.phase); | |
|
pdr.
2015/02/04 05:19:58
Can you move this up one line? The localPaintInfo
Xianzhu
2015/02/04 20:46:32
Done.
| |
| 36 | 38 |
| 37 ANNOTATE_GRAPHICS_CONTEXT(localPaintInfo, &m_renderBlock); | 39 ANNOTATE_GRAPHICS_CONTEXT(localPaintInfo, &m_renderBlock); |
| 38 | 40 |
| 39 LayoutPoint adjustedPaintOffset = paintOffset + m_renderBlock.location(); | 41 LayoutPoint adjustedPaintOffset = paintOffset + m_renderBlock.location(); |
| 40 | 42 |
| 41 PaintPhase originalPhase = localPaintInfo.phase; | 43 PaintPhase originalPhase = localPaintInfo.phase; |
| 42 | 44 |
| 43 // Check if we need to do anything at all. | 45 // Check if we need to do anything at all. |
| 44 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView | 46 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView |
| 45 // paints the root's background. | 47 // paints the root's background. |
| 46 if (!m_renderBlock.isDocumentElement()) { | 48 if (!m_renderBlock.isDocumentElement()) { |
| 47 LayoutRect overflowBox = overflowRectForPaintRejection(); | 49 LayoutRect overflowBox = overflowRectForPaintRejection(); |
| 48 m_renderBlock.flipForWritingMode(overflowBox); | 50 m_renderBlock.flipForWritingMode(overflowBox); |
| 49 overflowBox.moveBy(adjustedPaintOffset); | 51 overflowBox.moveBy(adjustedPaintOffset); |
| 50 if (!overflowBox.intersects(localPaintInfo.rect)) | 52 if (!overflowBox.intersects(localPaintInfo.rect)) |
| 51 return; | 53 return; |
| 52 } | 54 } |
| 53 | 55 |
| 56 subtreeInfoRecorder.begin(); | |
| 57 | |
| 54 // There are some cases where not all clipped visual overflow is accounted f or. | 58 // There are some cases where not all clipped visual overflow is accounted f or. |
| 55 // FIXME: reduce the number of such cases. | 59 // FIXME: reduce the number of such cases. |
| 56 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; | 60 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; |
| 57 if (m_renderBlock.hasOverflowClip() && !m_renderBlock.hasControlClip() && !( m_renderBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun d) && !hasCaret()) | 61 if (m_renderBlock.hasOverflowClip() && !m_renderBlock.hasControlClip() && !( m_renderBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun d) && !hasCaret()) |
| 58 contentsClipBehavior = SkipContentsClipIfPossible; | 62 contentsClipBehavior = SkipContentsClipIfPossible; |
| 59 | 63 |
| 60 if (localPaintInfo.phase == PaintPhaseOutline) { | 64 if (localPaintInfo.phase == PaintPhaseOutline) { |
| 61 localPaintInfo.phase = PaintPhaseChildOutlines; | 65 localPaintInfo.phase = PaintPhaseChildOutlines; |
| 62 } else if (localPaintInfo.phase == PaintPhaseChildBlockBackground) { | 66 } else if (localPaintInfo.phase == PaintPhaseChildBlockBackground) { |
| 63 localPaintInfo.phase = PaintPhaseBlockBackground; | 67 localPaintInfo.phase = PaintPhaseBlockBackground; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 RenderBlock* block = flow->containingBlock(); | 514 RenderBlock* block = flow->containingBlock(); |
| 511 for ( ; block && block != &m_renderBlock; block = block->containingBlock ()) | 515 for ( ; block && block != &m_renderBlock; block = block->containingBlock ()) |
| 512 accumulatedPaintOffset.moveBy(block->location()); | 516 accumulatedPaintOffset.moveBy(block->location()); |
| 513 ASSERT(block); | 517 ASSERT(block); |
| 514 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 518 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 515 } | 519 } |
| 516 } | 520 } |
| 517 | 521 |
| 518 | 522 |
| 519 } // namespace blink | 523 } // namespace blink |
| OLD | NEW |