| 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/BlockFlowPainter.h" | 6 #include "core/paint/BlockFlowPainter.h" |
| 7 | 7 |
| 8 #include "core/rendering/FloatingObjects.h" | 8 #include "core/rendering/FloatingObjects.h" |
| 9 #include "core/rendering/PaintInfo.h" | 9 #include "core/rendering/PaintInfo.h" |
| 10 #include "core/rendering/RenderBlockFlow.h" | 10 #include "core/rendering/RenderBlockFlow.h" |
| 11 #include "core/rendering/RenderLayer.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 void BlockFlowPainter::paintFloats(PaintInfo& paintInfo, const LayoutPoint& pain
tOffset, bool preservePhase) | 15 void BlockFlowPainter::paintFloats(PaintInfo& paintInfo, const LayoutPoint& pain
tOffset, bool preservePhase) |
| 15 { | 16 { |
| 16 if (!m_renderBlockFlow.floatingObjects()) | 17 if (!m_renderBlockFlow.floatingObjects()) |
| 17 return; | 18 return; |
| 18 | 19 |
| 19 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec
ts()->set(); | 20 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec
ts()->set(); |
| 20 FloatingObjectSetIterator end = floatingObjectSet.end(); | 21 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 38 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 38 currentPaintInfo.phase = PaintPhaseForeground; | 39 currentPaintInfo.phase = PaintPhaseForeground; |
| 39 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 40 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 40 currentPaintInfo.phase = PaintPhaseOutline; | 41 currentPaintInfo.phase = PaintPhaseOutline; |
| 41 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 42 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 } | 45 } |
| 45 } | 46 } |
| 46 | 47 |
| 48 void BlockFlowPainter::paintSelection(PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) |
| 49 { |
| 50 if (m_renderBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint
PhaseForeground) { |
| 51 LayoutUnit lastTop = 0; |
| 52 LayoutUnit lastLeft = m_renderBlockFlow.logicalLeftSelectionOffset(&m_re
nderBlockFlow, lastTop); |
| 53 LayoutUnit lastRight = m_renderBlockFlow.logicalRightSelectionOffset(&m_
renderBlockFlow, lastTop); |
| 54 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 55 |
| 56 LayoutRect gapRectsBounds = m_renderBlockFlow.selectionGaps(&m_renderBlo
ckFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo); |
| 57 if (!gapRectsBounds.isEmpty()) { |
| 58 RenderLayer* layer = m_renderBlockFlow.enclosingLayer(); |
| 59 gapRectsBounds.moveBy(-paintOffset); |
| 60 if (!m_renderBlockFlow.hasLayer()) { |
| 61 LayoutRect localBounds(gapRectsBounds); |
| 62 m_renderBlockFlow.flipForWritingMode(localBounds); |
| 63 gapRectsBounds = m_renderBlockFlow.localToContainerQuad(FloatRec
t(localBounds), layer->renderer()).enclosingBoundingBox(); |
| 64 if (layer->renderer()->hasOverflowClip()) |
| 65 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); |
| 66 } |
| 67 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
| 68 } |
| 69 } |
| 70 } |
| 71 |
| 47 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |