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/FrameSelection.h" | 8 #include "core/editing/FrameSelection.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutFlexibleBox.h" | 10 #include "core/layout/LayoutFlexibleBox.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 { | 29 { |
| 30 PaintInfo localPaintInfo(paintInfo); | 30 PaintInfo localPaintInfo(paintInfo); |
| 31 | 31 |
| 32 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); | 32 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); |
| 33 | 33 |
| 34 PaintPhase originalPhase = localPaintInfo.phase; | 34 PaintPhase originalPhase = localPaintInfo.phase; |
| 35 | 35 |
| 36 // Check if we need to do anything at all. | 36 // Check if we need to do anything at all. |
| 37 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView | 37 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView |
| 38 // paints the root's background. | 38 // paints the root's background. |
| 39 // TODO(schenney): Unroll m_layoutBlock.isDocumentElement() to try to get so me insight into crbug.com/475698 | |
| 40 Node* blockNode = m_layoutBlock.node(); | 39 Node* blockNode = m_layoutBlock.node(); |
| 41 RELEASE_ASSERT(blockNode || m_layoutBlock.isAnonymous()); | 40 RELEASE_ASSERT(blockNode || m_layoutBlock.isAnonymous()); |
| 42 if (blockNode) { | 41 if (blockNode) { |
| 43 TreeScope& blockTreescope = blockNode->treeScope(); // Will crash on bad node | 42 if (m_layoutBlock.isDocumentElement()) { |
|
chrishtr
2015/07/13 17:09:40
I think this conditional needs to be inverted. It
Stephen Chennney
2015/07/20 17:42:30
Can't believe I messed this up, and nothing broke
| |
| 44 Document& blockDocument = blockTreescope.document(); // Will crash in ba d treeScope | |
| 45 Element* blockDocumentElement = blockDocument.documentElement(); // Will crash on bad TreeScope::m_document | |
| 46 if (blockDocumentElement != blockNode) { | |
| 47 LayoutRect overflowBox = overflowRectForPaintRejection(); | 43 LayoutRect overflowBox = overflowRectForPaintRejection(); |
| 48 m_layoutBlock.flipForWritingMode(overflowBox); | 44 m_layoutBlock.flipForWritingMode(overflowBox); |
| 49 overflowBox.moveBy(adjustedPaintOffset); | 45 overflowBox.moveBy(adjustedPaintOffset); |
| 50 if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect))) | 46 if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect))) |
| 51 return; | 47 return; |
| 52 } | 48 } |
| 53 } else { | 49 } else { |
| 54 RELEASE_ASSERT(!m_layoutBlock.isDocumentElement()); | 50 RELEASE_ASSERT(!m_layoutBlock.isDocumentElement()); |
| 55 } | 51 } |
| 56 | 52 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 LayoutBlock* block = flow->containingBlock(); | 343 LayoutBlock* block = flow->containingBlock(); |
| 348 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) | 344 for ( ; block && block != &m_layoutBlock; block = block->containingBlock ()) |
| 349 accumulatedPaintOffset.moveBy(block->location()); | 345 accumulatedPaintOffset.moveBy(block->location()); |
| 350 ASSERT(block); | 346 ASSERT(block); |
| 351 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 347 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
| 352 } | 348 } |
| 353 } | 349 } |
| 354 | 350 |
| 355 | 351 |
| 356 } // namespace blink | 352 } // namespace blink |
| OLD | NEW |