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/DragCaretController.h" | 8 #include "core/editing/DragCaretController.h" |
| 9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) | 29 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) |
| 30 { | 30 { |
| 31 PaintInfo localPaintInfo(paintInfo); | 31 PaintInfo localPaintInfo(paintInfo); |
| 32 | 32 |
| 33 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); | 33 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); |
| 34 | 34 |
| 35 PaintPhase originalPhase = localPaintInfo.phase; | 35 PaintPhase originalPhase = localPaintInfo.phase; |
| 36 | 36 |
| 37 // Check if we need to do anything at all. | 37 // Check if we need to do anything at all. |
| 38 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView | 38 // TODO(schenney): Could eliminate the isDocumentElement() check if we fix b ackground painting so |
| 39 // paints the root's background. | 39 // that the LayoutView paints the root's background. |
|
trchen
2015/07/13 20:23:18
Yep now LayoutView paints root background.
| |
| 40 // TODO(schenney): Test this code path, as breaking changes have failed to s how up in testing. | |
| 41 // crbug.com/509737 | |
| 40 Node* blockNode = m_layoutBlock.node(); | 42 Node* blockNode = m_layoutBlock.node(); |
| 41 RELEASE_ASSERT(blockNode || m_layoutBlock.isAnonymous()); | 43 ASSERT(blockNode || m_layoutBlock.isAnonymous()); |
| 42 if (blockNode) { | 44 if (blockNode) { |
| 43 if (m_layoutBlock.isDocumentElement()) { | 45 if (!m_layoutBlock.isDocumentElement()) { |
|
trchen
2015/07/13 20:23:18
It is probably okay to remove this check here. Doe
| |
| 44 LayoutRect overflowBox = overflowRectForPaintRejection(); | 46 LayoutRect overflowBox = overflowRectForPaintRejection(); |
| 45 m_layoutBlock.flipForWritingMode(overflowBox); | 47 m_layoutBlock.flipForWritingMode(overflowBox); |
| 46 overflowBox.moveBy(adjustedPaintOffset); | 48 overflowBox.moveBy(adjustedPaintOffset); |
| 47 if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect))) | 49 if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect))) |
| 48 return; | 50 return; |
| 49 } | 51 } |
| 50 } else { | |
| 51 RELEASE_ASSERT(!m_layoutBlock.isDocumentElement()); | |
| 52 } | 52 } |
| 53 | 53 |
| 54 // There are some cases where not all clipped visual overflow is accounted f or. | 54 // There are some cases where not all clipped visual overflow is accounted f or. |
| 55 // FIXME: reduce the number of such cases. | 55 // FIXME: reduce the number of such cases. |
| 56 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; | 56 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; |
| 57 if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !( m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun d) && !hasCaret()) | 57 if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !( m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun d) && !hasCaret()) |
| 58 contentsClipBehavior = SkipContentsClipIfPossible; | 58 contentsClipBehavior = SkipContentsClipIfPossible; |
| 59 | 59 |
| 60 if (localPaintInfo.phase == PaintPhaseOutline) { | 60 if (localPaintInfo.phase == PaintPhaseOutline) { |
| 61 localPaintInfo.phase = PaintPhaseChildOutlines; | 61 localPaintInfo.phase = PaintPhaseChildOutlines; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 LayoutBlock* block = flow->containingBlock(); | 347 LayoutBlock* block = flow->containingBlock(); |
| 348 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) | 348 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) |
| 349 accumulatedPaintOffset.moveBy(block->location()); | 349 accumulatedPaintOffset.moveBy(block->location()); |
| 350 ASSERT(block); | 350 ASSERT(block); |
| 351 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 351 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 | 355 |
| 356 } // namespace blink | 356 } // namespace blink |
| OLD | NEW |